Git keeps prompting me for a password
I've been using Git for a while now, but the constant requests for a password are starting to drive me up the wall. I'm using Mac OS X and GitHub, and I set up Git and my SSH keys as instructed by Gi...
How to combine multiple querysets in Django?
I'm trying to build the search for a Django site I am building, and in that search, I am searching in three different models. And to get pagination on the search result list, I would like to use a gen...
- Modified
- 22 Jan at 05:4
How do I implement basic "Long Polling"?
I can find lots of information on how Long Polling works (For example, [this](http://jfarcand.wordpress.com/2007/05/15/new-adventures-in-comet-polling-long-polling-or-http-streaming-with-ajax-which-on...
Sort JavaScript object by key
I need to sort JavaScript objects by key. Hence the following: ``` { 'b' : 'asdsad', 'c' : 'masdas', 'a' : 'dsfdsfsdf' } ``` Would become: ``` { 'a' : 'dsfdsfsdf', 'b' : 'asdsad', 'c' : 'masdas'...
- Modified
- 17 May at 10:15
How to convert a Date to UTC?
Suppose a user of your website enters a date range. ``` 2009-1-1 to 2009-1-3 ``` You need to send this date to a server for some processing, but the server expects all dates and times to be in UTC. N...
- Modified
- 24 Mar at 21:29
How to print a date in a regular format?
This is my code: ``` import datetime today = datetime.date.today() print(today) ``` This prints: `2008-11-22` which is exactly what I want. But, I have a list I'm appending this to and then sudden...
How can you create multiple cursors in Visual Studio Code
What are the keyboard shortcuts for creating multiple cursors in VS Code?
- Modified
- 23 Jan at 17:25
How do I get the query builder to output its raw SQL query as a string?
Given the following code: ``` DB::table('users')->get(); ``` I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be `SELECT * FROM ...
- Modified
- 26 Dec at 00:23
Gradle build without tests
I want to execute `gradle build` without executing the unit tests. I tried: ``` $ gradle -Dskip.tests build ``` That doesn't seem to do anything. Is there some other command I could use?
How to deal with floating point number precision in JavaScript?
I have the following dummy test script: ``` function test() { var x = 0.1 * 0.2; document.write(x); } test(); ``` This will print the result `0.020000000000000004` while it should just print `...
- Modified
- 18 Jul at 21:35
How to check if a "lateinit" variable has been initialized?
I wonder if there is a way to check if a `lateinit` variable has been initialized. For example: ``` class Foo() { private lateinit var myFile: File fun bar(path: String?) { path?.le...
- Modified
- 27 Nov at 12:3
Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
I want to filter my dataframe with an `or` condition to keep rows with a particular column's values that are outside the range `[-0.25, 0.25]`. I tried: ``` df = df[(df['col'] < -0.25) or (df['col'] >...
What is sr-only in Bootstrap 3?
What is the class `sr-only` used for? Is it important or can I remove it? Works fine without. Here's my example: ``` <div class="btn-group"> <button type="button" class="btn btn-info btn-md">Dep...
- Modified
- 16 Aug at 09:1
What's the difference between a Python module and a Python package?
What's the difference between a Python module and a Python package? See also: [What's the difference between "package" and "module"](https://stackoverflow.com/questions/3680883/whats-the-difference-b...
How to squash commits in git after they have been pushed?
This gives a good explanation of squashing multiple commits: [http://git-scm.com/book/en/Git-Branching-Rebasing](http://git-scm.com/book/en/Git-Branching-Rebasing) but it does not work for commits tha...
Capture HTML canvas as GIF/JPG/PNG/PDF?
Is it possible to capture or print what's displayed in an HTML canvas as an image or PDF? I'd like to generate an image via canvas and be able to generate a PNG from that image.
- Modified
- 11 Feb at 20:18
How do I properly clean up Excel interop objects?
I'm using the Excel interop in C# (`ApplicationClass`) and have placed the following code in my finally clause: ``` while (System.Runtime.InteropServices.Marshal.ReleaseComObject(excelSheet) != 0) { ...
- Modified
- 26 Dec at 14:28
Import a module from a relative path
How do I import a Python module given its relative path? For example, if `dirFoo` contains `Foo.py` and `dirBar`, and `dirBar` contains `Bar.py`, how do I import `Bar.py` into `Foo.py`? Here's a vis...
- Modified
- 28 Aug at 13:52
MySQL Error 1093 - Can't specify target table for update in FROM clause
I have a table `story_category` in my database with corrupt entries. The next query returns the corrupt entries: ``` SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT cat...
- Modified
- 31 May at 09:35
wget command to download a file and save as a different filename
I am downloading a file using the `wget` command. But when it downloads to my local machine, I want it to be saved as a different filename. For example: I am downloading a file from `www.examplesite....
Unzipping files in Python
I read through the [zipfile documentation](https://docs.python.org/3/library/zipfile.html), but couldn't understand how to a file, only how to zip a file. How do I unzip all the contents of a zip fil...
- Modified
- 1 May at 12:27
How can I convert String to Int?
I have a `TextBoxD1.Text` and I want to convert it to an `int` to store it in a database. How can I do this?
- Modified
- 29 Jan at 08:42
Is there a link to the "latest" jQuery library on Google APIs?
I use the following for a jQuery link in my `<script>` tags: ``` http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js ``` Is there a link to the "latest" version? Something like the followin...
- Modified
- 22 Jan at 20:21
jQuery Ajax error handling, show custom exception messages
Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message? For example, if I want to throw an exception on the server side via [Struts](http://en.wikipedia.org...