Questions

How to create a GUID/UUID in Python

How do I create a GUID/UUID in Python that is platform independent? I hear there is a method using ActivePython on Windows but it's Windows only because it uses COM. Is there a method using plain Pyth...

6 Aug at 10:15

How do I type hint a method with the type of the enclosing class?

I have the following code in Python 3: ``` class Position: def __init__(self, x: int, y: int): self.x = x self.y = y def __add__(self, other: Position) -> Position: r...

Why would you use Expression<Func<T>> rather than Func<T>?

I understand lambdas and the `Func` and `Action` delegates. But expressions stump me. In what circumstances would you use an `Expression<Func<T>>` rather than a plain old `Func<T>`?

19 Apr at 13:53

How can I access and process nested objects, arrays, or JSON?

I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)? For example: ``` var data = { code: 42, ...

Best way to use multiple SSH private keys on one client

I want to use multiple private keys to connect to different servers or different portions of the same server (my uses are system administration of server, administration of Git, and normal Git usage w...

18 Oct at 19:39

Git: Find the most recent common ancestor of two branches

How to find the most recent common ancestor of two Git branches?

10 Nov at 12:33

How do I clear/delete the current line in terminal?

If I'm using terminal and typing in a line of text for a command, is there a hotkey or any way to clear/delete that line? For example, if my current line/command is something really long like: ``` >...

21 Mar at 04:28

How can I get the application's path in a .NET console application?

How do I find the application's path in a console application? In [Windows Forms](http://en.wikipedia.org/wiki/Windows_Forms), I can use `Application.StartupPath` to find the current path, but this d...

20 Nov at 15:40

How is an HTTP POST request made in node.js?

How can I make an outbound HTTP POST request, with data, in node.js?

5 Mar at 02:35

Angular: conditional class with *ngClass

What is wrong with my Angular code? I am getting the following error: > Cannot read property 'remove' of undefined at BrowserDomAdapter.removeClass ``` <ol> <li *ngClass="{active: step==='step1'}" (...

How to add dividers and spaces between items in RecyclerView

This is an example of how it could have been done previously in the `ListView` class, using the and parameters: ``` <ListView android:id="@+id/activity_home_list_view" android:layout_width="...

Is there any difference between a GUID and a UUID?

I see these two acronyms being thrown around and I was wondering if there are any differences between a GUID and a UUID?

2 Nov at 10:29

How to subtract a day from a date?

I have a Python [datetime.datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) object. What is the best way to subtract one day?

22 Feb at 23:46

What is the difference between a port and a socket?

This was a question raised by one of the software engineers in my organisation. I'm interested in the broadest definition.

28 Mar at 03:50

When should I use CROSS APPLY over INNER JOIN?

What is the main purpose of using [CROSS APPLY](http://technet.microsoft.com/en-us/library/ms175156.aspx)? I have read (vaguely, through posts on the Internet) that `cross apply` can be more efficien...

When should I use curly braces for ES6 import?

It seems to be obvious, but I found myself a bit confused about when to use curly braces for importing a single module in ES6. For example, in the React-Native project I am working on, I have the foll...

31 Dec at 02:0

Convert a String representation of a Dictionary to a dictionary

How can I convert the `str` representation of a `dict`, such as the following string, into a `dict`? ``` s = "{'muffin' : 'lolz', 'foo' : 'kitty'}" ``` I prefer not to use `eval`. What else can I u...

13 Jun at 16:51

Why can't variables be declared in a switch statement?

I've always wondered this - why can't you declare variables after a case label in a switch statement? In C++ you can declare variables pretty much anywhere (and declaring them close to first use is o...

15 Jan at 05:58

How to add 30 minutes to a JavaScript Date object?

I'd like to get a Date object which is 30 minutes later than another Date object. How do I do it with JavaScript?

11 Jul at 16:6

Error message "No exports were found that match the constraint contract name"

This morning I faced a problem while opening my Visual Studio solution, and when I tried to run it, it said: > No exports were found that match the constraint contract name How can I fix this proble...

7 Oct at 08:8

How to "comment-out" (add comment) in a batch/cmd?

I have a batch file that runs several python scripts that do table modifications. 1. I want to have users comment out the 1-2 python scripts that they don't want to run, rather than removing them ...

What's the difference between git reset --mixed, --soft, and --hard?

I'm looking to split a commit up and not sure which reset option to use. I was looking at the page [In plain English, what does "git reset" do?](https://stackoverflow.com/questions/2530060/can-you-ex...

18 Mar at 10:2

How to copy commits from one branch to another?

I've got two branches from my master: - - Is there a way to copy yesterday's commits from wss to v2.1?

29 Jun at 04:4

Converting unix timestamp string to readable date

I have a string representing a unix timestamp (i.e. "1284101485") in Python, and I'd like to convert it to a readable date. When I use `time.strftime`, I get a `TypeError`: ``` >>>import time >>>print...

How to download a file over HTTP?

I have a small utility that I use to download an MP3 file from a website on a schedule and then builds/updates a podcast XML file which I've added to iTunes. The text processing that creates/updates ...

25 Feb at 21:56