How to get the day of week and the month of the year?
I don't know much about Javascript, and the other questions I found are related to operations on dates, not only getting the information as I need it. ## Objective I wish to get the date as below...
- Modified
- 2 Apr at 11:26
How do I close a single buffer (out of many) in Vim?
I open several files in Vim by, for example, running ``` vim a/*.php ``` which opens 23 files. I then make my edit and run the following twice ``` :q ``` which closes all my buffers.
How to import data from text file to mysql database
I have a 350MB file named `text_file.txt` containing this tab delimited data: ``` 345868230 1646198120 1531283146 Keyword_1531283146 1.55 252910000 745345566 1646198120 1539847239 another...
- Modified
- 2 Jan at 21:10
Python Requests - No connection adapters
I'm using the [Requests: HTTP for Humans](http://docs.python-requests.org/en/latest/) library and I got this weird error and I don't know what is mean. ``` No connection adapters were found for '192....
- Modified
- 10 Feb at 12:29
How to test whether a service is running from the command line
I would like to be able to query whether or not a service is running from a windows batch file. I know I can use: > sc query "ServiceName" but, this dumps out some text. What I really want is fo...
- Modified
- 9 Dec at 16:0
import error: 'No module named' *does* exist
I am getting this stack trace when I start pyramid pserve: ``` % python $(which pserve) ../etc/development.ini Traceback (most recent call last): File "/home/hughdbrown/.local/bin/pserve", line 9, ...
- Modified
- 23 Oct at 23:8
Apply a function to every row of a matrix or a data frame
Suppose I have a n by 2 matrix and a function that takes a 2-vector as one of its arguments. I would like to apply the function to each row of the matrix and get a n-vector. How to do this in R? For ...
Correct way to use get_or_create?
I'm trying to use get_or_create for some fields in my forms, but I'm getting a 500 error when I try to do so. One of the lines looks like this: ``` customer.source = Source.objects.get_or_create(nam...
Cannot install packages inside docker Ubuntu image
I installed Ubuntu 14.04 image on docker. After that, when I try to install packages inside the ubuntu image, I'm getting unable to locate package error: ``` apt-get install curl Reading package li...
- Modified
- 2 Jul at 15:45
What is a good way to handle exceptions when trying to read a file in python?
I want to read a .csv file in python. - - Is there a prettier way to do it? ``` import csv fName = "aFile.csv" try: with open(fName, 'r') as f: reader = csv.reader(f) for row...
- Modified
- 27 Feb at 20:32
Amazon S3 exception: "The specified key does not exist"
I am using the AmazonS3Client in an Android app using a getObject request to download an image from my Amazon S3 bucket. Currently, I am getting this exception: ``` com.amazonaws.services.s3.model.A...
- Modified
- 30 Jul at 08:12
How can I remove all text after a character in bash?
How can I remove all text after a character, in this case a colon (":"), in bash? Can I remove the colon, too? I have no idea how to.
- Modified
- 12 Nov at 19:34
How to declare a constant in Java?
We always write: ``` public static final int A = 0; ``` Question: 1. Is static final the only way to declare a constant in a class? 2. If I write public final int A = 0; instead, is A still a ...
Correct way to use StringBuilder in SQL
I just found some sql query build like this in my project: ``` return (new StringBuilder("select id1, " + " id2 " + " from " + " table")).toString(); ``` Does this `StringBuilder` achieve its aim, i....
- Modified
- 19 Dec at 19:49
Tar a directory, but don't store full absolute paths in the archive
I have the following command in the part of a backup shell script: ``` tar -cjf site1.bz2 /var/www/site1/ ``` When I list the contents of the archive, I get: ``` tar -tf site1.bz2 var/www/site1/st...
How to close the command line window after running a batch file?
I've got a batch file. After it finished running, i.e. all command lines have been executed, the window stays open. However, I'd like to have it closed right after the batch file finishes its job. ...
- Modified
- 15 Aug at 11:40
ASP.NET MVC: No parameterless constructor defined for this object
``` Server Error in '/' Application. -------------------------------------------------------------------------------- No parameterless constructor defined for this object. Description: An unhandled ...
- Modified
- 24 Dec at 01:57
How to unmount, unrender or remove a component, from itself in a React/Redux/Typescript notification message
I know this question has been asked a couple of times already but most of the time, the solution is to handle this in the parent, as the flow of responsibility is only descending. However, sometimes, ...
Session TimeOut in web.xml
I am trying to understand the real purpose of session configuration in Web.xml for session timeout. ``` <!-- Session Configuration --> <session-config> <session-timeout>60</session-timeout> <...
- Modified
- 26 Nov at 21:5
Converting byte array to string in javascript
How do I convert a byte array into a string? I have found these functions that do the reverse: ``` function string2Bin(s) { var b = new Array(); var last = s.length; for (var i = 0; i <...
- Modified
- 21 Nov at 19:47
Convert XmlDocument to String
Here is how I'm currently converting to ``` StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); xmlDoc.WriteTo(xmlTextWriter); return st...
- Modified
- 9 Mar at 07:43
How to find children of nodes using BeautifulSoup
I want to get all the `<a>` tags which are children of `<li>`: ``` <div> <li class="test"> <a>link1</a> <ul> <li> <a>link2</a> </li> </ul> </li> </div> ``` I...
- Modified
- 17 May at 20:52
How to keep the console window open in Visual C++?
I'm starting out in Visual C++ and I'd like to know how to keep the console window. For instance this would be a typical "hello world" application: ``` int _tmain(int argc, _TCHAR* argv[]) { co...
- Modified
- 27 May at 14:57
PHP Warning: Unknown: failed to open stream
I edited the apache httpd.conf file recently for the mod_rewrite to work. I don't know if this problem originated from that or not, but i'm getting this problem from that day. This is what I see on th...
Remove substring from the string
I am just wondering if there is any method to remove string from another string? Something like this: ``` class String def remove(s) self[s.length, self.length - s.length] end end ```