problem
stringlengths
26
131k
labels
class label
2 classes
how to replace all of specific entry in a column with new entry : I have a data frame with a column that is filled with string entries of {A,B,C}, but want to replace all entries of A with B. What function would be best to do this? Thanks, I'm still an R newbie!
0debug
Regex to accept 5.0 and reject 5.1 : I have been searching for a while , my requirement is I want to accept only integers and if user enters 5.00 that also I want to accept but I do not want to accept 5.01 I have seen regex to accept only integers but that does not meet my requirement completely. REGEX to ACCEPT: 5.0, 7.0, 9.00, 77 REGEX to DECLINE: 5.1, 55.45
0debug
Please help sorting this array into ascending order : I would like to generate an array of 100 numbers and find their average and sum. I am able to do this but I am NOT able to get the output of numbers into ascending order! I am super new to java so any help would be awesome. import java.util.Random; public class randomNumberGen { public static void main(String [] args) { Random r=new Random(); double sum = 0; // is double so to prevent int division later on int amount = 100; int upperBound = 100; for (int i = 0; i < amount; i++){ int next = r.nextInt(upperBound) + 1; // creates a random int in [1,100] System.out.println(next); sum += next; // accumulate sum of all random numbers } System.out.println("Your average is: " + (sum/amount)); System.out.println("Your sum is: " + (sum)); } }
0debug
I installed my widows form application to another computer everything work but lodging report gives error. I used crystal report : [![enter code here][1]][1] [![enter image description here][2]][2] [![enter image description here][3]][3] This is error [1]: https://i.stack.imgur.com/Wns2Q.jpg [2]: https://i.stack.imgur.com/sN5G6.jpg [3]: https://i.stack.imgur.com/IdMZK.jpg
0debug
static int can_safely_read(GetBitContext* gb, int bits) { return get_bits_left(gb) >= bits; }
1threat
I wand to use OverridependingTransition in fragment but I am getting an error : Here is my code med=(LinearLayout) getView().findViewById(R.id.second); med.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i= new Intent(getContext(),SecondActivity.class); i.putExtra("table_name","questCompFunda"); startActivity(i); overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right); } });
0debug
Find shape within a rows of characters-Java : I came across to problem on thinking how to get the shape from the rows of characters, for example AAAAAAAA ABBBAABA ABABABBB ABBBAAAA AAAABBAA ABBABBAA ABBABBAA ABAABBAA which has A and B characters, and I want to calculate how many 'B' shape are there, what I mean by shape is that the 'B' are near each other and form shape like rectangular and triangle. The example has 4 shapes(hope you can see the shape) I am able to calculate how many 'B' are there, and then I tried to get the index number out of the rows with this code(it is not correct code, but I still have some questions because it does not give me the correct index number of the 'B') int indexZero = 0; ArrayList<Integer> list = new ArrayList<Integer>(); for(int a = 1; a < count; a++) { for(int b = 0; b < count - 1; b++) { indexZero = array[a].indexOf('B'); list.add(indexZero); } } System.out.println(list); The result was [-1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] Because the for loop it became so many numbers, but I still wonder why only 1 and 4 appear when there are also 2, 3, 5, 7 which missing from the result. I am still new to Java, so I want to ask is there is any java function that can check the same occurrence that near to each other in order to count the shape appears? Hope you can give me some pointer on how to construct this algorithm. (I have thought of taking each index of 'B' and check whether they are near to other 'B' but I get stuck)
0debug
Redirect and store URL parameters in CVS : I looking for solution that will allowed me to use redirection and store in CVS files the parameters from specific URL. I have a link: http://my-server.com/?url={link}&campaign={campaign_name}&date={date} Example: http://my-server.com/?url=google.com&campaign=web&date=17062016 When the user will click in the link, they will be redirect to google.com, but the 3 parameters: url, campaign and date, will be store in CSV files on my server. When I'm using 'window.location.href' I lost the all parameters. Thanks for the help in advance. DK
0debug
How to create an equation for a line in three dimensions given three points : <p>From the equation of a three dimensional line:</p> <pre><code> f(x,y,z) = A*x + B*y + C*z + D = 0 </code></pre> <p>The normal is </p> <pre><code> grad f = [A,B,C] </code></pre> <p>The Normal thru Point (x0,y0,z0) is [A .[x-x0 B y-y0 C] z-z0] = A*(x-x0) + B*(y-y0) + C*(z-z0)= 0</p> <p>My question is with given three points (x0,y0,z0),(x1,y1,z1), and (x2,y2,z2) How do you setup the matrix:</p> <pre><code>[a0 b0 c0 d0 a1 b1 c1 d1 a2 b2 c2 d2] </code></pre> <p>To solve for A,B,C,D?</p>
0debug
void memory_region_add_subregion_overlap(MemoryRegion *mr, hwaddr offset, MemoryRegion *subregion, int priority) { subregion->may_overlap = true; subregion->priority = priority; memory_region_add_subregion_common(mr, offset, subregion); }
1threat
How can I get what i'm reading in from a file to an output file : I'm able to pull out the 20 names randomly but how do I store them in a output file rather then displaying them to the screen? I tried filewriter but couldn't get it to work. public class Assignment2 { public static void main(String[] args) throws IOException { // Read in the file into a list of strings BufferedReader reader = new BufferedReader(new FileReader("textfile.txt")); //BufferedWriter bw = new BufferedWriter(new FileWriter("out.txt")); List<String> lines = new ArrayList<String>(); String line = reader.readLine(); while( line != null ) { lines.add(line); line = reader.readLine(); } // Choose a random one from the list Random r = new Random(); FileWriter letters = new FileWriter("out.txt"); for (int i = 0; i < 20; i++) { int rowNum = r.nextInt(lines.size ()); System.out.println(lines.get(rowNum)); } } }
0debug
Can I delete the tvOS from react native project? : <p>Eventually, I will be submitting a react native app to the app store but the app will only run on iOS, not tvOS. Will I be able to delete these targets and stuff and submit the project with no problem? <a href="https://i.stack.imgur.com/f9Wqf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/f9Wqf.png" alt="enter image description here"></a></p>
0debug
Combining Multiple Files with Laravel Mix : <p>I am currently in the process of diving into Laravel Mix and so far, whilst I fully understand what Laravel Mix is and how it works, I am trying to understand a little more about the common practices and 'How-Tos'...</p> <p>For instance, consider this file structure:</p> <pre><code>/resources/assets/js/app.js (all global functions) /resources/assets/js/index/index.js (functions specific to index.js) /resources/assets/js/about/about.js (functions specific to about.js) /resources/assets/js/contact/contact.js (functions specific to contact.js) </code></pre> <p>Now, ideally, I would like the following combined and minified in the following way:</p> <pre><code>/public/js/index/index-some_hash.js (including app.js) /public/js/about/about-some_hash.js (including app.js) /public/js/contact/contact-some_hash.js (including app.js) </code></pre> <p>As far as I understand, the way to achieve this is something like the following:</p> <pre><code>// Index mix.js([ 'resources/assets/js/app.js', 'resources/assets/js/index/index.js' ], 'public/js/index/index.js').version(); // About mix.js([ 'resources/assets/js/app.js', 'resources/assets/js/about/about.js' ], 'public/js/about/about.js').version(); // Contact mix.js([ 'resources/assets/js/app.js', 'resources/assets/js/contact/contact.js' ], 'public/js/contact/contact.js').version(); </code></pre> <h1>My Question</h1> <p>Quite simply, I would like to know if the above is the correct method for doing what I am trying to do? Are there better ways, or more common ways of achieving this?</p> <p>If the above structure is wrong and there are other ways my files should be combined then please share your knowledge. However, unless there is a very good reason, I would like to avoid the following:</p> <ul> <li>Serving two separate files for each page i.e. app.min.js and index.min.js. <em>This requires two lookups per page, ideally it should be as few as possible</em></li> <li>Serving the same file to ALL pages on my site. <em>Serving code to a page that is not going to use it is a waste of resource, regardless of caching...</em></li> </ul> <h1>One Idea...</h1> <p>I noticed a line of code in one of the JS files; <code>require('./bootstrap');</code>. Call me old fashioned but I have never seen this in JavaScript (I assume it is from node.js). That said, obviously it is just loading the <code>bootstrap.js</code> file as a dependency into the specific file. So, with this in mind, would the following solution be better:</p> <p><strong><em>about.js</em></strong></p> <pre><code>require('./app'); // Include global functions // Do some magic here specifically for the 'about' page... </code></pre> <p><strong><em>webpack.mix.js:</em></strong></p> <pre><code>mix.js(['resources/assets/js/*/*.js'); // For all pages </code></pre> <p>If this is a better solution then how do I include files using SASS as well? Are there ways the above can be improved at all?</p>
0debug
document.write('<script src="evil.js"></script>');
1threat
PHP data will not enter database : Hello for some reason query 3 and query 4 will throw out this error and I cannot see why it is doing this the query syntax seems fine: Couldn't enter data: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE job_id = '35'' at line 1 table structure: https://imgur.com/a/ioOKZ **actionpage7:** <?php session_start(); require 'config.php'; $id = $_SESSION['login_user']; $bidid = $_POST['bid_id']; $jobid = $_POST['job_id']; $bidder_id = $_POST['bidder_id']; $bid_amount = $_POST['bid_amount']; $query = " UPDATE bid SET status = '1' WHERE bid_id = '$bidid'"; $success = $conn->query($query); $query2 = " UPDATE job SET accepted = '1' WHERE job_id = '$jobid'"; $success = $conn->query($query2); $query3 = "INSERT into job (accepted_bidder) VALUES('" . $bidder_id . "') WHERE job_id = '$jobid'"; $success = $conn->query($query3); $query4 = "INSERT into job (accepted_bid) VALUES('" . $bid_amount . "') WHERE job_id = '$jobid'"; $success = $conn->query($query4); if (!$success) { die("Couldn't enter data: ".$conn->error); } echo "Thank You For Contacting Us <br>"; header("location: myjobs.php"); $conn->close(); ?>
0debug
ORA-12704: character set mismatch when performing multi-row INSERT of nullable NVARCHAR's : <p>Consider the following table where one of the columns is of type nullable <code>NVARCHAR</code>:</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE CHARACTER_SET_MISMATCH_TEST ( ID NUMBER(10) NOT NULL, VALUE NVARCHAR2(32) ); </code></pre> <p>Now, I want to insert multiple data tuples into this table using the multi-row <code>INSERT</code> (with sub-query) syntax:</p> <pre class="lang-sql prettyprint-override"><code>INSERT INTO CHARACTER_SET_MISMATCH_TEST (ID, VALUE) SELECT ?, ? FROM DUAL UNION ALL SELECT ?, ? FROM DUAL; </code></pre> <p>If <code>NVARCHAR</code> values are either both <code>NULL</code> or both non-<code>NULL</code>, everything runs fine and I observe exactly 2 rows inserted. If, however, I mix <code>NULL</code> and non-<code>NULL</code> values within a single <code>PreparedStatement</code>, I immediately receive an <code>ORA-12704: character set mismatch</code> error:</p> <pre class="lang-none prettyprint-override"><code>java.sql.SQLException: ORA-12704: character set mismatch at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:452) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:400) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:884) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:471) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:199) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:535) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:238) at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1385) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1709) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4364) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:4531) at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:5575) </code></pre> <p>Here's the code which reproduces the issue:</p> <pre class="lang-java prettyprint-override"><code>package com.example; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Types; import javax.sql.DataSource; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import oracle.jdbc.pool.OracleConnectionPoolDataSource; import oracle.jdbc.pool.OracleDataSource; public final class Ora12704Test { @NonNull private static final String SQL = "INSERT INTO CHARACTER_SET_MISMATCH_TEST (ID, VALUE) SELECT ?, ? FROM DUAL UNION ALL SELECT ?, ? FROM DUAL"; @Nullable private static DataSource dataSource; @Nullable private Connection conn; @BeforeClass public static void setUpOnce() throws SQLException { dataSource = new OracleConnectionPoolDataSource(); ((OracleDataSource) dataSource).setURL("jdbc:oracle:thin:@:1521:XE"); } @BeforeMethod public void setUp() throws SQLException { this.conn = dataSource.getConnection("SANDBOX", "SANDBOX"); } @AfterMethod public void tearDown() throws SQLException { if (this.conn != null) { this.conn.close(); } this.conn = null; } @Test public void testNullableNvarchar() throws SQLException { try (final PreparedStatement pstmt = this.conn.prepareStatement(SQL)) { pstmt.setInt(1, 0); pstmt.setNString(2, "NVARCHAR"); pstmt.setInt(3, 1); pstmt.setNull(4, Types.NVARCHAR); final int rowCount = pstmt.executeUpdate(); assertThat(rowCount, is(2)); } } } </code></pre> <p>Strangely, the above unit test passes just fine if I explicitly cast my parameters to <code>NCHAR</code>:</p> <pre class="lang-sql prettyprint-override"><code>INSERT INTO CHARACTER_SET_MISMATCH_TEST (ID, VALUE) SELECT ?, TO_NCHAR(?) FROM DUAL UNION ALL SELECT ?, TO_NCHAR(?) FROM DUAL; </code></pre> <p>or switch to the <code>INSERT ALL</code> syntax:</p> <pre class="lang-sql prettyprint-override"><code>INSERT ALL INTO CHARACTER_SET_MISMATCH_TEST (ID, VALUE) VALUES (?, ?) INTO CHARACTER_SET_MISMATCH_TEST (ID, VALUE) VALUES (?, ?) SELECT * FROM DUAL; </code></pre> <p>But what's wrong with the original code?</p>
0debug
static int dxva2_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const HEVCContext *h = avctx->priv_data; AVDXVAContext *ctx = avctx->hwaccel_context; struct hevc_dxva2_picture_context *ctx_pic = h->ref->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; av_assert0(ctx_pic); fill_picture_parameters(avctx, ctx, h, &ctx_pic->pp); fill_scaling_lists(ctx, h, &ctx_pic->qm); ctx_pic->slice_count = 0; ctx_pic->bitstream_size = 0; ctx_pic->bitstream = NULL; return 0; }
1threat
How to add a folder to `Path` environment variable in Windows 10 (with screenshots) : <p>On StackOverflow and on the net in general, there are outdated and few guides on how to add a specific folder to the Windows 10 <code>Path</code> environment variable of the user.</p> <p>I think a complete guide for new developers with step by step instructions and screenshots could be really usefull to help them executing utilities from a <a href="https://upload.wikimedia.org/wikipedia/commons/b/b3/Command_Prompt_on_Windows_10_RTM.png" rel="noreferrer">Command Prompt</a> without the need of the full path, simplifying the things.</p>
0debug
Auto change font size for different iPhone devices? : Is it possible to set different UILabel's font size based on the different iPhone device size for entire application.
0debug
static int main_loop(void) { int ret, timeout; #ifdef CONFIG_PROFILER int64_t ti; #endif CPUState *env; cur_cpu = first_cpu; next_cpu = cur_cpu->next_cpu ?: first_cpu; for(;;) { if (vm_running) { for(;;) { env = next_cpu; #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif if (use_icount) { int64_t count; int decr; qemu_icount -= (env->icount_decr.u16.low + env->icount_extra); env->icount_decr.u16.low = 0; env->icount_extra = 0; count = qemu_next_deadline(); count = (count + (1 << icount_time_shift) - 1) >> icount_time_shift; qemu_icount += count; decr = (count > 0xffff) ? 0xffff : count; count -= decr; env->icount_decr.u16.low = decr; env->icount_extra = count; } ret = cpu_exec(env); #ifdef CONFIG_PROFILER qemu_time += profile_getclock() - ti; #endif if (use_icount) { qemu_icount -= (env->icount_decr.u16.low + env->icount_extra); env->icount_decr.u32 = 0; env->icount_extra = 0; } next_cpu = env->next_cpu ?: first_cpu; if (event_pending && likely(ret != EXCP_DEBUG)) { ret = EXCP_INTERRUPT; event_pending = 0; break; } if (ret == EXCP_HLT) { cur_cpu = env; continue; } if (ret != EXCP_HALTED) break; if (env == cur_cpu) break; } cur_cpu = env; if (shutdown_requested) { ret = EXCP_INTERRUPT; if (no_shutdown) { vm_stop(0); no_shutdown = 0; } else break; } if (reset_requested) { reset_requested = 0; qemu_system_reset(); ret = EXCP_INTERRUPT; } if (powerdown_requested) { powerdown_requested = 0; qemu_system_powerdown(); ret = EXCP_INTERRUPT; } if (unlikely(ret == EXCP_DEBUG)) { vm_stop(EXCP_DEBUG); } if (ret == EXCP_HALTED) { if (use_icount) { int64_t add; int64_t delta; if (use_icount == 1) { delta = 0; } else { delta = cpu_get_icount() - cpu_get_clock(); } if (delta > 0) { timeout = (delta / 1000000) + 1; } else { add = qemu_next_deadline(); if (add > 10000000) add = 10000000; delta += add; add = (add + (1 << icount_time_shift) - 1) >> icount_time_shift; qemu_icount += add; timeout = delta / 1000000; if (timeout < 0) timeout = 0; } } else { timeout = 10; } } else { timeout = 0; } } else { if (shutdown_requested) break; timeout = 10; } #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif main_loop_wait(timeout); #ifdef CONFIG_PROFILER dev_time += profile_getclock() - ti; #endif } cpu_disable_ticks(); return ret; }
1threat
TypeScript - what type is f.e. setInterval : <p>If I'd like to assign a type to a variable that will later be assigned a setInterval like so:</p> <pre><code>this.autoSaveInterval = setInterval(function(){ if(this.car.id){ this.save(); } else{ this.create(); } }.bind(this), 50000); </code></pre> <p>What type should be assigned to this.autosaveInterval vairable?</p>
0debug
Why does the php code show in my website page? : <p>I am still new with using PHP, so i am having a problem which is when i run this code, the PHP show in my browser. I tried saving the file. html and this is the result </p> <p><a href="https://i.stack.imgur.com/OKUfl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OKUfl.jpg" alt="File.html"></a></p> <p>and if I tried to save it .php, this is the result</p> <p><a href="https://i.stack.imgur.com/tFfxO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tFfxO.jpg" alt="File.php"></a></p> <p>and here is my code </p> <p>Can anyone help me ?!</p> <p>Code:</p> <pre><code>&lt;?php include_once ("php_includes/check_login_status.php"); //If user is already logged in, header it away if ($member_ok == true) { header ("location: Member.php?u=".$_SESSION["Username"]); exit(); } ?&gt; &lt;?php //AJAX calls this part to be executed if ( isset($_POST["e"])) { $e = mysqli_real_escape_string($db_conx, $_POST['e']); $sql = "SELECT MmeberID, Username FROM Member WHERE Email='$e' AND activated='1' LIMIT 1"; $query = mysqli_query($db_conx, $sql); $numrows = mysqli_num_rows($query); if ($numrows &gt; 0) // The member exists { while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { $id = $row["id"]; $u = $row["username"]; } $emailcut = substr($e, 0, 4); //Cut the first 4 character of their mail $randNum = rand(10000,99999); // generate 5 digits random number $tempPass = "$emailcut$randNum"; //concatinate these two var to make the new random pass $hashTempPass = md5($tempPass); //hash this new random password $sql = "UPDATE Member SET temp_pass='$hashTempPass' WHERE Username='$u' LIMIT 1"; //Update the member table with the new password $query = mysqli_query($db_conx, $sql); $to = "$e"; $from = "IT_Department@8bits.com"; $headers ="From: $from\n"; $subject ="yoursite Temporary Password"; $msg = '&lt;h2&gt;Hello '.$u.'&lt;/h2&gt; &lt;p&gt; Somebody recently asked to reset your Facebook password. Didnt request this change? If you didnt request a new password.&lt;/p&gt; &lt;p&gt;We can generated a temporary password for you to log in with, then once logged in you can change your password to anything you like.&lt;/p&gt; &lt;p&gt;After you click the link below your password to login will be:&lt;br /&gt;&lt;b&gt;'.$tempPass.'&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.yoursite.com/forgot_pass.php?u='.$u.'&amp;p='.$hashTempPass.'"&gt;Click here now to apply the temporary password shown below to your account&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If you do not click the link in this email, no changes will be made to your account. In order to set your login password to the temporary password you must click the link above.&lt;/p&gt;'; if(mail($to,$subject,$msg,$headers)) { echo "success"; exit(); } else { echo "email_send_failed"; exit(); } } else { echo "no_exist"; } exit(); } ?&gt; </code></pre> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;header id = "PageHeader"&gt; &lt;script type="text/javascript" src = "Index.js"&gt; &lt;/script&gt; &lt;meta charset="utf-8"&gt; &lt;!-- The website title --&gt; &lt;TITLE&gt; 8 BITES &lt;/TITLE&gt; &lt;!-- Include the CSS file with this HTML file--&gt; &lt;link rel="icon" type="iamge/x-icon" href="C:/Users/hp1/Desktop/Website/Pictures/Logo.jpg"&gt; &lt;link rel="stylesheet" type="text/css" href="Style.css"&gt; &lt;img id = "HeaderLogo" src = "C:/Users/hp1/Desktop/Website/Pictures/T_Logo.jpg" alt="Logo" style="width:46px; height:46px;"&gt; &lt;h2 id = "HeaderQuote"&gt; 8BITS &lt;/h2&gt; &lt;/header&gt; &lt;body id ="ForgetPasswordPageBody"&gt; &lt;?php include_once("template_pageTop.php"); ?&gt; &lt;h1&gt; Generate temporary log in password &lt;/h1&gt; &lt;p&gt; Note: This password will last only for 24 hours. In orde to obtain a new valid password please contact us! &lt;/p&gt; &lt;form id = "ForgotPassForm"&gt; &lt;div id = "Step1"&gt; Step 1: Enter your Email! &lt;/div&gt; &lt;input id = "Email" type="Email" onfocus="_('status').innerHTML ='';" maxlength="100"&gt; &lt;br/&gt; &lt;button id = "ForgotPass" onclick="ForgotPass()"&gt; Generate &lt;/button&gt; &lt;p id = "status"&gt; &lt;/p&gt; &lt;/form&gt; &lt;script&gt; function ForgotPass() { var email = ("Email").value; if (email == " ") { _("status").innerHTML = "Type your Email address!"; } else { _("ForgotPass").style.display = "none"; _("status").innerHTML = 'Please wait...'; var ajax = ajaxObj ("POST", "forgot_pass.php"); ajax.onreadystatechange = function () { if (ajaxRetrun (ajax) == true) { var response = ajax.responseText; if (response == "success") { _("ForgotPassForm").innerHTML = '&lt;h3&gt; Step 2. Check your Email inbox please &lt;/h3&gt;'; } else if (response == "no_exist") { _("status").innerHTML = "This is Email is not registered!"; } else if (response =="email_send_falied") { _("status").innerHTML = "Mail falid to be sent!"; } else { _("status").innerHTML = "An unknow error occured!"; } } } ajax.send ("e=" +e); } } &lt;/script&gt; &lt;?php include_once("template_pageBottom.php"); ?&gt; &lt;/body&gt; &lt;footer id = "PageFooter"&gt; &lt;div id = "Info"&gt; &lt;ul id = "InfoLinks"&gt; &lt;li&gt; &lt;a href ="AboutPage.html" target="_blank"&gt; About &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="HelpPage.html" target="_blank"&gt; Help &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="TermsPage.html" target="_blank"&gt; Terms &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="PrivacyPage.html" target="_blank"&gt; Privacy &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="CookiesPage.html" target="_blank" &gt; Cookies &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="AddsInfoPage.html" target="_blank"&gt; Adds Info &lt;/a&gt; &lt;/li&gt; &lt;li&gt; @2017 8Bits &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id = "Media"&gt; &lt;ul id = "MediaLinks"&gt; &lt;li&gt; &lt;a href ="https://www.facebook.com/MIU8BITS/" target="_blank"&gt; &lt;img src = "C:/Users/hp1/Desktop/Website/Pictures/Facebook.jpg" alt="Facebook" style="width:40px;height:40px;"&gt; &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="#" target="_blank"&gt; &lt;img src = "C:/Users/hp1/Desktop/Website/Pictures/YouTube.jpg" alt="YouTube" style="width:40px;height:40px;"&gt; &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="#" target="_blank"&gt; &lt;img src = "C:/Users/hp1/Desktop/Website/Pictures/Instagram.jpg" alt="Instagram" style="width:40px;height:40px;"&gt; &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href ="#" target="_blank"&gt; &lt;img src = "C:/Users/hp1/Desktop/Website/Pictures/Twitter.jpg" alt="Twitter" style="width:40px;height:40px;"&gt; &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/footer&gt; &lt;/html&gt; </code></pre>
0debug
document.write('<script src="evil.js"></script>');
1threat
Print multidimensional String array in C : I am trying to print the below two dimensional string array in C as below: char text[10][80] = { "0", "Zero", "1", "One", "2", "Two", "3", "Three", "4", "Four", }; The output should be like this: 1 One 2 Two 3 Three 4 Four ......... and so on. I have written the below program: int main() { char text[10][80] = { "0", "Zero", "1", "One", "2", "Two", "3", "Three", "4", "Four", }; int i, j; for(i=0; i<6; i++) { for(j=0; j<1; j++) { printf("%s ", text[i]); } } return 0; } It does not provide me the desired output. I have tried several ways. But no good luck. If anyone knows, your help would be greatly appreciated !!!
0debug
how can i create a JSON object from different tables( MySQL database) to consume in android project : this is my api, how can I converted to JSON Object using JAVA? $sql1="SELECT s.* , c.*,u.* FROM schedule_ s,course_t c, u user_t WHERE c.course_crn=p.course_crn and s.teacher_id=u.employee_id" ; $result=mysqli_query($con,$sql1); if($result) { while($row=mysqli_fetch_array($result)) { $data[]=$row; } print(json_encode($data));
0debug
static void receive_from_chr_layer(SCLPConsoleLM *scon, const uint8_t *buf, int size) { assert(size == 1); if (*buf == '\r' || *buf == '\n') { scon->event.event_pending = true; return; } scon->buf[scon->length] = *buf; scon->length += 1; if (scon->echo) { qemu_chr_fe_write(scon->chr, buf, size); } }
1threat
How can I time something in PHP? : <p>I want to do on a script I`m working on that every month a part of the site resets. </p> <p>Or a better example, Something like a Subscription, when you want to buy something and you need to renew it every month. How can I know its been a month?</p>
0debug
static int activate(AVFilterContext *ctx) { PreMultiplyContext *s = ctx->priv; if (s->inplace) { AVFrame *frame = NULL; AVFrame *out = NULL; int ret, status; int64_t pts; if ((ret = ff_inlink_consume_frame(ctx->inputs[0], &frame)) > 0) { if ((ret = filter_frame(ctx, &out, frame, frame)) < 0) return ret; av_frame_free(&frame); ret = ff_filter_frame(ctx->outputs[0], out); } if (ret < 0) { return ret; } else if (ff_inlink_acknowledge_status(ctx->inputs[0], &status, &pts)) { ff_outlink_set_status(ctx->outputs[0], status, pts); return 0; } else { if (ff_outlink_frame_wanted(ctx->outputs[0])) ff_inlink_request_frame(ctx->inputs[0]); return 0; } } else { return ff_framesync_activate(&s->fs); } }
1threat
static int local_chmod(FsContext *fs_ctx, const char *path, FsCred *credp) { if (fs_ctx->fs_sm == SM_MAPPED) { return local_set_xattr(rpath(fs_ctx, path), credp); } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) { return chmod(rpath(fs_ctx, path), credp->fc_mode); } return -1; }
1threat
how to match elements from one set to elements in another set using firebase : I recently started to learn android and I came across a problem. I want to create a code for firebase ( the database i am using to store values) such that the contents from one set are matched to elements in another set. The scenario is as follows - there is a student who wants to learn or is interested in learning a new skill(c/c++,drawing,music etc.) if he were to update them in their profile he should get suggestions as names of other users registered in the application who have already listed their skill set. It is much like how facebook suggests common friends but here the basis for suggestion is what skills the user has and what he wants to learn.
0debug
static int h264_slice_header_init(H264Context *h, int reinit) { int nb_slices = (HAVE_THREADS && h->avctx->active_thread_type & FF_THREAD_SLICE) ? h->avctx->thread_count : 1; int i, ret; h->avctx->sample_aspect_ratio = h->sps.sar; av_assert0(h->avctx->sample_aspect_ratio.den); av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt, &h->chroma_x_shift, &h->chroma_y_shift); if (h->sps.timing_info_present_flag) { int64_t den = h->sps.time_scale; if (h->x264_build < 44U) den *= 2; av_reduce(&h->avctx->time_base.num, &h->avctx->time_base.den, h->sps.num_units_in_tick, den, 1 << 30); } if (reinit) ff_h264_free_tables(h, 0); h->first_field = 0; h->prev_interlaced_frame = 1; init_scan_tables(h); ret = ff_h264_alloc_tables(h); if (ret < 0) { av_log(h->avctx, AV_LOG_ERROR, "Could not allocate memory\n"); return ret; } if (nb_slices > H264_MAX_THREADS || (nb_slices > h->mb_height && h->mb_height)) { int max_slices; if (h->mb_height) max_slices = FFMIN(H264_MAX_THREADS, h->mb_height); else max_slices = H264_MAX_THREADS; av_log(h->avctx, AV_LOG_WARNING, "too many threads/slices %d," " reducing to %d\n", nb_slices, max_slices); nb_slices = max_slices; } h->slice_context_count = nb_slices; if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_SLICE)) { ret = ff_h264_context_init(h); if (ret < 0) { av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return ret; } } else { for (i = 1; i < h->slice_context_count; i++) { H264Context *c; c = h->thread_context[i] = av_mallocz(sizeof(H264Context)); if (!c) return AVERROR(ENOMEM); c->avctx = h->avctx; c->dsp = h->dsp; c->vdsp = h->vdsp; c->h264dsp = h->h264dsp; c->h264qpel = h->h264qpel; c->h264chroma = h->h264chroma; c->sps = h->sps; c->pps = h->pps; c->pixel_shift = h->pixel_shift; c->width = h->width; c->height = h->height; c->linesize = h->linesize; c->uvlinesize = h->uvlinesize; c->chroma_x_shift = h->chroma_x_shift; c->chroma_y_shift = h->chroma_y_shift; c->qscale = h->qscale; c->droppable = h->droppable; c->data_partitioning = h->data_partitioning; c->low_delay = h->low_delay; c->mb_width = h->mb_width; c->mb_height = h->mb_height; c->mb_stride = h->mb_stride; c->mb_num = h->mb_num; c->flags = h->flags; c->workaround_bugs = h->workaround_bugs; c->pict_type = h->pict_type; init_scan_tables(c); clone_tables(c, h, i); c->context_initialized = 1; } for (i = 0; i < h->slice_context_count; i++) if ((ret = ff_h264_context_init(h->thread_context[i])) < 0) { av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return ret; } } h->context_initialized = 1; return 0; }
1threat
significance of "trainable" and "training" flag in tf.layers.batch_normalization : <p>What is the significance of "trainable" and "training" flag in tf.layers.batch_normalization? How are these two different during training and prediction?</p>
0debug
static void virtio_pci_register_devices(void) { type_register_static(&virtio_blk_info); type_register_static_alias(&virtio_blk_info, "virtio-blk"); type_register_static(&virtio_net_info); type_register_static_alias(&virtio_net_info, "virtio-net"); type_register_static(&virtio_serial_info); type_register_static_alias(&virtio_serial_info, "virtio-serial"); type_register_static(&virtio_balloon_info); type_register_static_alias(&virtio_balloon_info, "virtio-balloon"); }
1threat
SQL How to create where clause to filter last six periods with this format YYYYMM : I want to run a query with a criteria that sums the previous 6 periods with the following period format yyyymm Period Usage ====== ===== 201907 30 201908 40 201909 50 201910 60 201911 70 201912 60 202001 20
0debug
Python3/list/ look near elements on list[x][y] : **Python3 *list*** mas1 = [[True, False, True], [False, True, True], [False, True, False]] mas_answer = [[1, 4, 2], [3, 4, 3], [2, 2, 3]] Main idea: I need to check all elements of mas1 and put the number of closest "True" elements for the current position in mas_answer. Please Help.
0debug
How to test authentication via API with Laravel Passport? : <p>I'm trying to test the authentication with Laravel's Passport and there's no way... always received a 401 of that client is invalid, I'll leave you what I've tried:</p> <p>My phpunit configuration is the one that comes from base with laravel </p> <h3>tests/TestCase.php</h3> <pre><code>abstract class TestCase extends BaseTestCase { use CreatesApplication, DatabaseTransactions; protected $client, $user, $token; public function setUp() { parent::setUp(); $clientRepository = new ClientRepository(); $this-&gt;client = $clientRepository-&gt;createPersonalAccessClient( null, 'Test Personal Access Client', '/' ); DB::table('oauth_personal_access_clients')-&gt;insert([ 'client_id' =&gt; $this-&gt;client-&gt;id, 'created_at' =&gt; date('Y-m-d'), 'updated_at' =&gt; date('Y-m-d'), ]); $this-&gt;user = User::create([ 'id' =&gt; 1, 'name' =&gt; 'test', 'lastname' =&gt; 'er', 'email' =&gt; 'test@test.test', 'password' =&gt; bcrypt('secret') ]); $this-&gt;token = $this-&gt;user-&gt;createToken('TestToken', [])-&gt;accessToken; } } </code></pre> <h3>tests/Feature/AuthTest.php</h3> <pre><code>class AuthTest extends TestCase { use DatabaseMigrations; public function testShouldSignIn() { // Arrange $body = [ 'client_id' =&gt; (string) $this-&gt;client-&gt;id, 'client_secret' =&gt; $this-&gt;client-&gt;secret, 'email' =&gt; 'test@test.test', 'password' =&gt; 'secret', ]; // Act $this-&gt;json('POST', '/api/signin', $body, ['Accept' =&gt; 'application/json']) // Assert -&gt;assertStatus(200) -&gt;assertJsonStructure([ 'data' =&gt; [ 'jwt' =&gt; [ 'access_token', 'expires_in', 'token_type', ] ], 'errors' ]); } } </code></pre> <p>My handy authentication with passport for testing purposes</p> <h3>routes/api.php</h3> <pre><code>Route::post('/signin', function () { $args = request()-&gt;only(['email', 'password', 'client_id', 'client_secret']); request()-&gt;request-&gt;add([ 'grant_type' =&gt; 'password', 'client_id' =&gt; $args['client_id'] ?? env('PASSPORT_CLIENT_ID', ''), 'client_secret' =&gt; $args['client_secret'] ?? env('PASSPORT_CLIENT_SECRET', ''), 'username' =&gt; $args['email'], 'password' =&gt; $args['password'], 'scope' =&gt; '*', ]); $res = Route::dispatch(Request::create('oauth/token', 'POST')); $data = json_decode($res-&gt;getContent()); $isOk = $res-&gt;getStatusCode() === 200; return response()-&gt;json([ 'data' =&gt; $isOk ? [ 'jwt' =&gt; $data ] : null, 'errors' =&gt; $isOk ? null : [ $data ] ], 200); }); </code></pre>
0debug
Detect CONNECTIVITY CHANGE in Android 7 and above when app is killed/in background : <p><strong>Problem:</strong></p> <p>So the problem is that I have an app which sends a request to our backend whenever WiFi is connected (with the connected SSID and other info) or when it is disconnected (over the mobile network). However with the changes in Android 7/N and above, CONNECTIVITY_CHANGE and CONNECTIVITY_ACTION no longer work in the background. Now in most cases people misuse this broadcast and as such I can completely understand why the change was made. However, I have no idea how to solve this problem in the current state.</p> <p>Now I'm not at all much of an Android developer (this is for a Cordova plugin) so I'm counting on you guys!</p> <p><strong>Expected behavior:</strong> App is woken up and request is sent whenever WiFi switches connectivity, even when app is killed/in background.</p> <p><strong>Current behavior:</strong> App only sends request when the app is in the foreground.</p> <p><strong>Tried so far:</strong> So far I've moved the implicit intent to listen to CONNECTIVITY_ACTION from the manifest to manually registering it in the main part of the app (plugin). This makes it work as long as the app is in memory but not on cold boot or actual background</p> <p><strong>Already looked at:</strong> Most answers talk about using scheduled jobs to substitute for the missing broadcast. I see how this works for, for example, retrying a download or similar, but not for my case (but please correct me if I'm wrong). Below are the SO posts I've already looked at:</p> <p><a href="https://stackoverflow.com/questions/39210191/detect-connectivity-changes-on-android-7-0-nougat-when-app-is-in-foreground">Detect connectivity changes on Android 7.0 Nougat when app is in foreground</a></p> <p><a href="https://stackoverflow.com/questions/36421930/connectivitymanager-connectivity-action-deprecated">ConnectivityManager.CONNECTIVITY_ACTION deprecated</a></p> <p><a href="https://stackoverflow.com/questions/45430598/detect-connectivity-change-using-jobscheduler">Detect Connectivity change using JobScheduler</a></p> <p><a href="https://stackoverflow.com/questions/46163131/android-o-detect-connectivity-change-in-background">Android O - Detect connectivity change in background</a></p>
0debug
static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQEDState *s = bs->opaque; QEDHeader le_header; int64_t file_size; int ret; s->bs = bs; QSIMPLEQ_INIT(&s->allocating_write_reqs); ret = bdrv_pread(bs->file, 0, &le_header, sizeof(le_header)); if (ret < 0) { return ret; qed_header_le_to_cpu(&le_header, &s->header); if (s->header.magic != QED_MAGIC) { error_setg(errp, "Image not in QED format"); if (s->header.features & ~QED_FEATURE_MASK) { char buf[64]; snprintf(buf, sizeof(buf), "%" PRIx64, s->header.features & ~QED_FEATURE_MASK); error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bdrv_get_device_name(bs), "QED", buf); return -ENOTSUP; if (!qed_is_cluster_size_valid(s->header.cluster_size)) { file_size = bdrv_getlength(bs->file); if (file_size < 0) { return file_size; s->file_size = qed_start_of_cluster(s, file_size); if (!qed_is_table_size_valid(s->header.table_size)) { if (!qed_is_image_size_valid(s->header.image_size, s->header.cluster_size, s->header.table_size)) { if (!qed_check_table_offset(s, s->header.l1_table_offset)) { s->table_nelems = (s->header.cluster_size * s->header.table_size) / sizeof(uint64_t); s->l2_shift = ffs(s->header.cluster_size) - 1; s->l2_mask = s->table_nelems - 1; s->l1_shift = s->l2_shift + ffs(s->table_nelems) - 1; if ((s->header.features & QED_F_BACKING_FILE)) { if ((uint64_t)s->header.backing_filename_offset + s->header.backing_filename_size > s->header.cluster_size * s->header.header_size) { ret = qed_read_string(bs->file, s->header.backing_filename_offset, s->header.backing_filename_size, bs->backing_file, sizeof(bs->backing_file)); if (ret < 0) { return ret; if (s->header.features & QED_F_BACKING_FORMAT_NO_PROBE) { pstrcpy(bs->backing_format, sizeof(bs->backing_format), "raw"); if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 && !bdrv_is_read_only(bs->file) && !(flags & BDRV_O_INCOMING)) { s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK; ret = qed_write_header_sync(s); if (ret) { return ret; bdrv_flush(bs->file); s->l1_table = qed_alloc_table(s); qed_init_l2_cache(&s->l2_cache); ret = qed_read_l1_table_sync(s); if (ret) { goto out; if (!(flags & BDRV_O_CHECK) && (s->header.features & QED_F_NEED_CHECK)) { if (!bdrv_is_read_only(bs->file) && !(flags & BDRV_O_INCOMING)) { BdrvCheckResult result = {0}; ret = qed_check(s, &result, true); if (ret) { goto out; bdrv_qed_attach_aio_context(bs, bdrv_get_aio_context(bs)); out: if (ret) { qed_free_l2_cache(&s->l2_cache); qemu_vfree(s->l1_table); return ret;
1threat
Mount local directory into pod in minikube : <p>I am running minikube v0.24.1. In this minikube, I will create a Pod for my nginx application. And also I want to pass data from my local directory.</p> <p>That means I want to mount my local <code>$HOME/go/src/github.com/nginx</code> into my Pod</p> <p>How can I do this?</p> <pre><code>apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - image: nginx:0.1 name: nginx volumeMounts: - mountPath: /data name: volume volumes: - name: volume hostPath: path: /data </code></pre>
0debug
Why this code freezes, when i'm trying to use write (man 2 write) function? : <p>I'm trying to write test, in which some data should be read from file descriptor, so i'm using dup and pipe functions to check this. </p> <pre><code> int main() { char *line; int out; int p[2]; char *str; int len = 50; str = (char *)malloc(235436); for (int i = 0; i &lt; 235436; ++i) { str[i]='h'; } out = dup(1); pipe(p); dup2(p[1], 1); write(1, str, strlen(str)); //freezes there. malloc alocates memory, i've checked this with debuger close(p[1]); dup2(out, 1); get_next_line(p[0], &amp;line); } </code></pre> <p>And for some reason this code works perfectly although it does all the same.</p> <pre><code>str = (char *)malloc(1000 * 1000); *str = '\0'; while (len--) strcat(str, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in leo dignissim, gravida leo id, imperdiet urna. Aliquam magna nunc, maximus quis eleifend et, scelerisque non dolor. Suspendisse augue augue, tempus"); out = dup(1); pipe(p); dup2(p[1], 1); if (str) write(1, str, strlen(str)); close(p[1]); dup2(out, 1); get_next_line(p[0], &amp;line); </code></pre>
0debug
Unable to locate attached view in the native tree : <p>When scrolling down and then up a large list of items in a SectionList I receive an error message. I'm wondering if someone else had this problem before, because I wasn't able to find any docs on it.</p> <p><a href="https://i.stack.imgur.com/OOZMJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OOZMJ.png" alt="enter image description here"></a></p>
0debug
How I can calculate date weekend in php : hy all.. i have date like this $start = strtotime('2010-01-01'); $end = strtotime('2010-01-25'); my quetion:<br> how I can calculate or count weekend from $start & $end date range..??
0debug
What SQL Statement can be used to access this information? : <p>I'm trying to write an <code>SQL</code> statement that can be used in <code>PHP</code> for a website, but am having trouble comprehending how to access the information.</p> <p>I have the following tables.. <a href="https://i.stack.imgur.com/Yvypl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yvypl.png" alt="enter image description here"></a> <strong>Please Note:</strong> <code>ACADEMIC_ID</code> &amp; <code>STUDENT_ID</code> are just foreign keys for <code>USER_ID</code>.</p> <p>My desired result is.. <a href="https://i.stack.imgur.com/df7ez.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/df7ez.png" alt="enter image description here"></a></p> <p>As I am trying to gain access to the information from the Students View of the website in <code>PHP</code>, I only have the following information to work with..</p> <ol> <li>The <code>USER_ID</code> of the student. </li> <li>The <code>DEBATE_ID</code> for each of the debates the student is currently enrolled in.</li> </ol> <p>Therefore..</p> <blockquote> <p><em>What SQL statement can be used to give the desired result?</em></p> </blockquote>
0debug
Multiple docker containers for mysql or one instance with multiple databases : <p>I have a question regarding best practices using docker containers.</p> <p>I need one database for each application I develop. Now my question is whether I should use one mysql docker instance with multiple databases inside or should I create one instance for each database. The disadvantage I see with creating one instance per database is that I can't have a user which has access to all database. I know this is a pro for security reasons but when I try to backup from a client than I need to go in every instance for backup up. And isn't multiple instance using to much overhead of resources (although mysql may be using less resource, but using e.x. mssql instance which is quit bigger may cause resource problems later) </p> <p>My question is what is the common way to do it with docker and what are the pros and contras? </p>
0debug
Using Google Maps geometry library in nodejs : <p>I want to use the Google Maps geometry library within a nodejs application.</p> <p>From what I can see this library is only available with the Google Maps Javascript api. Is there a way for me to do this?</p> <p>Colin Goldberg</p>
0debug
How i can take JavaScript value inside php : <p>I have created a javascript function. And the work of that function is to store the value which is selected by the user. Now I want to do that if the user selects the value then that value should be searched inside the database.</p> <pre><code>&lt;script&gt; function test(){ var a=$("#to_artist").val(); var aakash="&lt;option&gt;Select If you want to change&lt;/option&gt;&lt;?php define('DB_HOST','localhost'); define('DB_USERNAME','username'); define('DB_PASSWORD','password'); define('DB_NAME','dbname'); //echo '&lt;script&gt; $("#to_artist").val(); &lt;/script&gt;'; $con = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_NAME) or die("Unable to connect"); $sql = mysqli_query($con, "SELECT * FROM album;"); $row2 = mysqli_num_rows($sql2); ?&gt;"; aakash+="&lt;?php while ($row2 = mysqli_fetch_array($sql)){echo "&lt;option value='". $row2['album_name'] ."'&gt;" .$row2['album_name'] ."&lt;/option&gt;" ;} ?&gt;" ; $("#to_album").append(aakash); } &lt;/script&gt; </code></pre> <p>I want to use <code>Select * from album where artist=a</code> this query inside PHP but i don't know how i can use this can any one help me.</p>
0debug
String erreur android studio : Any help i get this erreur when, i run my programm **Text view has already been defined in this folder ** <resources> <string name="google_maps_Api_Key">AIzaSyB4RYfDdBxiWPS2eU5j_ehgcQD122asg0E</string> <string name="app_name">GoogleMapsGooglePlaces</string> <string name="map">MAP</string> <string name="mape">Map</string> <string name="RequestPermision" /> <string name="DenailMessage" /> <string name="ReciveLocation" /> <string name="RateDesc" /> <string name="new_message_notification_title_template" /> <string name="UpdateMsg" /> <string name="enter_your_phone_number">ENTER YOUR PHONE NUMBER</string> <string name="enter_your_string_smssend">Enter your @string/smsSend</string> <string name="number" /> <string name="message" /> <string name="send" /> <string name="enter_your_phone_numbernumber" /> <string name="textview">TextView</string> <string name="sendsms">Send</string> <string name="textview">TextView</string> <string name="enter_your_message">Enter your message</string> </resources>
0debug
void memory_region_init_ram_ptr(MemoryRegion *mr, const char *name, uint64_t size, void *ptr) { memory_region_init(mr, name, size); mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr); mr->backend_registered = true; }
1threat
Sort by value and key Python : I was searching for something to sort a list of pairs by values and keys in Python. I found this list.sort(key = lambda (k,v):(-v,k)), i tried to find some explanation about this but couldn't find anything which clarify my doubts. Can someone explain how this lambda function works?
0debug
Function to retun char array via pointers : Hi im new here and sorry foe the haste but looking for help ASAP. Need to make a function (no argument ) that will return a char array . the length of the array will be defined by the user . can not use gets() function. char get() { int size; char *str=new char[size]; int i,l; cout<<"enter size"; cin>>size; for(i=0;i<size;i++) { str[i]=getche(); } str[size]='\0'; return str[size]; }
0debug
static int bdrv_open_common(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret, open_flags; assert(drv != NULL); trace_bdrv_open_common(bs, filename, flags, drv->format_name); bs->file = NULL; bs->total_sectors = 0; bs->encrypted = 0; bs->valid_key = 0; bs->open_flags = flags; bs->buffer_alignment = 512; pstrcpy(bs->filename, sizeof(bs->filename), filename); if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) { return -ENOTSUP; } bs->drv = drv; bs->opaque = g_malloc0(drv->instance_size); if (flags & BDRV_O_CACHE_WB) bs->enable_write_cache = 1; open_flags = flags & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); if (bs->is_temporary) { open_flags |= BDRV_O_RDWR; } if (drv->bdrv_file_open) { ret = drv->bdrv_file_open(bs, filename, open_flags); } else { ret = bdrv_file_open(&bs->file, filename, open_flags); if (ret >= 0) { ret = drv->bdrv_open(bs, open_flags); } } if (ret < 0) { goto free_and_fail; } bs->keep_read_only = bs->read_only = !(open_flags & BDRV_O_RDWR); ret = refresh_total_sectors(bs, bs->total_sectors); if (ret < 0) { goto free_and_fail; } #ifndef _WIN32 if (bs->is_temporary) { unlink(filename); } #endif return 0; free_and_fail: if (bs->file) { bdrv_delete(bs->file); bs->file = NULL; } g_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret; }
1threat
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
static uint32_t nam_readl (void *opaque, uint32_t addr) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; dolog ("U nam readl %#x\n", addr); s->cas = 0; return ~0U; }
1threat
UITable view error when converting to swift 4 : Updating an old app from swift 2.2 to swift 4. I have to use swift 3 as a stepping stone. I converted to 3 but come across the following error: `Binary operator '==' cannot be applied to operands of type 'IndexPath' and 'Int` The code is: override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if (indexPath as NSIndexPath).row == 0 || indexPath == 1 { self.performSegue(withIdentifier: "NFL", sender: self) } if (indexPath as NSIndexPath).row == 1 { self.performSegue(withIdentifier: "AFL", sender: self) } if (indexPath as NSIndexPath).row == 2 { self.performSegue(withIdentifier: "FAI", sender: self) } if (indexPath as NSIndexPath).row == 3 { self.performSegue(withIdentifier: "IPA", sender: self) } } Why do I get this error in swift 3 and not 2.2? I tried to force it into an "int" but don't think I was going about it the right way. Any help would be great. Thanks.
0debug
How to set connection timeout for Mongodb using pymongo? : <p>I tried setting <code>connectTimeoutMS</code> and <code>socketTimeoutMS</code> to a low value but it still takes about 20 seconds before my script times out. Am I not using the options correctly? I want the script to exit after 5 seconds.</p> <pre><code>def init_mongo(): mongo_connection = MongoClient('%s' %MONGO_SERVER, connectTimeoutMS=5000, socketTimeoutMS=5000) if mongo_connection is None: return try: &lt;code&gt; except: &lt;code&gt; </code></pre>
0debug
Retrieve a single column sql from database : which code does i need to retrieve a single value i a column from table sql user_comment_count this is column name in tabel tabel is : zmar_hreviews_list_total
0debug
How to generate full APK file including dynamic feature module : <p>My project has dynamic feature module and I would like to generate debug or release APK including the dynamic feature. Currently I can get only base APK file.</p> <p>Basically I would generate an APK file like normal application. But I couldn't do with dynamic feature. Yes, I know dynamic feature will work based on AAB. </p> <p>Is there any ways to make a normal(base + all modules) APK file?. Please help on this.</p> <p>Thanks</p>
0debug
database sql, is that using join or all statement? : everyone, i'm new to sql language, can you help me to solve below question. i have two tables table1: author 1 2 3 table2: bookstore author A 1 A 2 A 3 B 1 B 2 my question is : how can i select distinct bookstore which includes all authors. so result would be bookstore A
0debug
static inline void patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { assert(addend == 0); switch (type) { case R_AARCH64_JUMP26: case R_AARCH64_CALL26: reloc_pc26(code_ptr, (tcg_insn_unit *)value); break; case R_AARCH64_CONDBR19: reloc_pc19(code_ptr, (tcg_insn_unit *)value); break; default: tcg_abort(); } }
1threat
Cannot have a pipe in an action expression ? : <p>I'm using this statement in my html template:</p> <pre><code>[(ngModel)]="tempProduct.unitprice | number : '1.2-2'" </code></pre> <p>But when i run it im getting this error in console:</p> <blockquote> <p>Cannot have a pipe in an action expression...</p> </blockquote> <p>I need to use this number pipe but with <code>[(ngModel)]</code> or i will not get data. Any suggestion how can i fix this?? I tried with <code>[ngModel]</code> but when i do that i dont get data, its empty in html template.</p>
0debug
static void vfio_vga_quirk_teardown(VFIODevice *vdev) { int i; for (i = 0; i < ARRAY_SIZE(vdev->vga.region); i++) { while (!QLIST_EMPTY(&vdev->vga.region[i].quirks)) { VFIOQuirk *quirk = QLIST_FIRST(&vdev->vga.region[i].quirks); memory_region_del_subregion(&vdev->vga.region[i].mem, &quirk->mem); QLIST_REMOVE(quirk, next); g_free(quirk); } } }
1threat
Related to ArrayList And Hashtable : <p>I have created one Hashtable and an arraylist.In arrayList I have values from which some are present in hashtable as key of hashtable. I am trying to check how many entry of elements stored in arraylist are there in Hashtable.</p>
0debug
Why is the value of my expression for two parameters incorrect? : <p>I am working on a homework problem for an introductory level Python class and am having difficulty understanding functions involving defining multiple parameters.</p> <p>I have already tried numerous attempts from a variety of online resources without any luck.</p> <p>The question asks "Write the definition of a function typing_speed, that receives two parameters. The first is the number of words that a person has typed (an int greater than or equal to zero) in a particular time interval. The second is the length of the time interval in seconds (an int greater than zero). The function returns the typing speed of that person in words per minute (a float)."</p> <p>This is the code that is displaying an incorrect expression. </p> <pre><code>def typing_speed(num_words,time_interval): num_words&gt;=0 time_interval&gt;0 result=float((num_words)/(time_interval*60)) return result </code></pre> <p>Thank you for any help</p>
0debug
Why does iTunes Store Reviews RSS feed sometimes return no results? : <p>I'm trying to import reviews for certain apps on the iTunes App Store via the public reviews RSS feed. Most of the time the feed returns a list of 50 reviews per page, and gives me links for up to 10 pages. But in the case of some apps, some or all of those pages have 0 reviews, and I can't tell why.</p> <p>At the time of this writing, the feed for Instagram (link below) returns no reviews, despite reporting that there's 10 pages of reviews available.</p> <p><a href="https://itunes.apple.com/us/rss/customerreviews/page=1/id=389801252/sortBy=mostrecent/xml" rel="noreferrer">https://itunes.apple.com/us/rss/customerreviews/page=1/id=389801252/sortBy=mostrecent/xml</a></p> <p>Even more confusing, I noticed last night that page 2 had 50 reviews but none of the other pages had any. This morning, page 2 is empty again.</p> <p>If I remove the <code>sortBy=mostrecent</code> portion of the URL above, I actually do get 50 results back, but none of the other pages have any results.</p> <p>Finally, it appears as if the JSON version of this page (link below) actually returns results better than the XML version. Unfortunately, the JSON version leaves off the date of the review in the data so I can't use it.</p> <p><a href="https://itunes.apple.com/us/rss/customerreviews/page=1/id=389801252/sortBy=mostrecent/json" rel="noreferrer">https://itunes.apple.com/us/rss/customerreviews/page=1/id=389801252/sortBy=mostrecent/json</a></p> <p>Can anyone explain this? Is Apple's XML feed API just extremely unreliable? Am I forming a bad URL?</p>
0debug
React router 4 history.listen never fires : <p>Switched to router v4 and history v4.5.1 and now history listener not working</p> <pre><code>import createBrowserHistory from 'history/createBrowserHistory' const history = createBrowserHistory() history.listen((location, action) =&gt; { console.log(action, location.pathname, location.state) // &lt;=== Never happens }) render( &lt;Provider store={store}&gt; &lt;Router history={history}&gt; ... &lt;/Router&gt; &lt;/Provider&gt;, document.getElementById('root') ) </code></pre> <p>Any ideas why it is being ignored?</p>
0debug
A relative layout inside of a scrollview isnt scrollable : Im trying to make a UI with a few fields in the middle of the screen and a button at the bottom. When i am writing a number in the fields, the keyboard hides part of the interface (which i want it to), but i also need the whole interface to be scrollable so that i can adjust the screen and keep filling the fields with the keyboard on. I've put the whole setup in a relative layout and put it under a scroll view. The posts here say it should work that way but it isnt working for me. the xml code is <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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" tools:context="com.example.maaz.rakattracker.MainActivity"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="horizontal"> <EditText android:id="@+id/farzET" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:gravity="center" android:hint="0" android:inputType="number" android:singleLine="true" android:textAlignment="center" /> <TextView android:id="@+id/farzLbl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:elevation="0dp" android:ems="5" android:text="farz" android:textAlignment="center" android:textSize="15sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="horizontal"> <EditText android:id="@+id/sunnatET" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:hint="0" android:inputType="number" android:singleLine="true" android:textAlignment="center" /> <TextView android:id="@+id/sunnatLbl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="5" android:text="Sunnat" android:textAlignment="center" android:textSize="15sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal"> <EditText android:id="@+id/naflET" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:gravity="center" android:hint="0" android:inputType="number" android:singleLine="true" android:textAlignment="center" /> <TextView android:id="@+id/naflLbl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="5" android:text="Nafl" android:textAlignment="center" android:textSize="15sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal"> <EditText android:id="@+id/witrET" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:hint="0" android:inputType="number" android:singleLine="true" android:textAlignment="center" /> <TextView android:id="@+id/witrLbl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="5" android:text="Witr" android:textAlignment="center" android:textSize="15sp" /> </LinearLayout> </LinearLayout> <Button android:id="@+id/startButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="Button" /> </RelativeLayout> </ScrollView> </RelativeLayout> Kindly help me figure out the issue here. Thanks
0debug
Understanding Liskov Substituion Principle : <p>My sample program like below;</p> <pre><code> public class Animal { public virtual string MakeSound() { return "General Sound"; } } public class Dog : Animal { public override string MakeSound() { return "Bow..Bow.."; } } } static void Main(string[] args) { Animal obj1 = new Animal(); Console.WriteLine("General Animal's sound id " + obj1.MakeSound()); Dog obj2 = new Dog(); Console.WriteLine("Dog Animal's sound id " + obj2.MakeSound()); //Violate LSP Animal obj3 = new Dog(); Console.WriteLine("Animal's sound id " + obj3.MakeSound()); Console.ReadKey(); } </code></pre> <p>Here as my understanding when we create Dog instance for Animal like obj3, we are violating LSP. Please confirm my understanding. If yes, please tell me how to achieve in this case to understand better. I think my coding is conceptionwise correct</p>
0debug
How i select some tag in a range : I have this code:How i can use jquery to select in range from fist to end(i already commented) and chage all <p> and <a> tag in that range to another color(may be yellow...) (I want a solution can use even we have more tag bettween that range) <div class="test1"> <a> 1 </a> <p title="hihi" style="color:red"> 2 </p>//first <p> 3 </p> <p> 4 </p> <a> 5.0 </a> <div> 5.1 </div> <a> 6.0 </a> <div> 5.1 </div> <p> 7 </p> <p> 8</p> <p> 9</p> <span></span> <p> 10</p>//end <div>11</div> <p>12</p> <span>13</span> </div>
0debug
document.write('<script src="evil.js"></script>');
1threat
flutter wrap text instead of overflow : <p>When creating a Text widget with a long string in Flutter, it wraps its text when put directly in a Column. However, when it is inside Column-Row-Column, the text overflows the side of the screen.</p> <p>How do I wrap text inside a Column-Row-Column? And what is the reason for this difference? It would seem logical to me that any child of the upper column would have the same width? Why is the width unbounded?</p> <p>I tried putting the text in Expanded, Flexible, Container and FittedBox, based on other answers, but it leads to new errors I don't understand.</p> <p>Example:</p> <pre><code>MaterialApp( title: 'Text overflow', home: Scaffold( appBar: AppBar(title: Text("MyApp"),), body: Column( children: &lt;Widget&gt;[ Row( children: &lt;Widget&gt;[ // The long text inside this column overflows. Remove the row and column above this comment and the text wraps. Column( children: &lt;Widget&gt;[ Text("Short text"), Text("Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. ") ], ), ], ), ], ), ), ) </code></pre>
0debug
static void print_sdp(void) { char sdp[16384]; int i; AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files); if (!avc) exit_program(1); for (i = 0; i < nb_output_files; i++) avc[i] = output_files[i]->ctx; av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp)); printf("SDP:\n%s\n", sdp); fflush(stdout); av_freep(&avc); }
1threat
static av_cold int MP3lame_encode_init(AVCodecContext *avctx) { Mp3AudioContext *s = avctx->priv_data; if (avctx->channels > 2) return -1; s->stereo = avctx->channels > 1 ? 1 : 0; if ((s->gfp = lame_init()) == NULL) goto err; lame_set_in_samplerate(s->gfp, avctx->sample_rate); lame_set_out_samplerate(s->gfp, avctx->sample_rate); lame_set_num_channels(s->gfp, avctx->channels); if(avctx->compression_level == FF_COMPRESSION_DEFAULT) { lame_set_quality(s->gfp, 5); } else { lame_set_quality(s->gfp, avctx->compression_level); } lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO); lame_set_brate(s->gfp, avctx->bit_rate/1000); if(avctx->flags & CODEC_FLAG_QSCALE) { lame_set_brate(s->gfp, 0); lame_set_VBR(s->gfp, vbr_default); lame_set_VBR_quality(s->gfp, avctx->global_quality/(float)FF_QP2LAMBDA); } lame_set_bWriteVbrTag(s->gfp,0); #if FF_API_LAME_GLOBAL_OPTS s->reservoir = avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR; #endif lame_set_disable_reservoir(s->gfp, !s->reservoir); if (lame_init_params(s->gfp) < 0) goto err_close; avctx->frame_size = lame_get_framesize(s->gfp); if(!(avctx->coded_frame= avcodec_alloc_frame())) { lame_close(s->gfp); return AVERROR(ENOMEM); } avctx->coded_frame->key_frame= 1; if(AV_SAMPLE_FMT_S32 == avctx->sample_fmt && s->stereo) { int nelem = 2 * avctx->frame_size; if(! (s->s32_data.left = av_malloc(nelem * sizeof(int)))) { av_freep(&avctx->coded_frame); lame_close(s->gfp); return AVERROR(ENOMEM); } s->s32_data.right = s->s32_data.left + avctx->frame_size; } return 0; err_close: lame_close(s->gfp); err: return -1; }
1threat
static qemu_irq *icp_pic_init(uint32_t base, qemu_irq parent_irq, qemu_irq parent_fiq) { icp_pic_state *s; int iomemtype; qemu_irq *qi; s = (icp_pic_state *)qemu_mallocz(sizeof(icp_pic_state)); if (!s) return NULL; qi = qemu_allocate_irqs(icp_pic_set_irq, s, 32); s->base = base; s->parent_irq = parent_irq; s->parent_fiq = parent_fiq; iomemtype = cpu_register_io_memory(0, icp_pic_readfn, icp_pic_writefn, s); cpu_register_physical_memory(base, 0x007fffff, iomemtype); return qi; }
1threat
static inline void wb_SR_F(void) { int label; label = gen_new_label(); tcg_gen_andi_tl(cpu_sr, cpu_sr, ~SR_F); tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, label); tcg_gen_ori_tl(cpu_sr, cpu_sr, SR_F); gen_set_label(label); }
1threat
How do I drop a MongoDB database using PyMongo? : <p>I want to drop a database in MongoDB similarly to</p> <pre><code>use &lt;DBNAME&gt; db.dropDatabase() </code></pre> <p>in the Mongo shell.</p> <p>How do I do that in PyMongo?</p>
0debug
Pandas DataFrame search is linear time or constant time? : <p>I have a dataframe object <code>df</code> of over 15000 rows like:</p> <pre><code>anime_id name genre rating 1234 Kimi no nawa Romance, Comedy 9.31 5678 Stiens;Gate Sci-fi 8.92 </code></pre> <p>And I am trying to find the row with a particular anime_id.</p> <pre><code>a_id = "5678" temp = (df.query("anime_id == "+a_id).genre) </code></pre> <p>I just wanted to know if this search was done in constant time (like dictionaries) or linear time(like lists).</p>
0debug
static int parse_object_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { PGSSubContext *ctx = avctx->priv_data; PGSSubObject *object; uint8_t sequence_desc; unsigned int rle_bitmap_len, width, height; int id; if (buf_size <= 4) return AVERROR_INVALIDDATA; buf_size -= 4; id = bytestream_get_be16(&buf); object = find_object(id, &ctx->objects); if (!object) { if (ctx->objects.count >= MAX_EPOCH_OBJECTS) { av_log(avctx, AV_LOG_ERROR, "Too many objects in epoch\n"); return AVERROR_INVALIDDATA; } object = &ctx->objects.object[ctx->objects.count++]; object->id = id; } buf += 1; sequence_desc = bytestream_get_byte(&buf); if (!(sequence_desc & 0x80)) { if (buf_size > object->rle_remaining_len) return AVERROR_INVALIDDATA; memcpy(object->rle + object->rle_data_len, buf, buf_size); object->rle_data_len += buf_size; object->rle_remaining_len -= buf_size; return 0; } if (buf_size <= 7) return AVERROR_INVALIDDATA; buf_size -= 7; rle_bitmap_len = bytestream_get_be24(&buf) - 2*2; if (buf_size > rle_bitmap_len) { av_log(avctx, AV_LOG_ERROR, "Buffer dimension %d larger than the expected RLE data %d\n", buf_size, rle_bitmap_len); return AVERROR_INVALIDDATA; } width = bytestream_get_be16(&buf); height = bytestream_get_be16(&buf); if (avctx->width < width || avctx->height < height) { av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n"); return AVERROR_INVALIDDATA; } object->w = width; object->h = height; av_fast_padded_malloc(&object->rle, &object->rle_buffer_size, rle_bitmap_len); if (!object->rle) return AVERROR(ENOMEM); memcpy(object->rle, buf, buf_size); object->rle_data_len = buf_size; object->rle_remaining_len = rle_bitmap_len - buf_size; return 0; }
1threat
static const void *boston_kernel_filter(void *opaque, const void *kernel, hwaddr *load_addr, hwaddr *entry_addr) { BostonState *s = BOSTON(opaque); s->kernel_entry = *entry_addr; return kernel; }
1threat
Remove miliseconds from string : <p>I have a string: 2020-02-04 09:42:20.0825826 </p> <p>There should be: 2020-02-04 09:42:20</p> <p>Is there any way to remove milliseconds part? (everything after '.')</p>
0debug
void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) { if (ctb_addr_ts == s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]) { cabac_init_decoder(s); if (s->sh.dependent_slice_segment_flag == 0 || (s->ps.pps->tiles_enabled_flag && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1])) cabac_init_state(s); if (!s->sh.first_slice_in_pic_flag && s->ps.pps->entropy_coding_sync_enabled_flag) { if (ctb_addr_ts % s->ps.sps->ctb_width == 0) { if (s->ps.sps->ctb_width == 1) cabac_init_state(s); else if (s->sh.dependent_slice_segment_flag == 1) load_states(s); } } } else { if (s->ps.pps->tiles_enabled_flag && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1]) { if (s->threads_number == 1) cabac_reinit(s->HEVClc); else cabac_init_decoder(s); cabac_init_state(s); } if (s->ps.pps->entropy_coding_sync_enabled_flag) { if (ctb_addr_ts % s->ps.sps->ctb_width == 0) { get_cabac_terminate(&s->HEVClc->cc); if (s->threads_number == 1) cabac_reinit(s->HEVClc); else cabac_init_decoder(s); if (s->ps.sps->ctb_width == 1) cabac_init_state(s); else load_states(s); } } } }
1threat
Pandas replace a character in all column names : <p>I have data frames with column names (coming from .csv files) containing <code>(</code> and <code>)</code> and I'd like to replace them with <code>_</code>.</p> <p>How can I do that in place for all columns?</p>
0debug
Please Help!!! How can I put user input into a list : thanks for helping. I am having trouble with the following code: digitsList = input("Enter any list of 0 or more digits in the form [digit, digit, ...]:") if element == int(list[index]): index += 1 return True else: index += 1 return False for example the user entered: [1,2,3] then I get a following error: ValueError: invalid literal for int() with base 10: '[' I tried everything I can but seems not being able to solve it.
0debug
Which concurrency model do multiple process/thread programming belong? : https://en.wikipedia.org/wiki/Concurrency_(computer_science)#Models says > A number of formalisms for modeling and understanding concurrent > systems have been developed, including:[5] > > The parallel random-access machine[6] > The actor model > Computational bridging models such as the bulk synchronous parallel (BSP) model > Petri nets > Process calculi > Calculus of communicating systems (CCS) > Communicating sequential processes (CSP) model > π-calculus > Tuple spaces, e.g., Linda > Simple Concurrent Object-Oriented Programming (SCOOP) > Reo Coordination Language Which model(s) do multi-process programming (as in C, Java, Python) belong to? Which model(s) do multi-threading programming (as in C, Java, Python) belong to? Thanks.
0debug
Where can I download the Remote Debugger for Visual Studio 2017 : <p>About six weeks ago I set up remote debugging on a couple of our servers to enable us to remotely debug applications that were created in Visual Studio 2017. However, I want to install remote debugging onto a different server but can't now seem to find a source from which to download the remote debugging software - it looks as if the source has been removed by Microsoft since the release of Visual Studio 2019.</p> <p>Can someone point me to a reliable source for the software? I stupidly didn't keep a copy of the download when I pulled it down before. Alternatively, is the remote debugging software available as part of the actual installation software for VS2017?</p>
0debug
How to generate rows for missing homeworks? : <p>Suppose I have a table of students, the dates they completed their homework, and how they performed. For example: t1</p> <pre><code>Name Date Result Carlos 2019-06-01 Average Carlos 2019-06-02 Outstanding Carlos 2019-06-03 Outstanding Ernesto 2019-06-01 Average Ernesto 2019-06-02 Average Ernesto 2019-06-03 Failed Miguel 2019-06-02 Average Miguel 2019-06-03 Average Ashley 2019-06-01 Outstanding Ashley 2019-06-02 Outstanding Eddie 2019-06-01 Failed Eddie 2019-06-03 Failed </code></pre> <p>As you can see from the table, there are no records for Miguel(2019-06-01), Ashley(2019-06-03), and Eddie(2019-06-02). In those scenarios, I would like to generate an extra row whenever there's a missing homework.</p> <p>I would like to generate a new table like this:</p> <pre><code>Name Date Result Carlos 2019-06-01 Average Carlos 2019-06-02 Outstanding Carlos 2019-06-03 Outstanding Ernesto 2019-06-01 Average Ernesto 2019-06-02 Average Ernesto 2019-06-03 Failed Miguel 2019-06-01 Missing --New row Miguel 2019-06-02 Average Miguel 2019-06-03 Average Ashley 2019-06-01 Outstanding Ashley 2019-06-02 Outstanding Ashley 2019-06-03 Missing --New row Eddie 2019-06-01 Failed Eddie 2019-06-02 Missing --New row Eddie 2019-06-03 Failed </code></pre> <p>Any clues?</p> <p>Thanks guys!</p>
0debug
Using jupyter notebook shortcuts in colaboratory : <p>Is there an easy way to use the default jupyter notebook shortcuts instead of the ones that come as default in colab?</p> <p>It also appears that hotkeys don't distinguish whether a cell is active or not, which makes the use of simple hotkeys (e.g. 'b'-> insert cell after) impossible.</p> <p>Any suggestions as to how this can be overcome, or will we have to get used to (slightly) different shortcuts?</p>
0debug
static int r3d_read_rdvo(AVFormatContext *s, Atom *atom) { R3DContext *r3d = s->priv_data; AVStream *st = s->streams[0]; int i; r3d->video_offsets_count = (atom->size - 8) / 4; r3d->video_offsets = av_malloc(atom->size); if (!r3d->video_offsets) return AVERROR(ENOMEM); for (i = 0; i < r3d->video_offsets_count; i++) { r3d->video_offsets[i] = avio_rb32(s->pb); if (!r3d->video_offsets[i]) { r3d->video_offsets_count = i; break; } av_dlog(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]); } if (st->r_frame_rate.num) st->duration = av_rescale_q(r3d->video_offsets_count, (AVRational){st->r_frame_rate.den, st->r_frame_rate.num}, st->time_base); av_dlog(s, "duration %"PRId64"\n", st->duration); return 0; }
1threat
which algorithm is suits for my time series data? : I am working in monitoring team, we do monitor of our client load on our tools. We recorded latency with respective to timeseries. Initially i kept static threshold to raise the anomaly detection. However, it doesn't work if seasonality occurs. Now, I am planning to apply ML on my data. My data looks like [enter image description here][1] volume_nfs_ops timestamp mount_point 2103 6/28/2018 3:16 /slowfs/us01dwt2p311 12440 6/28/2018 6:03 /slowfs/us01dwt2p311 14501 6/28/2018 14:20 /slowfs/us01dwt2p311 12482 6/28/2018 14:45 /slowfs/us01dwt2p311 10420 6/28/2018 18:09 /slowfs/us01dwt2p311 7203 6/28/2018 18:34 /slowfs/us01dwt2p311 14104 6/28/2018 21:58 /slowfs/us01dwt2p311 6996 6/29/2018 7:35 /slowfs/us01dwt2p311 11282 6/29/2018 8:39 /slowfs/us01dwt2p311 When I do google, I came up ARIMA is best model for time series. I am towards mathematics and could figure whether respective ARIMA is good for my data set. My question which algorithm is best to implement in python. which factors should I consider to find anomaly ? [1]: https://i.stack.imgur.com/QGMYk.png
0debug
Windows 10 Docker Host - Display GUI application from Linux Container : <p>I'm trying to use Windows 10 as my host and run Docker containers that contain gui based applications and display them using X11 forwarding or something similar. Pretty much all of the information I've found online deal with Linux Host to Linux Container (example - <a href="http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker" rel="noreferrer">http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker</a>) where the socket / x11 authority are exposed. Other information I've found is from previous implementations of Boot2Docker / Windows where virtualbox was required as part of the setup procedure and required VNC.</p> <p>Basic setup currently, does anyone know what has to be adjusted to get Firefox to display within a window on the host system? -- </p> <p>Start an XMing server on Windows 10 host</p> <h2>Dockerfile</h2> <pre><code>FROM ubuntu:14.04 RUN apt-get update &amp;&amp; apt-get install -y firefox CMD /usr/bin/firefox </code></pre> <h2>Commands</h2> <pre><code>PS&gt; docker build -t firefox . PS&gt; set-variable -name DISPLAY -value localhost:0.0 PS&gt; docker run -ti --rm -e DISPLAY=$DISPLAY firefox </code></pre> <p>Thanks</p>
0debug
void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { bool ret; uint32_t fsr = 0; ARMMMUFaultInfo fi = {}; ret = arm_tlb_fill(cs, addr, access_type, mmu_idx, &fsr, &fi); if (unlikely(ret)) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; uint32_t syn, exc; unsigned int target_el; bool same_el; if (retaddr) { cpu_restore_state(cs, retaddr); } target_el = exception_target_el(env); if (fi.stage2) { target_el = 2; env->cp15.hpfar_el2 = extract64(fi.s2addr, 12, 47) << 4; } same_el = arm_current_el(env) == target_el; syn = fsr & ~(1 << 9); if (access_type == MMU_INST_FETCH) { syn = syn_insn_abort(same_el, 0, fi.s1ptw, syn); exc = EXCP_PREFETCH_ABORT; } else { syn = merge_syn_data_abort(env->exception.syndrome, target_el, same_el, fi.s1ptw, access_type == MMU_DATA_STORE, syn); if (access_type == MMU_DATA_STORE && arm_feature(env, ARM_FEATURE_V6)) { fsr |= (1 << 11); } exc = EXCP_DATA_ABORT; } env->exception.vaddress = addr; env->exception.fsr = fsr; raise_exception(env, exc, syn, target_el); } }
1threat
static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header) { OMAContext *oc = s->priv_data; ID3v2ExtraMetaGEOB *geob = NULL; uint8_t *gdata; oc->encrypted = 1; av_log(s, AV_LOG_INFO, "File is encrypted\n"); while (em) { if (!strcmp(em->tag, "GEOB") && (geob = em->data) && (!strcmp(geob->description, "OMG_LSI") || !strcmp(geob->description, "OMG_BKLSI"))) { break; } em = em->next; } if (!em) { av_log(s, AV_LOG_ERROR, "No encryption header found\n"); return -1; } if (geob->datasize < 64) { av_log(s, AV_LOG_ERROR, "Invalid GEOB data size: %u\n", geob->datasize); return -1; } gdata = geob->data; if (AV_RB16(gdata) != 1) av_log(s, AV_LOG_WARNING, "Unknown version in encryption header\n"); oc->k_size = AV_RB16(&gdata[2]); oc->e_size = AV_RB16(&gdata[4]); oc->i_size = AV_RB16(&gdata[6]); oc->s_size = AV_RB16(&gdata[8]); if (memcmp(&gdata[OMA_ENC_HEADER_SIZE], "KEYRING ", 12)) { av_log(s, AV_LOG_ERROR, "Invalid encryption header\n"); return -1; } if (oc->k_size + oc->e_size + oc->i_size > geob->datasize) { av_log(s, AV_LOG_ERROR, "Too little GEOB data\n"); return AVERROR_INVALIDDATA; } oc->rid = AV_RB32(&gdata[OMA_ENC_HEADER_SIZE + 28]); av_log(s, AV_LOG_DEBUG, "RID: %.8x\n", oc->rid); memcpy(oc->iv, &header[0x58], 8); hex_log(s, AV_LOG_DEBUG, "IV", oc->iv, 8); hex_log(s, AV_LOG_DEBUG, "CBC-MAC", &gdata[OMA_ENC_HEADER_SIZE+oc->k_size+oc->e_size+oc->i_size], 8); if (s->keylen > 0) { kset(s, s->key, s->key, s->keylen); } if (!memcmp(oc->r_val, (const uint8_t[8]){0}, 8) || rprobe(s, gdata, oc->r_val) < 0 && nprobe(s, gdata, geob->datasize, oc->n_val) < 0) { int i; for (i = 0; i < FF_ARRAY_ELEMS(leaf_table); i += 2) { uint8_t buf[16]; AV_WL64(buf, leaf_table[i]); AV_WL64(&buf[8], leaf_table[i+1]); kset(s, buf, buf, 16); if (!rprobe(s, gdata, oc->r_val) || !nprobe(s, gdata, geob->datasize, oc->n_val)) break; } if (i >= FF_ARRAY_ELEMS(leaf_table)) { av_log(s, AV_LOG_ERROR, "Invalid key\n"); return -1; } } av_des_init(&oc->av_des, oc->m_val, 64, 0); av_des_crypt(&oc->av_des, oc->e_val, &gdata[OMA_ENC_HEADER_SIZE + 40], 1, NULL, 0); hex_log(s, AV_LOG_DEBUG, "EK", oc->e_val, 8); av_des_init(&oc->av_des, oc->e_val, 64, 1); return 0; }
1threat
Java- formatted input : <p>How can I accept input from STDIN in the format <strong>HH:MM:SSAM</strong> <strong>here in place of AM , PM can also be there</strong> and display output in the form <strong>HH:MM:SS</strong></p>
0debug
Flutter: Could not find the built application bundle at build/ios/iphonesimulator/Runner.app : <p>I am trying to run my application in debug mode from VSCode. However, every time, regardless if I am running on a simulator or a real device, the debug console outputs </p> <pre><code>Could not find the built application bundle at build/ios/iphonesimulator/Runner.app. </code></pre> <p>or </p> <pre><code>Could not find the built application bundle at build/ios/iphoneos/Runner.app. </code></pre> <p>When I went to the specified directory, my app bundle is being built every time but instead of being named Runner.app it is named MyAppName.app. I suspect the difference in name is causing the VSCode compiler to not being able to locate Runner.app. </p> <p>My question: How do I change my build settings so that the build bundle is named Runner.app again? </p>
0debug
how can i get non repeating value? I`m using sql select view : THIS IS MY SELECT VIEW, HOW CAN I GET NON REPEATING VALUES? [duplicated entry][1] *I need only one line in my view. SELECT A.TOTAL_PRESENT, A."LIMIT", A.COST_CENTER, A.ID, A.PLANT, A.BUDGET_YEAR, A."VERSION", B.BUDGET_YEAR, B."VERSION", B.PLANT, B.CHARGE_CC, B.YEAR_DATE_USD FROM CMS.SUM_REPANDMAINT A, CMS.V_SUM_REPANDMAINT B WHERE (A.BUDGET_YEAR = B.BUDGET_YEAR(+)) AND (A."VERSION" = B."VERSION"(+)) AND (A.PLANT = B.PLANT(+)) AND (A.COST_CENTER = B.CHARGE_CC(+)) AND (B.USERNAME = '[usr_name]') [1]: http://i.stack.imgur.com/9ezbS.png
0debug
MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, hwaddr *xlat, hwaddr *plen, bool is_write) { IOMMUTLBEntry iotlb; MemoryRegionSection *section; MemoryRegion *mr; hwaddr len = *plen; for (;;) { section = address_space_translate_internal(as->dispatch, addr, &addr, &len, true); mr = section->mr; if (!mr->iommu_ops) { break; } iotlb = mr->iommu_ops->translate(mr, addr); addr = ((iotlb.translated_addr & ~iotlb.addr_mask) | (addr & iotlb.addr_mask)); len = MIN(len, (addr | iotlb.addr_mask) - addr + 1); if (!(iotlb.perm & (1 << is_write))) { mr = &io_mem_unassigned; break; } as = iotlb.target_as; } *plen = len; *xlat = addr; return mr; }
1threat
Code skipping run : <pre><code>public class A{ public static void main(String[] args) { int a; int b;int c=0; for(a=100;a&lt;=999;a++){ for(b=100;b&lt;=999;b++){ int n=a*b; int temp=n; while(n&gt;0){ int r=n%10; c=(c*10)+r; n=n/10; } if(temp==c){ System.out.println(c); } } } } } </code></pre> <p>The code compiles well but while running it just skips off everything and exits. Help please. P.S. Problem 4 ProjectEuler</p>
0debug
static void test_validate_fail_union_flat_no_discrim(TestInputVisitorData *data, const void *unused) { UserDefFlatUnion2 *tmp = NULL; Error *err = NULL; Visitor *v; v = validate_test_init(data, "{ 'integer': 42, 'string': 'c', 'string1': 'd', 'string2': 'e' }"); visit_type_UserDefFlatUnion2(v, NULL, &tmp, &err); error_free_or_abort(&err); g_assert(!tmp); }
1threat
static int vm_request_pending(void) { return powerdown_requested || reset_requested || shutdown_requested || debug_requested || vmstop_requested; }
1threat
Converting docx to pdf with pure python (on linux, without libreoffice) : <p>I'm dealing with a problem trying to develop a web-app, part of which converts uploaded docx files to pdf files (after some processing). With <code>python-docx</code> and other methods, I do not require a windows machine with word installed, or even libreoffice on linux, for most of the processing (my web server is pythonanywhere - linux but without libreoffice and without <code>sudo</code> or <code>apt install</code> permissions). But converting to pdf seems to require one of those. From exploring questions here and elsewhere, this is what I have so far:</p> <pre><code>import subprocess try: from comtypes import client except ImportError: client = None def doc2pdf(doc): """ convert a doc/docx document to pdf format :param doc: path to document """ doc = os.path.abspath(doc) # bugfix - searching files in windows/system32 if client is None: return doc2pdf_linux(doc) name, ext = os.path.splitext(doc) try: word = client.CreateObject('Word.Application') worddoc = word.Documents.Open(doc) worddoc.SaveAs(name + '.pdf', FileFormat=17) except Exception: raise finally: worddoc.Close() word.Quit() def doc2pdf_linux(doc): """ convert a doc/docx document to pdf format (linux only, requires libreoffice) :param doc: path to document """ cmd = 'libreoffice --convert-to pdf'.split() + [doc] p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE) p.wait(timeout=10) stdout, stderr = p.communicate() if stderr: raise subprocess.SubprocessError(stderr) </code></pre> <p>As you can see, one method requires <code>comtypes</code>, another requires <code>libreoffice</code> as a subprocess. Other than switching to a more sophisticated hosting server, is there any solution?</p>
0debug
Firebase Storage: String does not match format 'base64': Invalid character found : <p>I'm working on a react-native and I need to upload an image to Firebase using <a href="https://firebase.google.com/docs/storage/web/start" rel="noreferrer">Firebase Storage</a>. I'm using <a href="https://github.com/marcshilling/react-native-image-picker" rel="noreferrer">react-native-image-picker</a> to select the image from the phone which gives me the base64 encoded data.</p> <p>When I try to upload the image to Firebase it gives me the error <code>Firebase Storage: String does not match format 'base64': Invalid character found</code> but I already checked if the string is a valid base64 string with regex and it is!</p> <p>I already read a few answers from here but I tried all that. Here's my code:</p> <pre><code>function uploadImage(image){ const user = getCurrentUser(); const refImage = app.storage().ref(`profileImages/${user.uid}`); refImage.putString(image, 'base64').then(() =&gt; { console.log('Image uploaded'); }); } </code></pre> <p>The image picker:</p> <pre><code>ImagePicker.showImagePicker(ImageOptions, (response) =&gt; { if (response.didCancel) { console.log('User cancelled image picker'); } else if (response.error) { console.log('ImagePicker Error: ', response.error); } else if (response.customButton) { console.log('User tapped custom button: ', response.customButton); } else { uploadImage(response.data); } }); </code></pre>
0debug