How to parse CSV data?
Where could I find some JavaScript code to parse CSV data?
- Modified
- 22 Aug at 19:34
What is the best way to test for an empty string in Go?
Which method is best (most idomatic) for testing non-empty strings (in Go)? ``` if len(mystring) > 0 { } ``` Or: ``` if mystring != "" { } ``` Or something else?
Serialize an object to string
I have the following method to save an Object to a file: ``` // Save an object out to the disk public static void SerializeObject<T>(this T toSerialize, String filename) { XmlSerializer xmlSerial...
- Modified
- 12 Mar at 17:32
How do you create a custom AuthorizeAttribute in ASP.NET Core?
I'm trying to make a custom authorization attribute in ASP.NET Core. In previous versions it was possible to override `bool AuthorizeCore(HttpContextBase httpContext)`. But this no longer exists in ...
- Modified
- 24 Jan at 22:55
What is the <leader> in a .vimrc file?
I see `<leader>` in many `.vimrc` files, and I am wondering what does it mean? What is it used for? Just a general overview of the purpose and usage would be great.
Use a.any() or a.all()
``` x = np.arange(0,2,0.5) valeur = 2*x if valeur <= 0.6: print ("this works") else: print ("valeur is too high") ``` here is the error I get: ``` if valeur <= 0.6: ValueError: The trut...
Pandas: Setting no. of max rows
I have a problem viewing the following `DataFrame`: ``` n = 100 foo = DataFrame(index=range(n)) foo['floats'] = np.random.randn(n) foo ``` The problem is that it does not print all rows per defaul...
- Modified
- 5 Jan at 14:49
Python locale error: unsupported locale setting
Why do I get the following error when doing this in python: ``` >>> import locale >>> print str( locale.getlocale() ) (None, None) >>> locale.setlocale(locale.LC_ALL, 'de_DE') Traceback (most recent ...
- Modified
- 14 Apr at 18:57
Get selected element's outer HTML
I'm trying to get the HTML of a selected object with jQuery. I am aware of the `.html()` function; the issue is that I need the HTML including the selected object (a table row in this case, where `.h...
- Modified
- 19 Jul at 07:34
Split a string by a delimiter in python
How to split this string where `__` is the delimiter ``` MATCHES__STRING ``` To get an output of `['MATCHES', 'STRING']`? --- [How do I split a string into a list of words?](https://stackoverflow....
Type safety: Unchecked cast
In my spring application context file, I have something like: ``` <util:map id="someMap" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String"> <entry key="some_k...
- Modified
- 27 Jul at 05:34
Load local JSON file into variable
I'm trying to load a .json file into a variable in javascript, but I can't get it to work. It's probably just a minor error but I can't find it. Everything works just fine when I use static data like...
- Modified
- 2 Dec at 22:33
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode
I installed DotNetOpenAuth SDK-3.4.5.10201.vsix, and I can't get it working. It works locally (when I run as localhost), but when I try to publish it doesn't work. The IIS error message I get is: > Er...
Row count with PDO
There are many conflicting statements around. What is the best way to get the row count using PDO in PHP? Before using PDO, I just simply used `mysql_num_rows`. `fetchAll` is something I won't want be...
How to use sed to replace only the first occurrence in a file?
I would like to update a large number of C++ source files with an extra include directive before any existing #includes. For this sort of task, I normally use a small bash script with sed to re-write ...
- Modified
- 19 Nov at 14:0
Running PowerShell as another user, and launching a script
I won't get into all the details of why I need this, but users must be able to launch PowerShell as a service account and when PowerShell loads it needs to run a script. I already can launch PowerShel...
- Modified
- 11 Mar at 14:47
Retrieve CPU usage and memory usage of a single process on Linux?
I want to get the CPU and memory usage of a single process on Linux - I know the PID. Hopefully, I can get it every second and write it to a CSV using the 'watch' command. What command can I use to ...
- Modified
- 17 May at 23:59
How to insert a character in a string at a certain position?
I'm getting in an `int` with a 6 digit value. I want to display it as a `String` with a decimal point (.) at 2 digits from the end of `int`. I wanted to use a `float` but was suggested to use `String`...
Execute script after specific delay using JavaScript
Is there any JavaScript method similar to the jQuery `delay()` or `wait()` (to delay the execution of a script for a specific amount of time)?
- Modified
- 12 Jan at 03:22
How do I install the ext-curl extension with PHP 7?
I've installed PHP 7 using [this repo](http://php7.zend.com/repo.php), but when I try to run `composer install`, it's giving this error: > - With PHP 5, you can easily install it by running the `yu...
How to ignore PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException?
I got the following exception when try to post a request to a http server: Here is the code I used ``` URL url = new URL( "https://www.abc.com"); HttpURLConnection conn = (HttpURLConnection)...
- Modified
- 29 Nov at 13:32
Call async/await functions in parallel
As far as I understand, in ES7/ES2016 putting multiple `await`'s in code will work similar to chaining `.then()` with promises, meaning that they will execute one after the other rather than in parall...
- Modified
- 25 Dec at 01:7
Validation of file extension before uploading file
I am uploading images to a servlet. The validation whether the uploaded file is an image is done in server side only, by checking the magic numbers in the file header. Is there any way to validate the...
- Modified
- 21 May at 08:20
How to write logs in text file when using java.util.logging.Logger
I have a situation in which I want to write all logs created by me into a text file. We are using java.util.logging.Logger API to generate the logs. I tried: ``` private static Logger logger = Logg...
How to un-commit last un-pushed git commit without losing the changes
Is there a way to revert a commit so that my local copy the changes made in that commit, but they become non-committed changes in my working copy? Rolling back a commit takes you to the previous comm...
- Modified
- 31 May at 20:4