How to revert a "git rm -r ."?
I accidentely said `git rm -r .`. How do I recover from this? I did not commit. I think all files were marked for deletion and were also physically removed from my local checkout. I could (if I kn...
How do I convert a Stream into a byte[] in C#?
Is there a simple way or method to convert a `Stream` into a `byte[]` in C#?
- Modified
- 28 Apr at 23:16
Stop Visual Studio from launching a new browser window when starting debug?
I already have a window open with the web site I'm debugging. I don't need VS to launch another one for me every time I need to debug. Is there a way to stop this behavior?
- Modified
- 19 Oct at 14:53
How do I get a Cron like scheduler in Python?
I'm looking for a library in Python which will provide `at` and `cron` like functionality. I'd quite like have a pure Python solution, rather than relying on tools installed on the box; this way I ru...
- Modified
- 15 Nov at 11:41
Difference between a Structure and a Union
Is there any good example to give the difference between a `struct` and a `union`? Basically I know that `struct` uses all the memory of its member and `union` uses the largest members memory space. I...
Can I have multiple primary keys in a single table?
Can I have multiple primary keys in a single table?
- Modified
- 30 Jan at 02:51
JavaScript: How do I print a message to the error console?
How can I print a message to the error console, preferably including a variable? For example, something like: ``` print('x=%d', x); ```
- Modified
- 12 Jul at 17:23
How to concatenate strings of a string field in a PostgreSQL 'group by' query?
I am looking for a way to concatenate the strings of a field within a group by query. So for example, I have a table: | ID | COMPANY_ID | EMPLOYEE | | -- | ---------- | -------- | | 1 | 1 | Anna | ...
- Modified
- 28 Feb at 09:42
How to use sudo inside a docker container?
Normally, docker containers are run using the user . I'd like to use a different user, which is no problem using docker's USER directive. But this user should be able to use inside the container. Thi...
- Modified
- 7 Apr at 18:13
Laravel Add a new column to existing table in a migration
I can't figure out how to add a new column to my existing database table using the Laravel framework. I tried to edit the migration file using... ``` <?php public function up() { Schema::create...
- Modified
- 23 Dec at 06:11
Unlimited Bash History
I want my `.bash_history` file to be unlimited. e.g. So I can always go back and see how I built/configured something, or what that nifty command was, or how some command broke something weeks ago. Ho...
Working with UTF-8 encoding in Python source
Consider: ``` $ cat bla.py u = unicode('d…') s = u.encode('utf-8') print s $ python bla.py File "bla.py", line 1 SyntaxError: Non-ASCII character '\xe2' in file bla.py on line 1, but no encoding ...
- Modified
- 8 Jul at 11:53
What is the main purpose of setTag() getTag() methods of View?
What is the main purpose of such methods as `setTag()` and `getTag()` of `View` type objects? Am I right in thinking that I can associate any number of objects with a single View?
- Modified
- 14 Oct at 17:30
Difference between >>> and >>
What is the difference between `>>>` and `>>` operators in Java?
Convert array to JSON
I have an Array `var cars = [2,3,..]` which holds a few integers. I've added a few values to the array, but I now need to send this array to a page via jQuery's `.get` method. How can I convert it to ...
- Modified
- 8 Apr at 05:58
How to run an EXE file in PowerShell with parameters with spaces and quotes
How do you run the following command in PowerShell? > C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql="Data Source=mysource;Integrated Security=false;User ID=sa;Pw...
- Modified
- 11 Jul at 23:18
Passing a dictionary to a function as keyword parameters
I'd like to call a function in python using a dictionary with matching key-value pairs for the parameters. Here is some code: ``` d = dict(param='test') def f(param): print(param) f(d) ``` This...
- Modified
- 22 Sep at 13:40
How to implement a queue using two stacks?
Suppose we have two stacks and no other temporary variable. Is to possible to "construct" a queue data structure using only the two stacks?
- Modified
- 23 Aug at 00:59
Disable browser 'Save Password' functionality
One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing e...
- Modified
- 10 Oct at 15:3
Difference between Running and Starting a Docker container
In practice to a container I do: ``` docker run a8asd8f9asdf0 ``` If thats the case, what does: ``` docker start ``` do? In the manual it says > Start one or more stopped containers
- Modified
- 28 Nov at 07:59
Parsing JSON giving "unexpected token o" error
I am having a problem parsing simple JSON strings. I have checked them on [JSONLint](http://www.JSONLint.com) and it shows that they are valid. But when I try to parse them using either `JSON.parse` o...
- Modified
- 8 Nov at 01:44
How do you build a Singleton in Dart?
The singleton pattern ensures only one instance of a class is ever created. How do I build this in Dart?
Watch multiple $scope attributes
Is there a way to subscribe to events on multiple objects using `$watch` E.g. ``` $scope.$watch('item1, item2', function () { }); ```
- Modified
- 7 Feb at 12:45
Pseudo-terminal will not be allocated because stdin is not a terminal
I am trying to write a shell script that creates some directories on a remote server and then uses scp to copy files from my local machine onto the remote. Here's what I have so far: ``` ssh -t user@...
Clear form fields with jQuery
I want to clear all input and textarea fields in a form. It works like the following when using an input button with the `reset` class: ``` $(".reset").bind("click", function() { $("input[type=text...