Questions

What is tail recursion?

Whilst starting to learn lisp, I've come across the term . What does it mean exactly?

Remove tracking branches no longer on remote

Is there a simple way to delete all tracking branches whose remote equivalent no longer exists? Example: Branches (local and remote) - - - - - Locally, I only have a master branch. Now I need to ...

13 Aug at 13:38

How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?

A C# desktop application (on the Visual Studio Express edition) worked, but then it didn't work 5 seconds later. I tried the following: - - - - I have two Windows Forms projects in the solution. One ...

Can't bind to 'ngModel' since it isn't a known property of 'input'

I have this simple input in my component which uses `[(ngModel)]` : ``` <input type="text" [(ngModel)]="test" placeholder="foo" /> ``` And I get the following error when I launch my app, even if the ...

25 Apr at 04:43

How can I display a JavaScript object?

How do I display the content of a JavaScript object in a string format like when we `alert` a variable? The same formatted way I want to display an object.

Comments in Markdown

How do you write a comment in Markdown, i.e. text that is not rendered in the HTML output? I found nothing on the [Markdown project](http://daringfireball.net/projects/markdown/).

21 Dec at 07:54

How can I delete all of my Git stashes at once?

How can I delete all of my [Git](https://en.wikipedia.org/wiki/Git) stashes at once? Specifically I mean, with typing in one command.

7 Jan at 09:22

Undo working copy modifications of one file in Git?

After the last commit, I modified a bunch of files in my working copy, but I want to undo the changes to one of those files, as in reset it to the same state as the most recent commit. However, I onl...

11 Jan at 10:49

How do I commit case-sensitive only filename changes in Git?

I have changed a few files name by de-capitalize the first letter, as in `Name.jpg` to `name.jpg`. Git does not recognize this changes and I had to delete the files and upload them again. Is there a ...

Static methods in Python?

Can I define a [static method](https://en.wikipedia.org/wiki/Method_(computer_programming)#Static_methods) which I can call directly on the class instance? e.g., ``` MyClass.the_static_method() ```

29 Nov at 00:11

Abort Ajax requests using jQuery

Is it possible that using jQuery, I that I have not yet received the response from?

8 Jul at 00:24

How does Git handle symbolic links?

If I have a file or directory that is a symbolic link and I commit it to a Git repository, what happens to it? I would assume that it leaves it as a symbolic link until the file is deleted and then i...

27 Oct at 10:1

Looping through the content of a file in Bash

How do I iterate through each line of a text file with [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell))? With this script: ``` echo "Start!" for p in (peptides.txt) do echo "${p}" done ``...

29 May at 19:47

How can I remove a commit on GitHub?

I "accidentally" pushed a commit to GitHub. Is it possible to remove this commit? I want to revert my GitHub repository as it was before this commit.

How to do case insensitive search in Vim

I'd like to search for an upper case word, for example COPYRIGHT in a file. I tried performing a search like: ``` /copyright/i # Doesn't work ``` but it doesn't work. I know that in Perl, if I ...

2 Apr at 12:50

How can I count all the lines of code in a directory recursively?

We've got a PHP application and want to count all the lines of code under a specific directory and its subdirectories. We don't need to ignore comments, as we're just trying to get a rough idea. ``` w...

7 Apr at 23:39

Who is listening on a given TCP port on Mac OS X?

On Linux, I can use `netstat -pntl | grep $PORT` or `fuser -n tcp $PORT` to find out which process (PID) is listening on the specified TCP port. How do I get the same information on Mac OS X?

12 Dec at 12:30

What do two question marks together mean in C#?

Ran across this line of code: ``` FormsAuth = formsAuth ?? new FormsAuthenticationWrapper(); ``` What do the two question marks mean, is it some kind of ternary operator? It's hard to look up in Go...

3 Apr at 11:10

How to exit from PostgreSQL command line utility: psql

What command or short key can I use to exit the PostgreSQL command line utility `psql`?

18 Oct at 08:41

Detach (move) subdirectory into separate Git repository

I have a [Git](http://en.wikipedia.org/wiki/Git_%28software%29) repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and shou...

1 Aug at 08:25

Inserting multiple rows in a single SQL query?

I have multiple set of data to insert at once, say 4 rows. My table has three columns: `Person`, `Id` and `Office`. ``` INSERT INTO MyTable VALUES ("John", 123, "Lloyds Office"); INSERT INTO MyTable ...

17 Oct at 13:25

How to detect a mobile device using jQuery

Is there a way to detect whether or not a user is using a mobile device in jQuery? Something similar to the CSS `@media` attribute? I would like to run a different script if the browser is on a handhe...

Why should text files end with a newline?

I assume everyone here is familiar with the adage that all text files should end with a newline. I've known of this "rule" for years but I've always wondered — why?

12 Nov at 19:49

What's the difference between the atomic and nonatomic attributes?

What do `atomic` and `nonatomic` mean in property declarations? ``` @property(nonatomic, retain) UITextField *userName; @property(atomic, retain) UITextField *userName; @property(retain) UITextField ...

What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?

Python 3.3 includes in its standard library the new package `venv`. What does it do, and how does it differ from all the other packages that match the regex `(py)?(v|virtual|pip)?env`?

What's the difference between a proxy server and a reverse proxy server?

What is the difference between a proxy server and a reverse proxy server?

How to duplicate a whole line in Vim?

How do I duplicate a whole line in in a similar way to + in IntelliJ IDEA/ Resharper or ++/ in ?

26 Apr at 10:6

What is the 'new' keyword in JavaScript?

The `new` keyword in JavaScript can be quite confusing when it is first encountered, as people tend to think that JavaScript is not an object-oriented programming language. - - -

25 Jul at 13:42

Loop inside React JSX

I'm trying to do something like the following in React JSX (where ObjectRow is a separate component): ``` <tbody> for (var i=0; i < numrows; i++) { <ObjectRow/> } </tbody> ``` I real...

14 Feb at 15:36

How to get just one file from another branch?

I have a `master` branch with a file called `app.js`. I made changes to this file on an `experiment` branch. I want to apply only the changes made to `app.js` from `experiment` onto the `master` branc...

25 Jul at 05:17

How do I split a string in Java?

I want to split the string `"004-034556"` into two strings by the delimiter `"-"`: ``` part1 = "004"; part2 = "034556"; ``` That means the first string will contain the characters before `'-'`, and t...

24 Jul at 23:41

What is TypeScript and why would I use it in place of JavaScript?

Can you please describe what the TypeScript language is? What can it do that JavaScript or available libraries cannot do, that would give me reason to consider it?

11 May at 13:36

What is the difference between Bower and npm?

What is the fundamental difference between `bower` and `npm`? Just want something plain and simple. I've seen some of my colleagues use `bower` and `npm` interchangeably in their projects.

AddTransient, AddScoped and AddSingleton Services Differences

I want to implement [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) (DI) in ASP.NET Core. So after adding this code to `ConfigureServices` method, both ways work. What is th...

8 Jun at 00:10

How to move an element into another element

I would like to move one DIV element inside another. For example, I want to move this (including all children): ``` <div id="source"> ... </div> ``` into this: ``` <div id="destination"> ... </di...

12 Nov at 05:3

How to redirect and append both standard output and standard error to a file with Bash

To redirect [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29) to a truncated file in Bash, I know to use: ``` cmd > file.txt ``` To redirect standard outp...

Why does this code using random strings print "hello world"?

The following print statement would print "hello world". Could anyone explain this? ``` System.out.println(randomString(-229985452) + " " + randomString(-147909649)); ``` And `randomString()` looks...

28 Aug at 16:12

How can I get a list of Git branches, ordered by most recent commit?

I want to get a list of all the branches in a Git repository with the "freshest" branches at the top, where the "freshest" branch is the one that's been committed to most recently (and is, therefore, ...

10 Dec at 19:42

Transitions on the CSS display property

I'm currently designing a CSS 'mega dropdown' menu - basically a regular CSS-only dropdown menu, but one that contains different types of content. At the moment, , i.e., you can't do any sort of tran...

26 Nov at 07:17

How to merge two arrays in JavaScript and de-duplicate items

I have two JavaScript arrays: ``` var array1 = ["Vijendra","Singh"]; var array2 = ["Singh", "Shakya"]; ``` I want the output to be: ``` var array3 = ["Vijendra","Singh","Shakya"]; ``` The output...

18 Oct at 06:29

Check existence of input argument in a Bash shell script

I need to check the existence of an input argument. I have the following script ``` if [ "$1" -gt "-1" ] then echo hi fi ``` I get ``` [: : integer expression expected ``` How do I check the i...

30 May at 11:25

What is a NullReferenceException, and how do I fix it?

I have some code and when it executes, it throws a `NullReferenceException`, saying: > Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error?...

How can I view an old version of a file with Git?

Is there a command in Git to see (either dumped to stdout, or in `$PAGER` or `$EDITOR`) a particular version of a particular file?

16 Jul at 11:30

Meaning of @classmethod and @staticmethod for beginner

What do `@classmethod` and `@staticmethod` mean in Python, and how are they different? should I use them, should I use them, and should I use them? As far as I understand, `@classmethod` tells a cl...

Proper use of the IDisposable interface

I know from reading [Microsoft documentation](https://learn.microsoft.com/dotnet/api/system.idisposable) that the "primary" use of the `IDisposable` interface is to clean up unmanaged resources. To me...

How do I check if an object has a key in JavaScript?

Which is the right thing to do? ``` if (myObj['key'] == undefined) ``` or ``` if (myObj['key'] == null) ``` or ``` if (myObj['key']) ```

23 Jan at 15:46

Command to collapse all sections of code?

In Visual Studio, is there a command to collapse/expand all the sections of code in a file?

3 Jan at 06:36

Installing specific package version with pip

I am trying to install version 1.2.2 of `MySQL_python`, using a fresh virtualenv created with the `--no-site-packages` option. The current version shown in PyPi is [1.2.3](http://pypi.python.org/pypi/...

3 Apr at 19:58

How do we control web page caching, across all browsers?

Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner. For security reasons we do not want certain pages in our application to be cached, by th...

Vanilla JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for it

With jQuery, we all know the wonderful `.ready()` function: ``` $('document').ready(function(){}); ``` However, let's say I want to run a function that is written in standard JavaScript with no lib...

29 Jun at 20:23