How do I do a literal *int64 in Go?

The Go Language Specification (Address operators) does not allow to take the address of a numeric constant (not of an untyped nor of a typed constant). The operand must be addressable, that is, either a variable, pointer indirection, or slice indexing operation; or a field selector of an addressable struct operand; or an array indexing … Read more

Literal notation for Dictionary in C#?

You use the collection initializer syntax, but you still need to make a new Dictionary<string, string> object first as the shortcut syntax is translated to a bunch of Add() calls (like your code): var data = new Dictionary<string, string> { { “test”, “val” }, { “test2”, “val2” } }; In C# 6, you now have … Read more

Why can’t Python’s raw string literals end with a single backslash?

The whole misconception about python’s raw strings is that most of people think that backslash (within a raw string) is just a regular character as all others. It is NOT. The key to understand is this python’s tutorial sequence: When an ‘r‘ or ‘R‘ prefix is present, a character following a backslash is included in … Read more

Java: how do I get a class literal from a generic type?

You can’t due to type erasure. Java generics are little more than syntactic sugar for Object casts. To demonstrate: List<Integer> list1 = new ArrayList<Integer>(); List<String> list2 = (List<String>)list1; list2.add(“foo”); // perfectly legal The only instance where generic type information is retained at runtime is with Field.getGenericType() if interrogating a class’s members via reflection. All of … Read more

Why does instanceof return false for some literals?

Primitives are a different kind of type than objects created from within Javascript. From the Mozilla API docs: var color1 = new String(“green”); color1 instanceof String; // returns true var color2 = “coral”; color2 instanceof String; // returns false (color2 is not a String object) I can’t find any way to construct primitive types with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)