Questions Tagged with #Configparser

ConfigParser is a Python module for reading and writing configuration files that have a structure similar to those of INI files in Microsoft Windows.

Python extending with - using super() Python 3 vs Python 2

Originally I wanted to ask this question, but then I found it was already thought of before... Googling around I found this example of extending configparser. The following works with Python 3: $ pyth..

Lists in ConfigParser

The typical ConfigParser generated file looks like: [Section] bar=foo [Section 2] bar2= baz Now, is there a way to index lists like, for instance: [Section 3] barList={ item1, item2 } Re..

Why cannot cast Integer to String in java?

I found some strange exception: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String How it can be possible? Each object can be casted to String, doesn't it? The co..

What is Cache-Control: private?

When I visit I get a response header that looks like Cache-Control:private Connection:keep-alive Content-Encoding:gzip Content-Type:text/css Date:Tue, 16 Oct 2012 06:37:53 GMT ..

How do you add a scroll bar to a div?

I have a popup that displays some results, and I want a scroll bar to be display since the results are being cutt off (and I don't want the popup to be too long)...

How to disable anchor "jump" when loading a page?

I think this may not be possible, will try and explain as best as I can. I have a page containing tabs (jquery powered), controlled by the following: I'm using this code, as provided by another user ..

Get the second highest value in a MySQL table

I have a table of employees and salaries defined that way: "name" (type: VARCHAR) "salary" (type: INTEGER) What query can I use to get the second highest salary in this table?..

What is the difference between response.sendRedirect() and request.getRequestDispatcher().forward(request,response)

I have got a problem with my page jump when I use JAVA, if I use: response.sendRedirect("login.jsp") then I get this url: http://localhost:8080/login.jsp But if I use request.getRequestDispathce..

Choosing the best concurrency list in Java

My thread pool has a fixed number of threads. These threads need to write and read from a shared list frequently. So, which data structure (it better be a List, must be monitor-free) in

How to use jQuery to select a dropdown option?

I was wondering if it’s possible to get jQuery to select an <option>, say the 4th item, in a dropdown box? <select> <option></option> <option></option> ..

How to increase font size in the Xcode editor?

To increase font-size in Xcode is a pain...

Getting Keyboard Input

How do I get simple keyboard input (an integer) from the user in the console in Java? I accomplished this using the* stuff, but it says it is deprecated. How should I do it now?..

iOS app 'The application could not be verified' only on one device

I have two iphone devices( 4s and 5 ) connected to my computer and i am trying to install an application in both the devices. It installs pretty well in iphone 5 but it gives an error 'The application..

What does hash do in python?

I saw an example of code that where hash function is applied to a tuple. As a result it returns a negative integer. I wonder what does this function do? Google does not help. I found a page that expla..

Generate random numbers with a given (numerical) distribution

I have a file with some probabilities for different values e.g.: 1 0.1 2 0.05 3 0.05 4 0.2 5 0.4 6 0.2 I would like to generate random numbers using this distribution. Does an existing module that ..

Simple way to create matrix of random numbers

I am trying to create a matrix of random numbers, but my solution is too long and looks ugly random_matrix = [[random.random() for e in range(2)] for e in range(3)] this looks ok, but in my impleme..

Namespace for [DataContract]

I can't find the namespace to use for [DataContract] and [DataMember] elements. According to what I've found, it seems that adding the following should be enough, but in my case it is not. using Syst..

What's the best way to convert a number to a string in JavaScript?

What's the "best" way to convert a number to a string (in terms of speed advantage, clarity advantage, memory advantage, etc) ? Some examples: String(n) n.toString() ""+n n+"" ..

How to force delete a file?

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar ..

form serialize javascript (no framework)

Wondering is there a function in javascript without jquery or any framework that allows me to serialize the form and access the serialized version?..

How to dismiss the dialog with click on outside of the dialog?

I have implemented a custom dialog for my application. I want to implement that when the user clicks outside the dialog, the dialog will be dismissed. What do I have to do for this?..

What is the difference between match_parent and fill_parent?

I'm a little confused about two XML properties: match_parent and fill_parent. It seems that both are the same. Is there any difference between them?..

Multiple IF statements between number ranges

I'm trying to set up a formula with multiple IF statements between number ranges but I'm seeing the error: Formula parse error Here is the forumula: =IF((AND(A2>0,A2<500),"Less than 500",..

How to get an ASP.NET MVC Ajax response to redirect to new page instead of inserting view into UpdateTargetId?

I am using the Ajax.BeginForm to create a form the will do an ajax postback to a certain controller action and then if the action is successful, the user should get redirected to another page (if the ..

Check if key exists and iterate the JSON array using Python

I have a bunch of JSON data from Facebook posts like the one below: {"from": {"id": "8", "name": "Mary Pinter"}, "message": "How ARE you?", "comments": {"count": 0}, "updated_time": "2012-05-01", "cr..

Submitting HTML form using Jquery AJAX

Im trying to submit a HTML form using AJAX using this example. My HTML code: <form id="formoid" action="studentFormInsert.php" title="" method="post"> <div> <label class="..

How to grant remote access to MySQL for a whole subnet?

I can easily grant access to one IP using this code: $ mysql -u root -p Enter password: mysql> use mysql mysql> GRANT ALL ON *.* to root@'' IDENTIFIED BY 'your-root-password'..

Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement

Is there any way in which I can clean a database in SQl Server 2005 by dropping all the tables and deleting stored procedures, triggers, constraints and all the dependencies in one SQL statement? REA..

Find the host name and port using PSQL commands

I have PSQL running, and am trying to get a perl application connecting to the database. Is there a command to find the current port and host that the database is running on?..

How to remove spaces from a string using JavaScript?

How to remove spaces in a string? For instance: Input: '/var/www/site/Brand new document.docx' Output: '/var/www/site/Brandnewdocument.docx' ..

Adobe Acrobat Pro make all pages the same dimension

Does anyone know how to change the dimensions of each page on an Acrobat document. Also how can I see the dimensions of each page seperately?? For example I have a 3 pages document. The first 2 pages..

PHP: How to handle <![CDATA[ with SimpleXMLElement?

I noticed that when using SimpleXMLElement on a document that contains those CDATA tags, the content is always NULL. How do I fix this? Also, sorry for spamming about XML here. I have been trying to ..

Android webview launches browser when calling loadurl

I created an Activity that has a title and a web view in a LinearLayout. In the onResume() method it calls webView.loadUrl(url). The problem is that the activity first shows the title with the rest of..

Declare variable MySQL trigger

My question might be simple for you, if you're used to MySQL. I'm used to PostgreSQL SGBD and I'm trying to translate a PL/PgSQL script to MySQL. Here is what I have : delimiter // CREATE TRIGGER p..

How to get current formatted date dd/mm/yyyy in Javascript and append it to an input

I would like to add a current date to a hidden HTML tag so that it can be sent to the server: <input type="hidden" id="DATE" name="DATE" value="WOULD_LIKE_TO_ADD_DATE_HERE"> How can I add a f..

How to use UTF-8 in resource properties with ResourceBundle

I need to use UTF-8 in my resource properties using Java's ResourceBundle. When I enter the text directly into the properties file, it displays as mojibake. My app runs on Google App Engine. Can any..

How to compare character ignoring case in primitive types

I am writing these lines of code: String name1 = fname.getText().toString(); String name2 = sname.getText().toString(); aru = 0; count1 = name1.length(); count2 = name2.length(); for (i = 0; i < ..

How do you post to an iframe?

How do you post data to an iframe?..

Edit a text file on the console using Powershell

I'm trying to figure out the easiest way to edit text files in the console (PowerShell in my case). I'm using Windows 7 64 bit. It galls me that I can't just type edit filename.txt to edit a file. T..

Gradle project refresh failed after Android Studio update

Here's the output: 11:57:04 AM Gradle 'KeddreaderProject' project refresh failed: Cause: org.gradle.internal.service.ServiceLocator.([Ljava/lang/ClassLoader;)V: I've tried to remove .gradle fo..

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

Update: A sample project reproducing this bug can be found here at Microsoft Connect. I have also tested and verified that the solution given in the accepted answer below works on that sample project...

CKEditor automatically strips classes from div

I am using CKEditor as a back end editor on my website. It is driving me round the bend though as it seems to want to change the code to how it sees fit whenever I press the source button. For example..

Error: Cannot invoke an expression whose type lacks a call signature

I am brand new to typescript, and I have two classes. In the parent class I have: abstract class Component { public deps: any = {}; public props: any = {}; public setProp(prop: string): any { ..

Driver executable must be set by the system property

I am using Selenium for automating the tests. My application exclusively uses IE, it will not work on other Browsers. Code: import; import

Undefined reference to 'vtable for xxx'

takeaway.o: In function `takeaway': project:145: undefined reference to `vtable for takeaway' project:145: undefined reference to `vtable for takeaway' takeaway.o: In function `~takeaway': project:151..

Escaping special characters in Java Regular Expressions

Is there any method in Java or any open source library for escaping (not quoting) a special character (meta-character), in order to use it as a regular expression? This would be very handy in dynamic..

Use CSS to automatically add 'required field' asterisk to form inputs

What is a good way to overcome the unfortunate fact that this code will not work as desired: <div class="required"> <label>Name:</label> <input type="text"> </div&g..

How to render an ASP.NET MVC view as a string?

I want to output two different views (one as a string that will be sent as an email), and the other the page displayed to a user. Is this possible in ASP.NET MVC beta? I've tried multiple examples: ..

xls to csv converter

I am using win32.client in python for converting my .xlsx and .xls file into a .csv. When I execute this code it's giving an error. My code is: def convertXLS2CSV(aFile): '''converts a MS Excel f..

fork: retry: Resource temporarily unavailable

I tried installing Intel MPI Benchmark on my computer and I got this error: fork: retry: Resource temporarily unavailable Then I received this error again when I ran ls and top command. What is ca..

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..

Spark Kill Running Application

I have a running Spark application where it occupies all the cores where my other applications won't be allocated any resource. I did some quick research and people suggested using YARN kill or /bin..

What is property in hasOwnProperty in JavaScript?

Consider: if (someVar.hasOwnProperty('someProperty') ) { // Do something(); } else { // Do somethingElse(); } What is the right use/explanation of hasOwnProperty('someProperty')? Why can't we simpl..

How to initialize a nested struct?

I cannot figure out how to initialize a nested struct. Find an example here: package main type Configuration struct { Val string Proxy struct { A..

How to check if a string is numeric?

I have a gpa program, and it works with the equalsIgnoreCase() method which compares two strings, the letter "a" to the user input, which checks if they put "a" or not. But now I want to add an except..

Ruby: What is the easiest way to remove the first element from an array?

Lets say I have an array [0, 132, 432, 342, 234] What is the easiest way to get rid of the first element? (0)..

How can I detect the encoding/codepage of a text file

In our application, we receive text files (.txt, .csv, etc.) from diverse sources. When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage...

Find Item in ObservableCollection without using a loop

Currently i have the following syntax (list is a list containing objects with many different properties (where Title is one of them): for (int i=0; i < list.Count; i++) { if(title == list[i].Ti..

Get a Div Value in JQuery

I have a page containing the following div element: <div id="myDiv" class="myDivClass" style="">Some Value</div> How would I retrieve the value ("Some Value") either through JQuery or t..

How to select the comparison of two columns as one column in Oracle

I cannot figure out how to add a column to my SELECT query indicating whether two columns contain the same data in Oracle. I would like to write a query like: select column1, column2, column1=column..

git checkout master error: the following untracked working tree files would be overwritten by checkout

I have a git repository. It has A B C D E ... commits. Now I want to checkout D as a new branch named Dbranch. So I excute:git checkout D -b Dbranch. And now I want to delete this branch. Firstly I ne..

linux: kill background task

How do I kill the last spawned background task in linux? Example: doSomething doAnotherThing doB & doC doD #kill doB ???? ..

How to prevent "The play() request was interrupted by a call to pause()" error?

I made a website where if the user clicks, it plays a sound. To prevent the sound from overlapping, I had to add the code: n.pause(); n.currentTime = 0;; But that causes the error: The pl..

Find and extract a number from a string

I have a requirement to find and extract a number contained within a string. For example, from these strings: string test = "1 test" string test1 = " 1 test" string test2 = "test 99" How can I do ..

Content Type text/xml; charset=utf-8 was not supported by service

I have a problem with a WCF service. I have a console application and I need to consume the service without using app.config, so I had to set the endpoint, etc. by code. I do have a service reference ..

could not access the package manager. is the system running while installing android application

While installing the android application in the emulator I am getting the following error. Please help me to resolve this error. Error message: emulator.exe -avd avd_name adb wait-for-device ..

How to create a .jar file or export JAR in IntelliJ IDEA (like Eclipse Java archive export)?

I was using IntelliJ IDEA IDE. I want to create a JAR file from Java compiled class files. But I didn't find a command or file. How to create a JAR file (like it is done in Eclipse)?..

How do I install Python 3 on an AWS EC2 instance?

I'm trying to install python 3.x on an AWS EC2 instance and: sudo yum install python3 doesn't work: No package python3 available. I've googled around and I can't find anyone else who has this pr..

How many bits or bytes are there in a character?

How many bits or bytes are there per "character"?..

how to format date in Component of angular 5

I am new to angular and looking to format date in component ngOnInit method. I have seen some example where pipe operator are used to format the data but i dont know how to format date in component fi..

Turn off textarea resizing

I'm trying to turn off textarea resizing in my site; right now I'm using this method: .textarea { clear:left; min-width: 267px; max-width: 267px; min-height:150px; max-height:150p..

How can I check if a checkbox is checked?

I am building a mobile web app with jQuery Mobile and I want to check if a checkbox is checked. Here is my code. <script type=text/javascript> function validate(){ if (remember.checked ==..

How to parse JSON data with jQuery / JavaScript?

I have a AJAX call that returns some JSON like this: $(document).ready(function () { $.ajax({ type: 'GET', url: 'http://example/functions.php', data: { get_param: 'valu..

How can I verify if a Windows Service is running

I have an application in C# (2.0 running on XP embedded) that is communicating with a 'watchdog' that is implemented as a Windows Service. When the device boots, this service typically takes some time..

How to extract text from an existing docx file using python-docx

I'm trying to use python-docx module (pip install python-docx) but it seems to be very confusing as in github repo test sample they are using opendocx function but in readthedocs they are using Docume..

Node.js Web Application examples/tutorials

So I finished watching Douglas Crockford's excellent series on Javascript, and in the final episode (so far), loopage he lays out why Node.js is a near perfect solution for server side code. He tal..

generating variable names on fly in python

Is there a way I can generate variable names in python in a loop and assign values to them? For example, if I have prices = [5, 12, 45] I want price1 = 5 price2 = 12 price3 = 45 Can I do this in..

Adding items to a JComboBox

I use a combo box on panel and as I know we can add items with the text only comboBox.addItem('item text'); But some times I need to use some value of the item and item text like in html select..

Find the files that have been changed in last 24 hours

E.g., a MySQL server is running on my Ubuntu machine. Some data has been changed during the last 24 hours. What (Linux) scripts can find the files that have been changed during the last 24 hours? Pl..

Javascript Get Element by Id and set the value

I have a javascript function to which I pass a parameter. The parameter represents the id of an element (a hidden field) in my web page. I want to change the value of this element. function myFunc(va..

How to remove all line breaks from a string

I have a text in a textarea and I read it out using the .value attribute. Now I would like to remove all linebreaks (the character that is produced when you press Enter) from my text now using .repla..

How to set thymeleaf th:field value from other variable

I have a simple text input field where i have to set default value from one object and save its final value in other. The following code is not working. <div th:object="${form}"> <input ..

java IO Exception: Stream Closed

This is the code I currently have: public class FileStatus extends Status{ FileWriter writer; public FileStatus(){ try { writer = new FileWriter("status.txt",true); } catch (IOExcepti..

Rotating a two-dimensional array in Python

In a program I'm writing the need to rotate a two-dimensional array came up. Searching for the optimal solution I found this impressive one-liner that does the job: rotated = zip(*original[::-1]) I..

What is a daemon thread in Java?

Can anybody tell me what daemon threads are in Java?..

How to part DATE and TIME from DATETIME in MySQL

I am storing a DATETIME field in a Table. Each value looks something like this: 2012-09-09 06:57:12 . I am using this syntax: date("Y-m-d H:i:s"); Now my question is, while fetching the..

Getting time difference between two times in PHP

Possible Duplicate: How to get time difference in minutes in PHP I am working on an attendance table to calculate the late and very late employees. I am storing the login time in the table ..

Jinja2 template variable if None Object set a default value

How to make a variable in jijna2 default to "" if object is None instead of doing something like this? {% if p %} {{ p.User['first_name']}} {% else %} NONE {%endi..

How do I do string replace in JavaScript to convert ‘9.61’ to ‘9:61’?

Given the code line var value = $("#text").val(); and value = 9.61, I need to convert 9.61 to 9:61. How can I use the JavaScript replace function here?..

Basic example of using .ajax() with JSONP?

Please could someone help me work out how to get started with JSONP? Code: $('document').ready(function() { var pm_url = ''; pm_url += '/user_timeline/stephenfry.jso..

Why is it important to override GetHashCode when Equals method is overridden?

Given the following class public class Foo { public int FooId { get; set; } public string FooName { get; set; } public override bool Equals(object obj) { Foo fooItem = obj as..

Basic http file downloading and saving to disk in python?

I'm new to Python and I've been going through the Q&A on this site, for an answer to my question. However, I'm a beginner and I find it difficult to understand some of the solutions. I need a very..

How to convert date to timestamp?

I want to convert date to timestamp, my input is 26-02-2012. I used new Date(myDate).getTime(); It says NaN.. Can any one tell how to convert this?..

How do you tell if caps lock is on using JavaScript?

How do you tell if caps lock is on using JavaScript? One caveat though: I did google it and the best solution I could find was to attach an onkeypress event to every input, then check each time if th..

draw diagonal lines in div background with CSS

I have a div for a preview box: HTML: <div class="preview-content">PREVIEW</div> CSS: .preview-content { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYA..

Is it correct to use alt tag for an anchor link?

Is it correct to use alt tag for an anchor link, something like <a href="#" class="test" alt="Something" src="sfasfs" ></a> ..

How do I remove all .pyc files from a project?

I've renamed some files in a fairly large project and want to remove the .pyc files they've left behind. I tried the bash script: rm -r *.pyc But that doesn't recurse through the folders as I thou..

How to send email from SQL Server?

How can I send an email using T-SQL but email address is stored in a table? I want to loop through the table and be able to send email. I cannot find a good example of doing this so far...

How do I add target="_blank" to a link within a specified div?

Let's say I have the following code: <div id="link_other"> <ul> <li><a href="">google</a></li> <li> <..

Get month name from Date

How can I generate the name of the month (e.g: Oct/October) from this date object in JavaScript? var objDate = new Date("10/11/2009"); ..

How to check if a DateTime field is not null or empty?

I am very new in C# and I have a doubt. In an application on which I am working I found something like it in the code: if (!String.IsNullOrEmpty(u.nome)) This code simply check if the nome field o..

java.lang.RuntimeException: Unable to start activity ComponentInfo

I know this error appeared on forum million of times, but please help me find what I missed. I'm trying to do simple tab orientated application,I don't have much (except errors) 1) my main activity i..

ssh server connect to host xxx port 22: Connection timed out on linux-ubuntu

I am trying to connect to remote server via ssh but getting connection timeout. I ran the following command ssh [email protected] and getting following result ssh: conne..

Search input with an icon Bootstrap 4

No clue how I can do this, since BS 4 doesn't support glyphicons. Do I set it up as a background or do I apply different positioning to a font-awesome icon? This is my code so far: _x000D_ _x000D_ ..

How do I turn off the output from tar commands on Unix?

I had a look at the options, but nothing seemed obvious as a manner in which to turn off the output when uncompressing a file. The below is the code I am currently using... I just need the option to s..

Which sort algorithm works best on mostly sorted data?

Which sorting algorithm works best on mostly sorted data?..

Selenium using Python - Geckodriver executable needs to be in PATH

I'm new to programming and started with Python about two months ago and am going over Sweigart's Automate the Boring Stuff with Python text. I'm using IDLE and already installed the Selenium module an..

Garbage collector in Android

I have seen many Android answers that suggest calling the garbage collector in some situations. Is it a good practice to request the garbage collector in Android before doing a memory-hungry operatio..

What is FCM token in Firebase?

In the new Firebase, under Notification, they have mentioned that developer can send notification to a particular device. For that, in console it asks for an FCM token. What is it exactly and how can ..

Negation in Python

I'm trying to create a directory if the path doesn't exist, but the ! (not) operator doesn't work. I'm not sure how to negate in Python... What's the correct way to do this? if (!os.path.exists("/usr..

An error occurred while collecting items to be installed (Access is denied)

I'm getting the error given below when I try to install the upgrade from Eclipse and it goes like half way and then throw the error. An error occurred while collecting items to be installed session ..

Loading DLLs at runtime in C#

I am trying to figure out how you could go about importing and using a .dll at runtime inside a C# application. Using Assembly.LoadFile() I have managed to get my program to load the dll (this part is..

What does '?' do in C++?

int qempty() { return (f == r ? 1 : 0); } In the above snippet, what does "?" mean? What can we replace it with?..

Display calendar to pick a date in java

In other languages like VB, C#, in occasions where you want the user to enter a date, say in a text box,we can make a calendar to appear once you click on it. So the user can click on the correspondin..

How do I convert a String to a BigInteger?

I'm trying to read some really big numbers from standard input and add them together. However, to add to BigInteger, I need to use BigInteger.valueOf(long);: private BigInteger sum = BigInteger.valu..

"ssl module in Python is not available" when installing package with pip3

I've install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with pip3. When I execute pip3 install <package>, I get the following SSL related erro..

How to use Greek symbols in ggplot2?

My categories need to be named with Greek letters. I am using ggplot2, and it works beautifully with the data. Unfortunately I cannot figure out how to put those greek symbols on the x axis (at the ..

How to force addition instead of concatenation in javascript

I'm trying to add all of the calorie contents in my javascript like this: $(function() { var data = []; $( "#draggable1" ).draggable(); $( "#draggable2" ).draggable(); $( "#draggable..

How do you handle a "cannot instantiate abstract class" error in C++?

How do you handle a "cannot instantiate abstract class" error in C++? I have looked at some of the similar errors here and none of them seem to be exactly the same or problem that I am having. But, t..

When to use HashMap over LinkedList or ArrayList and vice-versa

What is the reason why we cannot always use a HashMap, even though it is much more efficient than ArrayList or LinkedList in add,remove operations, also irrespective of the number of the elements. I ..

Java SSLException: hostname in certificate didn't match

I have been using the following code to connect to one of google's service. This code worked fine on my local machine : HttpClient client=new DefaultHttpClient(); HttpPost post = new HttpPost("https:..

How to write a test which expects an Error to be thrown in Jasmine?

I'm trying to write a test for the Jasmine Test Framework which expects an error. At the moment I'm using a Jasmine Node.js integration from GitHub. In my Node module I have the following code: thro..

XML Carriage return encoding

I was looking to represent a carriage return within an xml node. I have tried a whitespace preserve, hex entity with no luck- and a \n. viewing via a browser. Example <Quote> Alas, poor..

The simplest way to resize an UIImage?

In my iPhone app, I take a picture with the camera, then I want to resize it to 290*390 pixels. I was using this method to resize the image : UIImage *newImage = [image _imageScaledToSize:CGSizeMak..

How do you access the value of an SQL count () query in a Java program

I want to get to the value I am finding using the COUNT command of SQL. Normally I enter the column name I want to access into the getInt() getString() method, what do I do in this case when there is ..

Add a CSS border on hover without moving the element

I have a row that I am applying a background highlight to on hover. .jobs .item:hover { background: #e1e1e1; border-top: 1px solid #d0d0d0; } However, as the border adds 1px additional to ..

Java NIO FileChannel versus FileOutputstream performance / usefulness

I am trying to figure out if there is any difference in performance (or advantages) when we use nio FileChannel versus normal FileInputStream/FileOuputStream to read and write files to filesystem. I o..

Css Move element from left to right animated

I have an element that needs to be move from left to right and right to left when I change the left, right variables. Here is an jsfiddle example that I'm working on it. It moves left to right and ri..

How do I decode a string with escaped unicode?

I'm not sure what this is called so I'm having trouble searching for it. How can I decode a string with unicode from http\u00253A\u00252F\ to with JavaScript? I tr..

How to detect query which holds the lock in Postgres?

I want to track mutual locks in postgres constantly. I came across Locks Monitoring article and tried to run the following query: SELECT AS blocked_pid, a.usename AS blocked_user, ..

Access images inside public folder in laravel

How can I access the images stored inside public/images folder without the use of Laravel's own functions like assets()? I just want to get the direct URL of the images stored in images folder. Eg:..

Prevent HTML5 video from being downloaded (right-click saved)?

How can I disable "Save Video As..." from a browser's right-click menu to prevent clients from downloading a video? Are there more complete solutions that prevent the client from accessing a file pat..

How to use not contains() in xpath?

I have some XML that is structured like this: <whatson> <productions> <production> <category>Film</category> </production> <production&g..

How can you remove all documents from a collection with Mongoose?

I know how to... Remove a single document. Remove the collection itself. Remove all documents from the collection with Mongo. But I don't know how to remove all documents from the collection with ..

AddRange to a Collection

A coworker asked me today how to add a range to a collection. He has a class that inherits from Collection<T>. There's a get-only property of that type that already contains some items. He wants..

how to console.log result of this ajax call?

I have the following function in jQuery code: btnLogin.on('click', function(e,errorMessage){ console.log('my message' + errorMessage); e.preventDefault(); return $.ajax({ type: '..

How to download Google Play Services in an Android emulator?

I want to use Google Play Services API in my application, but when I open the emulator to test my application it sends me a message that says "Google Play Services must be downloaded". I know that occ..

How to printf a 64-bit integer as hex?

With the following code I am trying to output the value of a unit64_t variable using printf(). Compiling the code with gcc, returns the following warning: warning: format ‘%x’ expects argument..

Understanding React-Redux and mapStateToProps()

I'm trying to understand the connect method of react-redux, and the functions it takes as parameters. In particular mapStateToProps(). The way I understand it, the return value of mapStateToProps w..

How to fix curl: (60) SSL certificate: Invalid certificate chain

I get the following error running curl | sh on Mac OSX 10.9 (Mavericks): install npm@latest curl: (60) SSL certificate problem: Invalid certificate chain More details her..

In Python, how do you convert seconds since epoch to a `datetime` object?

The time module can be initialized using seconds since epoch: >>> import time >>> t1=time.gmtime(1284286794) >>> t1 time.struct_time(tm_year=2010, tm_mon=9, tm_mday=12, tm_..

Windows command to get service status?

I need to know the status of a service at the end of my batch script which restarts services using "net stop thingie" and "net start thingie". In my most favorite ideal world, I would like to e-mail ..

PostgreSQL database service

I downloaded PostgreSQL from their site - However, I can't create a database from pgAdmin and get a message: could not connect to server: Connection r..

GroupBy pandas DataFrame and select most common value

I have a data frame with three string columns. I know that the only one value in the 3rd column is valid for every combination of the first two. To clean the data I have to group by data frame by firs..

Failed to resolve version for org.apache.maven.archetypes

I have configured maven3.0.3 in my local machine. Have installed m2e eclipse plugin. But when i try to create a new maven project using maven-archetype-webapp, i get the following exception. Could n..

How to Set Active Tab in jQuery Ui

Can you please let me know how I can set the active tab in jquery ui with a button click out of the tabs? I have a button like: <input id="action" type="submit" value="Go to Action"> and he..

Is it possible to define more than one function per file in MATLAB, and access them from outside that file?

When I was studying for my undergraduate degree in EE, MATLAB required each function to be defined in its own file, even if it was a one-liner. I'm studying for a graduate degree now, and I have to w..

How do I select text nodes with jQuery?

I would like to get all descendant text nodes of an element, as a jQuery collection. What is the best way to do that?..

RelativeLayout center vertical

I want to make a list row layout. This layout has a imageview in the most left, a textview right next to the imageview, and a imageview in the most right. I want all of them are center vertical. <..

BAT file: Open new cmd window and execute a command in there

I'm trying to open a new command window in a BAT file: start %windir%\system32\cmd.exe After it opens, I'd like to execute a BAT command in the new window: echo "test in new window" How can I do..

For each row in an R dataframe

I have a dataframe, and for each row in that dataframe I have to do some complicated lookups and append some data to a file. The dataFrame contains scientific results for selected wells from 96 well ..

TensorFlow not found using pip

I'm trying to install TensorFlow using pip: $ pip install tensorflow --user Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching dist..

WebSocket with SSL

Is it possible to have WebSockets with HTTPS? When switching to HTTPS, my WebSocket returns a security error and works perfectly with regular HTTP. Below, a snippet; socket = new WebSocket("ws://my..

How to get line count of a large file cheaply in Python?

I need to get a line count of a large file (hundreds of thousands of lines) in python. What is the most efficient way both memory- and time-wise? At the moment I do: def file_len(fname): with op..

jQuery Validate Required Select

I am trying to validate html select element using jQuery Validate plugin. I set "required" rule to true but it always passes validation because zero index is chosed by default. Is there any way to def..

The smallest difference between 2 Angles

Given 2 angles in the range -PI -> PI around a coordinate, what is the value of the smallest of the 2 angles between them? Taking into account that the difference between PI and -PI is not 2 PI but z..

How to format DateTime columns in DataGridView?

I'm using a DataGridView with object data binding to display information about logging entities in a system, retrieved via SOAP from a remote service. One of the columns is called "Last action" and me..

ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

I have written a spring batch application using Spring boot. When I am trying to run that application using command line and classpath on my local system it is running fine. However, when I tried to r..

How to correctly display .csv files within Excel 2013?

It seems Excel 2013 doesn't read CSV files correctly (Excel 2010 does). Every time I open .csv files, all my data are displayed in the first column. I know I can go to DATA, Convert, and then choose ..

How to create a hex dump of file containing only the hex characters without spaces in bash?

How do I create an unmodified hex dump of a binary file in Linux using bash? The od and hexdump commands both insert spaces in the dump and this is not ideal. Is there a way to simply write a long st..

displayname attribute vs display attribute

What is difference between DisplayName attribute and Display attribute in ASP.NET MVC?..

Correct way to quit a Qt program?

How should I quit a Qt Program, e.g when loading a data file, and discovered file corruption, and user need to quit this app or re-initiate data file? Should I: call exit(EXIT_FAILURE) call QApplic..

SignalR Console app example

Is there a small example of a console or winform app using signalR to send a message to a .net hub?. I have tried the .net examples and have looked at the wiki but it is not making sense to me the rel..

C++ undefined reference to defined function

I cannot figure out why this is not working. I will put up all three of my files and possibly someone can tell me why it is throwing this error. I am using g++ to compile the program. Program: #in..

How to read connection string in .NET Core?

I want to read just a connection string from a configuration file and for this add a file with the name "appsettings.json" to my project and add this content on it: { "ConnectionStrings": { "Defaul..

Set style for TextView programmatically

I'm trying to use the TextView constructor with style like this: TextView myText = new TextView(MyActivity.this, null,; However, when I do this, the text view does not appear to t..

CSS transition shorthand with multiple properties?

I can't seem to find the correct syntax for the CSS transition shorthand with multiple properties. This doesn't do anything: .element { -webkit-transition: height .5s, opacity .5s .5s; -moz-tr..

What is the difference between an abstract function and a virtual function?

What is the difference between an abstract function and a virtual function? In which cases is it recommended to use virtual or abstract? Which one is the best approach? ..

WPF: Grid with column/row margin/padding?

Is it easily possible to specify a margin and/or padding for rows or columns in a WPF Grid? I could of course add extra columns to space things out, but this seems like a job for padding/margins (it ..

Why is my Spring @Autowired field null?

Note: This is intended to be a canonical answer for a common problem. I have a Spring @Service class (MileageFeeCalculator) that has an @Autowired field (rateService), but the field is null when I tr..

Lost connection to MySQL server at 'reading initial communication packet', system error: 0

I am getting error: "Lost connection to MySQL server at 'reading initial communication packet, system error: 0" while I am going to connect my db. If I am using localhost everything is working ..

how to set radio option checked onload with jQuery

How to set radio option checked onload with jQuery? Need to check if no default is set and then set a default..

Using the "With Clause" SQL Server 2008

Can someone show me a sample SQL server script that I can look at that uses the "With Clause"? I am trying to use this clause to iterate through 200 databases that contain the same table that I am ..

TypeError: unhashable type: 'numpy.ndarray'

From a text file containing three columns of data I want to be able to just take a slice of data from all three columns where the values in the first column are equal to the values defined in above. I..

MySQL - DATE_ADD month interval

I face a problem with the function DATE_ADD in MySQL. My request looks like this : SELECT * FROM mydb WHERE creationdate BETWEEN "2011-01-01" AND DATE_ADD("2011-01-01", INTERVAL 6 MONTH) GROUP BY..

Calculate AUC in R?

Given a vector of scores and a vector of actual class labels, how do you calculate a single-number AUC metric for a binary classifier in the R language or in simple English? Page 9 of "AUC: a Better..

Best practice for localization and globalization of strings and labels

I'm a member of a team with more than 20 developers. Each developer works on a separate module (something near 10 modules). In each module we might have at least 50 CRUD forms, which means that we cur..

Remove directory which is not empty

In my Node application I need to remove a directory which has some files, but fs.rmdir only works on empty directories. How can I do this?..

HTTP POST using JSON in Java

I would like to make a simple HTTP POST using JSON in Java. Let's say the URL is and it takes in the value {"name":"myname","age":"20"} labeled as 'details' for example. How would I g..

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac

I installed node using homebrew (Mojave), afterwards php stoped working and if I try to run php -v I get this error: php -v dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib Re..

LaTeX source code listing like in professional books

How should a latex source code listing look like to produce an output like in known books, for example one for the Spring Framework? I've tried with the latex listings package but wasn't able to produ..

How can one develop iPhone apps in Java?

I was wondering if is it possible to develop iPhone applications using Java plus XMLV, which claims to cross-compile Java-based Android applications to native iPhone applications. Is XMLV a viable way..

How to create a zip archive with PowerShell?

Is it possible to create a zip archive using PowerShell? ..

Correct use of flush() in JPA/Hibernate

I was gathering information about the flush() method, but I'm not quite clear when to use it and how to use it correctly. From what I read, my understanding is that the contents of the persistence con..

Transposing a 1D NumPy array

I use Python and NumPy and have some problems with "transpose": import numpy as np a = np.array([5,4]) print(a) print(a.T) Invoking a.T is not transposing the array. If a is for example [[],[]] th..

How to enable cURL in PHP / XAMPP

How do I enable cURL in PHP? ??..

Reading/writing an INI file

Is there any class in the .NET framework that can read/write standard .ini files: [Section] <keyname>=<value> ... Delphi has the TIniFile component and I want to know if there is anythi..

How to pass a user / password in ansible command

I want to use Ansible as part of another Python software. in that software I have a hosts list with their user / password. Is there a way to pass the user / pass of the SSH connection to the Ansible..

IntelliJ shortcut to show a popup of methods in a class that can be searched

I'm switching over from Eclipse to IntelliJ. In Eclipse, if you do Ctrl+O in the editor, it will show a hover popup that allows you to search for a method in the class you're editing. What is the equ..

TypeError: Converting circular structure to JSON in nodejs

I am using request package for nodejs i am using this code here var formData = ({first_name:firstname,last_name:lastname,user_name:username, email:email,password:password});{url:..

How to avoid the "divide by zero" error in SQL?

I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide by zero error encountered. What is the best way to write SQL code so that I will never see this error message again? I coul..

How to get name of calling function/method in PHP?

I am aware of function debug_backtrace, but I am looking for some ready to use implementation of function like GetCallingMethodName()? It would be perfect if it gave method's class too (if it is indee..

How do I auto size a UIScrollView to fit its content

Is there a way to make a UIScrollView auto-adjust to the height (or width) of the content it's scrolling? Something like: [scrollView setContentSize:(CGSizeMake(320, content.height))]; ..

How to install Java 8 on Mac

I want to do some programming with the latest JavaFX, which requires Java 8. I'm using IntelliJ 13 CE and Mac OS X 9 Mavericks. I ran Oracle's Java 8 installer, and the files look like they ended up a..

Scala: write string to file in one statement

For reading files in Scala, there is Source.fromFile("file.txt").mkString Is there an equivalent and concise way to write a string to file? Most languages support something like that. My favorite..

How to return HTTP 500 from ASP.NET Core RC2 Web Api?

Back in RC1, I would do this: [HttpPost] public IActionResult Post([FromBody]string something) { try{ // ... } catch(Exception e) { return new HttpStatusCodeResul..

Location for session files in Apache/PHP

What is the default location of session files on an installation of Apache/PHP on Ubuntu 10.10?..

Extract a single (unsigned) integer from a string

I want to extract the digits from a string that contains numbers and letters like: "In My Cart : 11 items" I want to extract the number 11...

How can a file be copied?

How do I copy a file in Python? I couldn't find anything under os...

Find duplicate records in a table using SQL Server

I am validating a table which has a transaction level data of an eCommerce site and find the exact errors. I want your help to find duplicate records in a 50 column table on SQL Server. Suppose my d..

Default values in a C Struct

I have a data structure like this: struct foo { int id; int route; int backup_route; int current_route; } and a function called update() that is used to req..