Convert dd-mm-yyyy string to date
i am trying to convert a string in the format dd-mm-yyyy into a date object in JavaScript using the following: ``` var from = $("#datepicker").val(); var to = $("#datepickertwo").val(); var f = new...
- Modified
- 29 Mar at 13:2
Make copy of an array
I have an array `a` which is constantly being updated. Let's say `a = [1,2,3,4,5]`. I need to make an exact duplicate copy of `a` and call it `b`. If `a` were to change to `[6,7,8,9,10]`, `b` should s...
Converting dictionary to JSON
``` r = {'is_claimed': 'True', 'rating': 3.5} r = json.dumps(r) file.write(str(r['rating'])) ``` I am not able to access my data in the JSON. What am I doing wrong? ``` TypeError: string indices mu...
- Modified
- 28 May at 17:15
How to convert DateTime to/from specific string format (both ways, e.g. given Format is "yyyyMMdd")?
I am having a problem converting a datetime which is in string format but I am not able to convert it using `"yyyyMMdd"` format. My code is: ``` string tpoc = refSubClaim.BenefitsFolder.BenefitFolde...
/etc/apt/sources.list" E212: Can't open file for writing
I am trying to edit sources.list using vi editor but getting the following error while saving the file: ``` /etc/apt/sources.list" E212: Can't open file for writing ```
- Modified
- 6 Dec at 01:17
What is 'Context' on Android?
In Android programming, what exactly is a `Context` class and what is it used for? I read about it on the [developer site](https://d.android.com/reference/android/content/Context), but I am unable to...
- Modified
- 4 Nov at 11:11
How can I check if a string is null or empty in PowerShell?
Is there a built-in `IsNullOrEmpty`-like function in order to check if a string is null or empty, in PowerShell? I could not find it so far and if there is a built-in way, I do not want to write a fu...
- Modified
- 13 Jul at 14:33
How can I split a string with a string delimiter?
I have this string: ``` "My name is Marco and I'm from Italy" ``` I'd like to split it, with the delimiter being `is Marco and`, so I should get an array with - `My name`- `I'm from Italy` How can I ...
Git - remote: Repository not found
I have SourceTree with local working copy. And all operations work good, I can simple fetch, push, pull and etc via SourceTree. I just needed to make force push which does not exist in SourceTree. I ...
- Modified
- 14 Jun at 13:31
How do I run Redis on Windows?
How do I run Redis on Windows? The Redis download page just seems to offer *nix options. Can I run Redis natively on Windows?
What is the difference between call and apply?
What is the difference between using `Function.prototype.apply()` and `Function.prototype.call()` to invoke a function? ``` var func = function() { alert('hello!'); }; ``` `func.apply();` vs `func....
- Modified
- 30 Oct at 12:56
jQuery .scrollTop(); + animation
I set the page to scroll to top when a button is clicked. But first I used an if statement to see if the top of the page was not set to 0. Then if it's not 0 I animate the page to scroll to the top....
- Modified
- 10 May at 04:28
'str' object has no attribute 'decode'. Python 3 error?
Here is my code: ``` import imaplib from email.parser import HeaderParser conn = imaplib.IMAP4_SSL('imap.gmail.com') conn.login('example@gmail.com', 'password') conn.select() conn.search(None, 'ALL')...
- Modified
- 29 Dec at 22:28
HTML.ActionLink method
Let's say I have a class ``` public class ItemController:Controller { public ActionResult Login(int id) { return View("Hi", id); } } ``` On a page that is not located at the Ite...
- Modified
- 11 Dec at 09:21
What's the difference between UTF-8 and UTF-8 with BOM?
What's different between UTF-8 and UTF-8 with [BOM](http://en.wikipedia.org/wiki/Byte_order_mark)? Which is better?
- Modified
- 9 Sep at 16:8
Save and load MemoryStream to/from a file
I am serializing an structure into a `MemoryStream` and I want to save and load the serialized structure. So, How to Save a `MemoryStream` into a file and also load it back from file?
- Modified
- 21 Dec at 22:45
Make .gitignore ignore everything except a few files
I understand that a `.gitignore` file cloaks specified files from Git's version control. How do I tell `.gitignore` to ignore everything except the files I'm tracking with Git? Something like: ``` # I...
Setting the default Java character encoding
How do I properly set the default character encoding used by the JVM (1.5.x) programmatically? I have read that `-Dfile.encoding=whatever` used to be the way to go for older JVMs. I don't have that l...
- Modified
- 29 Dec at 13:46
What do these operators mean (** , ^ , %, //)?
Other than the standard `+`, `-`, `*`and `/` operators; but what does these mean (`**` , `^` , `%`, `//`) ? ``` >>> 9+float(2) # addition 11.0 >>> 9-float(2) # subtraction 7.0 >>> 9*float(2) # multip...
Plot correlation matrix using pandas
I have a data set with huge number of features, so analysing the correlation matrix has become very difficult. I want to plot a correlation matrix which we get using `dataframe.corr()` function from p...
- Modified
- 27 Mar at 16:30
Convert from MySQL datetime to another format with PHP
I have a `datetime` column in MySQL. How can I convert it to the display as using PHP?
Do something if screen width is less than 960 px
How can I make jQuery do something if my screen width is less than 960 pixels? The code below always fires the 2nd alert, regardless of my window size: ``` if (screen.width < 960) { alert('Less ...
- Modified
- 5 Jun at 11:6
How to determine an object's class?
If class `B` and class `C` extend class `A` and I have an object of type `B` or `C`, how can I determine of which type it is an instance?
- Modified
- 22 Jan at 20:30
Error message: "'chromedriver' executable needs to be available in the path"
I am using selenium with python and have downloaded the chromedriver for my windows computer from this site: [http://chromedriver.storage.googleapis.com/index.html?path=2.15/](http://chromedriver.stor...
- Modified
- 24 Apr at 22:46