How do you see the entire command history in interactive Python?
I'm working on the default python interpreter on Mac OS X, and I + (cleared) my earlier commands. I can go through them one by one using the arrow keys. But is there an option like the --history optio...
Does "\d" in regex mean a digit?
I found that in `123`, `\d` matches `1` and `3` but not `2`. I was wondering if `\d` matches a digit satisfying what kind of requirement? I am talking about Python style regex. Regular expression pl...
SQL Server database backup restore on lower version
How to restore a higher version SQL Server database backup file onto a lower version SQL Server? Using SQL Server , I made a backup file and now I want to restore it on my live server's SQL Server . ...
- Modified
- 26 Jul at 21:1
Methods inside enum in C#
In Java, it's possible to have methods inside an enum. Is there such possibility in C# or is it just a string collection and that's it? I tried to override `ToString()` but it does not compile. Does...
- Modified
- 2 Jan at 12:7
Git on custom SSH port
My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is, while I know I can provide the port number when creating a remote config...
- Modified
- 19 Dec at 15:2
Do I need a content-type header for HTTP GET requests?
As far as I understood there are two places where to set the content type: 1. The client sets a content type for the body he is sending to the server (e.g. for post) 2. The server sets a content typ...
- Modified
- 25 Jul at 10:15
What is the difference between & and && in Java?
I always thought that `&&` operator in Java is used for verifying whether both its boolean operands are `true`, and the `&` operator is used to do Bit-wise operations on two integer types. Recently I...
- Modified
- 26 Mar at 14:14
The relationship could not be changed because one or more of the foreign-key properties is non-nullable
I am getting this error when I GetById() on an entity and then set the collection of child entities to my new list which comes from the MVC view. > The operation failed: The relationship could not ...
- Modified
- 4 Apr at 19:50
vim - How to delete a large block of text without counting the lines?
In vim, I often find myself deleting (or copying) large blocks of text. One can count the lines of text and say (for example) `50dd` to delete 50 lines. But how would one delete this large block of ...
- Modified
- 19 Mar at 13:29
Best practices for styling HTML emails
I'm designing an HTML template for an email newsletter. I've learned that many email clients ignore linked stylesheets, and many others (including Gmail) ignore CSS block declarations altogether. Are ...
- Modified
- 21 Dec at 09:13
How to loop through a directory recursively to delete files with certain extensions
I need to loop through a directory recursively and remove all files with extension `.pdf` and `.doc`. I'm managing to loop through a directory recursively but not managing to filter the files with the...
- Modified
- 31 Mar at 05:45
How to convert a Django QuerySet to a list?
I have the following: ``` answers = Answer.objects.filter(id__in=[answer.id for answer in answer_set.answers.all()]) ``` then later: ``` for i in range(len(answers)): # iterate through all exi...
- Modified
- 4 Sep at 08:39
Comparing arrays in JUnit assertions, concise built-in way?
Is there a concise, built-in way to do equals assertions on two like-typed arrays in JUnit? By default (at least in JUnit 4) it seems to do an instance compare on the array object itself. EG, doesn'...
- Modified
- 19 Nov at 18:59
How to calculate a logistic sigmoid function in Python?
This is a logistic sigmoid function: ![enter image description here](https://i.stack.imgur.com/SUuRi.png) I know x. How can I calculate F(x) in Python now? Let's say x = 0.458. F(x) = ?
python: SyntaxError: EOL while scanning string literal
I have the above-mentioned error in `s1="some very long string............"` Does anyone know what I am doing wrong?
- Modified
- 7 Apr at 03:24
Why can't a text column have a default value in MySQL?
If you try to create a TEXT column on a table, and give it a default value in MySQL, you get an error (on Windows at least). I cannot see any reason why a text column should not have a default value. ...
- Modified
- 12 Aug at 11:23
Scroll to a div using jQuery
so I have a page that has a fixed link bar on the side. I'd like to scroll to the different divs. Basically the page is just one long website, where I'd like to scroll to different divs using the me...
Trigger a keypress/keydown/keyup event in JS/jQuery?
What is the best way to simulate a user entering text in a text input box in JS and/or jQuery? I want to actually put text in the input box, I just want to trigger all the event that would normally...
- Modified
- 21 Aug at 21:19
How to set a default value with Html.TextBoxFor?
Simple question, if you use the Html Helper from ASP.NET MVC Framework 1 it is easy to set a default value on a textbox because there is an overload `Html.TextBox(string name, object value)`. When I ...
- Modified
- 14 Jun at 04:41
How to reload page every 5 seconds?
I am converting one layout to html; once I make the changes in code/html/css, every time I have to hit F5. Is there any simple javascript/jQuery solution for this? I.e. after I add the script, reload ...
- Modified
- 3 Apr at 17:52
Avoid browser popup blockers
I'm developing an OAuth authentication flow purely in JavaScript and I want to show the user the "grant access" window in a popup, but it gets blocked. How can I prevent pop up windows created by eit...
- Modified
- 10 Nov at 14:24
How to Programmatically Add Views to Views
Let's say I have a `LinearLayout`, and I want to add a View to it, in my program from the Java code. What method is used for this? I'm not asking how it's done in XML, which I do know, but rather, how...
- Modified
- 18 Mar at 12:32
PHP substring extraction. Get the string before the first '/' or the whole string
I am trying to extract a substring. I need some help with doing it in PHP. Here are some sample strings I am working with and the results I need: ``` home/cat1/subcat2 => home test/cat2 => test s...
change type of input field with jQuery
``` $(document).ready(function() { // #login-box password field $('#password').attr('type', 'text'); $('#password').val('Password'); }); ``` This is supposed to change the `#password` in...
- Modified
- 15 Aug at 16:59
Running Windows batch file commands asynchronously
Say, if I have - - - How do I run all of them from a batch file asynchronously, i.e. without waiting for the previous program to stop?
- Modified
- 9 Nov at 15:25