problem
stringlengths
26
131k
labels
class label
2 classes
how to add json file and print in console : i am new to ios. And this is my first post. I know how to create a dummy json data and to print them in console.like below code: NSArray *jsonObject; jsonObject = @[@{@"Id1":@"mad", @"people1":@"300"}, @{@"Id2":@"normal", @"people2":@"9",@"total2":@"300"}]; NSError *err; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonObject options:NSJSONWritingPrettyPrinted error:nil]; NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:jsonData options: NSJSONReadingMutableContainers error: &err]; NSLog(@"%@,%@",jsonArray); But wha i need is i have one file name **Areafiles.JSON**. In that file i have some json data.Now i directly drag and drop in my project. Now how can i read and print in my console like my above example. Please help me in code explain.Because i am stared learning.So it will help full to know how to code . Thanks!
0debug
Error while running code through TestNg : <p>Getting configuration error while running the below code. Due to which i am unable to do further actions. Could someone please help me to run script.</p> <p>========================================================================<br> package Flipkart;</p> <pre><code> import org.testng.annotations.Test; import org.testng.annotations.BeforeMethod; import java.util.HashMap; import java.util.Map; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.testng.annotations.AfterMethod; public class report { WebDriver driver; @Test public void f() throws InterruptedException { driver.get("https://www.coopathome.ch/de/"); Thread.sleep(2000); driver.findElement(By.xpath(".//*[@id='wa-badge']/span")).click(); driver.findElement(By.xpath(".//*[@id='mastheadMyAccountLink']/span")).click(); //driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS); Thread.sleep(2000); driver.findElement(By.id("j_username")).sendKeys("tinamalhotra325@gmail.com"); driver.findElement(By.id("j_password")).sendKeys("google@123"); driver.findElement(By.id("loginOverlaySubmitLoginFormButton")).click(); Thread.sleep(2000); driver.findElement(By.xpath(".//*[@id='nav']/ul/li[7]/a/span")).click(); Thread.sleep(2000); driver.findElement(By.xpath(".//*[@id='subnav--item-m_0222']/li[1]/ul[1]/li[2]/a")).click(); Thread.sleep(2000); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[8]/div/div/div[3]/button")).click(); Thread.sleep(2000); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[8]/div/div/div[3]/div/div/button[2]")).click(); driver.findElement(By.xpath(".//*[@id='nav']/ul/li[7]/a/span")).click(); Thread.sleep(2000); driver.findElement(By.xpath(".//*[@id='subnav--item-m_0222']/li[1]/ul[1]/li[1]/a")).click(); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[3]/div/div/div[4]/button")).click(); Thread.sleep(2000); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[3]/div/div/div[4]/div/div/button[2]")).click(); driver.findElement(By.xpath(".//*[@id='nav']/ul/li[1]/a/span")).click(); Thread.sleep(2000); driver.findElement(By.xpath(".//*[@id='subnav--item-m_0001']/li[1]/ul[1]/li[1]/a")).click(); Thread.sleep(2000); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[1]/div/div/div[3]/button")).click(); // WebElement apple_price=driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[1]/div/div/div[3]/button")); // if (apple_price.getText().equals("3.80")) // { // System.out.println("price matched"); // // } // else { // System.out.println("title not matched expected title is "+ apple_price.getText()); // } Thread.sleep(2000); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[1]/div/div/div[3]/div/div/button[2]")).click(); driver.findElement(By.xpath(".//*[@id='nav']/ul/li[2]/a/span")).click(); Thread.sleep(2000); driver.findElement(By.xpath(".//*[@id='subnav--item-m_0055']/li[1]/ul[1]/li[1]/a")).click(); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[5]/div/div/div[3]/button")).click(); driver.findElement(By.xpath("html/body/div[3]/div/div[2]/div[2]/div/div[4]/ul/li[2]/div/div/div[3]/button")).click(); Thread.sleep(2000); driver.findElement(By.id("miniCartProceedToCheckoutButton")).click(); Thread.sleep(2000); driver.findElement(By.id("miniCartProceedToCheckoutButton")).click(); Thread.sleep(2000); driver.findElement(By.xpath(".//*[@id='heimlieferung']/div[4]/dl/dd[2]/a")).click(); driver.findElement(By.id("chooseDeliveryDate_continue_button")).click(); WebElement t=driver.findElement(By.xpath("html/body/div[3]/div/div[3]/div/dd")); if (t.getText().equals("120.40")) { System.out.println("price matched"); } else { System.out.println("title not matched expected title is "+ t.getText()); } // String Total_Cart=driver.findElement(By.xpath("html/body/div[3]/div/div[3]/div/dd")).getText(); // System.out.println(Total_Cart); // if // Assert.assertEquals(Total_Cart, 120); // System.out.println("Test case passed"); } @BeforeMethod public void beforeMethod() { System.setProperty("webdriver.chrome.driver","C:\\Chrome\\chromedriver.exe"); ChromeOptions options = new ChromeOptions(); Map&lt;String, Object&gt; prefs = new HashMap&lt;String, Object&gt;(); prefs.put("credentials_enable_service", false); prefs.put("password_manager_enabled", false); options.setExperimentalOption("prefs", prefs); options.addArguments("start-maximized"); options.addArguments("disable-infobars"); WebDriver driver = new ChromeDriver(options); } @AfterMethod public void afterMethod() { driver.close(); } </code></pre> <h1> }</h1> <pre><code>Error: [TestNG] Running: C:\Users\SalunkheP\AppData\Local\Temp\testng-eclipse-1281031724\testng-customsuite.xml Starting ChromeDriver 2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed) on port 18277 Only local connections are allowed. FAILED CONFIGURATION: @AfterMethod afterMethod java.lang.NullPointerException at Flipkart.report.afterMethod(report.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211) at org.testng.internal.Invoker.invokeMethod(Invoker.java:703) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108) at org.testng.TestRunner.privateRun(TestRunner.java:774) at org.testng.TestRunner.run(TestRunner.java:624) at org.testng.SuiteRunner.runTest(SuiteRunner.java:359) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) at org.testng.SuiteRunner.run(SuiteRunner.java:261) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215) at org.testng.TestNG.runSuitesLocally(TestNG.java:1140) at org.testng.TestNG.run(TestNG.java:1048) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76) FAILED: f java.lang.NullPointerException at Flipkart.report.f(report.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeMethod(Invoker.java:639) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108) at org.testng.TestRunner.privateRun(TestRunner.java:774) at org.testng.TestRunner.run(TestRunner.java:624) at org.testng.SuiteRunner.runTest(SuiteRunner.java:359) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) at org.testng.SuiteRunner.run(SuiteRunner.java:261) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215) at org.testng.TestNG.runSuitesLocally(TestNG.java:1140) at org.testng.TestNG.run(TestNG.java:1048) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76) =============================================== Default test Tests run: 1, Failures: 1, Skips: 0 Configuration Failures: 1, Skips: 0 =============================================== =============================================== Default suite Total tests run: 1, Failures: 1, Skips: 0 Configuration Failures: 1, Skips: 0 =============================================== [TestNG] Time taken by org.testng.reporters.XMLReporter@649d209a: 81 ms [TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 54 ms [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@6fffcba5: 70 ms [TestNG] Time taken by org.testng.reporters.jq.Main@3ab39c39: 149 ms [TestNG] Time taken by org.testng.reporters.EmailableReporter2@16c0663d: 7 ms [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@ea4a92b: 5 ms </code></pre>
0debug
Predicate where condition is not working in IQueryable but working after converted IQuaryable to ToList() : This is not working **IQueryable<Items> items = Repository.GetItems(orderNo).Where(predicate);** This is working **IQueryable<Items> items = Repository.GetItems(orderNo).ToList().Where(predicate).AsQueryable();** But i don't want to convert the results to list while these are in IQueryable Please note : I am using **Convert.ToDateTime()** method in **predicate (dynamic) where** condition
0debug
How to show image using <input> : <p>I want to be able to have my user input an image into the webpage. As soon as they have imported the file from their computer the image should show in the img.</p> <pre><code>&lt;body&gt; &lt;img id="myImage" height="200px" width="200px"&gt; &lt;input type="file" id="ImageInput" oninput="changeImage()"&gt; &lt;script&gt; function changeImage(){ //def each element involved imageBox=document.getElementById("myImage"); inputBox=document.getElementById("ImageInput"); //set link from input box to image box link console.log(inputBox.files[0]) imageBox.setAttribute("src",inputBox.files[0].name); } &lt;/script&gt; &lt;/body&gt; </code></pre> <p>This code fails to find the image imported and so does nothing and pulls the error ERR_FILE_NOT_FOUND.</p> <p>Currently i think its just trying to find the file locally and failing as it is not in the local directory but im unsure.</p>
0debug
static BlockDriver *find_hdev_driver(const char *filename) { int score_max = 0, score; BlockDriver *drv = NULL, *d; QLIST_FOREACH(d, &bdrv_drivers, list) { if (d->bdrv_probe_device) { score = d->bdrv_probe_device(filename); if (score > score_max) { score_max = score; drv = d; } } } return drv; }
1threat
Google Speech API + Flex API : <p>This might be considered a very broad question but, I am trying to introduce speech into a web application built using Flex API. My initial plan is to introduce something like the Google homepage with a text box and a mic icon which will trigger the speech api on click.</p> <p>Having done research, I havent found a way yet.</p>
0debug
Form Closing when i press "c" when focus is on Radio Button or Check Box : Form is closing when I press "c" when the focus is on the radio button or checkbox. In the below form I have two buttons which named as Ok and Cancel(with Shortcut as "c") and two radio buttons. I put the focus on radio button and press "c" the form is closing. Once I press "c" in the form level btncancel_Clik event is firing and closing the form. even I verified in by creating a sample app there also I observed the same behavior that means closing the form. Id there any way we can handle this. [![enter image description here][1]][1] Thanks in Advance. [1]: https://i.stack.imgur.com/KkwmT.png
0debug
void bitmap_set_atomic(unsigned long *map, long start, long nr) { unsigned long *p = map + BIT_WORD(start); const long size = start + nr; int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG); unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); if (nr - bits_to_set > 0) { atomic_or(p, mask_to_set); nr -= bits_to_set; bits_to_set = BITS_PER_LONG; mask_to_set = ~0UL; p++; } if (bits_to_set == BITS_PER_LONG) { while (nr >= BITS_PER_LONG) { *p = ~0UL; nr -= BITS_PER_LONG; p++; } } if (nr) { mask_to_set &= BITMAP_LAST_WORD_MASK(size); atomic_or(p, mask_to_set); } else { smp_mb(); } }
1threat
Email Markup It does not show the button in the subject line on gsuite, in Gmail is working : I did Email Markup tests in Gmail with positive results, but in gsuite gmail (company) the same script does not show the button in the subject line. I do not know if it is related, but before setting up Dkim registration in Gsuite, we recieve external emails with Email Markup, will any additional permission, or additional code, be needed? I used the example code of the following link: https://developers.google.com/gmail/markup/apps-script-tutorial
0debug
xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len, uint32_t *app) { XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(obj); struct Stream *s = &ds->dma->streams[1]; size_t ret; if (!app) { hw_error("No stream app data!\n"); } ret = stream_process_s2mem(s, buf, len, app); stream_update_irq(s); return ret; }
1threat
static void uart_send_breaks(UartState *s) { int break_enabled = 1; qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK, &break_enabled); }
1threat
writing to mySQL with html and php : <p>Have been using these codes and not sure why they wont write to my database. Can't access the servers tonight but this is terribly irritating please help!</p> <p>HTML:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;!-- Basic Page Needs –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Collecting Data for Database&lt;/title&gt; &lt;meta name="description" content=""&gt; &lt;meta name="author" content="AleR"&gt; &lt;!-- Mobile Specific Metas –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;!-- FONT –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css"&gt; &lt;!-- CSS –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;link rel="stylesheet" href="normalize.css"&gt; &lt;link rel="stylesheet" href="skeleton.css"&gt; &lt;link rel="stylesheet" href="backbone.css"&gt; &lt;link rel="stylesheet" href="asspage.css"&gt; &lt;style&gt; #container{ width:90%; margin: 40px auto 0 auto; } h1 {color:lightgreen;} &lt;/style&gt; &lt;style&gt; body {background-color:lightgreen; color: green;} h1 {color: lightgreen;} p {color: lightgreen;} header { margin-top: -25px; margin-left: -500px; height: 100px; width: 10000px; background-color: green; } nav{background-color: green; height: 100%; width: 100%;} aside{background-color: green; height: 100%; width: 100%;} &lt;/style&gt; &lt;/head&gt; &lt;header&gt;&lt;/header&gt; &lt;nav&gt;&lt;/nav&gt; &lt;aside&gt;&lt;/aside&gt; &lt;body&gt; &lt;!-- Primary Page Layout –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;div id="container" align="center"&gt; &lt;form action="final.php" method="post"&gt; &lt;div class="row"&gt; &lt;div class="six columns"&gt; &lt;label for="Age"&gt;Category&lt;/label&gt; &lt;input class="u-full-width" type="text" name="Category"&gt; &lt;label for="Qualifications"&gt;Brand&lt;/label&gt; &lt;input class="u-full-width" type="text" name="Brand"&gt; &lt;label for="Experience"&gt;Condition&lt;/label&gt; &lt;input class="u-full-width" type="text" name="Condition"&gt; &lt;/div&gt; &lt;/div&gt; &lt;form action="final.php" method="post"&gt; &lt;input class="button-primary" type="submit" value="Submit"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>This next snippet is the PHP that is supposed to send information to my database!</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;!-- Basic Page Needs –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Audio Search&lt;/title&gt; &lt;meta name="description" content=""&gt; &lt;meta name="author" content="AlexR"&gt; &lt;!-- Mobile Specific Metas –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;!-- FONT –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css"&gt; &lt;!-- CSS –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;link rel="stylesheet" href="normalize.css"&gt; &lt;link rel="stylesheet" href="skeleton.css"&gt; &lt;link rel="stylesheet" href="backbone.css"&gt; &lt;style&gt; #container{ width:90%; margin: 40px auto 0 auto; } background{ color: green; } &lt;/style&gt; &lt;style&gt; body {background-color:lightgreen;} h1 {color:blue;} p {color:green;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;!-- Primary Page Layout –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;div id="container"&gt; &lt;form&gt; &lt;div class="row"&gt; &lt;div class="six columns"&gt; &lt;p&gt;Thank you for your name and e-mail.&lt;/p&gt; &lt;?php DEFINE('DB_USERNAME', '*****'); DEFINE('DB_PASSWORD', '*****'); DEFINE('DB_HOST', 'localhost'); DEFINE('DB_DATABASE', '*****'); echo "here!"; if (isset($_REQUEST['Age'])){ $Age = $_REQUEST['Age']; $Qualifications = $_REQUEST['Qualifications']; $Experience = $_REQUEST['Experience']; #echo "Thanks for your submission."; $dbc = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_DATABASE) OR die ('Could not connect to MySQL: '.mysqli_connect_error()); $q = "INSERT INTO `FinalForm`(`Age`, `Qualifications`, `Experience`) VALUES ('$Age','$Qualifications','$Experience' )"; #$q = "INSERT INTO `EmailList1`(`firstName`, `lastName`, `eMail`) VALUES ('Joseph','Wales','jwales@sjfc.edu')"; $r = mysqli_query($dbc,$q); # ^^^ Search submit results window if ($r){echo "Results below";} else {echo "Your search found zero results";}; } ?&gt; &lt;/div&gt; &lt;div&gt; &lt;/div&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>This snippet is what is supposed to retrieve and display my database data, not working!</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;!-- Basic Page Needs –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Audio Shop Data Retrieval&lt;/title&gt; &lt;meta name="description" content=""&gt; &lt;meta name="author" content="AlexR"&gt; &lt;!-- Mobile Specific Metas –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;!-- FONT –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css"&gt; &lt;!-- CSS –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;link rel="stylesheet" href="normalize.css"&gt; &lt;link rel="stylesheet" href="skeleton.css"&gt; &lt;link rel="stylesheet" href="backbone.css"&gt; &lt;style&gt; #container{ width:90%; margin: 40px auto 0 auto; } h1 {color:lightgreen;} &lt;/style&gt; &lt;style&gt; body {background-color:lightgreen; color: green;} h1 {color: lightgreen;} p {color: lightgreen;} header { margin-top: -25px; margin-left: -500px; height: 100px; width: 10000px; background-color: green; } &lt;/style&gt; &lt;/head&gt; &lt;header&gt;&lt;h1&gt;Audio Supply Retrieval&lt;/h1&gt;&lt;/header&gt; &lt;body&gt; &lt;!-- Primary Page Layout –––––––––––––––––––––––––––––––––––––––––––––––––– --&gt; &lt;div id="container" align="center"&gt; &lt;form&gt; &lt;div class="row"&gt; &lt;div class="six columns"&gt; &lt;?php DEFINE('DB_USERNAME', '*****'); DEFINE('DB_PASSWORD', '*****'); DEFINE('DB_HOST', 'localhost'); DEFINE('DB_DATABASE', '*****'); $dbc = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_DATABASE) OR die ('Could not connect to MySQL: '.mysqli_connect_error()); $q = "SELECT * FROM `FinalForm` ORDER BY `Category` ASC"; $r=@mysqli_query($dbc,$q); if ($r) { echo '&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Age&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Qualifications&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Experience&lt;/b&gt;&lt;/td&gt;&lt;/td&gt;'; while($row=mysqli_fetch_array($r,MYSQLI_ASSOC)){ echo "&lt;tr&gt;&lt;td&gt;$row[NameID]&lt;/td&gt;&lt;td&gt;$row[Age]&lt;/td&gt;&lt;td&gt;$row[Qualifications]&lt;/td&gt;&lt;td&gt;$row[Experience]&lt;/td&gt;&lt;/tr&gt;"; } echo "&lt;/select&gt;"; }; echo "&lt;p&gt;"; ?&gt; &lt;/div&gt; &lt;div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
0debug
static inline void downmix_3f_to_mono(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 512]); samples[i + 256] = samples[i + 512] = 0; } }
1threat
static void rtas_nvram_store(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRNVRAM *nvram = spapr->nvram; hwaddr offset, buffer, len; int alen; void *membuf; if ((nargs != 3) || (nret != 2)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } if (!nvram) { rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } offset = rtas_ld(args, 0); buffer = rtas_ld(args, 1); len = rtas_ld(args, 2); if (((offset + len) < offset) || ((offset + len) > nvram->size)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } membuf = cpu_physical_memory_map(buffer, &len, 0); if (nvram->drive) { alen = bdrv_pwrite(nvram->drive, offset, membuf, len); } else { assert(nvram->buf); memcpy(nvram->buf + offset, membuf, len); alen = len; } cpu_physical_memory_unmap(membuf, len, 0, len); rtas_st(rets, 0, (alen < len) ? RTAS_OUT_HW_ERROR : RTAS_OUT_SUCCESS); rtas_st(rets, 1, (alen < 0) ? 0 : alen); }
1threat
static int slirp_hostfwd(SlirpState *s, const char *redir_str, int legacy_format, Error **errp) { struct in_addr host_addr = { .s_addr = INADDR_ANY }; struct in_addr guest_addr = { .s_addr = 0 }; int host_port, guest_port; const char *p; char buf[256]; int is_udp; char *end; p = redir_str; if (!p || get_str_sep(buf, sizeof(buf), &p, ':') < 0) { goto fail_syntax; } if (!strcmp(buf, "tcp") || buf[0] == '\0') { is_udp = 0; } else if (!strcmp(buf, "udp")) { is_udp = 1; } else { goto fail_syntax; } if (!legacy_format) { if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { goto fail_syntax; } if (buf[0] != '\0' && !inet_aton(buf, &host_addr)) { goto fail_syntax; } } if (get_str_sep(buf, sizeof(buf), &p, legacy_format ? ':' : '-') < 0) { goto fail_syntax; } host_port = strtol(buf, &end, 0); if (*end != '\0' || host_port < 0 || host_port > 65535) { goto fail_syntax; } if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { goto fail_syntax; } if (buf[0] != '\0' && !inet_aton(buf, &guest_addr)) { goto fail_syntax; } guest_port = strtol(p, &end, 0); if (*end != '\0' || guest_port < 1 || guest_port > 65535) { goto fail_syntax; } if (slirp_add_hostfwd(s->slirp, is_udp, host_addr, host_port, guest_addr, guest_port) < 0) { error_setg(errp, "Could not set up host forwarding rule '%s'", redir_str); return -1; } return 0; fail_syntax: error_setg(errp, "Invalid host forwarding rule '%s'", redir_str); return -1; }
1threat
quic sort char array in c : I copy a int array quick sort algorithmn from http://www.comp.dit.ie/rlawlor/Alg_DS/sorting/quickSort.c Then change it to char array quick sort algorithmn. Here is the code extern void quickSortChar(char a[], int left, int right) { int j; if (left < right) { j = partition(a, left, right); quickSort(a, left, j - 1); quickSort(a, j + 1, right); } } static int partition(char a[], int left, int right) { int pivot, i, j, t; pivot = a[left]; i = left; j = right + 1; while (1) { do i++; while (a[i] <= pivot && i <= right); do j--; while (a[j] > pivot); if (i >= j) break; t = a[i]; a[i] = a[j]; a[j] = t; } t = a[left]; a[left] = a[j]; a[j] = t; return j; } void main() { char arr[] = "bacgd"; puts(arr); quickSortChar(arr, 0, strlen(arr) - 1); puts(arr); system("pause"); } I expecte the output to be: abcdg, but output is: abcgd
0debug
i have string as 'abc def ghi' in one column and one row but i want output abc def ghi one by one like down in one column and one row : 1. 'abc def ghi' but we want out put like in sql server 1. abc def ghi
0debug
What are the real time usage of Filter concept in Java Servlet? : <p>I am new to servlets, Help me understand Filter concept in real time?</p>
0debug
Deep copy of list with objects in Kotlin : <p>I am new to kotlin and I am trying to make a copy of a list of objects.The problem I am having is that when I change items in the new copy, the old list gets changed as well. This is the object:</p> <pre><code>class ClassA(var title: String?, var list: ArrayList&lt;ClassB&gt;, var selected: Boolean) class ClassB(val id: Int, val name: String) </code></pre> <p>I tried doing this, but it doesn't work:</p> <pre><code>val oldList:ArrayList&lt;ClassA&gt; val newList :ArrayList&lt;ClassA&gt; = ArrayList() newList.addAll(oldList) </code></pre>
0debug
static av_always_inline int normal_limit(uint8_t *p, int stride, int E, int I) { LOAD_PIXELS return simple_limit(p, stride, 2*E+I) && FFABS(p3-p2) <= I && FFABS(p2-p1) <= I && FFABS(p1-p0) <= I && FFABS(q3-q2) <= I && FFABS(q2-q1) <= I && FFABS(q1-q0) <= I; }
1threat
static void xhci_events_update(XHCIState *xhci, int v) { XHCIInterrupter *intr = &xhci->intr[v]; dma_addr_t erdp; unsigned int dp_idx; bool do_irq = 0; if (xhci->usbsts & USBSTS_HCH) { return; } erdp = xhci_addr64(intr->erdp_low, intr->erdp_high); if (erdp < intr->er_start || erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) { DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", v, intr->er_start, intr->er_size); xhci_die(xhci); return; } dp_idx = (erdp - intr->er_start) / TRB_SIZE; assert(dp_idx < intr->er_size); if (intr->er_full) { int er_free = dp_idx - intr->er_ep_idx; if (er_free <= 0) { er_free += intr->er_size; } if (er_free < (intr->er_size/2)) { DPRINTF("xhci_events_update(): event ring still " "more than half full (hack)\n"); return; } } while (intr->ev_buffer_put != intr->ev_buffer_get) { assert(intr->er_full); if (((intr->er_ep_idx+1) % intr->er_size) == dp_idx) { DPRINTF("xhci_events_update(): event ring full again\n"); #ifndef ER_FULL_HACK XHCIEvent full = {ER_HOST_CONTROLLER, CC_EVENT_RING_FULL_ERROR}; xhci_write_event(xhci, &full, v); #endif do_irq = 1; break; } XHCIEvent *event = &intr->ev_buffer[intr->ev_buffer_get]; xhci_write_event(xhci, event, v); intr->ev_buffer_get++; do_irq = 1; if (intr->ev_buffer_get == EV_QUEUE) { intr->ev_buffer_get = 0; } } if (do_irq) { xhci_intr_raise(xhci, v); } if (intr->er_full && intr->ev_buffer_put == intr->ev_buffer_get) { DPRINTF("xhci_events_update(): event ring no longer full\n"); intr->er_full = 0; } }
1threat
Angular2 How to get reference of HTML elements generated dynamically : <p>I have this inputs generated dynamically:</p> <pre><code> &lt;div *ngFor="let cell of column; let i = index;"&gt; &lt;!-- Material design input--&gt; &lt;md-input id="my-input-{{i}}"&gt; &lt;/md-input&gt; &lt;/div&gt; </code></pre> <p>Please notice <strong><code>id=my-input-{{i}}</code></strong> I would like to get a reference to the DOM element based on this dynamic id. This input can be 3, 6 or more inputs so I need to access the id dynamically and get a hold to it.</p>
0debug
int qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offset, int nb_clusters) { BDRVQcow2State *s = bs->opaque; uint64_t cluster_index, refcount; uint64_t i; int ret; assert(nb_clusters >= 0); if (nb_clusters == 0) { return 0; } do { cluster_index = offset >> s->cluster_bits; for(i = 0; i < nb_clusters; i++) { ret = qcow2_get_refcount(bs, cluster_index++, &refcount); if (ret < 0) { return ret; } else if (refcount != 0) { break; } } ret = update_refcount(bs, offset, i << s->cluster_bits, 1, false, QCOW2_DISCARD_NEVER); } while (ret == -EAGAIN); if (ret < 0) { return ret; } return i; }
1threat
What is this carbon,boron,argon , which is used for nodejs? : <p>I am just curious, what is <code>carbon, boron, argon</code> which is used while describing versions of <code>nodejs</code>?</p>
0debug
How to make an angular application take arguments from command line? : <p>I have an AngularJS application in which my code looks something like this:</p> <pre><code>myApp = angular.module('myApp', [ 'ui.router', 'ngMaterial', 'ngMessages' ] ); myApp.constant('CONSTANTS', (function() { // Define your variable return { backend: { baseURL: 'http://mybackend.com:3026' } }; })()); </code></pre> <p>I run this application using <a href="https://www.npmjs.com/package/http-server" rel="noreferrer">http-server</a> on port number 8000 like this:</p> <pre><code>% http-server -p 8000 </code></pre> <p>I want to pass in a command-line argument for the <code>backend.baseURL</code> such that it over-rides the value specified in the code. How can I do it??</p>
0debug
How to create my specific MySLQ select? : i have 2 DB tables Table1 [US_name1 : US] [US_name2 : US] [US_name3 : US] [UK_name1 : UK] [UK_name2 : UK] [DE_name1 : DE] [DE_name2 : DE] ... and the Table2 ... [2014-05-01 : US_name1 : 150] [2014-05-01 : US_name2 : 300] [2014-05-01 : US_name3 : 12.2] [2014-05-01 : UK_name1 : 18] [2014-05-01 : UK_name2 : 24] ... how can i get result from specific date (for example: all from 2014-04-30) in next data-format: {[US] -> [name]=US_name1, [last]=150, [2014-05-01]=150, [2014-04-30]=103} {[US] -> [name]=US_name2, [last]=300, [2014-05-01]=300, [2014-04-30]=786} {[UK] -> [name]=UK_name1, [last]=18, [2014-05-01]=18, [2014-04-30]=362} my query is incorrect: SELECT t1.Country, t1.Name, t2.Date, t2.Name, t2.Value FROM t1, t2 WHERE t2.Date >='".$start."' ORDER BY `Date` DESC if($res){ while($row=mysql_fetch_array($res, MYSQL_ASSOC)){ if(!isset($rez[$row['Name']]['last'])){$rez[$row['Name']]['last']=$row['Value'];} if(!isset($rez[$row['Name']]['country'])){$rez[$row['Name']]['country']=$row['Country'];} $rez[$row['Name']][$row['Date']]=$row['Value']; } }
0debug
What does the ? and : mean in this statement in Java? : <p>What exactly does this mean? </p> <pre><code>String path = selectedPath.equals("/") ? "/" : selectedDir; </code></pre> <p>What I think it is saying is set path to the selectedPath if it equals "/" and if it doesn't set the path to selectedDir.</p>
0debug
static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *frame){ int p,x,y; for(p=0; p < s->nb_planes; p++){ int is_chroma= !!p; int w= is_chroma ? s->avctx->width >>s->chroma_h_shift : s->avctx->width; int h= is_chroma ? s->avctx->height>>s->chroma_v_shift : s->avctx->height; int ls= frame->linesize[p]; uint8_t *src= frame->data[p]; halfpel[1][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); halfpel[2][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); halfpel[3][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p]) return AVERROR(ENOMEM); halfpel[0][p]= src; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[1][p][i]= (20*(src[i] + src[i+1]) - 5*(src[i-1] + src[i+2]) + (src[i-2] + src[i+3]) + 16 )>>5; } } for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[2][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } src= halfpel[1][p]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[3][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } } return 0; }
1threat
Print last 20 bash history using python and save in pdf file : <p>This code print all the bash history but i have to print last 20 bash history.How can i do that?</p> <pre><code>import fpdf pdf = fpdf.FPDF(format='letter') pdf.add_page() pdf.set_font("Arial", size=14) for history in open('.bash_history'): pdf.write(8,history) pdf.output("bash.pdf") </code></pre>
0debug
HTTP 404 resource not found when project run on server on spring tool suite : <p>It was all working fine until I made some changes that I can't seem remember in order to revert. I changed the the dynamic web module version and the java version to their latest respective versions in project facets. Then I made some changes to the 'pom.xml' file by adding latest versions of the jar files. I cannot seem to understand what isn't working. </p> <p><strong>pom.xml</strong></p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.store&lt;/groupId&gt; &lt;artifactId&gt;emusicstore&lt;/artifactId&gt; &lt;name&gt;EMusicStore&lt;/name&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;version&gt;1.0.0-BUILD-SNAPSHOT&lt;/version&gt; &lt;properties&gt; &lt;java-version&gt;1.8&lt;/java-version&gt; &lt;org.springframework-version&gt;4.3.6.RELEASE&lt;/org.springframework-version&gt; &lt;org.aspectj-version&gt;1.8.10&lt;/org.aspectj-version&gt; &lt;org.slf4j-version&gt;1.7.25&lt;/org.slf4j-version&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;!-- Spring --&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-context&lt;/artifactId&gt; &lt;version&gt;${org.springframework-version}&lt;/version&gt; &lt;exclusions&gt; &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt; &lt;exclusion&gt; &lt;groupId&gt;commons-logging&lt;/groupId&gt; &lt;artifactId&gt;commons-logging&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-core&lt;/artifactId&gt; &lt;version&gt;${org.springframework-version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-orm&lt;/artifactId&gt; &lt;version&gt;${org.springframework-version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt; &lt;version&gt;${org.springframework-version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt; &lt;version&gt;5.2.9.Final&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt; &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt; &lt;version&gt;1.0.1.Final&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.h2database&lt;/groupId&gt; &lt;artifactId&gt;h2&lt;/artifactId&gt; &lt;version&gt;1.4.194&lt;/version&gt; &lt;/dependency&gt; &lt;!-- AspectJ --&gt; &lt;dependency&gt; &lt;groupId&gt;org.aspectj&lt;/groupId&gt; &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt; &lt;version&gt;${org.aspectj-version}&lt;/version&gt; &lt;/dependency&gt; &lt;!-- Logging --&gt; &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt; &lt;version&gt;${org.slf4j-version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt; &lt;version&gt;${org.slf4j-version}&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt; &lt;version&gt;${org.slf4j-version}&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;log4j&lt;/groupId&gt; &lt;artifactId&gt;log4j&lt;/artifactId&gt; &lt;version&gt;1.2.15&lt;/version&gt; &lt;exclusions&gt; &lt;exclusion&gt; &lt;groupId&gt;javax.mail&lt;/groupId&gt; &lt;artifactId&gt;mail&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;exclusion&gt; &lt;groupId&gt;javax.jms&lt;/groupId&gt; &lt;artifactId&gt;jms&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;exclusion&gt; &lt;groupId&gt;com.sun.jdmk&lt;/groupId&gt; &lt;artifactId&gt;jmxtools&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;exclusion&gt; &lt;groupId&gt;com.sun.jmx&lt;/groupId&gt; &lt;artifactId&gt;jmxri&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;taglibs&lt;/groupId&gt; &lt;artifactId&gt;standard&lt;/artifactId&gt; &lt;version&gt;1.1.2&lt;/version&gt; &lt;/dependency&gt; &lt;!-- @Inject --&gt; &lt;dependency&gt; &lt;groupId&gt;javax.inject&lt;/groupId&gt; &lt;artifactId&gt;javax.inject&lt;/artifactId&gt; &lt;version&gt;1&lt;/version&gt; &lt;/dependency&gt; &lt;!-- Servlet --&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt; &lt;version&gt;3.0.1&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt; &lt;artifactId&gt;javax.servlet.jsp-api&lt;/artifactId&gt; &lt;version&gt;2.3.1&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;jstl&lt;/artifactId&gt; &lt;version&gt;1.2&lt;/version&gt; &lt;/dependency&gt; &lt;!-- Test --&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;4.7&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt; &lt;version&gt;2.9&lt;/version&gt; &lt;configuration&gt; &lt;additionalProjectnatures&gt; &lt;projectnature&gt;org.springframework.ide.eclipse.core.springnature&lt;/projectnature&gt; &lt;/additionalProjectnatures&gt; &lt;additionalBuildcommands&gt; &lt;buildcommand&gt;org.springframework.ide.eclipse.core.springbuilder&lt;/buildcommand&gt; &lt;/additionalBuildcommands&gt; &lt;downloadSources&gt;true&lt;/downloadSources&gt; &lt;downloadJavadocs&gt;true&lt;/downloadJavadocs&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;3.6.1&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;${java-version}&lt;/source&gt; &lt;target&gt;${java-version}&lt;/target&gt; &lt;compilerArgument&gt;-Xlint:all&lt;/compilerArgument&gt; &lt;showWarnings&gt;true&lt;/showWarnings&gt; &lt;showDeprecation&gt;true&lt;/showDeprecation&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.2.1&lt;/version&gt; &lt;configuration&gt; &lt;mainClass&gt;org.test.int1.Main&lt;/mainClass&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p><strong>web.xml</strong></p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"&gt; &lt;!-- The definition of the Root Spring Container shared by all Servlets and Filters --&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/spring/root-context.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Processes application requests --&gt; &lt;servlet&gt; &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/spring/appServlet/servlet-context.xml&lt;/param-value&gt; &lt;/init-param&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p><strong>root-context.xml</strong></p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;!-- Root Context: defines shared resources visible to all other web components --&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="org.h2.Driver" /&gt; &lt;property name="url" value=" jdbc:h2:~/test" /&gt; &lt;property name="username" value="sa" /&gt; &lt;property name="password" value="" /&gt; &lt;/bean&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.H2Dialect&lt;/prop&gt; &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt; &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;property name="packagesToScan"&gt; &lt;list&gt; &lt;value&gt;com.store.emusicstore&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"&gt; &lt;property name="sessionFactory" ref="sessionFactory" /&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p><strong>servlet-context.xml</strong></p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"&gt; &lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt; &lt;!-- Enables the Spring MVC @Controller programming model --&gt; &lt;annotation-driven /&gt; &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --&gt; &lt;resources mapping="/resources/**" location="/webapp/resources/" /&gt; &lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --&gt; &lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt; &lt;beans:property name="suffix" value=".jsp" /&gt; &lt;/beans:bean&gt; &lt;context:component-scan base-package="com.store.emusicstore" /&gt; &lt;tx:annotation-driven /&gt; </code></pre> <p></p> <p><strong>HomeController.java</strong></p> <pre><code>package com.store.emusicstore; import java.io.IOException; import java.text.DateFormat; import java.util.Date; import java.util.List; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.store.emusicstore.dao.ProductDao; import com.store.emusicstore.model.Product; /** * Handles requests for the application home page. */ @Controller public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); private ProductDao productDao ; /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! The client locale is {}.", locale); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate ); return "home"; } @RequestMapping("/productList") public String getProduct(Model model) { List&lt;Product&gt; productList = productDao.getAllProducts(); model.addAttribute("productList" ,productList); return "ProductList"; } @RequestMapping("/productList/viewProduct/{productId}") public String viewProduct(@PathVariable String productId, Model model) throws IOException{ Product product = productDao.getProductById(productId); model.addAttribute(product); return "viewProduct"; } } </code></pre> <p>Is changing the web app version from 2.5 to 3.1 the cause? </p>
0debug
static inline void tcg_out_rld(TCGContext *s, int op, TCGReg ra, TCGReg rs, int sh, int mb) { assert(TCG_TARGET_REG_BITS == 64); sh = SH(sh & 0x1f) | (((sh >> 5) & 1) << 1); mb = MB64((mb >> 5) | ((mb << 1) & 0x3f)); tcg_out32(s, op | RA(ra) | RS(rs) | sh | mb); }
1threat
Rotating every 3 bits of integer in C++ : <p>Note the following may have exactly the same solution if x is any positive integer, but for the exact problem at hand:</p> <p>Choose an integer 0 &lt; n &lt; 11. Let x be an integer whose binary representation is given by pasting together up to n of the 3-bit strings: 001, 010, 100, 111 in some order (this is "Numbers with digits 1,2,4,7 when written in base 8", see e.g. <a href="http://oeis.org/A308496" rel="nofollow noreferrer">http://oeis.org/A308496</a> ). Let y be the integer formed by rotating each 3-bit substring of x by 1 to the left. E.g. if (x)_2 = 001_010_111_100 then (y)_2 = 010_100_111_001 </p> <p>Problem: Let x_1, x_2, ... x_m be a sequence of such x for a given n, find the corresponding y_1, y_2, ... y_m. </p> <p>If m is less than, say, a few thousand, then speed is not really an issue. One could e.g. break "001_010_111_100" down into an array [001, 010, 111, 100] and perform bit rotation for each element of the array. </p> <p>However, once m becomes quite large (e.g. > 10^6), this task needs to be optimized as much as possible. Any suggestions (to a C++ beginner)?</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MJpegDecodeContext *s = avctx->priv_data; const uint8_t *buf_end, *buf_ptr; const uint8_t *unescaped_buf_ptr; int hshift, vshift; int unescaped_buf_size; int start_code; int i, index; int ret = 0; av_dict_free(&s->exif_metadata); av_freep(&s->stereo3d); buf_ptr = buf; buf_end = buf + buf_size; while (buf_ptr < buf_end) { start_code = ff_mjpeg_find_marker(s, &buf_ptr, buf_end, &unescaped_buf_ptr, &unescaped_buf_size); if (start_code < 0) { break; } else if (unescaped_buf_size > INT_MAX / 8) { av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (%d/%d), corrupt data?\n", start_code, unescaped_buf_size, buf_size); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr); ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "invalid buffer\n"); goto fail; } s->start_code = start_code; if (s->avctx->debug & FF_DEBUG_STARTCODE) av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code); if (start_code >= 0xd0 && start_code <= 0xd7) av_log(avctx, AV_LOG_DEBUG, "restart marker: %d\n", start_code & 0x0f); else if (start_code >= APP0 && start_code <= APP15) mjpeg_decode_app(s); else if (start_code == COM) mjpeg_decode_com(s); ret = -1; if (!CONFIG_JPEGLS_DECODER && (start_code == SOF48 || start_code == LSE)) { av_log(avctx, AV_LOG_ERROR, "JPEG-LS support not enabled.\n"); return AVERROR(ENOSYS); } switch (start_code) { case SOI: s->restart_interval = 0; s->restart_count = 0; break; case DQT: ff_mjpeg_decode_dqt(s); break; case DHT: if ((ret = ff_mjpeg_decode_dht(s)) < 0) { av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n"); goto fail; } break; case SOF0: case SOF1: s->lossless = 0; s->ls = 0; s->progressive = 0; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case SOF2: s->lossless = 0; s->ls = 0; s->progressive = 1; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case SOF3: s->lossless = 1; s->ls = 0; s->progressive = 0; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case SOF48: s->lossless = 1; s->ls = 1; s->progressive = 0; if ((ret = ff_mjpeg_decode_sof(s)) < 0) goto fail; break; case LSE: if (!CONFIG_JPEGLS_DECODER || (ret = ff_jpegls_decode_lse(s)) < 0) goto fail; break; case EOI: eoi_parser: s->cur_scan = 0; if (!s->got_picture) { av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n"); break; } if (s->interlaced) { s->bottom_field ^= 1; if (s->bottom_field == !s->interlace_polarity) break; } if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0) return ret; *got_frame = 1; s->got_picture = 0; if (!s->lossless) { int qp = FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]); int qpw = (s->width + 15) / 16; AVBufferRef *qp_table_buf = av_buffer_alloc(qpw); if (qp_table_buf) { memset(qp_table_buf->data, qp, qpw); av_frame_set_qp_table(data, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1); } if(avctx->debug & FF_DEBUG_QP) av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", qp); } goto the_end; case SOS: s->cur_scan++; if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) goto fail; break; case DRI: mjpeg_decode_dri(s); break; case SOF5: case SOF6: case SOF7: case SOF9: case SOF10: case SOF11: case SOF13: case SOF14: case SOF15: case JPG: av_log(avctx, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", start_code); break; } buf_ptr += (get_bits_count(&s->gb) + 7) / 8; av_log(avctx, AV_LOG_DEBUG, "marker parser used %d bytes (%d bits)\n", (get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb)); } if (s->got_picture && s->cur_scan) { av_log(avctx, AV_LOG_WARNING, "EOI missing, emulating\n"); goto eoi_parser; } av_log(avctx, AV_LOG_FATAL, "No JPEG data found in image\n"); return AVERROR_INVALIDDATA; fail: s->got_picture = 0; return ret; the_end: if (s->upscale_h) { uint8_t *line = s->picture_ptr->data[s->upscale_h]; av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || avctx->pix_fmt == AV_PIX_FMT_YUV444P || avctx->pix_fmt == AV_PIX_FMT_YUVJ440P || avctx->pix_fmt == AV_PIX_FMT_YUV440P); for (i = 0; i < s->chroma_height; i++) { for (index = s->width - 1; index; index--) line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1; line += s->linesize[s->upscale_h]; } } if (s->upscale_v) { uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]]; int w; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); w = s->width >> hshift; av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || avctx->pix_fmt == AV_PIX_FMT_YUV444P || avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || avctx->pix_fmt == AV_PIX_FMT_YUV422P); for (i = s->height - 1; i; i--) { uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]]; uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]]; if (src1 == src2) { memcpy(dst, src1, w); } else { for (index = 0; index < w; index++) dst[index] = (src1[index] + src2[index]) >> 1; } dst -= s->linesize[s->upscale_v]; } } if (s->flipped) { int j; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); for (index=0; index<4; index++) { uint8_t *dst = s->picture_ptr->data[index]; int w = s->picture_ptr->width; int h = s->picture_ptr->height; if(index && index<3){ w = FF_CEIL_RSHIFT(w, hshift); h = FF_CEIL_RSHIFT(h, vshift); } if(dst){ uint8_t *dst2 = dst + s->linesize[index]*(h-1); for (i=0; i<h/2; i++) { for (j=0; j<w; j++) FFSWAP(int, dst[j], dst2[j]); dst += s->linesize[index]; dst2 -= s->linesize[index]; } } } } if (s->stereo3d) { AVStereo3D *stereo = av_stereo3d_create_side_data(data); if (stereo) { stereo->type = s->stereo3d->type; stereo->flags = s->stereo3d->flags; } av_freep(&s->stereo3d); } av_dict_copy(avpriv_frame_get_metadatap(data), s->exif_metadata, 0); av_dict_free(&s->exif_metadata); av_log(avctx, AV_LOG_DEBUG, "decode frame unused %td bytes\n", buf_end - buf_ptr); return buf_ptr - buf; }
1threat
Where to get poi final jar for xssf? : <p>I have downloaded poi -3.14 jar from Maven repository but it was having all packages for hssf where I need xssf for xlsx format. Where should I download xssf jar.</p>
0debug
How to convert an IP binary address into a decimal in C#? : <p>I'm looking for a function that will convert "10011101.11001001.01001100.00000000" to "157.201.76.0" </p>
0debug
Laravel 5 - Check if date is today : <p>I'm creating a timeline and I'm nearly finished. I want that the color of the date for each timeline event is the same beside if the date is "today".</p> <p>So I need something like: </p> <pre><code>@if($event[$i]-&gt;created_at-&gt;format('d.m.Y') == *code or variable that says its today*) .... @endif </code></pre> <p>But I couldn't figure out what I can do to save the todays date in a variable.. Does anybody knows a solution for this?</p> <p>thanks! </p>
0debug
How to enable Gzip Compression in php : <p>i have developed a website in PHP . I want to enable gzip compression to reduce response time of website.how can i do it . </p>
0debug
Is Tomcat a HTTP server or a servlet container? : When I download Tomcat it seems to be both a HTTP server and a servlet container. Can I use TomCat with a different HTTP server than the one built-in in TomCat ?
0debug
Extracting quoted part from string : <p>I am trying following code to extract quoted part from a string: </p> <pre><code>package main import ("fmt") func main(){ var oristr = "This is a \"test string\" for testing only" var quotedstr = "" var newstr = "" var instring = false fmt.Println(oristr) for i,c := range oristr { fmt.Printf("Char number: %d; char: %c\n", i, c); if c = `"` { if instring {instring=false} else {instring=true}} if instring {quotedstr += c} else {newstr += c} } fmt.Printf("Newstr: %s; quotedstr = %s", newstr, quotedstr ) } </code></pre> <p>However, I am getting following error: </p> <pre><code># command-line-arguments ./getstring.go:11:14: syntax error: c = `"` used as value ./getstring.go:12:15: syntax error: unexpected newline, expecting { after if clause ./getstring.go:14:4: syntax error: unexpected else, expecting } ./getstring.go:15:3: syntax error: non-declaration statement outside function body </code></pre> <p>Why I am getting this error and how can this be corrected? </p> <p>Also, is this approach all right or some other approach may be better?</p>
0debug
Angularjs 2 Quickstart : I have tried the angular2 5 Min quickstart from https://angular.io/docs/ts/latest/quickstart.html. All Files were created by copy & past because i am lazy and because of possible faults. I preferred the typescript version. At the end, i must compile and start with "nmp start". i do this as admin. my os is windows 10. After start i get some errors. this is the npm-debug.log: 0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'start' ] 2 info using npm@2.9.1 3 info using node@v0.12.3 4 verbose node symlink C:\Program Files\nodejs\\node.exe 5 verbose run-script [ 'prestart', 'start', 'poststart' ] 6 info prestart angular2-quickstart@1.0.0 7 info start angular2-quickstart@1.0.0 8 verbose unsafe-perm in lifecycle true 9 info angular2-quickstart@1.0.0 Failed to exec start script 10 verbose stack Error: angular2-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" ` 10 verbose stack Exit status 2 10 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16) 10 verbose stack at EventEmitter.emit (events.js:110:17) 10 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14) 10 verbose stack at ChildProcess.emit (events.js:110:17) 10 verbose stack at maybeClose (child_process.js:1015:16) 10 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5) 11 verbose pkgid angular2-quickstart@1.0.0 12 verbose cwd C:\web\angular2-quickstart 13 error Windows_NT 6.3.9600 14 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" 15 error node v0.12.3 16 error npm v2.9.1 17 error code ELIFECYCLE 18 error angular2-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" ` 18 error Exit status 2 19 error Failed at the angular2-quickstart@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '. 19 error This is most likely a problem with the angular2-quickstart package, 19 error not with npm itself. 19 error Tell the author that this fails on your system: 19 error tsc && concurrently "npm run tsc:w" "npm run lite" 19 error You can get their info via: 19 error npm owner ls angular2-quickstart 19 error There is likely additional logging output above. 20 verbose exit [ 1, true ] Can anybody helps me that the quickstart app starts? I also tried to start the index.html in Firefox ( because the .ts files are all translate in .js files ) but nothing happens.
0debug
def cube_Sum(n): sum = 0 for i in range(0,n) : sum += (2*i+1)*(2*i+1)*(2*i+1) return sum
0debug
static uint64_t bonito_ldma_readl(void *opaque, hwaddr addr, unsigned size) { uint32_t val; PCIBonitoState *s = opaque; val = ((uint32_t *)(&s->bonldma))[addr/sizeof(uint32_t)]; return val;
1threat
Is there possible way to download files if we only know the directory name? : We have following requirements. Two zip files and Two images are in https://example.com/directory. (Since index.php file is avlable in this directory we don't know the file names of those files). Is there any possible way to find names of above two files using PHP or Linux commands?
0debug
Truncated Android SDK package paths from sdkmanager CLI : <p><code>./sdkmanager --list &gt; tmp.txt</code> gives me a .txt file like this:</p> <pre><code>Installed packages: Path | Version | Description | Location ------- | ------- | ------- | ------- tools | 25.2.3 | Android SDK Tools 25.2.3 | tools/ Available Packages: Path | Version | Description ------- | ------- | ------- add-ons;addon-g..._apis-google-15 | 3 | Google APIs add-ons;addon-g..._apis-google-16 | 4 | Google APIs add-ons;addon-g..._apis-google-17 | 4 | Google APIs add-ons;addon-g..._apis-google-18 | 4 | Google APIs add-ons;addon-g..._apis-google-19 | 20 | Google APIs add-ons;addon-g..._apis-google-21 | 1 | Google APIs add-ons;addon-g..._apis-google-22 | 1 | Google APIs add-ons;addon-g..._apis-google-23 | 1 | Google APIs add-ons;addon-g..._apis-google-24 | 1 | Google APIs add-ons;addon-g...e_gdk-google-19 | 11 | Glass Development Kit Preview build-tools;19.1.0 | 19.1.0 | Android SDK Build-Tools 19.1 Kit Preview build-tools;19.1.0 | 19.1.0 | Android SDK Build-Tools 19.1 </code></pre> <p>I want to install from some of these paths using <code>./sdkmanager --install &lt;path&gt;</code>, but I can't, because the paths are truncated. Note I am using the standard Terminal app on macOS, if that matters.</p> <p>How can I get the full paths to these packages?</p>
0debug
Store a values from HTML input into a php variable using javascript : <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html" /&gt; &lt;meta name="author" content="gencyolcu" /&gt; &lt;title&gt;Untitled 8&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Date:&lt;br /&gt; &lt;input type="date" id="sdate"/&gt;&lt;br /&gt; &lt;button onclick="fun()"&gt;Click me&lt;/button&gt; &lt;script&gt; var js_x =document.getElementById('sdate'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php echo $php_x; ?&gt; </code></pre> <p>I want to use the date to fetch data using php. How can I store the value I get from the date input tag in the php variable ?</p>
0debug
void ff_acelp_weighted_filter( int16_t *out, const int16_t* in, const int16_t *weight_pow, int filter_length) { int n; for(n=0; n<filter_length; n++) out[n] = (in[n] * weight_pow[n] + 0x4000) >> 15; }
1threat
React native: How to combine external and inline styles? : <p>This is a part of a _renderRow-function. I have some basic styles for a button, and also a style that is read from a variable on the row. In this example it's '#f00' but it could be a variable, like thisColor. How can I combine an external style with an inline style? </p> <p>Something like this, but this doesn't work:</p> <pre><code>&lt;TouchableHighlight style={[styles.button]{ backgroundColor: '#f00'}} </code></pre> <p>Or do I have to nest it with a container inside the TouchableHightlight and put the inline style on that element instead?</p>
0debug
How to read JSon boolen and number values? : I send a JSon object to server by creating as : var input_array =self.input_value(); myJson={ request_type:1, //send request for problem 1 list_empty: 0, //1 is empty, 0 is not empty data_list:[] }; for(var k=0;k<input_array.length;k++) { myJson.data_list[k]=input_array[k]; } On the server var data=req.body; console.log("request_type: ",req.body.request_type); // worked var m_bool= Number(data.list_empty); if( m_bool != 0) { console.log("data_list size: ",data.data_list.length); for(var i=0;i<data.data_list.length;i++) { console.log(data.data_list[i]); } } It stopped just after printing second line. I think it can't read "list_empty" field of JSon. I changed to ... list_empty: false, ... still server did not enter in "if" statement. without the if statement I been able to print the array elements. I think I am failing to read "list_empty"'s value. so how can I enter inside the if statement?
0debug
Is it possible to convert String to ResultSet in jsp? : <p>How can I convert List to Result Set. Is it possible to do this conversion?</p>
0debug
static av_cold int movie_common_init(AVFilterContext *ctx) { MovieContext *movie = ctx->priv; AVInputFormat *iformat = NULL; int64_t timestamp; int nb_streams = 1, ret, i; char default_streams[16], *stream_specs, *spec, *cursor; char name[16]; AVStream *st; if (!movie->file_name) { av_log(ctx, AV_LOG_ERROR, "No filename provided!\n"); return AVERROR(EINVAL); } movie->seek_point = movie->seek_point_d * 1000000 + 0.5; stream_specs = movie->stream_specs; if (!stream_specs) { snprintf(default_streams, sizeof(default_streams), "d%c%d", !strcmp(ctx->filter->name, "amovie") ? 'a' : 'v', movie->stream_index); stream_specs = default_streams; } for (cursor = stream_specs; *cursor; cursor++) if (*cursor == '+') nb_streams++; if (movie->loop_count != 1 && nb_streams != 1) { av_log(ctx, AV_LOG_ERROR, "Loop with several streams is currently unsupported\n"); return AVERROR_PATCHWELCOME; } av_register_all(); iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; movie->format_ctx = NULL; if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to avformat_open_input '%s'\n", movie->file_name); return ret; } if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0) av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n"); if (movie->seek_point > 0) { timestamp = movie->seek_point; if (movie->format_ctx->start_time != AV_NOPTS_VALUE) { if (timestamp > 0 && movie->format_ctx->start_time > INT64_MAX - timestamp) { av_log(ctx, AV_LOG_ERROR, "%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n", movie->file_name, movie->format_ctx->start_time, movie->seek_point); return AVERROR(EINVAL); } timestamp += movie->format_ctx->start_time; } if ((ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD)) < 0) { av_log(ctx, AV_LOG_ERROR, "%s: could not seek to position %"PRId64"\n", movie->file_name, timestamp); return ret; } } for (i = 0; i < movie->format_ctx->nb_streams; i++) movie->format_ctx->streams[i]->discard = AVDISCARD_ALL; movie->st = av_calloc(nb_streams, sizeof(*movie->st)); if (!movie->st) return AVERROR(ENOMEM); for (i = 0; i < nb_streams; i++) { spec = av_strtok(stream_specs, "+", &cursor); if (!spec) return AVERROR_BUG; stream_specs = NULL; st = find_stream(ctx, movie->format_ctx, spec); if (!st) return AVERROR(EINVAL); st->discard = AVDISCARD_DEFAULT; movie->st[i].st = st; movie->max_stream_index = FFMAX(movie->max_stream_index, st->index); movie->st[i].discontinuity_threshold = av_rescale_q(movie->discontinuity_threshold, AV_TIME_BASE_Q, st->time_base); } if (av_strtok(NULL, "+", &cursor)) return AVERROR_BUG; movie->out_index = av_calloc(movie->max_stream_index + 1, sizeof(*movie->out_index)); if (!movie->out_index) return AVERROR(ENOMEM); for (i = 0; i <= movie->max_stream_index; i++) movie->out_index[i] = -1; for (i = 0; i < nb_streams; i++) { AVFilterPad pad = { 0 }; movie->out_index[movie->st[i].st->index] = i; snprintf(name, sizeof(name), "out%d", i); pad.type = movie->st[i].st->codecpar->codec_type; pad.name = av_strdup(name); if (!pad.name) return AVERROR(ENOMEM); pad.config_props = movie_config_output_props; pad.request_frame = movie_request_frame; ff_insert_outpad(ctx, i, &pad); if ( movie->st[i].st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !movie->st[i].st->codecpar->channel_layout) { ret = guess_channel_layout(&movie->st[i], i, ctx); if (ret < 0) return ret; } ret = open_stream(ctx, &movie->st[i]); if (ret < 0) return ret; } av_log(ctx, AV_LOG_VERBOSE, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n", movie->seek_point, movie->format_name, movie->file_name, movie->stream_index); return 0; }
1threat
K&R Word Couting program in C 1.5.4 : I am referring K&R for learning C. I am not getting the desired output for the following code. #include<stdio.h> #define IN 1 #define OUT 0 main() { int c,nl,nw,nc, state; nl = nc = nw = 0; state = OUT; while ((c=getchar()!= EOF)) { ++nc; if (c == '\n') { ++nl; } if (c ==' ' || c == '\n' || c == '\t') state = OUT; else if (state == OUT) { state = IN; ++nw; } } printf("%d %d %d", nc, nw,nl); } I gave the following input the door is open The output I obtained was 17 1 0 Kindly tell me what's wrong in the code.
0debug
how we can create a multiple spinner with my SQL database value in android : i am working with a project with multiple snipers in a single app , which fetches data from my SQL database and shown in snippers. If any one knows please help.thank you
0debug
jQuery Event wenn Besucher inaktiv oder sehr aktiv : Ich suche nach einem jQuery Script das bei inaktive Besucher Besuchern ausgelΓΆscht wird. - Wenn der Benutzer seine Maus nicht mehr bewegt - Wenn die Maus aus dem Vieport geht - Wenn er die halbe Seite gescrollt hat - wenn er nach oben scrollt Geht das und gibt es das bereit?
0debug
Credentials in pip.conf for private PyPI : <p>I have a private PyPI repository. Is there any way to store credentials in <code>pip.conf</code> similar to <code>.pypirc</code>?</p> <p>What I mean. Currently in <code>.pypirc</code> you can have such configuration:</p> <pre><code>[distutils] index-servers = custom [custom] repository: https://pypi.example.com username: johndoe password: changeme </code></pre> <p>From what I've found that you can put in <code>pip.conf</code>:</p> <pre><code>[global] index = https://username:password@pypi.example.com/pypi index-url = https://username:password@pypi.example.com/simple cert = /etc/ssl/certs/ca-certificates.crt </code></pre> <p>But here I see two problems:</p> <ol> <li>For each url you'll need each time to specify the same username and password.</li> <li>Username and password become visible in the logs, cause they are part of the url.</li> </ol> <p>Is there any way to store username and password outside of url?</p>
0debug
static void virtio_setup(uint64_t dev_info) { struct schib schib; int ssid; bool found = false; uint16_t dev_no; enable_mss_facility(); if (dev_info != -1) { dev_no = dev_info & 0xffff; debug_print_int("device no. ", dev_no); blk_schid.ssid = (dev_info >> 16) & 0x3; debug_print_int("ssid ", blk_schid.ssid); found = find_dev(&schib, dev_no); } else { for (ssid = 0; ssid < 0x3; ssid++) { blk_schid.ssid = ssid; found = find_dev(&schib, -1); if (found) { break; } } } if (!found) { virtio_panic("No virtio-blk device found!\n"); } virtio_setup_block(blk_schid); if (!virtio_ipl_disk_is_valid()) { virtio_panic("No valid hard disk detected.\n"); } }
1threat
JAVA-Selenium Error Unique Scenario Pls Take a Look : While working on code written in JAVA to automate clicking of a search button on a certain website, i have come across an interesting problem. This is what is happening - The java code runs in loops and locates plus clicks the search button on every iteration.This works well for initial two-three iterations but then the code breaks.If manually during execution, before the breaking of code i click on this web-element that is button, everything works well. Here is the code that is used,kindly take a look - Command in Java WebElement shineWebElementSearchButton = shineWaitLocal.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("button[id=id_searchButton]"))); shineWebElementSearchButton.click(); **The error thrown is shared below:** Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.cssSelector: input[id=id_q] (tried for 30 second(s) with 500 MILLISECONDS interval) Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z' System info: host: 'ADMIN-PC', ip: '192.168.2.8', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{moz:profile=C:\Users\admin\AppData\Local\Temp\rust_mozprofile.8ZXO56Gv1Uip, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, moz:headless=false, platform=XP, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=57.0, platformVersion=10.0, moz:processID=3628, browserName=firefox, javascriptEnabled=true, platformName=XP, moz:webdriverClick=false}] Session ID: 24c06052-dcac-42f4-86ed-46f4002f096e at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:82) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:231) at autoApplyShine.applyForJobs.applyForJobsFunctionality(applyForJobs.java:32) at autoApplyShine.ApplyShine.main(ApplyShine.java:28)
0debug
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) { Picture *pic = NULL; int64_t pts; int i, display_picture_number = 0, ret; const int encoding_delay = s->max_b_frames ? s->max_b_frames : (s->low_delay ? 0 : 1); int direct = 1; if (pic_arg) { pts = pic_arg->pts; display_picture_number = s->input_picture_number++; if (pts != AV_NOPTS_VALUE) { if (s->user_specified_pts != AV_NOPTS_VALUE) { int64_t time = pts; int64_t last = s->user_specified_pts; if (time <= last) { av_log(s->avctx, AV_LOG_ERROR, "Error, Invalid timestamp=%"PRId64", " "last=%"PRId64"\n", pts, s->user_specified_pts); return -1; } if (!s->low_delay && display_picture_number == 1) s->dts_delta = time - last; } s->user_specified_pts = pts; } else { if (s->user_specified_pts != AV_NOPTS_VALUE) { s->user_specified_pts = pts = s->user_specified_pts + 1; av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%"PRId64")\n", pts); } else { pts = display_picture_number; } } } if (pic_arg) { if (!pic_arg->buf[0]) direct = 0; if (pic_arg->linesize[0] != s->linesize) direct = 0; if (pic_arg->linesize[1] != s->uvlinesize) direct = 0; if (pic_arg->linesize[2] != s->uvlinesize) direct = 0; av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize); if (direct) { i = ff_find_unused_picture(s, 1); if (i < 0) return i; pic = &s->picture[i]; pic->reference = 3; if ((ret = av_frame_ref(&pic->f, pic_arg)) < 0) return ret; if (ff_alloc_picture(s, pic, 1) < 0) { return -1; } } else { i = ff_find_unused_picture(s, 0); if (i < 0) return i; pic = &s->picture[i]; pic->reference = 3; if (ff_alloc_picture(s, pic, 0) < 0) { return -1; } if (pic->f.data[0] + INPLACE_OFFSET == pic_arg->data[0] && pic->f.data[1] + INPLACE_OFFSET == pic_arg->data[1] && pic->f.data[2] + INPLACE_OFFSET == pic_arg->data[2]) { } else { int h_chroma_shift, v_chroma_shift; av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for (i = 0; i < 3; i++) { int src_stride = pic_arg->linesize[i]; int dst_stride = i ? s->uvlinesize : s->linesize; int h_shift = i ? h_chroma_shift : 0; int v_shift = i ? v_chroma_shift : 0; int w = s->width >> h_shift; int h = s->height >> v_shift; uint8_t *src = pic_arg->data[i]; uint8_t *dst = pic->f.data[i]; if (s->codec_id == AV_CODEC_ID_AMV && !(s->avctx->flags & CODEC_FLAG_EMU_EDGE)) { h = ((s->height + 15)/16*16) >> v_shift; } if (!s->avctx->rc_buffer_size) dst += INPLACE_OFFSET; if (src_stride == dst_stride) memcpy(dst, src, src_stride * h); else { int h2 = h; uint8_t *dst2 = dst; while (h2--) { memcpy(dst2, src, w); dst2 += dst_stride; src += src_stride; } } if ((s->width & 15) || (s->height & 15)) { s->dsp.draw_edges(dst, dst_stride, w, h, 16>>h_shift, 16>>v_shift, EDGE_BOTTOM); } } } } copy_picture_attributes(s, &pic->f, pic_arg); pic->f.display_picture_number = display_picture_number; pic->f.pts = pts; } for (i = 1; i < MAX_PICTURE_COUNT ; i++) s->input_picture[i - 1] = s->input_picture[i]; s->input_picture[encoding_delay] = (Picture*) pic; return 0; }
1threat
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program) { AVStream *stream = ist->st; AVCodecParameters *par; AVCodecContext *dec_ctx; char val_str[128]; const char *s; AVRational sar, dar; AVBPrint pbuf; const AVCodecDescriptor *cd; int ret = 0; const char *profile = NULL; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(w, in_program ? SECTION_ID_PROGRAM_STREAM : SECTION_ID_STREAM); print_int("index", stream->index); par = stream->codecpar; dec_ctx = ist->dec_ctx; if (cd = avcodec_descriptor_get(par->codec_id)) { print_str("codec_name", cd->name); if (!do_bitexact) { print_str("codec_long_name", cd->long_name ? cd->long_name : "unknown"); } } else { print_str_opt("codec_name", "unknown"); if (!do_bitexact) { print_str_opt("codec_long_name", "unknown"); } } if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, par->profile))) print_str("profile", profile); else { if (par->profile != FF_PROFILE_UNKNOWN) { char profile_num[12]; snprintf(profile_num, sizeof(profile_num), "%d", par->profile); print_str("profile", profile_num); } else print_str_opt("profile", "unknown"); } s = av_get_media_type_string(par->codec_type); if (s) print_str ("codec_type", s); else print_str_opt("codec_type", "unknown"); #if FF_API_LAVF_AVCTX if (dec_ctx) print_q("codec_time_base", dec_ctx->time_base, '/'); #endif print_str("codec_tag_string", av_fourcc2str(par->codec_tag)); print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag); switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: print_int("width", par->width); print_int("height", par->height); if (dec_ctx) { print_int("coded_width", dec_ctx->coded_width); print_int("coded_height", dec_ctx->coded_height); } print_int("has_b_frames", par->video_delay); sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL); if (sar.den) { print_q("sample_aspect_ratio", sar, ':'); av_reduce(&dar.num, &dar.den, par->width * sar.num, par->height * sar.den, 1024*1024); print_q("display_aspect_ratio", dar, ':'); } else { print_str_opt("sample_aspect_ratio", "N/A"); print_str_opt("display_aspect_ratio", "N/A"); } s = av_get_pix_fmt_name(par->format); if (s) print_str ("pix_fmt", s); else print_str_opt("pix_fmt", "unknown"); print_int("level", par->level); if (par->color_range != AVCOL_RANGE_UNSPECIFIED) print_str ("color_range", av_color_range_name(par->color_range)); else print_str_opt("color_range", "N/A"); if (par->color_space != AVCOL_SPC_UNSPECIFIED) print_str("color_space", av_color_space_name(par->color_space)); else print_str_opt("color_space", av_color_space_name(par->color_space)); if (par->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(par->color_trc)); else print_str_opt("color_transfer", av_color_transfer_name(par->color_trc)); if (par->color_primaries != AVCOL_PRI_UNSPECIFIED) print_str("color_primaries", av_color_primaries_name(par->color_primaries)); else print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries)); if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(par->chroma_location)); else print_str_opt("chroma_location", av_chroma_location_name(par->chroma_location)); if (par->field_order == AV_FIELD_PROGRESSIVE) print_str("field_order", "progressive"); else if (par->field_order == AV_FIELD_TT) print_str("field_order", "tt"); else if (par->field_order == AV_FIELD_BB) print_str("field_order", "bb"); else if (par->field_order == AV_FIELD_TB) print_str("field_order", "tb"); else if (par->field_order == AV_FIELD_BT) print_str("field_order", "bt"); else print_str_opt("field_order", "unknown"); #if FF_API_PRIVATE_OPT if (dec_ctx && dec_ctx->timecode_frame_start >= 0) { char tcbuf[AV_TIMECODE_STR_SIZE]; av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start); print_str("timecode", tcbuf); } else { print_str_opt("timecode", "N/A"); } #endif if (dec_ctx) print_int("refs", dec_ctx->refs); break; case AVMEDIA_TYPE_AUDIO: s = av_get_sample_fmt_name(par->format); if (s) print_str ("sample_fmt", s); else print_str_opt("sample_fmt", "unknown"); print_val("sample_rate", par->sample_rate, unit_hertz_str); print_int("channels", par->channels); if (par->channel_layout) { av_bprint_clear(&pbuf); av_bprint_channel_layout(&pbuf, par->channels, par->channel_layout); print_str ("channel_layout", pbuf.str); } else { print_str_opt("channel_layout", "unknown"); } print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id)); break; case AVMEDIA_TYPE_SUBTITLE: if (par->width) print_int("width", par->width); else print_str_opt("width", "N/A"); if (par->height) print_int("height", par->height); else print_str_opt("height", "N/A"); break; } if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) { const AVOption *opt = NULL; while (opt = av_opt_next(dec_ctx->priv_data,opt)) { uint8_t *str; if (opt->flags) continue; if (av_opt_get(dec_ctx->priv_data, opt->name, 0, &str) >= 0) { print_str(opt->name, str); av_free(str); } } } if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id); else print_str_opt("id", "N/A"); print_q("r_frame_rate", stream->r_frame_rate, '/'); print_q("avg_frame_rate", stream->avg_frame_rate, '/'); print_q("time_base", stream->time_base, '/'); print_ts ("start_pts", stream->start_time); print_time("start_time", stream->start_time, &stream->time_base); print_ts ("duration_ts", stream->duration); print_time("duration", stream->duration, &stream->time_base); if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); #if FF_API_LAVF_AVCTX if (stream->codec->rc_max_rate > 0) print_val ("max_bit_rate", stream->codec->rc_max_rate, unit_bit_per_second_str); else print_str_opt("max_bit_rate", "N/A"); #endif if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample); else print_str_opt("bits_per_raw_sample", "N/A"); if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames); else print_str_opt("nb_frames", "N/A"); if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]); else print_str_opt("nb_read_frames", "N/A"); if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]); else print_str_opt("nb_read_packets", "N/A"); if (do_show_data) writer_print_data(w, "extradata", par->extradata, par->extradata_size); writer_print_data_hash(w, "extradata_hash", par->extradata, par->extradata_size); #define PRINT_DISPOSITION(flagname, name) do { \ print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \ } while (0) if (do_show_stream_disposition) { writer_print_section_header(w, in_program ? SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION); PRINT_DISPOSITION(DEFAULT, "default"); PRINT_DISPOSITION(DUB, "dub"); PRINT_DISPOSITION(ORIGINAL, "original"); PRINT_DISPOSITION(COMMENT, "comment"); PRINT_DISPOSITION(LYRICS, "lyrics"); PRINT_DISPOSITION(KARAOKE, "karaoke"); PRINT_DISPOSITION(FORCED, "forced"); PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired"); PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired"); PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects"); PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic"); PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails"); writer_print_section_footer(w); } if (do_show_stream_tags) ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS); if (stream->nb_side_data) { print_pkt_side_data(w, stream->codecpar, stream->side_data, stream->nb_side_data, SECTION_ID_STREAM_SIDE_DATA_LIST, SECTION_ID_STREAM_SIDE_DATA); } writer_print_section_footer(w); av_bprint_finalize(&pbuf, NULL); fflush(stdout); return ret; }
1threat
how do I use angular cli on a Windows Server in a Jenkins build batch command : <p>before installing Jenkins I ran this: <strong>npm install -g @angular/cli</strong></p> <p>but I also have this in devDependencies in the package.json for the project: </p> <p><strong>"@angular/cli": "1.0.0-beta.32.3"</strong>,</p> <hr> <p>when running a Jenkins build, I get this message in the log:</p> <p><em>'ng' is not recognized as an internal or external command, operable program or batch file.</em></p> <p>=======================================</p> <p>Here is the Windows batch command in Jenkins:</p> <p><strong>cmd /c call npm install</strong> </p> <p><strong>set Path=%WORKSPACE%\node_modules\@angular\cli\bin;%PATH%</strong></p> <p><strong>echo %PATH%</strong></p> <p><strong>ng build -prod</strong></p> <p>========================================</p> <p>here is a little more log output from Jenkins:</p> <p>C:\Program Files (x86)\Jenkins\workspace\UiUnitTests><strong>ng build -prod</strong> </p> <p><em>'ng' is not recognized as an internal or external command, operable program or batch file.</em></p> <p>C:\Program Files (x86)\Jenkins\workspace\UiUnitTests>exit 9009 Build step 'Execute Windows batch command' marked build as failure</p> <hr> <p>but when I run this just from the command line (not in a Jenkins job), this works fine:</p> <p>C:\Program Files (x86)\Jenkins\workspace\UiUnitTests><strong>ng build -prod</strong></p> <h3>Your global Angular CLI version (1.0.0-rc.1) is greater than your local</h3> <h3>version (1.0.0-beta.32.3). The local Angular CLI version is used.</h3> <p>To disable this warning use "ng set --global warnings.versionMismatch=false". Hash: 7853ecb5a81a25eadbeb Time: 61317ms chunk {0} polyfills.7aaf5284cd5921eea40b.bundle.js (polyfills) 278 kB {4} [initial] [rendered] chunk {1} main.3380f71d3e71966aea27.bundle.js (main) 371 kB {3} [initial] [rendered] chunk {2} styles.9db1bafdfc989b37db97.bundle.css (styles) 69 bytes {4} [initial] [rendered] chunk {3} vendor.24574fc8320129058fac.bundle.js (vendor) 2.18 MB [initial] [rendered] chunk {4} inline.d1f5b52100bed2568d44.bundle.js (inline) 0 bytes [entry] [rendered]</p> <p>C:\Program Files (x86)\Jenkins\workspace\UiUnitTests></p> <p>================================================</p> <p>last but not least, here is the Jenkins log output from <strong>echo %PATH%</strong></p> <p>C:\Program Files (x86)\Jenkins\workspace\UiUnitTests>echo C:\Program Files (x86)\Jenkins\workspace\UiUnitTests\node_modules\@angular\cli\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Ruby23-x64\bin;C:\Program Files\nodejs\;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps C:\Program Files (x86)\Jenkins\workspace\UiUnitTests\node_modules\@angular\cli\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Ruby23-x64\bin;C:\Program Files\nodejs\;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps</p>
0debug
Extracts incomplete cases from a data set in r : <p>from this example: </p> <pre><code> ## x ## v1 v2 v3 ##1 90 55 NA ##2 NA 45 8 ##3 85 NA 5 ##4 NA 33 7 ##5 55 30 4 ##6 60 20 3 ##7 75 15 2 ##8 80 23 6 # ici is where Incomplete case indicator ici=(function (x) return(is.na(x))) ici(x) v1 v2 v3 ## [1,] FALSE FALSE TRUE ## [2,] TRUE FALSE FALSE ## [3,] FALSE TRUE FALSE ## [4,] TRUE FALSE FALSE ## [5,] FALSE FALSE FALSE ## [6,] FALSE FALSE FALSE ## [7,] FALSE FALSE FALSE ## [8,] FALSE FALSE FALSE # Extracts incomplete cases from a data set ic=(function (x, drop) return(x[ici(x)]))(x, drop) ic(x) ## Error: could not find function "ic" </code></pre> <p>from the last run ( Error: could not find function "ic") why it give me this and how I solve this broblem with function ic</p>
0debug
static int bdrv_inherited_flags(int flags) { flags |= BDRV_O_PROTOCOL; flags |= BDRV_O_CACHE_WB | BDRV_O_UNMAP; if (flags & BDRV_O_SNAPSHOT) { flags &= ~BDRV_O_RDWR; } flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); return flags; }
1threat
static int mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { MJpegDecodeContext *s = avctx->priv_data; uint8_t *buf_end, *buf_ptr; int i, start_code; AVPicture *picture = data; *data_size = 0; if (buf_size == 0) return 0; buf_ptr = buf; buf_end = buf + buf_size; while (buf_ptr < buf_end) { start_code = find_marker(&buf_ptr, buf_end); { if (start_code < 0) { goto the_end; } else { dprintf("marker=%x avail_size_in_buf=%d\n", start_code, buf_end - buf_ptr); if ((buf_end - buf_ptr) > s->buffer_size) { av_free(s->buffer); s->buffer_size = buf_end-buf_ptr; s->buffer = av_malloc(s->buffer_size); dprintf("buffer too small, expanding to %d bytes\n", s->buffer_size); } if (start_code == SOS) { uint8_t *src = buf_ptr; uint8_t *dst = s->buffer; while (src<buf_end) { uint8_t x = *(src++); *(dst++) = x; if (x == 0xff) { while(*src == 0xff) src++; x = *(src++); if (x >= 0xd0 && x <= 0xd7) *(dst++) = x; else if (x) break; } } init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8); dprintf("escaping removed %d bytes\n", (buf_end - buf_ptr) - (dst - s->buffer)); } else init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr)*8); s->start_code = start_code; if(s->avctx->debug & FF_DEBUG_STARTCODE){ printf("startcode: %X\n", start_code); } if (start_code >= 0xd0 && start_code <= 0xd7) { dprintf("restart marker: %d\n", start_code&0x0f); } else if (s->first_picture) { if (start_code >= 0xe0 && start_code <= 0xef) mjpeg_decode_app(s); else if (start_code == COM) mjpeg_decode_com(s); } switch(start_code) { case SOI: s->restart_interval = 0; break; case DQT: mjpeg_decode_dqt(s); break; case DHT: mjpeg_decode_dht(s); break; case SOF0: s->lossless=0; if (mjpeg_decode_sof(s) < 0) return -1; break; case SOF3: s->lossless=1; if (mjpeg_decode_sof(s) < 0) return -1; break; case EOI: eoi_parser: { if (s->interlaced) { s->bottom_field ^= 1; if (s->bottom_field) goto not_the_end; } for(i=0;i<3;i++) { picture->data[i] = s->current_picture[i]; picture->linesize[i] = (s->interlaced) ? s->linesize[i] >> 1 : s->linesize[i]; } *data_size = sizeof(AVPicture); avctx->height = s->height; if (s->interlaced) avctx->height *= 2; avctx->width = s->width; switch((s->h_count[0] << 4) | s->v_count[0]) { case 0x11: if(s->rgb){ avctx->pix_fmt = PIX_FMT_RGBA32; }else avctx->pix_fmt = PIX_FMT_YUV444P; break; case 0x21: avctx->pix_fmt = PIX_FMT_YUV422P; break; default: case 0x22: avctx->pix_fmt = PIX_FMT_YUV420P; break; } goto the_end; } break; case SOS: mjpeg_decode_sos(s); if ((s->buggy_avid && !s->interlaced) || s->restart_interval) goto eoi_parser; break; case DRI: mjpeg_decode_dri(s); break; case SOF1: case SOF2: case SOF5: case SOF6: case SOF7: case SOF9: case SOF10: case SOF11: case SOF13: case SOF14: case SOF15: case JPG: printf("mjpeg: unsupported coding type (%x)\n", start_code); break; } not_the_end: buf_ptr += (get_bits_count(&s->gb)+7)/8; dprintf("marker parser used %d bytes (%d bits)\n", (get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb)); } } } the_end: dprintf("mjpeg decode frame unused %d bytes\n", buf_end - buf_ptr); return buf_ptr - buf; }
1threat
how to past value from textview to a variable for others activities in android : i having problem to assign a Text-view result[from database] to a new variable. Text-view retrieve data from database no issue. Now issue is i need to link the value in the Text-view to a new variable. Then use button function for my next activity.
0debug
Noobie learning but plz help ,,, while loop : public static void main (String [] args){ double x = 100;**strong text** while (x < 500 && x % 17 == 0 && x % 9 == 0 ){ System.out.println(x); x++ ; Hello i am trying to check if the number X (100 - 500 ) is divisible by 9 and 17 using the While-loop but when i run this program the compiler shows me no results Can someone tell me where is the problem ?
0debug
UWP: ListView ItemClick not work : <p>I have to do a Master/Detail in UWP</p> <p>1- If you're in Laptop:</p> <p>The responsible GridView of show the data of this person appear. So when you select a item is binded to ViewModel.</p> <pre><code>&lt;ScrollViewer x:Name="ScrollLista" Grid.Column="0" Grid.Row="1"&gt; &lt;ListView x:Name="Lista" ItemsSource="{Binding Lista}" ItemClick="Lista_ItemClick" SelectedItem="{Binding PersonaSeleccionada, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"&gt; &lt;ListView.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;TextBlock Text="{Binding nombre}" /&gt; &lt;TextBlock Text="{Binding apellido}" /&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListView.ItemTemplate&gt; &lt;/ListView&gt; &lt;/ScrollViewer&gt; &lt;Grid x:Name="CRUD" Grid.Column="1" Grid.Row="1" DataContext="{Binding PersonaSeleccionada}" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"&gt; ... &lt;/Grid&gt; </code></pre> <p>2- When is a mobile:</p> <p>Only will appear the list and when I select a item this should be two things.</p> <ol> <li>Call to ViewModel by binding using SelectedItem.</li> <li>Call to code behind using ItemClick, this will be in charge of calling another page.</li> </ol> <p>The problem: ItemClick not working, not call to Lista_ItemClick... How can I call a method and send the item selected to code behind?</p>
0debug
Update Typescript in Angular2 project : <p>I have an Angular2 project using Typescript, in Visual Studio. I want to update Typescript from 1.8 to 2.0.x. In my system I have updated typescript and <code>tsc -v</code> logs <code>Version 2.0.10</code> The package.json, among others, contains</p> <pre><code>"devDependencies": { .... "typescript": "^1.8.10", "typings": "^1.3.1", ... } </code></pre> <p>In order to update typescript, is it enough to change the version to <code>"typescript": "^2.0.10"</code> in the package.json? Also, what is the relation of typescript and typings version, when it comes to update?</p>
0debug
Setter for class within a class : i have a Sheet class which contains two attributes and each is a class 1. summary (class) 2. data (class) summary and data has 1 attribute,df, which is a dataframe my question is, am i right to say that since summary and data are classes: 1. I shouldn't store summary and data directly as dataframes in Sheet class's attribute. 2. I should store summary and data as objects and when main class wish to set summary/ data, i use Sheet's setter which uses summary/ data's setter to set the actual dataframe Create sheet object in Main Class : ``` import Sheet sheet = Sheet.Sheet() # create empty sheet sheet.set_summary(new_df) # set summary sheet.set_data(new_df) # set data ``` In Sheet Class : ``` import Summary import Data class Sheet: def __init__(self): self.name = None self._summary = Summary.Summary() self._data = Data.Data() def get_SheetSummary(self): return self._summary.get_summary() def set_SheetSummary(self,new_df): self._summary.set_summary(new_df) def get_SheetData(self): return self._data.get_data() def set_SheetData(self, new_df): self._data.set_data(new_df) ```
0debug
How can I specify where my local developer's service fabric cluster is created? : <p>My problem: I am learning Service Fabric, and doing simple tutorials, and the local cluster is filling up my C drive. I run the projects in Visual Studio. It first creates a cluster in a folder SfDevCluster. That takes up 842 MB of space. Then it deploys the services and web api sites. Remember, these are trivial tutorials with almost nothing in them. Now, I notice that I have a folder with a Size = 1.22 TB and Size on Disk of 9.4 GB. I'm not sure how to interpret that. But it consumes the remaining space on my C drive and sets off alarms. I have other drives with lots of space. I would love to specify that those be used. Is there a way to do that with the service fabric cluster used by Visual Studio? Or is there a way to constrain the overly ambitious size allocations? And if you understand this, can you explain what these unusual folder sizes mean? In the old days, I would have a hard drive with lots of space. But now, my developer machine has a much faster, but more expensive SSD drive, and space is at a premium. So I need more control of the cluster location. </p>
0debug
Which of the following are valid C++ variable names? : <p>9index, break, user_name, CONSTANT, _member</p> <p>Got this wrong on a test and I'm wondering where I can find the right answer. Would be highly appreciated. Thanks!</p>
0debug
Can chrome headless browser be used to save the complete web page with resources? : <p>I am looking to use the chrome headless browser to replicate the 'Save As' functionality to save the complete web page with all its resources. Is there a way to do this? I tried the --print-to-pdf and --screenshot options and looking to explore the 'Save As' option as well.</p>
0debug
Multiple Classes in 1 file only 1 Class accesable : I have Multiple Classes in 1 file. I have to put them all in 1 file because of Compay standard for the programm im Writing something for. Is there some way to only make 1 Class in the file accesable? Nobody needs to see the other classes.
0debug
Function using PHP that converts a base 36 string to a base 10 integer : <p>Can someone show me how I would write a php function that converts a base 36 string to a base 10 integer without using the base convert function </p> <p>the function should work like this </p> <pre><code>echo base36_to_base10('614qa'); //prints 10130482 echo base36_to_base10('614z1'); //prints 10130797 </code></pre>
0debug
java swing- jtable cell rendere : I design a system by Java Swing. I have a tablet called sick and this tablet has a column called status which has two values,one is open and onother is closed values. My question is that when the value of the column is open I want to change color to blue and when it is closed i want to change color to red (when the information is selected from the database). Thank
0debug
void kvm_arm_reset_vcpu(ARMCPU *cpu) { memmove(cpu->cpreg_values, cpu->cpreg_reset_values, cpu->cpreg_array_len * sizeof(cpu->cpreg_values[0])); if (!write_list_to_kvmstate(cpu)) { abort(); } }
1threat
savewidget from htmlwidget in R , cannot save html file in another folder : <p>I have a map leaflet that I want to save in an html file in a specific folder. I am using Windows 7.</p> <p>I tried the following :</p> <pre><code>library(htmlwidgets) saveWidget(map_leaflet, file="ressources/test.html") library(htmlwidgets) saveWidget(map_leaflet, file="ressources\\test.html") library(htmlwidgets) path_name &lt;- file.path("ressources", "test.html", fsep="\\") saveWidget(map_leaflet, file=path_name) library(htmlwidgets) path_name &lt;- paste("ressources", "test.html", sep="/") saveWidget(map_leaflet, file=path_name) </code></pre> <p>As an error message, depending on the Rstudio session, I either have</p> <p>1) Error in setwd(dir) : cannot change working directory</p> <p>2) Cannot find path</p> <p>When I only save like this :</p> <pre><code>library(htmlwidgets) saveWidget(map_leaflet, file="test.html") </code></pre> <p>It works perfectly.</p> <p>Thank you in advance for your help.</p>
0debug
void ppc_hash64_unmap_hptes(PowerPCCPU *cpu, const ppc_hash_pte64_t *hptes, hwaddr ptex, int n) { if (cpu->env.external_htab == MMU_HASH64_KVM_MANAGED_HPT) { g_free((void *)hptes); } else if (!cpu->env.external_htab) { address_space_unmap(CPU(cpu)->as, (void *)hptes, n * HASH_PTE_SIZE_64, false, n * HASH_PTE_SIZE_64); } }
1threat
angular2, typescript, extract an array from object : I'm having an issue trying to extract an array from an object. The strcuture is as follows: [] 0: Array(4) 0: 0 1: 5 2: 500 3: (5) [{…}, {…}, {…}, {…}, {…}] I've tried object.keys, for and foreach loops but I haven't been able to find a solution. This example is what I get when I use console.log(object). When I put console.log(object.length) I get 0 as an answer. But the type is an object. Any help would be much appreciated.
0debug
static void numa_add(const char *optarg) { char option[128]; char *endptr; unsigned long long value, endvalue; int nodenr; optarg = get_opt_name(option, 128, optarg, ',') + 1; if (!strcmp(option, "node")) { if (get_param_value(option, 128, "nodeid", optarg) == 0) { nodenr = nb_numa_nodes; } else { nodenr = strtoull(option, NULL, 10); } if (get_param_value(option, 128, "mem", optarg) == 0) { node_mem[nodenr] = 0; } else { int64_t sval; sval = strtosz(option, &endptr); if (sval < 0 || *endptr) { fprintf(stderr, "qemu: invalid numa mem size: %s\n", optarg); exit(1); } node_mem[nodenr] = sval; } if (get_param_value(option, 128, "cpus", optarg) == 0) { node_cpumask[nodenr] = 0; } else { value = strtoull(option, &endptr, 10); if (value >= 64) { value = 63; fprintf(stderr, "only 64 CPUs in NUMA mode supported.\n"); } else { if (*endptr == '-') { endvalue = strtoull(endptr+1, &endptr, 10); if (endvalue >= 63) { endvalue = 62; fprintf(stderr, "only 63 CPUs in NUMA mode supported.\n"); } value = (2ULL << endvalue) - (1ULL << value); } else { value = 1ULL << value; } } node_cpumask[nodenr] = value; } nb_numa_nodes++; } return; }
1threat
Algorithm to correct misspelled product names from excel file : <p>Hi I am fairly new to python and am looking to write a script that can correct misspelled product names.</p> <p>As part of my job I receive excel files with product names and prices, sometimes those product names can be misspelled. This can mean switched up letters, added product specifications behind names or incomplete names.</p> <p>So far I am using microsoft access to clean this data, but I am looking to improve this process and improve my Python skills in the process.</p> <p>So my question would be: is this a feasable project? Any pointers as to where to start, algorithm to use and such would be helpful.</p>
0debug
void axisdev88_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; CRISCPU *cpu; CPUCRISState *env; DeviceState *dev; SysBusDevice *s; DriveInfo *nand; qemu_irq irq[30], nmi[2]; void *etraxfs_dmac; struct etraxfs_dma_client *dma_eth; int i; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); MemoryRegion *phys_intmem = g_new(MemoryRegion, 1); if (cpu_model == NULL) { cpu_model = "crisv32"; } cpu = cpu_cris_init(cpu_model); env = &cpu->env; memory_region_allocate_system_memory(phys_ram, NULL, "axisdev88.ram", ram_size); memory_region_add_subregion(address_space_mem, 0x40000000, phys_ram); memory_region_init_ram(phys_intmem, NULL, "axisdev88.chipram", INTMEM_SIZE, &error_abort); vmstate_register_ram_global(phys_intmem); memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem); nand = drive_get(IF_MTD, 0, 0); nand_state.nand = nand_init(nand ? blk_by_legacy_dinfo(nand) : NULL, NAND_MFR_STMICRO, 0x39); memory_region_init_io(&nand_state.iomem, NULL, &nand_ops, &nand_state, "nand", 0x05000000); memory_region_add_subregion(address_space_mem, 0x10000000, &nand_state.iomem); gpio_state.nand = &nand_state; memory_region_init_io(&gpio_state.iomem, NULL, &gpio_ops, &gpio_state, "gpio", 0x5c); memory_region_add_subregion(address_space_mem, 0x3001a000, &gpio_state.iomem); dev = qdev_create(NULL, "etraxfs,pic"); qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, 0x3001c000); sysbus_connect_irq(s, 0, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_IRQ)); sysbus_connect_irq(s, 1, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_NMI)); for (i = 0; i < 30; i++) { irq[i] = qdev_get_gpio_in(dev, i); } nmi[0] = qdev_get_gpio_in(dev, 30); nmi[1] = qdev_get_gpio_in(dev, 31); etraxfs_dmac = etraxfs_dmac_init(0x30000000, 10); for (i = 0; i < 10; i++) { etraxfs_dmac_connect(etraxfs_dmac, i, irq + 7 + i, i & 1); } dma_eth = g_malloc0(sizeof dma_eth[0] * 4); etraxfs_eth_init(&nd_table[0], 0x30034000, 1, &dma_eth[0], &dma_eth[1]); if (nb_nics > 1) { etraxfs_eth_init(&nd_table[1], 0x30036000, 2, &dma_eth[2], &dma_eth[3]); } etraxfs_dmac_connect_client(etraxfs_dmac, 0, &dma_eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, &dma_eth[1]); if (nb_nics > 1) { etraxfs_dmac_connect_client(etraxfs_dmac, 6, &dma_eth[2]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, &dma_eth[3]); } sysbus_create_varargs("etraxfs,timer", 0x3001e000, irq[0x1b], nmi[1], NULL); sysbus_create_varargs("etraxfs,timer", 0x3005e000, irq[0x1b], nmi[1], NULL); for (i = 0; i < 4; i++) { sysbus_create_simple("etraxfs,serial", 0x30026000 + i * 0x2000, irq[0x14 + i]); } if (kernel_filename) { li.image_filename = kernel_filename; li.cmdline = kernel_cmdline; cris_load_image(cpu, &li); } else if (!qtest_enabled()) { fprintf(stderr, "Kernel image must be specified\n"); exit(1); } }
1threat
int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f) { uint8_t buf[4096]; target_phys_addr_t dst_begin = dst_addr; size_t want, did; while (nbytes) { want = nbytes > sizeof(buf) ? sizeof(buf) : nbytes; did = fread(buf, 1, want, f); cpu_physical_memory_write_rom(dst_addr, buf, did); dst_addr += did; nbytes -= did; if (did != want) break; } return dst_addr - dst_begin; }
1threat
Link does not work without http:// protocols (php) : I use php and I have an input that the user types in a link to his website and the link should appear for others to view it or open it. I'm testing the input and the problem is the link does not work unless I types either http:// or https:// before the mentioned URL and I think some one might just write www.foo.com without writing the hhtp:// . The link automatically substitutes the http:// or https://with the root of my website ( or at least that's what I guess ), because I'm working with XAMP and the URL appears as so : localhost/MyFooProjectFile/www.foo.com . How to make links work without the protocols or substitute the none mentioned protocol with the right one before my user's link ? Note : I know the question might seem stupid (cause who is the idiot who thinks a link could work without protocol), but what makes me wonder is I write in the address bar of my browser www.foo.co and it would take me there, without me menthionioning the protocols. PLease note that I do not have the code in the time of writing the question. Do not downvote just comment if code is crucial, Thanks.
0debug
static int get_whole_cluster(BlockDriverState *bs, VmdkExtent *extent, uint64_t cluster_offset, uint64_t offset, bool allocate) { uint8_t whole_grain[extent->cluster_sectors * 512]; if (bs->backing_hd) { int ret; if (!vmdk_is_cid_valid(bs)) return -1; offset -= offset % (extent->cluster_sectors * 512); ret = bdrv_read(bs->backing_hd, offset >> 9, whole_grain, extent->cluster_sectors); if (ret < 0) { return -1; } ret = bdrv_write(extent->file, cluster_offset, whole_grain, extent->cluster_sectors); if (ret < 0) { return -1; } } return 0; }
1threat
static void pcnet_ioport_write(void *opaque, target_phys_addr_t addr, uint64_t data, unsigned size) { PCNetState *d = opaque; if (addr < 16 && size == 1) { return pcnet_aprom_writeb(d, addr, data); } else if (addr >= 0x10 && addr < 0x20 && size == 2) { return pcnet_ioport_writew(d, addr, data); } else if (addr >= 0x10 && addr < 0x20 && size == 4) { return pcnet_ioport_writel(d, addr, data); } }
1threat
SVG How do increase width using animateTransform? : I have a <rect> that need to expand its WIDTH using animateTransform based on a given value, the <rect> should change colors as follows - if <rect> value is 0 - 29 <rect>'s {fill:red;} - if <rect> value is 30-49 <rect>'s {fill:blue;} - if <rect> value is 50 - 100 <rect>'s {fill:green;} I hope that i have well communicated, Thank you very much for your help! **Here is my .svg** <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613 656"> <defs> <style>.cls-1,.cls-4{fill:red;}.cls-2,.cls-5{fill:#29abe2;}.cls-3,.cls-6{fill:#22b573;}.cls-4,.cls-5,.cls-6{font-size:48px;font-family:MyriadPro-Regular, Myriad Pro;}</style> </defs> <title>Stackoverflow</title> <rect class="cls-1" x="45.5" y="67.5" width="104" height="104" /> <rect class="cls-2" x="46" y="198" width="229" height="104" /> <rect class="cls-3" x="46" y="340" width="395" height="104" /> <rect class="cls-3" x="46" y="486" width="544" height="104"> <animateTransform attributeName="transform" type="translate" from="0 0" to="150 0" begin="0s" dur="2s" repeatCount="indefinite" /> </rect> <text class="cls-4" transform="translate(190.86 128.57)">initial</text> <text class="cls-5" transform="translate(317.86 258.57)">30 - 49%</text> <text class="cls-6" transform="translate(455.86 408.57)"50 - 100%</text> <text class="cls-4" transform="translate(317.86 125.57)">0 - 29%</text> </svg>
0debug
how to add class from java script without removing class from css : im new in javascript, i got problem with javascript from callmenick $(document).ready(function() { $( '.dropdown' ).hover( function(){ $(this).children('.sub-menu').slideDown(200); }, function(){ $(this).children('.sub-menu').slideUp(200); } ); }); to call 'dropdown' and 'sub-menu' must using class, but in my class already have css <li class="button_a hvr-underline"> /* i want to put 'dropdown' in this class */ <a href="#" class="button" style="width: 128px;">a</a> </li> im not advance
0debug
simple login php not working : <p>Created a simple login form but it doesnt seem to work.It always opens the admin page. </p> <pre><code>$username=$_POST["username"]; $password=$_POST["password"]; if(mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'",$con)){ session_start(); $_SESSION["username"]=$username; $_SESSION["password"]=$password; header('location:admin.html'); } else{ echo "Login Failed.&lt;a href=index.html&gt;Re Login&lt;/a"; } </code></pre> <p>Need help.And here is the html part.</p> <pre><code> &lt;form method="post" id="loginform" action="validate.php"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;label&gt;Username :&lt;/label&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="username"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;br&gt; &lt;tr&gt; &lt;td&gt; &lt;label&gt;Password :&lt;/label&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="password" name="password"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;br&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="submit" id="login" value="Log In" class="btn btn-primary"/&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="reset" id="reset" value="Reset" class="btn btn-primary"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p> Need the working code in 2hrs else im dommed</p>
0debug
av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx) { const int high_bit_depth = avctx->bits_per_raw_sample > 8; if (!high_bit_depth) { switch (check_dcbzl_effect()) { case 32: c->clear_blocks = clear_blocks_dcbz32_ppc; break; case 128: c->clear_blocks = clear_blocks_dcbz128_ppc; break; default: break; } } #if HAVE_ALTIVEC if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { ff_dsputil_init_altivec(c, avctx); ff_int_init_altivec(c, avctx); c->gmc1 = ff_gmc1_altivec; #if CONFIG_ENCODERS if (avctx->bits_per_raw_sample <= 8 && (avctx->dct_algo == FF_DCT_AUTO || avctx->dct_algo == FF_DCT_ALTIVEC)) { c->fdct = ff_fdct_altivec; } #endif if (avctx->bits_per_raw_sample <= 8) { if ((avctx->idct_algo == FF_IDCT_AUTO) || (avctx->idct_algo == FF_IDCT_ALTIVEC)) { c->idct_put = ff_idct_put_altivec; c->idct_add = ff_idct_add_altivec; c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; } } } #endif }
1threat
Instantiating the base class member by creating the object in the derived class Method : <p>when i am trying to instantiate the base class member by creating an object in the derived class method it should be accessed by c.Id instead getting an error</p> <pre><code>public class RetailCust : Customer { public void Print() { Customer c = new Customer(); c.id=102 //getting an error } } public class Customer { protected int id = 100; } </code></pre>
0debug
static void sh7750_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t mem_value) { SH7750State *s = opaque; uint16_t temp; switch (addr) { case SH7750_BCR1_A7: case SH7750_BCR4_A7: case SH7750_WCR1_A7: case SH7750_WCR2_A7: case SH7750_WCR3_A7: case SH7750_MCR_A7: ignore_access("long write", addr); return; case SH7750_PCTRA_A7: temp = porta_lines(s); s->pctra = mem_value; s->portdira = portdir(mem_value); s->portpullupa = portpullup(mem_value); porta_changed(s, temp); return; case SH7750_PCTRB_A7: temp = portb_lines(s); s->pctrb = mem_value; s->portdirb = portdir(mem_value); s->portpullupb = portpullup(mem_value); portb_changed(s, temp); return; case SH7750_MMUCR_A7: s->cpu->mmucr = mem_value; return; case SH7750_PTEH_A7: s->cpu->pteh = mem_value; return; case SH7750_PTEL_A7: s->cpu->ptel = mem_value; return; case SH7750_PTEA_A7: s->cpu->ptea = mem_value & 0x0000000f; return; case SH7750_TTB_A7: s->cpu->ttb = mem_value; return; case SH7750_TEA_A7: s->cpu->tea = mem_value; return; case SH7750_TRA_A7: s->cpu->tra = mem_value & 0x000007ff; return; case SH7750_EXPEVT_A7: s->cpu->expevt = mem_value & 0x000007ff; return; case SH7750_INTEVT_A7: s->cpu->intevt = mem_value & 0x000007ff; return; case SH7750_CCR_A7: s->ccr = mem_value; return; default: error_access("long write", addr); assert(0); } }
1threat
Azure: Pricing of deployment slots for an Azure App Service : <p>Azure: Pricing of deployment slots for an Azure App Service.</p> <p>Using an S1 App Service Plan, my web site has up to 5 slots for web app staging. How are those slots charged? Are they billed only if used? Included in the S1 fee? or something else.</p>
0debug
static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc) { int addr_reg, data_reg, arg0, arg1, arg2, mem_index, s_bits; #if defined(CONFIG_SOFTMMU) uint32_t *label1_ptr, *label2_ptr; data_reg = *args++; addr_reg = *args++; mem_index = *args; s_bits = opc & 3; arg0 = TCG_REG_O0; arg1 = TCG_REG_O1; arg2 = TCG_REG_O2; #if defined(CONFIG_SOFTMMU) tcg_out_arithi(s, arg1, addr_reg, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS, SHIFT_SRL); tcg_out_arithi(s, arg0, addr_reg, TARGET_PAGE_MASK | ((1 << s_bits) - 1), ARITH_AND); tcg_out_andi(s, arg1, (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS); tcg_out_addi(s, arg1, offsetof(CPUState, tlb_table[mem_index][0].addr_read)); tcg_out_arith(s, arg1, TCG_AREG0, arg1, ARITH_ADD); tcg_out32(s, TARGET_LD_OP | INSN_RD(arg2) | INSN_RS1(arg1) | INSN_RS2(TCG_REG_G0)); tcg_out_arith(s, TCG_REG_G0, arg0, arg2, ARITH_SUBCC); label1_ptr = (uint32_t *)s->code_ptr; tcg_out32(s, 0); tcg_out_mov(s, arg0, addr_reg); tcg_out_movi(s, TCG_TYPE_I32, arg1, mem_index); tcg_out32(s, CALL | ((((tcg_target_ulong)qemu_ld_helpers[s_bits] - (tcg_target_ulong)s->code_ptr) >> 2) & 0x3fffffff)); tcg_out_ldst(s, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_ST_OP); tcg_out_ldst(s, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_LD_OP); switch(opc) { case 0 | 4: tcg_out_arithi(s, data_reg, arg0, (int)sizeof(tcg_target_long) * 8 - 8, HOST_SLL_OP); tcg_out_arithi(s, data_reg, data_reg, (int)sizeof(tcg_target_long) * 8 - 8, HOST_SRA_OP); break; case 1 | 4: tcg_out_arithi(s, data_reg, arg0, (int)sizeof(tcg_target_long) * 8 - 16, HOST_SLL_OP); tcg_out_arithi(s, data_reg, data_reg, (int)sizeof(tcg_target_long) * 8 - 16, HOST_SRA_OP); break; case 2 | 4: tcg_out_arithi(s, data_reg, arg0, 32, HOST_SLL_OP); tcg_out_arithi(s, data_reg, data_reg, 32, HOST_SRA_OP); break; case 0: case 1: case 2: case 3: default: tcg_out_mov(s, data_reg, arg0); break; } label2_ptr = (uint32_t *)s->code_ptr; tcg_out32(s, 0); tcg_out_nop(s); *label1_ptr = (INSN_OP(0) | INSN_COND(COND_E, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)s->code_ptr - (unsigned long)label1_ptr)); tcg_out_ldst(s, arg1, arg1, offsetof(CPUTLBEntry, addend) - offsetof(CPUTLBEntry, addr_read), HOST_LD_OP); tcg_out_arith(s, arg0, addr_reg, arg1, ARITH_ADD); arg0 = addr_reg; switch(opc) { case 0: tcg_out_ldst(s, data_reg, arg0, 0, LDUB); break; case 0 | 4: tcg_out_ldst(s, data_reg, arg0, 0, LDSB); break; case 1: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, LDUH); tcg_out_ldst_asi(s, data_reg, arg0, 0, LDUHA, ASI_PRIMARY_LITTLE); break; case 1 | 4: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, LDSH); tcg_out_ldst_asi(s, data_reg, arg0, 0, LDSHA, ASI_PRIMARY_LITTLE); break; case 2: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, LDUW); tcg_out_ldst_asi(s, data_reg, arg0, 0, LDUWA, ASI_PRIMARY_LITTLE); break; case 2 | 4: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, LDSW); tcg_out_ldst_asi(s, data_reg, arg0, 0, LDSWA, ASI_PRIMARY_LITTLE); break; case 3: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, LDX); tcg_out_ldst_asi(s, data_reg, arg0, 0, LDXA, ASI_PRIMARY_LITTLE); break; default: tcg_abort(); } #if defined(CONFIG_SOFTMMU) *label2_ptr = (INSN_OP(0) | INSN_COND(COND_A, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)s->code_ptr - (unsigned long)label2_ptr)); }
1threat
Can one connect an USB-hub to the ethernet port? : <p>My system:<br> 2x USB 2.0<br> 1x 1000MBit Ethernet<br> Wifi<br> OS: Linux</p> <p>I want to connect an usb-hub, but plugging it into the usb 2.0 is super slow. Is there a possibility to connect the usb-hub to the ethernet port? I am anyway only using Wifi for Internet. I don't care which Linux distribution to use as long as I can write images to sd-cards with it.</p> <p>Google-"Research" only gives me "usb -> to -> ethernet" adapters but no usb-hubs pluggable into ethernet.</p> <p>Thank you very much for any help :-)</p>
0debug
def count_even(array_nums): count_even = len(list(filter(lambda x: (x%2 == 0) , array_nums))) return count_even
0debug
static void sdp_parse_fmtp_config(AVCodecContext * codec, void *ctx, char *attr, char *value) { switch (codec->codec_id) { case CODEC_ID_MPEG4: case CODEC_ID_AAC: if (!strcmp(attr, "config")) { int len = hex_to_data(NULL, value); if (codec->extradata) av_free(codec->extradata); codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return; codec->extradata_size = len; hex_to_data(codec->extradata, value); } break; case CODEC_ID_VORBIS: ff_vorbis_parse_fmtp_config(codec, ctx, attr, value); break; default: break; } return; }
1threat
Remove 'search' option but leave 'search columns' option : <p>I would like to remove 'global search' option from my application, but leave 'column search' option. Any ideas? I've tried different paramethers like <code>searching=FALSE, filtering='none'</code>... None of this works properly. </p> <p>My code:</p> <p><code>server.R:</code></p> <pre><code>library("shiny") library("DT") data(iris) shinyServer(function(input, output) { output$tabelka &lt;- DT::renderDataTable({ datatable(iris, filter="top", selection="multiple", escape=FALSE) }) }) </code></pre> <p><code>ui.R</code></p> <pre><code>library("shiny") library("DT") shinyUI(fluidPage( DT::dataTableOutput("tabelka") )) </code></pre> <p>And picture which helps to understand my problem:</p> <p><a href="https://i.stack.imgur.com/B2Map.png" rel="noreferrer"><img src="https://i.stack.imgur.com/B2Map.png" alt="enter image description here"></a></p>
0debug
How to decode javascript error : <p>I am downloading file by clicking on link from ExtJS grid column. </p> <p>After download When I go back to my Application page I am getting one notification by</p> <p><strong>The operation failed due to a system error. Please try again.</strong> </p> <p>In fiddler I am checking</p> <p>I am getting this error with 200 CODE. </p> <p>My Question is how to decode this.</p> <blockquote> <p>ErrorInfo=Invalid%20Element%20%22id%22%3A%20%22COSMIC%20Mutation%20Data%20v77%22%3Cbr%3ESource%20%3AExt.dom.Element%3Cbr%3EMethod%3Aconstructor%3Cbr%3E%27 &amp; ErrSource =Java%20Script</p> </blockquote>
0debug
av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) { int n = 1 << nbits; int i; const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1)*2*M_PI/n; s->nbits = nbits; s->inverse = trans == IRDFT || trans == IRIDFT; s->sign_convention = trans == RIDFT || trans == IRIDFT ? 1 : -1; if (nbits < 4 || nbits > 16) return -1; if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) return -1; s->tcos = ff_cos_tabs[nbits-4]; s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2); for (i = 0; i < (n>>2); i++) { s->tcos[i] = cos(i*theta); s->tsin[i] = sin(i*theta); } return 0; }
1threat
Use a variable to set string length : I am working on a scanning system to make edits to very long strings. For the scanning I am using a string to contain the current letters being checked. I need to set the length of the string "scanSet" to the length of the variable "stringLength". The variable "stringLenght" is a constant but because it is set to the length of a different string it is considered not constant. Any fixes? string inputScan; cout << "Enter string." << endl; getline(cin, inputScan); const int stringLength = inputScan.length(); char scanSet[stringLength];
0debug