Tutorial by Examples: c

The following code is taken from he official AutoHotkey documentation: Function implementation: #Persistent OnClipboardChange("ClipChanged") return ClipChanged(Type) { ToolTip Clipboard data type: %Type% Sleep 1000 ToolTip ; Turn off the tip. } Label implementati...
This script demonstrates how to receive complicated GUI events from different controls in the same event callback function. We'll be using two ListView controls for that. Now every time an action is detected on one of those ListView controls, we want a precise description of what happened and have ...
Some character may be reserved for HTML and cannot be used directly as it may obstruct the actual HTML codes. For example, trying to display the left and right angle brackets (<>) in the source code may cause unexpected results in the output. Similarly, white spaces as written in the source co...
If your package isn't only a library, but has a piece of code that can be used either as a showcase or a standalone application when your package is installed, put that piece of code into __main__.py file. Put the __main__.py in the package_name folder. This way you will be able to run it directly ...
It is possible that the client browser does not support Javascript or have Javascript execution disabled, perhaps due to security reasons. To be able to tell users that a script is supposed to execute in the page, the <noscript> tag can be used. The content of <noscript> is displayed whe...
When applied to a single-argument constructor, prevents that constructor from being used to perform implicit conversions. class MyVector { public: explicit MyVector(uint64_t size); }; MyVector v1(100); // ok uint64_t len1 = 100; MyVector v2{len1}; // ok, len1 is uint64_t int len2 ...
Oracle Java 7 and Java 8 Java 7 and Java 8 for macOS are available from Oracle. This Oracle page answers a lot of questions about Java for Mac. Note that Java 7 prior to 7u25 have been disabled by Apple for security reasons. In general, Oracle Java (Version 7 and later) requires an Intel-based Mac...
<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"&g...
Sometimes you may need to convert a Set to an array, for example to be able to use Array.prototype methods like .filter(). In order to do so, use Array.from() or destructuring-assignment: var mySet = new Set([1, 2, 3, 4]); //use Array.from const myArray = Array.from(mySet); //use destructuring-a...
There are no build-in methods for intersection and difference in Sets, but you can still achieve that but converting them to arrays, filtering, and converting back to Sets: var set1 = new Set([1, 2, 3, 4]), set2 = new Set([3, 4, 5, 6]); const intersection = new Set(Array.from(set1).filter(x...
Suppose you have a pojo class Person public class Person { public String name; public Person(String name) { this.name = name; } } And you want to parse it into a JSON array or a map of Person objects. Due to type erasure you cannot construct classes of List<Person&g...
Table locks can be an important tool for ENGINE=MyISAM, but are rarely useful for ENGINE=InnoDB. If you are tempted to use table locks with InnoDB, you should rethink how you are working with transactions. MySQL enables client sessions to acquire table locks explicitly for the purpose of cooperati...
To export the type and all its constructors, one must use the following syntax: module X (Person (..)) where So, for the following top-level definitions in a file called People.hs: data Person = Friend String | Foe deriving (Show, Eq, Ord) isFoe Foe = True isFoe _ = False This module d...
Haskell supports importing a subset of items from a module. import qualified Data.Stream (map) as D would only import map from Data.Stream, and calls to this function would require D.: D.map odd [1..] otherwise the compiler will try to use Prelude's map function.
C99 Macros with variadic args: Let's say you want to create some print-macro for debugging your code, let's take this macro as an example: #define debug_print(msg) printf("%s:%d %s", __FILE__, __LINE__, msg) Some examples of usage: The function somefunc() returns -1 if failed and 0 ...
Convert in uppercase the string argument Syntax: UPPER(str) UPPER('fOoBar') -- 'FOOBAR' UCASE('fOoBar') -- 'FOOBAR'
To generalize type_trait creation:based on SFINAE there are experimental traits detected_or, detected_t, is_detected. With template parameters typename Default, template <typename...> Op and typename ... Args: is_detected: alias of std::true_type or std::false_type depending of the validi...
To concatenate the value of two or more variables into a single string and print it as the output, we need to make use of interpolation. The following Less code, #demo:after { @var1: Hello; @var2: World!!!; content: "@{var1} @{var2}"; } when compiled would set "Hello Wo...
Classes, structs, enums and all their methods are internal by default. This means they can be only accessed from the same module. The test cases are in a different target an this means they are in a different module. To be able to access the method you want to test, you need to import the module to ...
If you want to add a Drawable be shown during the load, you can add a placeholder: Glide.with(context) .load(yourUrl) .placeholder(R.drawable.placeholder) .into(imageView); If you want a Drawable to be shown if the load fails for any reason: Glide.with(context) .load(yourUrl...

Page 448 of 826