Questions Tagged with #Loadoptions

"Invalid JSON primitive" in Ajax processing

I am getting an error in an ajax call from jQuery. Here is my jQuery function: function DeleteItem(RecordId, UId, XmlName, ItemType, UserProfileId) { var obj = { RecordId: RecordId, ..

How to capture a list of specific type with mockito

Is there a way to capture a list of specific type using mockitos ArgumentCaptore. This doesn't work: ArgumentCaptor<ArrayList<SomeType>> argument = ArgumentCaptor.forClass(ArrayList.class..

Conditional Binding: if let error – Initializer for conditional binding must have Optional type

I am trying to delete a row from my Data Source and the following line of code: if let tv = tableView { causes the following error: Initializer for conditional binding must have Optional type, ..

Breaking out of nested loops

Is there an easier way to break out of nested loops than throwing an exception? (In Perl, you can give labels to each loop and at least continue an outer loop.) for x in range(10): for y in ran..

JSON array javascript

I need to store 3 pet names in string format, parse them into array and later read one by one Example pets = '{{"name":"jack"},{"name":"john"},{name:"joe"}}'; var arr = JSON.parse(pets); alert(arr..

Can I have H2 autocreate a schema in an in-memory database?

(I've already seen the H2 database In memory - Init schema via Spring/Hibernate question; it is not applicable here.) I'd like to know if there's a setting in H2 that will allow me to auto-create a s..

Looping through a DataTable

Well. I have a DataTable with multiple columns and multiple rows. I want to loop through the DataTable dynamically basically the output should look as follows excluding the braces : Name (DataColumn..

Python def function: How do you specify the end of the function?

I'm just learning python and confused when a "def" of a function ends? I see code samples like: def myfunc(a=4,b=6): sum = a + b return sum myfunc() I know it doesn't end because of the r..

PHP import Excel into database (xls & xlsx)

I tried to search for some plugins to import Excel file into MySQL database, one of them is The tool is so powerful that it displays the entire excel conten..

How to add calendar events in Android?

I'm just getting up to speed on Android, and today in a project meeting someone said that Android has no native calendar app so users just use whatever calendar app they like. Is this true, and if so..

How to compare two object variables in EL expression language?

I am creating a drop down list of all languages. The default language selection for the list will be determined by information added by the user: <select> <c:forEach items="${languages}..

UL list style not applying

I've got a stylesheet that will not, for whatever reason, apply list-style-type to a UL element. I'm using YUI's Grid CSS with their reset-fonts-grid.css file, which I know strips that out as part of ..

Failed linking file resources

This is the java file that is giving the error package com.example.daksh.timetable; import; import android.os.Bundle; import android.view.View; import androi..

View content of H2 or HSQLDB in-memory database

Is there a way to browse the content of an H2 or an HSQLDB in-memory database for viewing? For example, during a debugging session with Hibernate in order to check when the flush is executed; or to ma..

Caesar Cipher Function in Python

I'm trying to create a simple Caesar Cipher function in Python that shifts letters based on input from the user and creates a final, new string at the end. The only problem is that the final cipher te..

What does android:layout_weight mean?

I don't understand how to use this attribute. Can anyone tell me more about it?..

SQL: How to get the count of each distinct value in a column?

I have a SQL table called "posts" that looks like this: id | category ----------------------- 1 | 3 2 | 1 3 | 4 4 | 2 5 | 1 6 | 1 7 | 2 Each category number corresponds to a category. How wo..

How to log cron jobs?

I want to know how I can see exactly what the cron jobs are doing on each execution. Where are the log files located? Or can I send the output to my email? I have set the email address to send the log..

What does the arrow operator, '->', do in Java?

While hunting through some code I came across the arrow operator, what exactly does it do? I thought Java did not have an arrow operator. return (Collection<Car>)

Configuration with name 'default' not found. Android Studio

I have an Android Studio app. It has a library dependency (Android-Bootstrap), when I try to sync gradle, it gives me an error: Configuration with name 'default' not found. My structure is: -FT..

Finish all activities at a time

I have an application with multiple pages i.e., multiple activities and some of them remain open. Is there a way to close all activities at once?..

CSS: background-color only inside the margin

I have searched for an answer but couldn't find it anywhere. My question is reasonably simple: I have a background color of my body, then a large margin, and now I want a different background color in..

Select DataFrame rows between two dates

I am creating a DataFrame from a csv as follows: stock = pd.read_csv('data_in/' + filename + '.csv', skipinitialspace=True) The DataFrame has a date column. Is there a way to create a new DataFrame..

Rebasing a Git merge commit

Take the following case: I have some work in a topic branch and now I'm ready to merge back to master: * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 I perform the ..

How do I initialize the base (super) class?

In Python, consider I have the following code: >>> class SuperClass(object): def __init__(self, x): self.x = x >>> class SubClass(SuperClass): def __init__(self, y)..

How to access the contents of a vector from a pointer to the vector in C++?

I have a pointer to a vector. Now, how can I read the contents of the vector through pointer?..

Load image from url

I have an image URL. I want to display an image from this URL in an ImageView but I am unable to do that. How can this be achieved?..

Change Text Color of Selected Option in a Select Box

I have a select box. The options have been styled with different colors via a CSS file that has been referenced. I want to be able to select an option and change the text color of the closed select bo..

How to run jenkins as a different user

I have been trying to follow tutorials and this one: Deploy as Jenkins User or Allow Jenkins To Run As Different User? but I still can't for the love of the computing gods, run as a different user. H..

How do I analyze a program's core dump file with GDB when it has command-line parameters?

My program operates like this: exe -p param1 -i param2 -o param3 It crashed and generated a core dump file, I want to analyze the core dump file by gdb ./exe -p param1 -i param2 -o para..

Close dialog on click (anywhere)

Is there a default option to close a jQuery dialog by clicking somewhere on the screen instead of the close icon?..

Can't bind to 'dataSource' since it isn't a known property of 'table'

I am new in angular 5 development. I am trying to develop a data table with angular material using the example provided here: "". I am getting an ..

How to read file using NPOI

I found NPOI is very good to write Excel files with C#. But I want to open, read and modify Excel files in C#. How can I do this?..

Remove elements from collection while iterating

AFAIK, there are two approaches: Iterate over a copy of the collection Use the iterator of the actual collection For instance, List<Foo> fooListCopy = new ArrayList<Foo>(fooList); for..

How to move up a directory with Terminal in OS X

When I launch a new Terminal window, it starts me in 'Macintosh HD/Users/MyName'. How can I back out of my user directory, back up to the top level?..

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

org.hibernate.MappingException: Unknown entity

I'm trying to work through Beginning Hibernate 2nd edition, and I'm stuck trying to put together the simple working example with HSQLDB. When I run ant populateMessages, I get [java] org.hibernate.M..

How to create windows service from java jar?

I have an executable JAR file. Is it possible to create a Windows service of that JAR? Actually, I just want to run that on startup, but I don't want to place that JAR file in my startup folder, neith..

Android ListView Selector Color

Hi All, I have 2 questions regarding a ListView in Android: How can I get the color of the listview's focused row ? I tried to use the ListView.getSelector() method, which according to its document..

how to reference a YAML "setting" from elsewhere in the same YAML file?

I have the following YAML: paths: patha: /path/to/root/a pathb: /path/to/root/b pathc: /path/to/root/c How can I "normalise" this, by removing /path/to/root/ from the three paths, and have it..

Bootstrap 3.0 Sliding Menu from left

I've implemented a sliding menu from left to right in my bootstrap 3.0 website using mmenu. However, the performances in Android (samsung galaxy) are not ideal. I also have a default collapsing menu ..

gitbash command quick reference

Does anyone know where I can find a quick reference for all commands in gitbash for windows? The help command covers the most important, but I can't find info on basic navigation such as getting the c..

Select a row from html table and send values onclick of a button

I have HTML table where I need to select a row and send its first cell ID to a button and onclick of the button send the selected value to a function in Javascript. How can I achieve this? test.html ..

How do you make a HTTP request with C++?

Is there any way to easily make a HTTP request with C++? Specifically, I want to download the contents of a page (an API) and check the contents to see if it contains a 1 or a 0. Is it also possible ..

Why would you use Expression<Func<T>> rather than Func<T>?

I understand lambdas and the Func and Action delegates. But expressions stump me. In what circumstances would you use an Expression<Func<T>> rather than a plain old Func<T>?..

A potentially dangerous Request.Path value was detected from the client (*)

I am receiving the rather self explanatory error: A potentially dangerous Request.Path value was detected from the client (*). The issue is due to * in the request URL:

jQuery: get the file name selected from <input type="file" />

This code should work in IE (don't even test it in Firefox), but it doesn't. What I want is to display the name of the attached file. Any help? <html> <head> <title>example</ti..

POST request with a simple string in body with Alamofire

how is it possible to send a POST request with a simple string in the HTTP body with Alamofire in my iOS app? As default Alamofire needs parameters for a request: Alamofire.request(.POST, "http://my..

A SQL Query to select a string between two known strings

I need a SQL query to get the value between two known strings (the returned value should start and end with these two strings). An example. "All I knew was that the dog had been very bad and require..

Magento How to debug blank white screen

I have an error in my Magento backend that results in a blank screen (WSOD). I have set errors to on in admin but there is nothing being created in var/logs/. (I have checked permissions for that dire..

Iterating through a JSON object

I am trying to iterate through a JSON object to import data, i.e. title and link. I can't seem to get to the content that is past the :. JSON: [ { "title": "Baby (Feat. Ludacris) - Jus..

git: How to diff changed files versus previous versions after a pull?

When I run "git pull" I often want to know what changed between the last version of a file and the new one. Say I want to know what someone else committed to a particular file. How is that done? I'..

What is the best way to programmatically detect porn images?

Akismet does an amazing job at detecting spam comments. But comments are not the only form of spam these days. What if I wanted something like akismet to automatically detect porn images on a social n..

Pycharm does not show plot

Pycharm does not show plot from the following code: import pandas as pd import numpy as np import matplotlib as plt ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000..

Visual studio equivalent of java System.out

What do I use in Visual Studio (C#) to perform the equivalent of Java's System.out.println( /*stuff*/ ) ? Does the output from the command show in the Output window in the IDE? I have a button on a ..

Android XXHDPI resources

The Google Nexus 10 comes out shortly, and is the first device to use xxhdpi resources. It sports a display density of about 300 DPI (according to the Nexus 10 website and this calculator). However, ..

implement time delay in c

I don't know exactly how to word a search for this.. so I haven't had any luck finding anything.. :S I need to implement a time delay in C. for example I want to do some stuff, then wait say 1 minut..

Purpose of a constructor in Java?

What is the purpose of a constructor? I've been learning Java in school and it seems to me like a constructor is largely redundant in things we've done thus far. It remains to be seen if a purpose com..

How to find the type of an object in Go?

How do I find the type of an object in Go? In Python, I just use typeof to fetch the type of object. Similarly in Go, is there a way to implement the same ? Here is the container from which I am iter..

Ignore mapping one property with Automapper

I'm using Automapper and I have the following scenario: Class OrderModel has a property called 'ProductName' that isn't in the database. So when I try to do the mapping with: Mapper.CreateMap<Orde..

C# - Print dictionary

I have made a dictionary which contains two values a DateTime and a string. Now I want to print everything from the dictionary to a Textbox. Does anybody know how to do this. I have used this code to ..

Open link in new tab or window

Is it possible to open an a href link in a new tab instead of the same tab? <a href="http://your_url_here.html">Link</a> ..

fatal error: iostream.h no such file or directory

Possible Duplicate: No such file iostream.h when including Even after naming the source file with .cpp extension. my compiler gives this error, both in command prompt and Codeblocks. How ca..

port 8080 is already in use and no process using 8080 has been listed

I am trying to start Tomcat from Eclipse, but a problem occured: Port 8080 required by Tomcat v6.0 Server at localhost is already in use. The server may already be running in another process, or..

Current time in microseconds in java

On a Unix system, is there a way to get a timestamp with microsecond level accuracy in Java? Something like C's gettimeofday function...

Is returning out of a switch statement considered a better practice than using break?

Option 1 - switch using return: function myFunction(opt) { switch (opt) { case 1: return "One"; case 2: return "Two"; case 3: return "Three"; default: retur..

How to remove square brackets from list in Python?

LIST = ['Python','problem','whatever'] print(LIST) When I run this program I get [Python, problem, whatever] Is it possible to remove that square brackets from output?..

How to find third or n?? maximum salary from salary table?

How to find third or nth maximum salary from salary table(EmpID, EmpName, EmpSalary) in optimized way?..

Understanding implicit in Scala

I was making my way through the Scala playframework tutorial and I came across this snippet of code which had me puzzled: def newTask = Action { implicit request => taskForm.bindFromRequest.fold(..

How can I convert a stack trace to a string?

What is the easiest way to convert the result of Throwable.getStackTrace() to a string that depicts the stacktrace?..

Setting graph figure size

All I want to do is make the width greater and the height smaller. I'm just doing raster plots but this question applies to any MATLAB figure. I can manually resize it using the figure directly when..

mysql after insert trigger which updates another table's column

i'm trying to write a trigger, I have following tables: BookingRequest: +-----------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra ..

How can I find the number of years between two dates?

I am trying to determine an age in years from a certain date. Does anyone know a clean way to do this in Android? I have the Java api available obviously, but the straight-up java api is pretty weak..

Class has no member named

I have a problem with accessing a function from a class with the class object in my main function. I am just trying to make the object for the class and use that object to access the function inside t..

Checking if a number is a prime number in Python

I have written the following code, which should check if the entered number is a prime number or not, but there is an issue i couldn't get through: def main(): n = input("Please enter a number:") is_..

Remove duplicates from dataframe, based on two columns A,B, keeping row with max value in another column C

I have a pandas dataframe which contains duplicates values according to two columns (A and B): A B C 1 2 1 1 2 4 2 7 1 3 4 0 3 4 8 I want to remove duplicates keeping the row with max value in colu..

javascript convert int to float

I have a variable var fval = 4; now I want out put as 4.00..

Floating Div Over An Image

I'm having trouble floating a div over an image. Here is what I am trying to accomplish: _x000D_ _x000D_ .container {_x000D_ border: 1px solid #DDDDDD;_x000D_ width: 200px;_x000D_ ..

How to get year/month/day from a date object?

alert(dateObj) gives Wed Dec 30 2009 00:00:00 GMT+0800 How to get date in format 2009/12/30?..

How do I get an object's unqualified (short) class name?

How do I check the class of an object within the PHP name spaced environment without specifying the full namespaced class. For example suppose I had an object library/Entity/Contract/Name. The fo..

Tracking Google Analytics Page Views with AngularJS

I'm setting up a new app using AngularJS as the frontend. Everything on the client side is done with HTML5 pushstate and I'd like to be able to track my page views in Google Analytics...

Succeeded installing but could not start apache 2.4 on my windows 7 system

I am attempting to install and run apache 2.4 on my windows 7 system I went to the apache 2.4 bin directory and ran the following: Note: I opened the cmd window as administrator. C:\Apache24\bin>httpd..

Compare two DataFrames and output their differences side-by-side

I am trying to highlight exactly what changed between two dataframes. Suppose I have two Python Pandas dataframes: "StudentRoster Jan-1": id Name score isEnrolled Co..

How to update record using Entity Framework Core?

What is the best approach to update database table data in Entity Framework Core? Retrieve the table row, do the changes and save Use keyword Update in DB context and handle exception for item not ex..

ReferenceError: describe is not defined NodeJs

I am trying to define some endpoints and do a test using nodejs. In server.js I have: var express = require('express'); var func1 = require('./func1.js'); var port = 8080; var server = express(); se..

Adding a column after another column within SQL

How do I add a column after another column within MS SQL by using SQL query? TempTable ID int, Type nvarchar(20), Active bit NewTable ID int, Type nvarchar(20), Description text, ..

Changing the Git remote 'push to' default

I want to change the Git default remote branch destination so I could just git push Instead of: git push upstream Currently this is set to the origin remote and I want to set it to a different r..

Simple JavaScript problem: onClick confirm not preventing default action

I'm making a simple remove link with an onClick event that brings up a confirm dialog. I want to confirm that the user wants to delete an entry. However, it seems that when Cancel is clicked in the di..

Calling Non-Static Method In Static Method In Java

I'm getting an error when I try to call a non-static method in a static class. Cannot make a static reference to the non-static method methodName() from the type playback I can't make the method..

CSS text-transform capitalize on all caps

Here is my HTML: <a href="#" class="link">small caps</a> & <a href="#" class="link">ALL CAPS</a> Here is my CSS: .link {text-transform: capitalize;} The output is: ..

Troubleshooting BadImageFormatException

I have a Windows service written in C# using Visual Studio 2010 and targeting the full .NET Framework 4. When I run from a Debug build the service runs as expected. However, when I run it from a Rel..

How to remove elements from a generic list while iterating over it?

I am looking for a better pattern for working with a list of elements which each need processed and then depending on the outcome are removed from the list. You can't use .Remove(element) inside a f..

Can VS Code run on Android?

Does anybody know about plans of MS to support running VS Code so it can run on Android OS?..

ASP.NET Core form POST results in a HTTP 415 Unsupported Media Type response

Sending a form POST HTTP request (Content-Type: application/x-www-form-urlencoded) to the below controller results into a HTTP 415 Unsupported Media Type response. public class MyController : Control..

Get list of all input objects using JavaScript, without accessing a form object

I need to get all the input objects and manipulate the onclick param. The following does the job for <a> links. Looking for something like this for input tags. for (var ls = document.links, nu..

Validation of radio button group using jQuery validation plugin

How to perform validation for a radio button group (one radio button should be selected) using jQuery validation plugin?..

Getting URL

How do I go about either making, or retrieving facebook short url's ( from a page, profile, event etc? I want to update my url shortener site - but if the user links to a facebook page I want to..

How can I get current date in Android?

I wrote the following code Date d = new Date(); CharSequence s = DateFormat.format("MMMM d, yyyy ", d.getTime()); But is asking me parameter, I want current date in string format, like 28-Dec-..

Tomcat base URL redirection

Using tomcat, how do I get a request for to redirect to ? i haven't even managed to get an index.html to display from http://myd..

Live Video Streaming with PHP

I have a PHP/AJAX/MYSQL chat application. I want to add video chatting to my application. How can I create live video streaming to be used for live video conferences/chatting in a PHP application. Wha..

starting file download with JavaScript

Let's say I have download links for files on my site. When clicked these links send an AJAX request to the server which returns the URL with the location of the file. What I want to do is direct t..

How to play YouTube video in my Android application?

How do I play YouTube videos in my application? I want to play video by streaming it directly from YouTube without downloading. Also, while playing videos, I want provide menu options. I don't want to..

How to get a view table query (code) in SQL Server 2008 Management Studio

I have a view in SQL Server 2008 and would like to view it in Management Studio. Example: --is the underlying query for the view Example_1 select * from table_aView View name: Example_1 How to ..

C# if/then directives for debug vs release

In Solution properties, I have Configuration set to "release" for my one and only project. At the beginning of the main routine, I have this code, and it is showing "Mode=Debug". I also have these ..

Building a complete online payment gateway like Paypal

So this question isn't about integrating an existing payment gateway into my site. This is more of a architectural question. I want to build a system similar to Paypal. Now I understand that Paypal o..

Getting rid of all the rounded corners in Twitter Bootstrap

I love Twitter Bootstrap 2.0 - I love how it's such a complete library... but I want to make a global modification for a very boxy-not-round site, which is to get rid of all the rounded corners in Boo..

Laravel, sync() - how to sync an array and also pass additional pivot fields?

Official Laravel documentation has this on sync() function: $user->roles()->sync( array( 1, 2, 3 ) ); You may also associate other pivot table values with the given IDs: $user->roles()-&g..

ArrayList of String Arrays

I would like to do something like this: private ArrayList<String[]> addresses = new ArrayList<String[3]>(); This does not seem to work. Whats the easiest way of storing multiple address..

How to insert a large block of HTML in JavaScript?

If I have a block of HTML with many tags, how do insert it in JavaScript? var div = document.createElement('div'); div.setAttribute('class', 'post block bc2'); div.innerHTML = 'HERE TOO MUCH HTML tha..

Deserialize a JSON array in C#

I'm stuck with a tricky problem. I've a JSON string of this format: [{ "record": { "Name": "Komal", "Age": 24, "Location": "Siliguri" } ..

Showing an image from an array of images - Javascript

I have a large image which is shown on my homepage, and when the user clicks the "next_img" button the large image on the homepage should change to the next image in the array. However, the next arr..

Counting repeated characters in a string in Python

I want to count the number of times each character is repeated in a string. Is there any particular way to do it apart from comparing each character of the string from A-Z and incrementing a counter? ..

How to form a correct MySQL connection string?

I am using C# and I am trying to connect to the MySQL database hosted by 00webhost. I am getting error on the line connection.Open(): there is no mysql host with this parameters. I have checke..

Cannot stop or restart a docker container

When trying to stop or restart a docker container I'm getting the following error message: $ docker restart 5ba0a86f36ea Error response from daemon: Cannot restart container 5ba0a86f36ea: [2] Contain..

How to get last items of a list in Python?

I need the last 9 numbers of a list and I'm sure there is a way to do it with slicing, but I can't seem to get it. I can get the first 9 like this: num_list[0:9] ..

exception in thread 'main' java.lang.NoClassDefFoundError:

The following program is throwing error: public class HelloWorld { public static void main(String args[]) { System.out.println("Hello World!"); } } CLASSPATH C:\Program Files\Java\j..

Swift add icon/image in UITextField

I would like to add icon/image in UITextField. The icon/image should be left to placeholder. I tried this: var imageView = UIImageView(); var image = UIImage(named: "email.png"); imageView.image =..

Print the stack trace of an exception

How do I print the stack trace of an exception to a stream other than stderr? One way I found is to use getStackTrace() and print the entire list to the stream...

Difference between String replace() and replaceAll()

What's the difference between java.lang.String 's replace() and replaceAll() methods, other than later uses regex? For simple substitutions like, replace . with / , is there any difference?..

JavaScript regex for alphanumeric string with length of 3-5 chars

I need regex for validating alphanumeric String with length of 3-5 chars. I tried following regex found from the web, but it didn't even catch alphanumerics correctly. var myRegxp = /^([a-zA-Z0-9_-]..

Git credential helper - update password

I'm currently using GitHub over HTTPS and have the latest version of Git installed (1.9.0) along with the Git credential helper on Windows 7. On setting up my environment, I told git-credentials to p..

Best way to encode text data for XML

I was looking for a generic method in .Net to encode a string for use in an Xml element or attribute, and was surprised when I didn't immediately find one. So, before I go too much further, could I j..

Set up adb on Mac OS X

I spent quite sometime figuring how to set up adb on Mac, so I figure writing how to set it up might be useful to some people. adb is the command line tool to install and run android apps on your phon..

Building executable jar with maven?

I am trying to generate an executable jar for a small home project called "logmanager" using maven, just like this: How can I create an executable JAR with dependencies using Maven? I added the snip..

How do I build JSON dynamically in javascript?

var myJSON = { "list1" : [ "1", "2" ], "list2" : [ "a", "b" ], "list3" : [ { "key1" : "value1" }, { "key2" : "value2" } ], "not_a_list" : "11"..

Run-time error '3061'. Too few parameters. Expected 1. (Access 2007)

I have the following 'set recordset' line that I cannot get working. The parameters seem correct according to all available help I can find on the subject. The error displays : "Run-time error '3..

How to show Snackbar when Activity starts?

I want to show android Snackbar ( when the activity starts just like we show a Toast. But the problem is we have to specify the parent layout when creating Sna..

Where is the syntax for TypeScript comments documented?

Is the syntax for TypeScript comments documented anywhere? And by any chance, does it now support the C# /// system?..

How to List All Redis Databases?

I ran this command to access my redis server. telnet 6379 What is the command to show all of my databases?..

Change the background color of CardView programmatically

The CardView has an attribute card_view:cardBackgroundColor to define the background color. This attribute works fine. At the same time there isn't a method to change the color dynamically. I've jus..

How should we manage jdk8 stream for null values

Hello fellow Java developers, I know the subject may be a bit in advance as the JDK8 is not yet released (and not for now anyway..) but I was reading some articles about the Lambda expressions and par..

Intersect Two Lists in C#

I have two lists: List<int> data1 = new List<int> {1,2,3,4,5}; List<string> data2 = new List<string>{"6","3"}; I want do to something like var newData = data1.intersec..

CURL ERROR: Recv failure: Connection reset by peer - PHP Curl

I'm having this strange error, CURL ERROR: Recv failure: Connection reset by peer This is how it happens, if I did not connect to the server and all of a sudden trying to connect to the server via CU..

Received an invalid column length from the bcp client for colid 6

I want to bulk upload csv file data to sql server 2005 from c# code but I am encountering the below error - Received an invalid column length from the bcp client for colid 6. when bulk copy wri..

How to simulate key presses or a click with JavaScript?

I wrote a Google Chrome extension and the site that I want to use my extension on requires me to click or tab onto a text box (because I think it runs javaScript verification "onClick" only). I can ge..

Resize font-size according to div size

It is made of 9 boxes, with the middle on has text it in. I've made it so the boxes so they will resize with the screen resize so it will remain in the same place all the time. The text, however, doe..

Is there a foreach in MATLAB? If so, how does it behave if the underlying data changes?

Is there a foreach structure in MATLAB? If so, what happens if the underlying data changes (i.e. if objects are added to the set)?..

Global Variable from a different file Python

So I have two different files somewhat like this: from file2 import * foo = "bar"; test = SomeClass(); class SomeClass : def __init__ (self): global foo; pri..

TSQL How do you output PRINT in a user defined function?

Basically I want to use PRINT statement inside a user defined function to aide my debugging. However I'm getting the following error; Invalid use of side-effecting or time-dependent operator in '..

Get width height of remote image from url

So the alert gives undefined values for the width and height. I think the w and h values of the image from the img.onload calculation is not being passed to the values to return, or it may be returnin..

Updates were rejected because the tip of your current branch is behind its remote counterpart

Our workflow is such. We have a branch called dev which I can reach at origin/dev. When we do changes, we create a branch off dev: git checkout -b FixForBug origin/dev Now I have a branch called F..

Combining paste() and expression() functions in plot labels

Consider this simple example: labNames <- c('xLab','yLabl') plot(c(1:10),xlab=expression(paste(labName[1], x^2)),ylab=expression(paste(labName[2], y^2))) What I want is for the character entry ..

jquery find element by specific class when element has multiple classes

So I am working on something that wasn't well thought out in the build from the backend team. That leaves me with a document full of divs. What I am doing is rolling back from the element I need to ..

What is a clean, Pythonic way to have multiple constructors in Python?

I can't find a definitive answer for this. As far as I know, you can't have multiple __init__ functions in a Python class. So how do I solve this problem? Suppose I have a class called Cheese with the..

Untrack files from git temporarily

I have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont w..

How do you get total amount of RAM the computer has?

Using C#, I want to get the total amount of RAM that my computer has. With the PerformanceCounter I can get the amount of Available ram, by setting: counter.CategoryName = "Memory"; counter.Counterna..

Update Angular model after setting input value with jQuery

I have this simple scenario: Input element which value is changed by jQuery's val() method. I am trying to update the angular model with the value that jQuery set. I tried to write a simple direct..

How do I remove the space between inline/inline-block elements?

Given this HTML and CSS: _x000D_ _x000D_ span {_x000D_ display:inline-block;_x000D_ width:100px;_x000D_ background-color:palevioletred;_x000D_ }_x000D_ <p>_x000D_ <span> F..

How do you format code on save in VS Code

I would like to automatically format TypeScript code using the build-in formatter when I save a file in Visual Studio Code. I'm aware of the following options, but none of them is good enough: Fo..

Set the value of a variable with the result of a command in a Windows batch file

When working in a Bash environment, to set the value of a variable as the result of a command, I usually do: var=$(command -args) where var is the variable set by the command command -args. I can t..

Day Name from Date in JS

I need to display the name of the day given a date (like "05/23/2014") which I get from a 3rd party. I've tried using Date, but I only get the date. What is the correct way to get the name of the d..

How can I use a for each loop on an array?

I have an array of Strings: Dim sArray(4) as String I am going through each String in the array: for each element in sarray do_something(element) next element do_something takes a string as a ..

ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d

I am replicating web application deployment and found several issues related to HTTP Error 500.19. My machine is running Windows 7 while the working development is using Windows 8. We're developing ou..

Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays

I looked at similar questions, but none of them helped me. I am going to receive an object like the following: [ { "id": 1, "name": "Safa", "email": "[email protected]", "purpose":..

Difference between Key, Primary Key, Unique Key and Index in MySQL

When should I use KEY, PRIMARY KEY, UNIQUE KEY and INDEX?..

What characters do I need to escape in XML documents?

What characters must be escaped in XML documents, or where could I find such a list?..

To the power of in C?

So in python, all I have to do is print(3**4) Which gives me 81 How do I do this in C? I searched a bit and say the exp() function, but have no clue how to use it, thanks in advance..

Which regular expression operator means 'Don't' match this character?

*, ?, + characters all mean match this character. Which character means 'don't' match this? Examples would help...

How do I set a VB.Net ComboBox default value

I can not locate the correct method to make the first item in a combo box visible. The app starts with an empty combo box. The user makes a radio box selection then clicks Go! (how original). The com..

How to handle ListView click in Android

How do I listen to click event on a ListView? This is what I have now ListView list = (ListView)findViewById(; ... list.setAdapter(adapter); When I do the following list.s..

FragmentActivity to Fragment

I haven't found any question like this on here so I wanted to ask. Please keep in mind that I'm new to Fragments & FragmentActivity (not Android) and I don't really know how to work with them quit..

Calling a java method from c++ in Android

I'm trying to get a simple Java method call from C++ while Java calls native method. Here's the Java code: public class MainActivity extends Activity { private static String LIB_NAME = "name"; ..

How to configure multi-module Maven + Sonar + JaCoCo to give merged coverage report?

I've searched up and down the internet for this one. There's lots of half-answers out there, to do with Maven properties such as ${sonar.jacoco.reportPath}, or org.jacoco:jacoco-maven-plugin:prepare-a..

What is the difference between public, protected, package-private and private in Java?

In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritan..

How do I raise the same Exception with a custom message in Python?

I have this try block in my code: try: do_something_that_might_raise_an_exception() except ValueError as err: errmsg = 'My custom error message.' raise ValueError(errmsg) Strictly speak..

How can I create a border around an Android LinearLayout?

I have one big layout, and one smaller layout inside of it. How do I create a line border around the small layout?..

How to calculate the CPU usage of a process by PID in Linux from C?

I want to programmatically [in C] calculate CPU usage % for a given process ID in Linux. How can we get the realtime CPU usage % for a given process? To make it further clear: I should be able to ..

Is there a replacement for unistd.h for Windows (Visual C)?

I'm porting a relatively simple console program written for Unix to the Windows platform (Visual C++ 8.0). All the source files include "unistd.h", which doesn't exist. Removing it, I get complaints ..

JavaScript sleep/wait before continuing

I have a JavaScript code that I need to add a sleep/wait function to. The code I am running is already in a function, eg: function myFunction(time) { alert('time starts now'); //code to make ..

How to include a quote in a raw Python string

Consider: >>> r"what"ever" SyntaxError: invalid syntax >>> r"what\"ever" 'what\\"ever' So how do we get the quote, but not the slash? And please don't suggest r'what"ever', becau..

Apply a theme to an activity in Android?

I know how to apply a theme to a whole application, but where would I go to apply a theme to just a single activity? ..

What's the best way to override a user agent CSS stylesheet rule that gives unordered-lists a 1em margin?

I'm working on a web app that has a topBar similar to facebook's blue bar at the top. I have an unordered list within the div of that bar to list some items, like Inbox, Notifications, etc. The UL ha..

Reducing the gap between a bullet and text in a list item

How can I reduce default gap between bullet and text in an <li>? Item 1 Item 2 Item 3 I want to reduce gap between the bullet and "I"...

Boto3 Error: botocore.exceptions.NoCredentialsError: Unable to locate credentials

When I simply run the following code, I always gets this error. s3 = boto3.resource('s3') bucket_name = "python-sdk-sample-%s" % uuid.uuid4() print("Creating new bucket with name:"..

Array Length in Java

I declared an array as shown below: int[] arr = new int[10]; Then I assigned following values to the array: arr[0] = 1; arr[1] = 2; arr[2] = 3; arr[3] = 4; Then I declared and initialized an int..

HTTP POST Returns Error: 417 "Expectation Failed."

When I try to POST to a URL it results in the following exception: The remote server returned an error: (417) Expectation Failed. Here's a sample code: var client = new WebClient(); var post..

Android M - check runtime permission - how to determine if the user checked "Never ask again"?

According to this: an app can check for runtime permissions and request permissions if it hasn't been granted already. The..

How to add a touch event to a UIView?

How do I add a touch event to a UIView? I try: UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, nextY)] autorelease]; [headerView addTarget:self actio..

Setting default values to null fields when mapping with Jackson

I am trying to map some JSON objects to Java objects with Jackson. Some of the fields in the JSON object are mandatory(which I can mark with @NotNull) and some are optional. After the mapping with Ja..

Spring MVC: How to return image in @ResponseBody?

I'm getting image data (as byte[]) from DB. How to return this image in @ResponseBody ? EDIT I did it without @ResponseBody using HttpServletResponse as method parameter: @RequestMapping("/photo1")..

Log exception with traceback

How can I log my Python errors? try: do_something() except: # How can I log my exception here, complete with its traceback? ..

Maven not found in Mac OSX mavericks

After upgrading my Mac OSX 10.8 to 10.9, Maven not found in the /usr/share path but its installed in 10.8. when I try this command: $ maven -version got this result -bash: mvn: command not f..

How to update data in one table from corresponding data in another table in SQL Server 2005

I have two tables in different databases on the same database server. Both the databases have the same structure, but different data. Database1 (Test1) is the latest, and database2 (Test2) is an old ..

How to create a .gitignore file

I need to add some rules to my .gitignore file. However, I can't find it in my project folder. Isn't it created automatically by Xcode? If not, what command allows me to create one?..

How to remove padding around buttons in Android?

In my Android app, I have this layout: <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="" android:layout_width="match_pa..

Error Dropping Database (Can't rmdir '.test\', errno: 17)

Basically, I was taught on how to create a root password using the "mysqladmin -u root -p password" command, this was done all through the windows command editor. Now, the next process was to display ..

What is the difference between JDK and JRE?

What is the difference between JDK and JRE? What are their roles and when should I use one or the other?..

javascript cell number validation

I want to validate cell number using JavaScript. Here is my code. if(number.value == "") { window.alert("Error: Cell number must not be null."); number.focus(); return false; } if(numbe..

Correct way to try/except using Python requests module?

try: r = requests.get(url, params={'s': thing}) except requests.ConnectionError, e: print e #should I also sys.exit(1) after this? Is this correct? Is there a better way to structure this? W..

How to enable remote access of mysql in centos?

My apache is running on 8113 port instead of 80. I want to access my mysql Database remotely. I have tried following steps. Bind-address XXX.XX.XX.XXX in /etc/my.cnf Create Database and run the com..

gpg: no valid OpenPGP data found

I am trying to install Jenkins on Ubuntu 13.10 and I am getting the above mentioned error when i try to run the following command: wget -q -O - | s..

Explain why constructor inject is better than other options

In a Pro Spring 3 Book, Chapter 4 - Introduction IOC and DI in Spring - Page 59, In "Setter Injection vs. Constructor Injection" section, a paragraph says Spring included, provide a mechanism for ..

How to find a string inside a entire database?

I have one specific string, such as "123abcd" for example but I don't know the name of the table or even the name of the column inside the table on my SQL Server Database. I want to find it with a sel..

illegal character in path

I am trying to get to a file located in C:\Program Files (x86)\test software\myapp\demo.exe In VS debugger i see the path as: "\"C:\\\Program Files (x86)\\\test software\\\myapp\\\demo.exe\"" w..

Injecting content into specific sections from a partial view ASP.NET MVC 3 with Razor View Engine

I have this section defined in my _Layout.cshtml @RenderSection("Scripts", false) I can easily use it from a view: @section Scripts { @*Stuff comes here*@ } What I'm struggling with is how..

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

What's the difference between & and && in MATLAB?

What is the difference between the & and && logical operators in MATLAB?..

AttributeError: 'module' object has no attribute 'urlopen'

I'm trying to use Python to download the HTML source code of a website but I'm receiving this error. Traceback (most recent call last): File "C:\Users\Sergio.Tapia\Documents\NetBeansProjects\D..

Unable to Connect to For Cloning

I am trying to clone the angular-phonecat git repository, but I am getting the following message when I enter the command in my Git Bash: $ git clone git:// C..

Which mime type should I use for mp3

I'm trying to decide which mime type to choose for returning mp3 data (served up by php) according to this listing of mime types: .mp3 audio/mpeg..

Skip rows during csv import pandas

I'm trying to import a .csv file using pandas.read_csv(), however I don't want to import the 2nd row of the data file (the row with index = 1 for 0-indexing). I can't see how not to import it because..