Questions

How would you do a "not in" query with LINQ?

I have two collections which have property `Email` in both collections. I need to get a list of the items in the first list where `Email` does not exist in the second list. With SQL I would just use "...

6 Mar at 20:25

Unity Scripts edited in Visual studio don't provide autocomplete

When I want to edit C# Unity scripts, they open in Visual Studio. It is supposed to provide auto complete for all Unity related code, but it doesn't work. Here you can see the missing functionality: !...

12 Aug at 23:25

Android Material Design Button Styles

I'm confused on button styles for material design. I'd like to get colorful raised buttons like in the attached link., like the "force stop" and "uninstall" buttons seen under the usage section. Are t...

What does enumerate() mean?

What does `for row_number, row in enumerate(cursor):` do in Python? What does `enumerate` mean in this context?

21 Apr at 09:11

How do I set up HttpContent for my HttpClient PostAsync second parameter?

``` public static async Task<string> GetData(string url, string data) { UriBuilder fullUri = new UriBuilder(url); if (!string.IsNullOrEmpty(data)) fullUri.Query = data; HttpClien...

7 Nov at 09:29

List all files in one directory PHP

What would be the best way to list all the files in one directory with PHP? Is there a $_SERVER function to do this? I would like to list all the files in the usernames/ directory and loop over that r...

2 Apr at 21:23

Is there a "standard" format for command line/shell help text?

If not, is there a de facto standard? Basically I'm writing a command line help text like so: ``` usage: app_name [options] required_input required_input2 options: -a, --argument Does somet...

Recommended way to get hostname in Java

Which of the following is the best and most portable way to get the hostname of the current computer in Java? `Runtime.getRuntime().exec("hostname")` vs `InetAddress.getLocalHost().getHostName()`...

Show space, tab, CRLF characters in editor of Visual Studio

Where are the settings to show a `space`, `tab`, `paragraph`, `CRLF`, etc. () characters?

23 Aug at 20:59

Determine if a String is an Integer in Java

I'm trying to determine if a particular item in an Array of strings is an integer or not. I am `.split(" ")`'ing an infix expression in `String` form, and then trying to split the resultant array int...

4 Mar at 08:15

INSERT with SELECT

I have a query that inserts using a `SELECT` statement: ``` INSERT INTO courses (name, location, gid) SELECT name, location, gid FROM courses WHERE cid = $cid ``` Is it possible to only select "na...

14 Jan at 20:55

Comparing two dictionaries and checking how many (key, value) pairs are equal

I have two dictionaries, but for simplification, I will take these two: ``` >>> x = dict(a=1, b=2) >>> y = dict(a=2, b=2) ``` Now, I want to compare whether each `key, value` pair in `x` has the sa...

29 Jul at 15:15

How to set HTTP header to UTF-8 using PHP which is valid in W3C validator

I have several [PHP](http://en.wikipedia.org/wiki/PHP) pages echoing out various things into [HTML](http://en.wikipedia.org/wiki/HTML) pages with the following code. ``` <meta http-equiv="Content-typ...

15 Aug at 11:5

Forking vs. Branching in GitHub

I'd like to know more about the advantages and disadvantages of forking a github project vs. creating a branch of a github project. Forking makes my version of the project more isolated from the orig...

31 Aug at 17:5

List of All Locales and Their Short Codes?

I'm looking for a list of all locales and their short codes for a PHP application I am writing. Is there much variation in this data between platforms? Also, if I am developing an international appli...

7 Jul at 03:31

How to format time since xxx e.g. “4 minutes ago” similar to Stack Exchange sites

The question is how to format a JavaScript `Date` as a string stating the time elapsed similar to the way you see times displayed on Stack Overflow. e.g. - - - - -

5 Jul at 07:45

Python truncate a long string

How does one truncate a string to 75 characters in Python? This is how it is done in JavaScript: ``` var data="saddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddsad...

18 Jul at 21:3

What is a practical use for a closure in JavaScript?

I'm [trying](http://jsbin.com/ojuxo/edit) my hardest to wrap my head around JavaScript closures. I get that by returning an inner function, it will have access to any variable defined in its immediat...

22 Jul at 17:33

Replace spaces with dashes and make all letters lower-case

I need to reformat a string using jQuery or vanilla JavaScript Let’s say we have `"Sonic Free Games"`. I want to convert it to `"sonic-free-games"`. So whitespaces should be replaced by dashes and ...

2 Mar at 13:35

Performance surprise with "as" and nullable types

I'm just revising chapter 4 of C# in Depth which deals with nullable types, and I'm adding a section about using the "as" operator, which allows you to write: ``` object o = ...; int? x = o as int?; ...

7 Apr at 02:46

Is there a command like "watch" or "inotifywait" on the Mac?

I want to watch a folder on my Mac and then execute a bash script, passing it the name of whatever file/folder was just moved into or created in the watched directory.

18 May at 07:44

Check if a string is null or empty in XSLT

How can I check if a value is null or empty with [XSL](http://en.wikipedia.org/wiki/XSL)? For example, if `categoryName` is empty? I'm using a construct. For example: ``` <xsl:choose> <xsl:whe...

25 Jul at 17:35

What causes javac to issue the "uses unchecked or unsafe operations" warning

For example: ``` javac Foo.java Note: Foo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. ```

8 Mar at 20:44

How do I split a multi-line string into multiple lines?

I have a multi-line string that I want to do an operation on each line, like so: ``` inputString = """Line 1 Line 2 Line 3""" ``` I want to iterate on each line: ``` for line in inputString: doSt...

20 Oct at 04:40

How to parse a string into a nullable int

I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed. I was kind of hoping that this would work ``` int? ...

13 Dec at 06:10