Questions Tagged with #Selenium

Selenium is a popular open-source tool for automating web browsers. When using this tag, also include other tags for the specific components you are using, e.g. selenium-webdriver for the language bindings, selenium-ide, selenium-grid, etc.

How to open a link in new tab (chrome) using Selenium WebDriver?

System.setProperty("webdriver.chrome.driver", "D:\\softwares\\chromedriver_win32\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SEC..

SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81

I am currently new to robot framework.I am currently using latest window version of chrome and chromedriver which is 80 but when i try to run the test it gives the message "SessionNotCreatedException:..

How to select a drop-down menu value with Selenium using Python?

I need to select an element from a drop-down menu. For example: <select id="fruits01" class="select" name="fruits"> <option value="0">Choose your fruits:</option> <option v..

How do you tell if a checkbox is selected in Selenium for Java?

I am using Selenium in Java to test the checking of a checkbox in a webapp. Here's the code: private boolean isChecked; private WebElement e; I declare e and assign it to the area where the checkbox ..

How to click on hidden element in Selenium WebDriver?

I have a grid which displays some records. When I click on a record and inspect that element it is shown that it is hidden but it is visible in the grid. My HTML is: <a href="http://192.168.1.6/..

How to Maximize window in chrome using webDriver (python)

Is there a way to maximize the chrome browser window using python selenium WebDriver? Note: I am using Chrome Driver 23.0 Any solution on this would be greatly appreciated!..

Click in OK button inside an Alert (Selenium IDE)

I need to click the 'Ok' button inside an alert window with a Selenium command. I've tried assertAlert or verifyAlert but they don't do what I want. It's possible the click the 'Ok' button? If so, ca..

Page scroll up or down in Selenium WebDriver (Selenium 2) using java

I have written the following code in Selenium 1 (a.k.a Selenium RC) for page scrolling using java: selenium.getEval("scrollBy(0, 250)"); What is the equivalent code in Selenium 2 (WebDriver)?..

How to click a href link using Selenium

I have a html href link <a href="/docs/configuration">App Configuration</a> using Selenium I need to click the link. Currently, I am using below code - Driver.findElement(By.xpa..

How to set Google Chrome in WebDriver

I am trying to set Chrome as my browser for testing with Web-Driver and set the chromedriver.exe file properly but I am still getting the following error: org.openqa.selenium.WebDriverException: The..

How to perform mouseover function in Selenium WebDriver using Java?

I want to do mouseover function over a drop down menu. When we hover over the menu, it will show the new options. I tried to click the new options using the xpath. But cannot click the menus directly...

How to make Firefox headless programmatically in Selenium with Python?

I am running this code with python, selenium, and firefox but still get 'head' version of firefox: binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', log_file=sys.stdout)..

Set value of input instead of sendKeys() - Selenium WebDriver nodejs

I have a long string to test and sendKeys() takes too long. When I tried to set the value of the text the program crashes. I know the Selenium sendKeys() is the best way to test the actual user input,..

How to get selected option using Selenium WebDriver with Java

I want to get the selected label or value of a drop down using Selenium WebDriver and then print it on the console. I am able to select any value from the drop down, but I am not able to retrieve the..

Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

I have box where I run tests. It seems like Jenkins would ssh in and execute commands described in the specific job that's running. Here I am trying to run my Selenium Webdriver tests, but it tells ..

How to select specified node within Xpath node sets by index with Selenium?

I'm writing a Selenium testcase. And here's the xpath expression I use to match all 'Modify' buttons within a data table. //img[@title='Modify'] My question is, how can I visit the matched node set..

Access to file download dialog in Firefox

Is there any kind of API that can allow me to manipulate a file download dialog in Firefox? (I want to access the one that appears when user does something, not initiate one myself). What I want to d..

How to set "value" to input web element using selenium?

I have element in my code that looks like this: <input id="invoice_supplier_id" name="invoice[supplier_id]" type="hidden" value=""> I want to set its value, so I created a web element with it..

Clicking at coordinates without identifying element

As part of my Selenium test for a login function, I would like to click a button by identifying its coordinates and instructing Selenium to click at those coordinates. This would be done without ident..

Selenium webdriver click google search

I'm searching text "Cheese!" on google homepage and unsure how can I can click on the searched links after pressing the search button. For example I wanted to click the third link from top on search p..

Using Selenium Web Driver to retrieve value of a HTML input

In the HTML of a webapp there is the following code <input type="text" name="prettyTime" id="prettyTime" class="ui-state-disabled prettyTime" readonly="readonly"> What is actually shown on t..

Selenium Error - The HTTP request to the remote WebDriver timed out after 60 seconds

I've been using Selenium for a number of months, which we're using to automate some of our internal testing processes. The scripts have been passing fine. I've recently upgraded to C# 2.40.0 webdriver..

How can I generate an HTML report for Junit results?

Is there a way to (easily) generate a HTML report that contains the tests results ? I am currently using JUnit in addition to Selenium for testing web apps UI. PS: Given the project structure I am no..

Selenium wait until document is ready

Can anyone let me how can I make selenium wait until the time the page loads completely? I want something generic, I know I can configure WebDriverWait and call something like 'find' to make it wait b..

SyntaxError: Use of const in strict mode?

I am trying to login on facebook.com with selenium-webdriver. var webdriver = require('selenium-webdriver'), By = require('selenium-webdriver').By, until = require('selenium-webdriver').until..

Cannot find firefox binary in PATH. Make sure firefox is installed

In Selenium Grid I am trying to execute a simple program and I'm getting Cannot find firefox binary in PATH though I have added the binary path in my code. My code and the error are given below. Kindl..

Is there a way to get element by XPath using JavaScript in Selenium WebDriver?

I am looking for something like: getElementByXpath(//html[1]/body[1]/div[1]).innerHTML I need to get the innerHTML of elements using JS (to use that in Selenium WebDriver/Java, since WebDriver can'..

How can I start InternetExplorerDriver using Selenium WebDriver

I downloaded the driver and I gave the exact path in my code but when I ran the code it shows me error my code with java is as below: System.out.println("Internet Explorer is selected"); System.setP..

How to get text of an element in Selenium WebDriver, without including child element text?

<div id="a">This is some <div id="b">text</div> </div> Getting "This is some" is non-trivial. For instance, this returns "This is some text": driver.find_element_by_id('..

How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?

Currently I'm trying to capture a screenshot using the Selenium WebDriver. But I can only obtain the whole page screen shot. However, what I wanted is just to capture a part of the page or perhaps jus..

How to get all options in a drop-down list by Selenium WebDriver using C#?

I'm new to both C# and Selenium WebDriver. I know how to select/click on an option in a drop-down list, but I've a problem before that. Since the drop-down list is dynamically generated, I have to g..

Test if element is present using Selenium WebDriver?

Is there a way how to test if an element is present? Any findElement method would end in an exception, but that is not what I want, because it can be that an element is not present and that is okay, t..

How do I setup the InternetExplorerDriver so it works

I am using WebDriver and I have downloaded the InternetExplorerDriver and was wondering what I do with it after it is downloaded? This says to put the driver in my path. Not really certain what exact..

How to handle authentication popup with Selenium WebDriver using Java

I'm trying to handle authentication popup using the code below: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.http.phishy-userpass-length", 255); profile.setPreference..

How to wait until an element is present in Selenium?

I'm trying to make Selenium wait for an element that is dynamically added to the DOM after page load. Tried this: fluentWait.until(ExpectedConditions.presenceOfElement(By.id("elementId")); In case ..

click command in selenium webdriver does not work

I have just recently done an export of my selenium IDE code to selenium web driver. I have found that a lot of the commands that worked in IDE either fail to work or selenium web driver claims to not ..

Selenium Webdriver: Entering text into text field

When I enter text into the text field it gets removed. Here is the code: String barcode="0000000047166"; WebElement element_enter = _driver.findElement(By.xpath("//*[@id='div-barcode']")); element..

How to get selenium to wait for ajax response?

How can I get selenium to wait for something like a calendar widget to load? Right now I am just doing a Thread.sleep(2500) after exporting the testcase to a junit program...

Xpath for href element

I need to click on the below href element,which is present among similar href elements. <a id="oldcontent" href="listDetails.do?camp=1865"><u>Re-Call</u></a> Can anyone prov..

How do I run Selenium in Xvfb?

I'm on EC2 instance. So there is no GUI. $pip install selenium $sudo apt-get install firefox xvfb Then I do this: $Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null & $DISPLAY=:1 java -..

IE Driver download location Link for Selenium

Usually I download the drivers for Selenium from https://code.google.com/p/selenium/downloads/list but I couldn't find the IEDriver Server at this location now. Can any one please share the latest do..

How can I check if some text exist or not in the page using Selenium?

I'm using Selenium WebDriver, how can I check if some text exist or not in the page? Maybe someone recommend me useful resources where I can read about it. Thanks..

How to switch to the new browser window, which opens after click on the button?

I have situation, when click on button opens the new browser window with search results. Is there any way to connect and focus to new opened browser window? And work with it, then return back to or..

Scroll Element into View with Selenium

Is there any way in either Selenium 1.x or 2.x to scroll the browser window so that a particular element identified by an XPath is in view of the browser? There is a focus method in Selenium, but it d..

How to identify and switch to the frame in selenium webdriver when frame does not have id

Can anyone tell me how I can identify and switch to the iframe which has only a title? <iframe frameborder="0" style="border: 0px none; width: 100%; height: 356px; min-width: 0px; min-height: 0px;..

How to install Selenium WebDriver on Mac OS

How to install Selenium WebDriver on Mac OS X 10.7.5 supporting Chrome, Firefox and safari ? What I have to set, where to install...

Selenium Web Driver & Java. Element is not clickable at point (x, y). Other element would receive the click

I used explicit waits and I have the warning: org.openqa.selenium.WebDriverException: Element is not clickable at point (36, 72). Other element would receive the click: ... Command duratio..

Debugging "Element is not clickable at point" error

I see this only in Chrome. The full error message reads: "org.openqa.selenium.WebDriverException: Element is not clickable at point (411, 675). Other element would receive the click: ..." The e..

element not interactable exception in selenium web automation

In the below code i cannot send password keys in the password field, i tried clicking the field, clearing the field and sending the keys. But now working in any of the method. But its working if i deb..

Selenium WebDriver and DropDown Boxes

If I want to select an option of a dropdown box, there are several ways to do that. I always used: driver.findElement(By.id("selection")).sendKeys("Germany"); But that didn't work every time. Som..

What is the difference between cssSelector & Xpath and which is better with respect to performance for cross browser testing?

I am working with the Selenium WebDriver 2.25.0 on multilingual web application & mainly test the page content (For different languages like Arabic, English, Russian & so on). For my applicat..

Get HTML source of WebElement in Selenium WebDriver using Python

I'm using the Python bindings to run Selenium WebDriver: from selenium import webdriver wd = webdriver.Firefox() I know I can grab a webelement like so: elem = wd.find_element_by_css_selector('#my-id..

What is difference between Implicit wait and Explicit wait in Selenium WebDriver?

There are Implicit and Explicit wait in Selenium WebDriver. What's the difference between them? Kindly share the knowledge about Selenium WebDriver. Please show the real time example with Implicit &a..

Find elements inside forms and iframe using Java and Selenium WebDriver

I'm trying to access elements that are present under <form> <iFrame> <form> elements </form> </iFrame> </form>. Could you help me on accessing these 'elements', wh..

Get page title with Selenium WebDriver using Java

How can I verify some text in the title tag using Selenium WebDriver and java?..

How to type in textbox using Selenium WebDriver (Selenium 2) with Java?

I am using Selenium 2. But after running following code, i could not able to type in textbox. package Actor; import org.openqa.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDr..

How to select element using XPATH syntax on Selenium for Python?

consider following HTML: <div id='a'> <div> <a class='click'>abc</a> </div> </div> I want to click abc, but the wrapper div could change, so driver.get_..

How to get HTTP Response Code using Selenium WebDriver

I have written tests with Selenium2/WebDriver and want to test if HTTP Request returns an HTTP 403 Forbidden. Is it possible to get the HTTP response status code with Selenium WebDriver?..

What is the difference between getText() and getAttribute() in Selenium WebDriver?

Both are used to get the WebElement value in between tags. Is my assumption right? If wrong, please elaborate...

Equivalent of waitForVisible/waitForElementPresent in Selenium WebDriver tests using Java?

With "HTML" Selenium tests (created with Selenium IDE or manually), you can use some very handy commands like WaitForElementPresent or WaitForVisible. <tr> <td>waitForElementPresent&l..

unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9

I am trying to run Selenium tests on Debian 7 but without success. The error is: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9.248316,platform=Linux 3.2.0..

How to check if an element is visible with WebDriver

With WebDriver from Selenium 2.0a2 I am having trouble checking if an element is visible. WebDriver.findElement returns a WebElement, which unfortunately doesn't offer an isVisible method. I can go a..

How can I ask the Selenium-WebDriver to wait for few seconds in Java?

I'm working on a Java Selenium-WebDriver. I added driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); and WebElement textbox = driver.findElement(By.id("textbox")); because my App..

Using XPATH to search text containing &nbsp;

I use XPather Browser to check my XPATH expressions on an HTML page. My end goal is to use these expressions in Selenium for the testing of my user interfaces. I got an HTML file with a content simi..

Selenium and xpath: finding a div with a class/id and verifying text inside

I'm trying to have xpath find a div and verify that the div has a specific string of text inside. Here's the HTML: <div class="Caption"> Model saved </div> and <div id="alertLabe..

Where to find 64 bit version of chromedriver.exe for Selenium WebDriver?

Can anybody tell where I can find 64 bit version of chromedriver.exe? I tried it with 32bit also but it doesn't call main method...

How to use Selenium with Python?

How do I set up Selenium to work with Python? I just want to write/export scripts in Python, and then run them. Are there any resources for that? I tried googling, but the stuff I found was either ref..

Need to find element in selenium by css

I want to find the element of this link "us states" in <h5>. I am trying this in craigslist. Any help will be highly appreciated Here is the url: http://auburn.craigslist.org/ <html cla..

Which ChromeDriver version is compatible with which Chrome Browser version?

Actually I'm a bit confused. Although I read several resources about this. For having a test of Selenium 3 using ChromeBrowser we need an extra app called ChromeDriver. I found this text from GitHub..

Selenium and xPath - locating a link by containing text

I'm trying to use xPath to find an element containing a piece of text, but I can't get it to work.... WebElement searchItemByText = driver.findElement(By.xpath("//*[@id='popover-search']/div/div/ul/l..

How to handle iframe in Selenium WebDriver using java

<div> <iframe id="cq-cf-frame "> <iframe id="gen367"> <body spellcheck="false" id="CQrte" style="height: 255px; font-size: 12px; font-family:tahoma,arial,he..

How do I set browser width and height in Selenium WebDriver?

I'm using Selenium WebDriver for Python. I want instantiate the browser with a specific width and height. So far the closest I can get is: driver = webdriver.Firefox() driver.set_window_size(1080,800..

Is it possible to run selenium (Firefox) web driver without a GUI?

We are considering upgrading our production server from Ubuntu-desktop 10.04 to Ubuntu-server 12.04. We have various services running on our current desktop OS such as Selenium Web Driver. My questi..

Python Selenium accessing HTML source

How can I get the HTML source in a variable using the Selenium module with Python? I wanted to do something like this: from selenium import webdriver browser = webdriver.Firefox() browser.get("http..

Class has been compiled by a more recent version of the Java Environment

While running selenium script, I am getting the following error message in Eclipse console: Class has been compiled by a more recent version of the Java Environment (class file version 53.0), this..

python selenium click on button

I am quite new to python selenium and I am trying to click on a button which has the following html structure: <div class="b_div"> <div class="button c_button s_button" onclick="submitF..

Running javascript in Selenium using Python

I am totally new to Selenium. I want to execute a javascript snippet in the following code(as commented in the code), but can't do so. Please help. from selenium import webdriver import selenium from..

On Selenium WebDriver how to get Text from Span Tag

On Selenium Webdriver, how I can retrieve text from a span tag & print? I need to extract the text UPS Overnight - Free HTML code are as follow: div id="customSelect_3" class="select_wrapp..

How to use the gecko executable with Selenium

I'm using Firefox 47.0 with Selenium 2.53. Recently they have been a bug between Selenium and Firefox which make code not working. One of the solution is to use the Marionnette driver. I followed th..

Getting the URL of the current page using Selenium WebDriver

I'm attempting to get the URL of the currently open page. I am using Selenium WebDriver and Java. I am accessing the current URL via: WebDriver driver = new WebDriver(); String url = driver.getCurr..

Selenium Webdriver move mouse to Point

I am currently trying to move the cursor to a point (org.openqa.selenium.Point) that has been set by checking for an occurrence of a marker on a live chart from which I can get no details but can find..

How can I select checkboxes using the Selenium Java WebDriver?

How can I check the checkboxes using an id or XPath expression? Is there a method similar to select by visibletext for a dropdown? Going through the examples given for all other related questions, I c..

Selenium WebDriver findElement(By.xpath()) not working for me

I've been through the xpath tutorials and checked many other posts, hence I'm not sure what I'm missing. I'm simply trying to find the following element by xpath: <input class="t-TextBox" type="e..

How do I set the selenium webdriver get timeout?

When I am using a proxy in webdriver like FirefoxDriver, if the proxy is bad then the get method will block forever. I set some timeout parameters, but this did not work out. This is my code: Firefo..

How to select the Date Picker In Selenium WebDriver

Currently working on Selenium WebDriver and using Java. I want to select values in date range from the drop down.. I want to know how can I select the values as Date, Month and year in the date picker..

Selenium: Can I set any of the attribute value of a WebElement in Selenium?

I have a WebElement, I want to reset its an attribute's value to some other value (for e.g. attr is the attribute, and I want to change its original value=1 to new value=10). Is it possible? I am us..

Is there any way to start with a POST request using Selenium?

I'm trying to start a Selenium test with a POST request to my application. Instead of a simple open(/startpoint) I would like to do something like open(/startpoint, stuff=foo,stuff2=bar) Is there a..

How to check if an alert exists using WebDriver?

I need to check the existence of Alert in WebDriver. Sometimes it pops up an alert but sometimes it will not pop up. I need to check if the alert exists first, then I can accept or dismiss it or it w..

Webdriver findElements By xpath

1)I am doing a tutorial to show how findElements By xpath works. I would like to know why it returns all the texts that following the <div> element with attribute id=container. code for xpath: ..

Refreshing Web Page By WebDriver When Waiting For Specific Condition

I'm looking for more elegant way to refresh webpage during tests (I use Selenium2). I just send F5 key but I wonder if driver has method for refreshing entire webpage Here is my code while(driv..

How do you fix the "element not interactable" exception?

I know this has been asked lots of times before but how do you get around the "element not interactable" exception? I'm new to Selenium so excuse me if I get something wrong. Here is my code: butto..

How to run Selenium WebDriver test cases in Chrome

I tried this WebDriver driver = new ChromeDriver(); But I'm getting the error as Failed tests: setUp(com.TEST): The path to the driver executable must be set by the webdriver.chrome.driver system ..

Selenium WebDriver can't find element by link text

I'm trying to select an element that includes an anchor, but the text is buried in a paragraph inside of a div. Here's the HTML I'm working with: <a class="item" ng-href="#/catalog/90d9650a36988e..

How can I scroll a web page using selenium webdriver in python?

I am currently using selenium webdriver to parse through facebook user friends page and extract all ids from the AJAX script. But I need to scroll down to get all the friends. How can I scroll down in..

Selenium using Java - The path to the driver executable must be set by the webdriver.gecko.driver system property

I am trying to launch Mozilla but still I am getting this error: Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.dr..

Switch tabs using Selenium WebDriver with Java

Using Selenium WebDriver with JAVA. I am trying to automate a functionality where I have to open a new tab do some operations there and come back to previous tab (Parent). I used switch handle but it'..

Error: org.testng.TestNGException: Cannot find class in classpath: EmpClass

When i'm trying to run the test suite, am getting this exception. We are using maven project here and i am done with refreshing, cleaning, reinstalling testNG and then imported the maven projects but ..

Wait until page is loaded with Selenium WebDriver for Python

I want to scrape all the data of a page implemented by a infinite scroll. The following python code works. for i in range(100): driver.execute_script("window.scrollTo(0, document.body.scrollHeigh..

How to select/get drop down option in Selenium 2

I am converting my selenium 1 code to selenium 2 and can't find any easy way to select a label in a drop down menu or get the selected value of a drop down. Do you know how to do that in Selenium 2? ..

Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed

Recently I switched computers and since then I can't launch chrome with selenium. I've also tried Firefox but the browser instance just doesn't launch. from selenium import webdriver d = webdriver...

How to find SQL Server running port?

Yes I read this How to find the port for MS SQL Server 2008? no luck. telnet 1433 returns connection failed, so I must specify other port. I tried to use netstat -abn but I don't see sql..

"’" showing on page instead of " ' "

’ is showing on my page instead of '. I have the Content-Type set to UTF-8 in both my <head> tag and my HTTP headers: <meta http-equiv="Content-Type" content="text/html; charset=UTF-..

Trying to include a library, but keep getting 'undefined reference to' messages

I am attempting to use the libtommath library. I'm using the NetBeans IDE for my project on Ubuntu linux. I have downloaded and built the library, I have done a 'make install' to put the resulting .a ..

Check if a path represents a file or a folder

I need a valid method to check if a String represents a path for file or a directory. What are valid directory names in Android? As it comes out, folder names can contain '.' chars, so how does system..

Colors in JavaScript console

Can Chrome's built-in JavaScript console display colors? I want errors in red, warnings in orange and console.log's in green. Is that possible?..

Updating state on props change in React Form

I am having trouble with a React form and managing the state properly. I have a time input field in a form (in a modal). The initial value is set as a state variable in getInitialState, and is passed ..

Spring Boot, Spring Data JPA with multiple DataSources

I'm trying to connect each @Repositories to different DataSource(s) with Spring Boot and Spring Data JPA. I used the following, http://xantorohara.blogspot.com/2013/11/spring-boot-jdbc-with-multiple.h..

Parse String to Date with Different Format in Java

I want to convert String to Date in different formats. For example, I am getting from user, String fromDate = "19/05/2009"; // i.e. (dd/MM/yyyy) format I want to convert this fromDate as a Date ..

OnclientClick and OnClick is not working at the same time?

I have a button like the following, <asp:Button ID="pagerLeftButton" runat="server" OnClientClick="disable(this)" onclick="pager_Left_Click" Text="<" /> When I use my button like that, onc..

How to unzip a file in Powershell?

I have a .zip file and need to unpack its entire content using Powershell. I'm doing this but it doesn't seem to work: $shell = New-Object -ComObject shell.application $zip = $shell.NameSpace("C:\a.z..

How to use Redirect in the new react-router-dom of Reactjs

I am using the last version react-router module, named react-router-dom, that has become the default when developing web applications with React. I want to know how to make a redirection after a POST ..

Email & Phone Validation in Swift

i am using the following code for phone number validation. But i am getting the following error. I cant able to proceed further. Help us to take it forward. class PhoneNumberValidation: Validation { ..

How do I cast a string to integer and have 0 in case of error in the cast with PostgreSQL?

In PostgreSQL I have a table with a varchar column. The data is supposed to be integers and I need it in integer type in a query. Some values are empty strings. The following: SELECT myfield::integer..

Using Linq to group a list of objects into a new grouped list of list of objects

I don't know if this is possible in Linq but here goes... I have an object: public class User { public int UserID { get; set; } public string UserName { get; set; } public int GroupID { get; s..

super() fails with error: TypeError "argument 1 must be type, not classobj" when parent does not inherit from object

I get some error that I can't figure out. Any clue what is wrong with my sample code? class B: def meth(self, arg): print arg class C(B): def meth(self, arg): super(C, self)...

Clear terminal in Python

Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?..

How to select a single column with Entity Framework?

Is there a way to get the entire contents of a single column using Entity Framework 4? The same like this SQL Query: SELECT Name FROM MyTable WHERE UserId = 1; ..

onchange event for input type="number"

How can I handle an onchange for <input type="number" id="n" value="5" step=".5" /> ? I can't do a keyup or keydown, because, the user may just use the arrows to change the value. I would want ..

nodejs module.js:340 error: cannot find module

I installed nodejs in C:\Program Files (x86)\nodejs then I created a .js file and saved it in my desktop just to output 'hello world' in the console: console.log('hello world'); When I tried to ru..

Finding an item in a List<> using C#

I have a list which contains a collection of objects. How can I search for an item in this list where object.Property == myValue?..

How to _really_ programmatically change primary and accent color in Android Lollipop?

First of all, this question asks a very similar question. However, my question has a subtle difference. What I'd like to know is whether it is possible to programmatically change the colorPrimary att..

Renaming the current file in Vim

How should I rename my current file in Vim? For example: I am editing person.html_erb_spec.rb I would like it renamed to person.haml_spec.rb I would like to continue editing person.haml_spec.rb H..

Python: printing a file to stdout

I've searched and I can only find questions about the other way around: writing stdin to a file :) Is there a quick and easy way to dump the contents of a file to stdout?..

inline conditionals in angular.js

I was wondering if there is a way in angular to conditionally display content other than using ng-show etc. For example in backbone.js I could do something with inline content in a template like: <..

How to include (source) R script in other scripts

I've created a utility R script, util.R, which I want to use from other scripts in my project. What is the proper way to ensure that the function this script defines are available to function in my ot..

jQuery - Check if DOM element already exists

I am trying to add some form elements dynamically via Ajax with jQuery. I want to make sure that I don't create the same element twice, so I only want to add it if it hasn't already been added to the ..

Java stack overflow error - how to increase the stack size in Eclipse?

I am running a program that I've written in Java in Eclipse. The program has a very deep level of recursion for very large inputs. For smaller inputs the program runs fine however when large inputs ar..

Check whether there is an Internet connection available on Flutter app

I have a network call to be executed. But before doing that I need to check whether the device have internet connectivity. This is what i have done so far: var connectivityResult = new Connectivit..

Making HTML page zoom by default

I've designed a page, where buttons look good when the browser zoom is at 90%, but by default other users view it at 100/125%+ in their browser which is resulting an overlap in buttons and input forms..

How can I git stash a specific file?

How can I stash a specific file leaving the others currently modified out of the stash I am about to save? For example, if git status gives me this: younker % gst # On branch master # Your bra..

Column standard deviation R

I was wondering if there was a built-in function in R that would compute the standard deviation for columns just like colMeans computes mean for every column. It would be simple enough to write my own..

htons() function in socket programing

I am new to socket programming and I am trying to understand the operation of htons(). I've read a few tutorials on the Internet like this and this one for instance. But I couldn't understand what ht..

String length in bytes in JavaScript

In my JavaScript code I need to compose a message to server in this format: <size in bytes>CRLF <data>CRLF Example: 3 foo The data may contain unicode characters. I need to send them..

AngularJs ReferenceError: angular is not defined

I trying to add a custom filter, but if I use the following code: angular.module('myApp',[]).filter('startFrom', function() { return function(input, start) { start = +start; //parse to in..

How to Find the Default Charset/Encoding in Java?

The obvious answer is to use Charset.defaultCharset() but we recently found out that this might not be the right answer. I was told that the result is different from real default charset used by java...

Plotting dates on the x-axis with Python's matplotlib

I am trying to plot information against dates. I have a list of dates in the format "01/02/1991". I converted them by doing the following: x = parser.parse(date).strftime('%Y%m%d')) which gives 19..

Do HTTP POST methods send data as a QueryString?

I'd like to know if the POST method on HTTP sends data as a QueryString, or if it use a special structure to pass the data to the server. In fact, when I analyze the communication with POST method f..

ffmpeg usage to encode a video to H264 codec format

I have a *.mp4 video file(MPEG4 video codec) and I am trying to convert this to a H264 video codec format(raw h.264 format) using ffmpeg on Linux(Version - FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1, ..

Is a URL allowed to contain a space?

Is a URI (specifically an HTTP URL) allowed to contain one or more space characters? If a URL must be encoded, is + just a commonly followed convention, or a legitimate alternative? In particular, ..

How to rename a component in Angular CLI?

Is there any shortcut to rename a component with the Angular CLI other than manually editing all the component files such as folder name, .css, .ts, spec.ts and app.module.ts? ..

YAML equivalent of array of objects in JSON

I have a JSON array of objects that I'm trying to convert to YAML. {"AAPL": [ { "shares": -75.088, "date": "11/27/2015" }, { "shares": 75.088, "date": "11/26/2015" }, ]} Is..

Read the package name of an Android APK

I need to get the package name of an Android APK. I have tried to unzip the APK and read contents of AndroidManifest.xml, but seems it's not a text file. How can I extract the APK's package name?..

Bootstrap center heading

It is my first Twitter Bootstrap experience. I have added some headings (h1, h2, etc.) and they are aligned by left side. What is the right way to center headings?..

Link a .css on another folder

I have some questions about how to link things. Imagine that I have a folder "Website" where my files for that website are stored, and another folder with fonts, and that the font folder has more fol..

What is the difference between int, Int16, Int32 and Int64?

What is the difference between int, System.Int16, System.Int32 and System.Int64 other than their sizes?..

Reference to non-static member function must be called

I'm using C++ (not C++11). I need to make a pointer to a function inside a class. I try to do following: void MyClass::buttonClickedEvent( int buttonId ) { // I need to have an access to all memb..

MongoDB SELECT COUNT GROUP BY

I am playing around with MongoDB trying to figure out how to do a simple SELECT province, COUNT(*) FROM contest GROUP BY province But I can't seem to figure it out using the aggregate function. I c..

TypeScript getting error TS2304: cannot find name ' require'

I am trying to get my first TypeScript and DefinitelyTyped Node.js application up and running, and running into some errors. I am getting the error "TS2304: Cannot find name 'require' " when I attemp..

Convert string to buffer Node

I am using a library which on call of a function returns the toString of a buffer. The exact code is return Buffer.concat(stdOut).toString('utf-8'); But I don't want string version of it. I just..

Return a value from AsyncTask in Android

One simple question: is it possible to return a value in AsyncTask? //AsyncTask is a member class private class MyTask extends AsyncTask<Void, Void, Void>{ protected Void doInBackground(Vo..

The 'Access-Control-Allow-Origin' header contains multiple values

I'm using AngularJS $http on the client side to access an endpoint of a ASP.NET Web API application on the server side. As the client is hosted on a different domain as the server, I need CORS. It wor..

How to Flatten a Multidimensional Array?

Is it possible, in PHP, to flatten a (bi/multi)dimensional array without using recursion or references? I'm only interested in the values so the keys can be ignored, I'm thinking in the lines of arra..

Set font-weight using Bootstrap classes

Is there any Twitter Bootstrap class for font-weight: bold and other values of font-weight? I would not create a new one if this already exists in Bootstrap...

Capturing image from webcam in java?

How can I continuously capture images from a webcam? I want to experiment with object recognition (by maybe using java media framework). I was thinking of creating two threads one thread: Node 1..

Java getHours(), getMinutes() and getSeconds()

As I know getHours(), getMinutes() and getSeconds() are all deprecated in Java and they are replaced with Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND. These will in fact return the hour, m..

Node JS Error: ENOENT

I'm following along with: The Node Beginner Book After testing with the code from another SO post: var Fs = require('fs'); var dirs = ['tmp']; var index; var stats; for (index = 0; index < dir..

CSS: Force float to do a whole new line

I have a bunch of float: left elements and some are SLIGHTLY bigger than others. I want the newline to break and have the images float all the way to the left instead of getting stuck on a bigger elem..

Add class to an element in Angular 4

I was trying to create an image gallery with Angular 4.The logic behind this is to add a Cascading Style Sheet (CSS) class to the selected image that will show a red border on the selected (clicked) i..

How do I convert a TimeSpan to a formatted string?

I have two DateTime vars, beginTime and endTime. I have gotten the difference of them by doing the following: TimeSpan dateDifference = endTime.Subtract(beginTime); How can I now return a string of..

Why does this code using random strings print "hello world"?

The following print statement would print "hello world". Could anyone explain this? System.out.println(randomString(-229985452) + " " + randomString(-147909649)); And randomString() looks like this..

How to do sed like text replace with python?

I would like to enable all apt repositories in this file cat /etc/apt/sources.list ## Note, this file is written by cloud-init on first boot of an instance ..

PHP Change Array Keys

Is there a way to change all the numeric keys to "Name" without looping through the array (so a php function)? [ 0 => 'blabla', 1 => 'blabla', 2 => 'blblll', // etc ..

What is the most accurate way to retrieve a user's correct IP address in PHP?

I know there are a plethora of $_SERVER variables headers available for IP address retrieval. I was wondering if there is a general consensus as to how to most accurately retrieve a user's real IP add..

How do I set the icon for my application in visual studio 2008?

How do I set the executable icon for my C++ application in visual studio 2008?..

More elegant way of declaring multiple variables at the same time

To declare multiple variables at the "same time" I would do: a, b = True, False But if I had to declare much more variables, it turns less and less elegant: a, b, c, d, e, f, g, h, i, j = True, Tr..

How to change the locale in chrome browser

I want to change Accept-language request header to anything I wanted in chrome, is there any extension or plugin where I can do it. I want to be able to change locale and language both. Main requireme..

Date minus 1 year?

I've got a date in this format: 2009-01-01 How do I return the same date but 1 year earlier?..

Hide element by class in pure Javascript

I have tried the following code, but it doesn't work. Any idea where I have gone wrong? _x000D_ _x000D_ document.getElementsByClassName('appBanner').style.visibility='hidden';_x000D_ <div class="a..

How to pass form input value to php function

I want to write a php page in which there is a html form. I want to send all input (number for example) of my form to a php function (instead of a javascript function; I make this to hide my javascrip..

Source file not compiled Dev C++

I just installed Dev C++ and I am learning C programming. the code i used was #include <stdio.h> int main() { printf("Hello world"); getch(); } I saved it as a .c file. When I compil..

Node.js ES6 classes with require

So up until now, i have created classes and modules in node.js the following way: var fs = require('fs'); var animalModule = (function () { /** * Constructor initialize object * @c..

How to manually set an authenticated user in Spring Security / SpringMVC

After a new user submits a 'New account' form, I want to manually log that user in so they don't have to login on the subsequent page. The normal form login page going through the spring security int..

Why do I keep getting Delete 'cr' [prettier/prettier]?

I am using vscode with Prettier 1.7.2 and Eslint 1.7.0. After every newline I get: [eslint] Delete 'cr' [prettier/prettier] This is the .eslintrc.json: { "extends": ["airbnb", "plugin:prettier/r..

Why Git is not allowing me to commit even after configuration?

This question seems like a duplicate but it's really not. Just a slight difference that keeps on repeating. git keeps on telling me: "please tell me who you are", even after setting it up. when I run ..

Javascript change Div style

I want that part 1 onclick div style changes and part 2 again on click it comes back to normal. I tried doing so but I failed to achieve the part 2 results. Following is the Javascript code functio..

How to draw checkbox or tick mark in GitHub Markdown table?

I am able to draw checkbox in Github README.md lists using - [ ] (for unchecked checkbox) - [x] (for checked checkbox) But this is not working in table. Does anybody know how to implement checkbox ..

What is the default encoding of the JVM?

Is UTF-8 the default encoding in Java? If not, how can I know which encoding is used by default?..

How to get current date in jquery?

I want to know how to use the Date() function in jQuery to get the current date in a yyyy/mm/dd format...

File content into unix variable with newlines

I have a text file test.txt with the following content: text1 text2 And I want to assign the content of the file to a UNIX variable, but when I do this: testvar=$(cat test.txt) echo $testvar t..

Where is GACUTIL for .net Framework 4.0 in windows 7?

i've made an assembly in the .net framework that I intend to publish to the GAC but I can't find the gacutil utlity. I've been googling a while and I've found a lot of suggestions, but nothing works:..

How do I trap ctrl-c (SIGINT) in a C# console app

I would like to be able to trap CTRL+C in a C# console application so that I can carry out some cleanups before exiting. What is the best way of doing this?..

urllib2 and json

can anyone point out a tutorial that shows me how to do a POST request using urllib2 with the data being in JSON format?..

Custom header to HttpClient request

How do I add a custom header to a HttpClient request? I am using PostAsJsonAsync method to post the JSON. The custom header that I would need to be added is "X-Version: 1" This is what I have don..

java.net.MalformedURLException: no protocol

I am getting Java exception like: java.net.MalformedURLException: no protocol My program is trying to parse an XML string by using: Document dom; DocumentBuilderFactory dbf = DocumentBuilderFacto..

Proper way to initialize a C# dictionary with values?

I am creating a dictionary in a C# file with the following code: private readonly Dictionary<string, XlFileFormat> FILE_TYPE_DICT = new Dictionary<string, XlFileFormat> { ..

What is the easiest way to remove the first character from a string?

Example: [12,23,987,43 What is the fastest, most efficient way to remove the "[", using maybe a chop() but for the first character?..

How to get the instance id from within an ec2 instance?

How can I find out the instance id of an ec2 instance from within the ec2 instance?..

How can I convert this foreach code to Parallel.ForEach?

I am a bit of confused about Parallel.ForEach. What is Parallel.ForEach and what does it exactly do? Please don't reference any MSDN link. Here's a simple example : string[] lines = File.ReadAllL..

- java.lang.NullPointerException - setText on null object reference

This is what I'm trying to do for several hours: I've got a MainActivity.java file (listing below) and a fragment_start.xml file with a start button. Tapping the start-button should display the activi..

Getting time span between two times in C#?

I have two textboxes. One for a clock in time and one for clock out. The times will be put in this format: Hours:Minutes Lets say I have clocked in at 7:00 AM and clocked out at 2:00 PM. With my c..

Why is $$ returning the same id as the parent process?

I have problem with Bash, and I don't know why. Under shell, I enter: echo $$ ## print 2433 (echo $$) ## also print 2433 (./getpid) ## print 2602 "getpid" is a C program to get current pid, lik..

Access elements in json object like an array

Possible Duplicate: I have a nested data structure / JSON, how can I access a specific value? I have a json object, like the one below: [ ["Blankaholm", "Gamleby"], ["2012-10-23", "201..

tsc is not recognized as internal or external command

I updated from VSCode 0.10.6 to 0.10.8, and tried using Typescript for the first time. Unfortunately I when I tell VSCode to build, I get the error: tsc is not a recognized as an internal or externa..

momentJS date string add 5 days

i have a start date string "20.03.2014" and i want to add 5 days to this with moment.js but i don't get the new date "25.03.2014" in the alert window. here my javascript Code: startdate = "20.03.201..

Get environment variable value in Dockerfile

I'm building a container for a ruby app. My app's configuration is contained within environment variables (loaded inside the app with dotenv). One of those configuration variables is the public ip of..

How to access parameters in a RESTful POST method

My POST method looks like this: @POST @Consumes({"application/json"}) @Path("create/") public void create(String param1, String param2){ System.out.println("param1 = " + param1); System.out.p..

Sql server - log is full due to ACTIVE_TRANSACTION

I have a very large database (50+ GB). In order to free space in my hard drive, I tried deleting old records from one of the tables . I ran the command: delete from Table1 where TheDate<'2004-01-0..

Create a data.frame with m columns and 2 rows

I would like to create a data.frame in R with m (a variable) number of columns (for example 30), and 2 rows and fill all the values in the data.frame initially with 0's. It seems as though data.frame ..

Content Security Policy "data" not working for base64 Images in Chrome 28

In this simple example, I'm trying to set a CSP header with the meta http-equiv header. I included a base64 image and I'm trying to make Chrome load the image. I thought the data keyword should do th..

How do I disable orientation change on Android?

I have an application that I just would like to use in portrait mode, so I have defined android:screenOrientation="portrait" in the manifest XML. This works OK for the HTC Magic phone (and prevents or..

Getting the difference between two sets

So if I have two sets: Set<Integer> test1 = new HashSet<Integer>(); test1.add(1); test1.add(2); test1.add(3); Set<Integer> test2 = new HashSet<Integer>(); test2.add(1); test2..

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0

I've got a gradle FAILURE: ..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0." Case description: Attached to the project codebase the next libs: APP..

Using tr to replace newline with space

Have output from sed: http://sitename.com/galleries/83450 72-profile Those two strings should be merged into one and separated with space like: http://sitename.com/galleries/83450 72-profile Two..

Extract date (yyyy/mm/dd) from a timestamp in PostgreSQL

I want to extract just the date part from a timestamp in PostgreSQL. I need it to be a postgresql DATE type so I can insert it into another table that expects a DATE value. For example, if I have 20..

How to generate .json file with PHP?

CREATE TABLE Posts { id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(200), url VARCHAR(200) } json.php code <?php $sql=mysql_query("select * from Posts limit 20"); echo '{"posts": ['; while($ro..

When and why to 'return false' in JavaScript?

When and why to return false in JavaScript?..

Android + Pair devices via bluetooth programmatically

I want to discover bluetooth devices in range, list and pair to them on click. I used following code but its just closing application when I click on device name which I want to pair. I want to know ..

Writing a dictionary to a csv file with one line for every 'key: value'

I've got a dictionary: mydict = {key1: value_a, key2: value_b, key3: value_c} I want to write the data to a file dict.csv, in this style: key1: value_a key2: value_b key3: value_c I wrote: impo..

How to copy Outlook mail message into excel using VBA or Macros

I'm a newbie in VBA and Macros. If someone helps me with VBA code and macros, it will be helpful. Daily I'll receive around 50-60 mails with one standard subject: "Task Completed". I have created a r..

How do I keep the screen on in my App?

For my Android app I never want the phone to lock or the back light to turn off..

What is the difference between JavaScript and ECMAScript?

What's the difference between ECMAScript and JavaScript? From what I've deduced, ECMAScript is the standard and JavaScript is the implementation. Is this correct?..

Is there a W3C valid way to disable autocomplete in a HTML form?

When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML <input type="text" id="cardNumber" name="cardNumber" autocomplete='off'/> will flag a w..

non static method cannot be referenced from a static context

First some code: import java.util.*; //... class TicTacToe { //... public static void main (String[]arg) { Random Random = new Random() ; toerunner () ; // this leads to a path of ..

Get all unique values in a JavaScript array (remove duplicates)

I have an array of numbers that I need to make sure are unique. I found the code snippet below on the internet and it works great until the array has a zero in it. I found this other script here on St..

Access PHP variable in JavaScript

Possible Duplicate: How to access PHP variables in JavaScript or jQuery rather than <?php echo $variable ?> Is there any way to get access to a PHP variable in JavaScript? I have a v..

Push Notifications in Android Platform

I am looking to write an app that receives pushed alerts from a server. I found a couple of methods to do this. SMS - Intercept the incoming SMS and initiate a pull from the server Poll the server..

I got error "The DELETE statement conflicted with the REFERENCE constraint"

I tried to truncate a table with foreign keys and got the message: "Cannot truncate table because it is being referenced by a FOREIGN KEY constraint". I read a lot of literature about the prob..

How should you diagnose the error SEHException - External component has thrown an exception

Whenever a user reports an error such as System.Runtime.InteropServices.SEHException - External component has thrown an exception? is there anything that I as a programmer can do to determine t..

Run a php app using tomcat?

Is it possible to run a PHP app using tomcat? Before you tell me to just use httpd, I already have a Java application running on my webserver at host/myapp. Now I want to install RoundCube at host/ro..

Remove local git tags that are no longer on the remote repository

We use tags in git as part of our deployment process. From time to time, we want to clean up these tags by removing them from our remote repository. This is pretty straightforward. One user deletes..

How to supply value to an annotation from a Constant java

I am thinking this may not be possible in Java because annotation and its parameters are resolved at compile time. I have an interface as follows, public interface FieldValues { String[] FIELD1 = ..

javascript change background color on click

Can you show me Javascript that allows you to change the background color of the page to another color. For example, I have a blue background color and I want to change it to green. The color must be ..

How can I insert data into a MySQL database?

I want to insert the integers 188 and 90 in my MySQL database, but the following code doesn't work: import MySQLdb conn = MySQLdb.connect(host= "localhost", user="root", ..

Separation of business logic and data access in django

I am writing a project in Django and I see that 80% of the code is in the file models.py. This code is confusing and, after a certain time, I cease to understand what is really happening. Here is what..

"NoClassDefFoundError: Could not initialize class" error

When I run my project, I get numerous outputs of this error: Sep 9, 2009 8:22:23 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet Jersey threw exception ..

Getting year in moment.js

What is the differenct between those two: var year = moment().format('YYYY'); var year = moment().year(); Is it just type of or anything else? I am just curious...

Using a global variable with a thread

How do I share a global variable with thread? My Python code example is: from threading import Thread import time a = 0 #global variable def thread1(threadname): #read variable "a" modify by t..

Faster way to zero memory than with memset?

I learned that memset(ptr, 0, nbytes) is really fast, but is there a faster way (at least on x86)? I assume that memset uses mov, however when zeroing memory most compilers use xor as it's faster, co..

iOS 11, 12, and 13 installed certificates not trusted automatically (self signed)

On our internal network, we use a self-signed CA certificate. This has worked fine for years, in both Safari and our iOS product, all the way through iOS 10. We simply install the CA certificate on an..

Python creating a dictionary of lists

I want to create a dictionary whose values are lists. For example: { 1: ['1'], 2: ['1','2'], 3: ['2'] } If I do: d = dict() a = ['1', '2'] for i in a: for j in range(int(i), int(i) + 2..

In Javascript/jQuery what does (e) mean?

I am new to JavaScript/jQuery and I've been learning how to make functions. A lot of functions have cropped up with (e) in brackets. Let me show you what I mean: $(this).click(function(e) { // do..

New lines (\r\n) are not working in email body

I am using PHP mail() function: $to = 'AAAA <[email protected]>'; $subject = 'BBBB'; $message = "CCCC\r\nCCCC CCCC \r CCC \n CCC \r\n CCC \n\r CCCC"; $headers = 'From: DDD&..

How to get the file-path of the currently executing javascript code

I'm trying to do something like a C #include "filename.c", or PHP include(dirname(__FILE__)."filename.php") but in javascript. I know I can do this if I can get the URL a js file was loaded from (e.g...

Drag and drop elements from list into separate blocks

I'm trying to get a jQuery component similar to the one on this site. Basically, there is a list with available elements that you can drag and drop into several blocks. I have quite a bit of JavaScr..

Eclipse Generate Javadoc Wizard: what is "Javadoc Command"?

I want to generate the javadocs for an open-source code-base I'm using. But I'm being asked for a "Javadoc Command" by the Eclipse Generate JavaDoc wizard and the help doesn't explain what this means...

How to get data from database in javascript based on the value passed to the function

In my web application, I want to retrieve data from database based on the value that is passed to the function. I wrote the query as follows. <script> //Functions to open database and to crea..

Sending JSON to PHP using ajax

I want to send some data in json format to php and do some operation in php. My problem is i can't send json data via ajax to my php file.Please help me how can i do that. I have tried this way.. <..

Image overlay on responsive sized images bootstrap

I am trying to create a responsive grid of images (with descriptions) that when moused over will have a color overlay (just the image and not the text). Because of the responsive heights of the images..

Link a photo with the cell in excel

Is there anyone who knows how to connect a picture with the cell that it is in at microsoft excel? For example in the first column I put some brands of mobile phones and in the second one some pictur..

key_load_public: invalid format

I used PuTTY Key Generator to generate a 4096 bit RSA-2 key with a passphrase. I save the .ppk and an openSSL format public key. The putty format public key doesn't work. In any case, my error is as..

JavaScript click event listener on class

I'm currently trying to write some JavaScript to get the attribute of the class that has been clicked. I know that to do this the correct way, I should use an event listener. My code is as follows: ..

WampServer orange icon

I am having problems with Wamp Server, the icon will never turn green. It is constantly stuck at orange. I have tried many ways, editing HOSTS file, .config files, disabling IIS, changing SKYPE's por..

jQuery input button click event listener

Brand new to jQuery. I was trying to set up an event listener for the following control on my page which when clicked would display an alert: <input type="button" id="filter" name="filter" value="..

Jquery href click - how can I fire up an event?

I have this anchor and on click I would like to popup something. This href is within a page that has other hrefs. <a class="sign_new" href="#sign_up">Sign up</a> jQuery: $(document).re..

Validating IPv4 addresses with regexp

I've been trying to get an efficient regex for IPv4 validation, but without much luck. It seemed at one point I had had it with (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?(\.|$)){4}, but it produces some st..

Convert a string representation of a hex dump to a byte array using Java?

I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array. I couldn't have phrased it better than the person that posted the same question here. But..

python setup.py uninstall

I have installed a python package with python setup.py install. How do I uninstall it?..

How to merge lists into a list of tuples?

What is the Pythonic approach to achieve the following? # Original lists: list_a = [1, 2, 3, 4] list_b = [5, 6, 7, 8] # List of tuples from 'list_a' and 'list_b': list_c = [(1,5), (2,6), (3,7), (4..

Space between Column's children in Flutter

I have a Column widget with two TextField widgets as children and I want to have some space between both of them. I already tried mainAxisAlignment: MainAxisAlignment.spaceAround, but the result was ..

HTML5 image icon to input placeholder

I'd like to add an image icon to an input placeholder, like in this picture: Please note that this is a placeholder, so when the user starts typing, the icon also disappears. I came with the follow..

How to do HTTP authentication in android?

I am checking out the class org.apache.http.auth. Any more reference or example if anyone has?..

how to run python files in windows command prompt?

I want to run a python file in my command prompt but it does nothing. These are the screen shots of my program i am testing with and the output the command prompt gives me. ..

Reading an integer from user input

What I am looking for is how to read an integer that was given by the user from the command line (console project). I primarily know C++ and have started down the C# path. I know that Console.ReadLine..

SQLException : String or binary data would be truncated

I have a C# code which does lot of insert statements in a batch. While executing these statements, I got "String or binary data would be truncated" error and transaction roledback. To find out the w..

JavaScript string encryption and decryption?

I'm interested in building a small app for personal use that will encrypt and decrypt information on the client side using JavaScript. The encrypted information will be stored in a database on a serv..

Android design support library for API 28 (P) not working

I've configured android-P SDK environment successfully. When I attempt to use the android design support library I face project build errors. Project configurations are: IDE: 3.2 Canary 17 Target API..

What's the difference between tilde(~) and caret(^) in package.json?

After I upgraded to the latest stable node and npm, I tried npm install moment --save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix. Why are the..

Reading and writing to serial port in C on Linux

I'm trying to send/receive data over an USB Port using FTDI, so I need to handle serial communication using C/C++. I'm working on Linux (Ubuntu). Basically, I am connected to a device which is listen..

Visual Studio: LINK : fatal error LNK1181: cannot open input file

I've been encountering a strange bug in Visual Studio 2010 for some time now. I have a solution consisting of a project which compiles to a static library, and another project which is really simple ..

What does "while True" mean in Python?

def play_game(word_list): hand = deal_hand(HAND_SIZE) # random init while True: cmd = raw_input('Enter n to deal a new hand, r to replay the last hand, or e to end game: ') if ..

Best tool for inspecting PDF files?

How can I inspecting PDF files, preferable with a tool? Use case: I'm trying to programmatically generate PDF files (using iText). I'm having trouble achieving certain layouts, but I have PDF files w..

Responsive Google Map?

How to make a responsive google map from the code <div class="map"> <iframe>...</iframe> </div> I use in css for full map .map{max-width:100%;} and small device ...

Capturing a form submit with jquery and .submit

I'm attempting to use jQuery to capture a submit event and then send the form elements formatted as JSON to a PHP page. I'm having issues capturing the submit though, I started with a .click() event b..

How do you redirect to a page using the POST verb?

When you call RedirectToAction within a controller, it automatically redirects using an HTTP GET. How do I explicitly tell it to use an HTTP POST? I have an action that accepts both GET and POST req..

Determine Whether Integer Is Between Two Other Integers?

How do I determine whether a given integer is between two other integers (e.g. greater than/equal to 10000 and less than/equal to 30000)? I'm using 2.3 IDLE and what I've attempted so far is not worki..

Validation for 10 digit mobile number and focus input field on invalid

I need the code for validating email and mobile number in jQuery and also focus() on that particular field where validations are not satisfied. This is my query <form name="enquiry_form" method=..

Unix command to check the filesize

I need to check the display the files my server with their sizes.Which command that I need to use. Any variants of ls command?..

Excel Macro : How can I get the timestamp in "yyyy-MM-dd hh:mm:ss" format?

I am using DateTime.Now in my Excel Macro to show the current timestamp. It shows timestamp in "dd-MM-yyyy hh:mm:ss" format. Instead, how can I get the timestamp in "yyyy-MM-dd hh:mm:ss" format?..

Install pip in docker

I'm not able to install pip in Docker. Here's my Dockerfile: FROM ubuntu:14.04 # Install dependencies RUN apt-get update -y RUN apt-get install -y git curl apache2 php5 libapache2-mod-php5 php5-mcr..

Find out the history of SQL queries

An update SQL query was executed on the server, which caused many problems later. How can I get the list of update queries executed in last 2 months, so that I can trace the exact problematic SQL que..

How to get english language word database?

I need a database of every single valid word in English. I checked the /usr/share/dict/words file, it contains less than 100k words. Wikipedia says English has 475k words. Where do I get the complete..

What is the lifetime of a static variable in a C++ function?

If a variable is declared as static in a function's scope it is only initialized once and retains its value between function calls. What exactly is its lifetime? When do its constructor and destructor..

Hadoop cluster setup - java.net.ConnectException: Connection refused

I want to setup a hadoop-cluster in pseudo-distributed mode. I managed to perform all the setup-steps, including startuping a Namenode, Datanode, Jobtracker and a Tasktracker on my machine. Then I tr..

Running two projects at once in Visual Studio

I created a solution in Visual C# 2010 Express that contains two projects: one is the client, the other is the server. I would like to debug both at the same time, but I can only seem to run one of th..

How to set a cookie for another domain

Say I have a website called a.com, and when a specific page of this site is loaded, say page link, I like to set a cookie for another site called b.com, then redirect the user to b.com. I mean, on l..

How can I get the "network" time, (from the "Automatic" setting called "Use network-provided values"), NOT the time on the phone?

I would like in my application to find a way to synch the date and time with something given by an external source. I don't want to use the phone time because I might get a difference of maybe 5 minu..

How to use OrderBy with findAll in Spring Data

I am using spring data and my DAO looks like public interface StudentDAO extends JpaRepository<StudentEntity, Integer> { public findAllOrderByIdAsc(); // I want to use some thing like thi..

How to manipulate arrays. Find the average. Beginner Java

I have a homework assignment and I was wondering if anyone could help me as I am new to Java and programming and am stuck on a question. The question is: The first method finds the average of the el..

How to run mvim (MacVim) from Terminal?

I have MacVim installed and I am trying to set it up as the editor for Git (version control), but I can't run 'mvim' from the command line as it isn't recognised. How do I setup mvim so I can run it ..

HTML Tags in Javascript Alert() method

I wanted to know if it's possible to add HTML tags to JavaScript alert() method, such as: <b> <ul> <li> etc. Thanks for your help..

Difference between HashSet and HashMap?

Apart from the fact that HashSet does not allow duplicate values, what is the difference between HashMap and HashSet? I mean implementation wise? It's a little bit vague because both use hash tables ..

Testing if a site is vulnerable to Sql Injection

I was reading about sql injection and i understand how it works if there is a form where the user can enter his username and login. What i dont get is how websites without a login page can be vulnerab..

How to write macro for Notepad++?

I would like to write a macro for Notepad++ which should replace char1, char2, char3 with char4, char5, char6, respectively...

What are best practices that you use when writing Objective-C and Cocoa?

I know about the HIG (which is quite handy!), but what programming practices do you use when writing Objective-C, and more specifically when using Cocoa (or CocoaTouch)...

ConnectionTimeout versus SocketTimeout

I'm having a problem with a library that I am using. It might be the library or it might be me using it wrong! Basically, when I do this (Timeout in milliseconds) _ignitedHttp.setConnectionTimeout(1..

Oracle SQL Developer and PostgreSQL

I'm trying to connect to a PostgreSQL 9.1 database using Oracle SQL Developer 3.0.04, but I'm not having any success so far. First, if I add a third party driver on preferences, when adding a new con..

CodeIgniter 500 Internal Server Error

I downloaded a PHP script written using CodeIgniter. when I run it from the localhost, on going to the admin folder, it shows localhost again. Also when running from my web host, it shows a 500 Intern..

XMLHttpRequest blocked by CORS Policy

I add an API with following script in let's say http://www.test.com: <script src="http://apiendpoint.com/api/v1/api.js"></script> <div id="api" data-apikey="LA59CJI9HZ-KIJK4I5-3CKJC"&..

how to iterate through dictionary in a dictionary in django template?

My dictionary looks like this(Dictionary within a dictionary): {'0': { 'chosen_unit': <Unit: Kg>, 'cost': Decimal('10.0000'), 'unit__name_abbrev': u'G', 'supplier__supplier': u"..

WebDriver: check if an element exists?

How to check if an element exist with web driver? Is using a try catch really the only possible way? boolean present; try { driver.findElement(By.id("logoutLink")); present = true; } catch (No..

How do I check out a specific version of a submodule using 'git submodule'?

How would I go about adding a Git submodule for a specific tag or commit?..

Box-Shadow on the left side of the element only

I have been having trouble setting a box shadow on the left side of an element only. I tried this: box-shadow: -10px 0px 3px 0px #aaa; However, the box shadow looks more like a grey line and lacks..

Pandas sum by groupby, but exclude certain columns

What is the best way to do a groupby on a Pandas dataframe, but exclude some columns from that groupby? e.g. I have the following dataframe: Code Country Item_Code Item Ele_Code Unit ..

PHP ternary operator vs null coalescing operator

Can someone explain the differences between ternary operator shorthand (?:) and null coalescing operator (??) in PHP? When do they behave differently and when in the same way (if that even happens)? ..

Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time

def check_web_server(host, port, path): h = httplib.HTTPConnection(host, port) h.request('GET',path) resp = h.getresponse() print 'HTTP Response:' print ' sta..

Access restriction: The type 'Application' is not API (restriction on required library rt.jar)

Here is the code: package mscontroller; import javax.swing.*; import com.apple.eawt.Application; public class Main { public static void main(String[] args) { Application app = new A..

Positional argument v.s. keyword argument

Based on this A positional argument is a name that is not followed by an equal sign (=) and default value. A keyword argument is followed by an equal sign and an expression that gives its..

Usage of __slots__?

What is the purpose of __slots__ in Python — especially with respect to when I would want to use it, and when not?..

Select single item from a list

Using LINQ what is the best way to select a single item from a list if the item may not exists in the list? I have come up with two solutions, neither of which I like. I use a where clause to select..

Visual Studio 2010 - recommended extensions

What are your recommended extensions for Visual Studio 2010? (Please indicate if its free or not And also its purpose / function too)..