Questions

Vertically align text next to an image?

Why won't `vertical-align: middle` work? And yet, `vertical-align: top` work. ``` span{ vertical-align: middle; } ``` ``` <div> <img src="https://via.placeholder.com/30" alt="small img" /> <sp...

19 Feb at 19:14

HTML 5: Is it <br>, <br/>, or <br />?

I've tried checking [other answers](https://stackoverflow.com/questions/1659208/why-br-and-not-br), but I'm still confused — especially after seeing [W3schools HTML 5 reference](http://www.w3schools.c...

30 Jul at 14:15

How do I name and retrieve a Git stash by name?

How do I save/apply a stash with a name? I don't want to have to look up its index number in `git stash list`. I tried `git stash save "my_stash_name"`, but that only changes the stash description, an...

2 Sep at 02:0

How do I delete an exported environment variable?

Before installing [gnuplot](https://en.wikipedia.org/wiki/Gnuplot), I set the environment variable `GNUPLOT_DRIVER_DIR = /home/gnuplot/build/src`. During the installation, something went wrong. I want...

25 Jan at 23:38

How do I calculate someone's age based on a DateTime type birthday?

Given a `DateTime` representing a person's birthday, how do I calculate their age in years?

27 Jul at 22:34

When should I use 'self' over '$this'?

In PHP 5, what is the difference between using `self` and `$this`? When is each appropriate?

2 Sep at 23:14

Daylight saving time and time zone best practices

I am hoping to make this question and the answers to it the definitive guide to dealing with daylight saving time, in particular for dealing with the actual change overs. Many systems are dependen...

How can I symlink a file in Linux?

I want to make a symbolic link in Linux. I have written this Bash command where the first path is the folder I want link into and the second path is the compiled source. ``` ln -s '+basebuild+'/IpDo...

16 Nov at 23:34

How does JavaScript .prototype work?

I'm not that into dynamic programming languages but I've written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one know how this works?...

How can I see the changes in a Git commit?

When I do `git diff COMMIT` I see the changes between that commit and HEAD (as far as I know), but I would like to see the changes that were made by that single commit. I haven't found any obvious op...

11 Apr at 09:19

C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?

C++11 introduced a standardized memory model, but what exactly does that mean? And how is it going to affect C++ programming? [This article](http://www.theregister.co.uk/2011/06/11/herb_sutter_next_c_...

How to remove an element from a list by index

How do I remove an element from a list ? I found `list.remove()`, but this slowly scans the list for an item .

29 Mar at 09:37

What are drawbacks or disadvantages of singleton pattern?

The [singleton pattern](https://en.wikipedia.org/wiki/Singleton_pattern) is a fully paid up member of the [GoF](https://en.wikipedia.org/wiki/Design_Patterns)'s [patterns book](https://rads.stackoverf...

20 Jun at 07:56

RegEx match open tags except XHTML self-contained tags

I need to match all of these opening tags: ``` <p> <a href="foo"> ``` But not these: ``` <br /> <hr class="foo" /> ``` I came up with this and wanted to make sure I've got it right. I am only ca...

26 May at 20:37

Why is reading lines from stdin much slower in C++ than Python?

I wanted to compare reading lines of string input from stdin using Python and C++ and was shocked to see my C++ code run an order of magnitude slower than the equivalent Python code. Since my C++ is r...

Could not open a connection to your authentication agent

I am running into this error of: ``` $ git push heroku master Warning: Permanently added the RSA host key for IP address '50.19.85.132' to the list of known hosts. ! Your key with fingerprint b7:fd...

15 Feb at 00:29

Remove file from latest commit

How do I remove a file from the latest commit?

17 Jul at 00:52

How to create an array containing 1...N

I'm looking for any alternatives to the below for creating a JavaScript array containing 1 through to N where N is only known at runtime. ``` var foo = []; for (var i = 1; i <= N; i++) { foo.push(...

26 May at 08:19

How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?

How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?

7 Oct at 13:30

What is the "N+1 selects problem" in ORM (Object-Relational Mapping)?

The "N+1 selects problem" is generally stated as a problem in Object-Relational mapping (ORM) discussions, and I understand that it has something to do with having to make a lot of database queries fo...

23 May at 14:49

How to use java.net.URLConnection to fire and handle HTTP requests

Use of [java.net.URLConnection](http://docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html) is asked about pretty often here, and the [Oracle tutorial](http://download.oracle.com/javase/tuto...

How do you merge two Git repositories?

Consider the following scenario: I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big reposito...

17 Feb at 20:38

How to copy Docker images from one host to another without using a repository

How do I transfer a Docker image from one machine to another one without using a repository, no matter private or public? I create my own image in VirtualBox, and when it is finished I try to deploy ...

13 Mar at 11:3

Short circuit Array.forEach like calling break

``` [1,2,3].forEach(function(el) { if(el === 1) break; }); ``` How can I do this using the new `forEach` method in JavaScript? I've tried `return;`, `return false;` and `break`. `break` crashes ...

28 Oct at 09:21

How do I profile C++ code running on Linux?

How do I find areas of my code that run slowly in a C++ application running on Linux?

4 Jul at 22:44