new keyword in method signature

New keyword reference from MSDN: MSDN Reference Here is an example I found on the net from a Microsoft MVP that made good sense: Link to Original public class A { public virtual void One(); public void Two(); } public class B : A { public override void One(); public new void Two(); } B … Read more

`static` keyword inside function?

It makes the function remember the value of the given variable ($has_run in your example) between multiple calls. You could use this for different purposes, for example: function doStuff() { static $cache = null; if ($cache === null) { $cache=”%heavy database stuff or something%”; } // code using $cache } In this example, the if … Read more

What is the “type” reserved word in TypeScript?

It’s used for “type aliases”. For example: type StringOrNumber = string | number; type DictionaryOfStringAndPerson = Dictionary<string, Person>; Reference: (edit: removed outdated link) TypeScript Specification v1.5 (section 3.9, “Type Aliases”, pages 46 & 47) Update: (edit: removed outdated link) Now on section 3.10 of the 1.8 spec. Thanks @RandallFlagg for the updated spec and link … Read more

Why does Clojure have “keywords” in addition to “symbols”?

Here’s the Clojure documentation for Keywords and Symbols. Keywords are symbolic identifiers that evaluate to themselves. They provide very fast equality tests… Symbols are identifiers that are normally used to refer to something else. They can be used in program forms to refer to function parameters, let bindings, class names and global vars… Keywords are … Read more

Practical use of `stackalloc` keyword

The sole reason to use stackalloc is performance (either for computations or interop). By using stackalloc instead of a heap allocated array, you create less GC pressure (the GC needs to run less), you don’t need to pin the arrays down, it’s faster to allocate than a heap array, an it is automatically freed on … Read more

What does the `is` keyword do in typescript?

See the reference for user-defined type guard functions for more information. function isString(test: any): test is string{ return typeof test === “string”; } function example(foo: any){ if(isString(foo)){ console.log(“it is a string” + foo); console.log(foo.length); // string function } } example(“hello world”); Using the type predicate test is string in the above format (instead of just … Read more

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