Questions

Using Transactions or SaveChanges(false) and AcceptAllChanges()?

I have been investigating transactions and it appears that they take care of themselves in EF as long as I pass `false` to `SaveChanges()` and then call `AcceptAllChanges()` if there are no errors: `...

20 Mar at 11:20

How can I check whether a string variable is empty or null in C#?

How can I check whether a C# variable is an empty string `""` or null? I am looking for the simplest way to do this check. I have a variable that can be equal to `""` or null. Is there a single functi...

23 Nov at 23:19

Java associative-array

How can I create and fetch associative arrays in Java like I can in PHP? For example: ``` $arr[0]['name'] = 'demo'; $arr[0]['fname'] = 'fdemo'; $arr[1]['name'] = 'test'; $arr[1]['fname'] = 'fname'; ...

3 Jul at 11:28

How to convert Set<String> to String[]?

I need to get a `String[]` out of a `Set<String>`, but I don't know how to do it. The following fails: ``` Map<String, ?> myMap = gpxlist.getAll(); Set<String> myset = myMap.keySet(); String[] GPXFIL...

12 May at 18:45

Deleting multiple elements from a list

Is it possible to delete multiple elements from a list at the same time? If I want to delete elements at index 0 and 2, and try something like `del somelist[0]`, followed by `del somelist[2]`, the sec...

14 Oct at 12:31

How to display the first few characters of a string in Python?

I just started learning Python but I'm sort of stuck right now. I have `hash.txt` file containing thousands of malware hashes in MD5, Sha1 and Sha5 respectively separated by delimiters in each line. B...

16 Dec at 02:1

How to parse JSON Array (Not Json Object) in Android

I have a trouble finding a way how to parse JSONArray. It looks like this: ``` [{"name":"name1","url":"url1"},{"name":"name2","url":"url2"},...] ``` I know how to parse it if the JSON was written ...

10 Jan at 10:44

How can I change the default Django date template format?

I have dates in ISO 8601 format in the database, `%Y-%m-%d`. However, when the date is passed on to the template, it comes out as something like `Oct. 16, 2011`. Is there a way that I can manipulate ...

31 Jan at 14:44

Using stored procedure output parameters in C#

I am having a problem returning an output parameter from a Sql Server stored procedure into a C# variable. I have read the other posts concerning this, not only here but on other sites, and I cannot g...

25 Apr at 19:35

How to know if two arrays have the same values

I have these two arrays: one is filled with information from an ajax request and another stores the buttons the user clicks on. I use this code (I filled with sample numbers): ``` var array1 = [2, 4]...

7 Mar at 16:27

Finding the average of an array using JS

I've been looking and haven't found a simple question and answer on stack overflow looking into finding the average of an array. This is the array that I have ``` const grades = [80, 77, 88, 95, 68]; ...

17 Jul at 04:39

Automatically run a program on startup under Linux Ubuntu

I'd need a program to be run every time I start up my Ubuntu Linux. So I'd need to add it to my startup programs list. Just one problem: I'd need to do it via the terminal.

17 Aug at 08:17

scipy.misc module has no attribute imread?

I am trying to read an image with scipy. However it does not accept the `scipy.misc.imread` part. What could be the cause of this? ``` >>> import scipy >>> scipy.misc <module 'scipy.misc' from 'C:\Py...

Is there a way to purge the topic in Kafka?

I pushed a message that was too big into a kafka message topic on my local machine, now I'm getting an error: ``` kafka.common.InvalidMessageSizeException: invalid message size ``` Increasing the `fe...

15 Jun at 14:45

Stopping Excel Macro executution when pressing Esc won't work

I'm running excel 2007 on XP. Is there a way to stop a macro from running during its execution other than pressing escape? Usually if I think I created an infinate loop or otherwise messed something...

27 Jun at 14:16

How to calculate mean, median, mode and range from a set of numbers

Are there any functions (as part of a math library) which will calculate [mean](http://www.cimt.plymouth.ac.uk/projects/mepres/book8/bk8i5/bk8_5i2.htm), median, mode and range from a set of numbers. ...

16 Nov at 06:26

Java switch statement: Constant expression required, but it IS constant

So, I am working on this class that has a few static constants: ``` public abstract class Foo { ... public static final int BAR; public static final int BAZ; public static final int B...

30 Sep at 03:2

Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system

Inside of visual studio code, I'm trying to execute a script.bat from the command line, but I'm getting the following error: > File C:\Theses_Repo\train-cnn\environment\Scripts\activate.ps1 cannot be...

Check if value exists in dataTable?

I have DataTable with two columns and . I want to check if the given string value already exists in the DataTable. Is there some built in method to check it, like for Arrays `array.contains`?

30 Aug at 23:25

Best HTTP Authorization header type for JWT

I'm wondering what is the best appropriate `Authorization` HTTP header type for [JWT tokens](http://jwt.io/). One of the probably most popular type is `Basic`. For instance: ``` Authorization: Basic...

21 Oct at 17:55

Auto reloading python Flask app upon code changes

I'm investigating how to develop a decent web app with Python. Since I don't want some high-order structures to get in my way, my choice fell on the lightweight [Flask framework](https://flask.pallets...

12 Jan at 21:9

How can I display a tooltip message on hover using jQuery?

As the title states, how can I display a tooltip message on hover using jQuery?

23 Nov at 16:18

RegExp matching string not starting with my

For PMD I'd like to have a rule which warns me of those ugly variables which start with `my`. This means I have to accept all variables which do start with `my`. So, I need a RegEx (re) which behaves...

23 Jun at 07:15

How to test if a string contains one of the substrings in a list, in pandas?

Is there any function that would be the equivalent of a combination of `df.isin()` and `df[col].str.contains()`? For example, say I have the series `s = pd.Series(['cat','hat','dog','fog','pet'])`, ...

1 Jul at 18:11

URL rewriting with PHP

I have a URL that looks like: ``` url.com/picture.php?id=51 ``` How would I go about converting that URL to: ``` picture.php/Some-text-goes-here/51 ``` I think WordPress does the same. How do I...