Questions

Flexbox: 4 items per row

I'm using a flex box to display 8 items that will dynamically resize with my page. How do I force it to split the items into two rows? (4 per row)? Here is a relevant snip: (Or if you prefer jsfiddl...

26 Dec at 21:47

How can I avoid "RuntimeError: dictionary changed size during iteration" error?

I have a dictionary of lists in which some of the values are empty: ``` d = {'a': [1], 'b': [1, 2], 'c': [], 'd':[]} ``` At the end of creating these lists, I want to remove these empty lists before ...

2 Feb at 16:23

Is there any way to redraw tmux window when switching smaller monitor to bigger one?

I started a tmux session on a smaller terminal. When I "attach" to the same session on a larger resolution monitor, it draws dots around the console. It doesn't fit the new window size. Is there any w...

17 Aug at 08:29

Delete all Duplicate Rows except for One in MySQL?

How would I delete all duplicate data from a MySQL Table? For example, with the following data: ``` SELECT * FROM names; +----+--------+ | id | name | +----+--------+ | 1 | google | | 2 | yahoo...

28 Mar at 10:37

Returning unique_ptr from functions

`unique_ptr<T>` does not allow copy construction, instead it supports move semantics. Yet, I can return a `unique_ptr<T>` from a function and assign the returned value to a variable. ``` #include <io...

2 Jul at 17:29

Retrieve only the queried element in an object array in MongoDB collection

Suppose you have the following documents in my collection: ``` { "_id":ObjectId("562e7c594c12942f08fe4192"), "shapes":[ { "shape":"square", "color":"blue" },...

How to repeatedly execute a function every x seconds?

I want to repeatedly execute a function in Python every 60 seconds forever (just like an [NSTimer](http://web.archive.org/web/20090823012700/http://developer.apple.com:80/DOCUMENTATION/Cocoa/Reference...

19 Nov at 20:25

How to use GROUP BY to concatenate strings in SQL Server?

How do I get: ``` id Name Value 1 A 4 1 B 8 2 C 9 ``` to ``` id Column 1 A:4, B:8 2 C:9 ```

Find a file by name in Visual Studio Code

How can I in Visual Studio Code? A Visual Studio shortcut I'm used to is +, but it does not work here.

6 Feb at 03:39

How to set Python's default version to 3.x on OS X?

I'm running Mountain Lion and the basic default Python version is 2.7. I downloaded Python 3.3 and want to set it as default. Currently: ``` $ python version 2.7.5 $ python3.3 version 3.3 ``...

31 Aug at 14:57

Adding multiple columns AFTER a specific column in MySQL

I need to add multiple columns to a table but position the columns a column called `lastname`. I have tried this: ``` ALTER TABLE `users` ADD COLUMN ( `count` smallint(6) NOT NULL, `log` va...

6 Jul at 12:35

How to escape double quotes in JSON

I'm trying to show double quotes but it shows one of the backslashes: ``` "maingame": { "day1": { "text1": "Tag 1", "text2": "Heute startet unsere Rundreise \\\"Example text\\\". ...

26 Mar at 04:18

sed edit file in place

I am trying to find out if it is possible to edit a file in a single sed command without streaming the edited content into a new file and then renaming the new file to the original file name. I tried...

18 Aug at 16:56

How to clear basic authentication details in chrome

I'm working on a site that uses basic authentication. Using Chrome I've logged in using the basic auth. I now want to remove the basic authentication details from the browser and try a different login...

12 Oct at 12:34

Equivalent of Math.Min & Math.Max for Dates?

What's the quickest and easiest way to get the Min (or Max) value between two dates? Is there an equivalent to Math.Min (& Math.Max) for dates? I want to do something like: ``` if (Math.Min(Date1, D...

31 Dec at 13:0

Get MIME type from filename extension

How can I get the MIME type from a file extension?

18 Apr at 02:13

Passing arguments to C# generic new() of templated type

I'm trying to create a new object of type T via its constructor when adding to the list. I'm getting a compile error: The error message is: > 'T': cannot provide arguments when creating an instance ...

8 Mar at 10:22

Why Doesn't C# Allow Static Methods to Implement an Interface?

Why was C# designed this way? As I understand it, an interface only describes behaviour, and serves the purpose of describing a contractual obligation for classes implementing the interface that cert...

6 Jul at 07:14

How do you round a number to two decimal places in C#?

I want to do this using the `Math.Round` function

26 Jun at 04:58

JavaScript for...in vs for

Do you think there is a big difference in for...in and for loops? What kind of "for" do you prefer to use and why? Let's say we have an array of associative arrays: ``` var myArray = [{'key': 'value...

11 Apr at 02:42

How do you specify a different port number in SQL Management Studio?

I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when connecting to the server using SQL Management Studio?

22 Dec at 09:0

Updating an object with setState in React

Is it at all possible to update object's properties with `setState`? Something like: ``` this.state = { jasper: { name: 'jasper', age: 28 }, } ``` I have tried: ``` this.setState({jasper.name...

22 Mar at 11:37

Bootstrap align navbar items to the right

How do I align a navbar item to right? I want to have the login and register to the right. But everything I try does not seem to work. [](https://i.stack.imgur.com/G2o6H.png) ## This is what I hav...

How to change the figure size of a seaborn axes or figure level plot

How do I change the size of my image so it's suitable for printing? For example, I'd like to use to A4 paper, whose dimensions are 11.7 inches by 8.27 inches in landscape orientation.

21 Nov at 20:41

scp or sftp copy multiple files with single command

I'd like to copy files from/to remote server in different directories. For example, I want to run these 4 commands at once. ``` scp remote:A/1.txt local:A/1.txt scp remote:A/2.txt local:A/2.txt scp r...

2 Jun at 18:56