Tutorial by Examples: c

If you make a commit as the wrong author, you can change it, and then amend git config user.name "Full Name" git config user.email "[email protected]" git commit --amend --reset-author
Function scope is the special scope for labels. This is due to their unusual property. A label is visible through the entire function it is defined and one can jump (using instruction gotolabel) to it from any point in the same function. While not useful, the following example illustrate the point: ...
Android Studio's Live templates can offer quite a few shortcuts for quick logging. To use Live templates, all you need to do is to start typing the template name, and hit TAB or enter to insert the statement. Examples: logi → turns into → android.util.Log.i(TAG, "$METHOD_NAME$: $content$&q...
Caffe can run on multiple cores. One way is to enable multithreading with Caffe to use OpenBLAS instead of the default ATLAS. To do so, you can follow these three steps: sudo apt-get install -y libopenblas-dev Before compiling Caffe, edit Makefile.config, replace BLAS := atlas by BLAS := open A...
What's between \Q and \E is treated as normal characters #!/usr/bin/perl my $str = "hello.it's.me"; my @test = ( "hello.it's.me", "hello/it's!me", ); sub ismatched($) { $_[0] ? "MATCHED!" : "DID NOT MATCH!" } my @match = ( ...
It is sometimes required for a process to concurrently write and read the same "data". The ReadWriteLock interface, and its ReentrantReadWriteLock implementation allows for an access pattern that can be described as follow : There can be any number of concurrent readers of the data. If...
using System; using System.Runtime.InteropServices; namespace ComLibrary { [ComVisible(true)] public interface IMainType { int GetInt(); void StartTime(); int StopTime(); } [ComVisible(true)] [ClassInterface(ClassInterfaceType.N...
Services declaration : # src/Acme/YourBundle/Resources/config/services.yml services: my_service: class: Acme\YourBundle\Service\MyService arguments: ["@doctrine", "%some_parameter%", "@another_service"] another_service: class: Ac...
For an instance, if the html source code of an html view or element is wrapped by an iframe like this: <iframe src="../images/eightball.gif" name="imgboxName" id="imgboxId"> <p>iframes example</p> <a href="../images/redball.gif" t...
el-get is an open source package management system for GNU Emacs. el-get works with melpa, as well as with many common version control systms. Its documentation includes a simple self-installer for your .emacs: (unless (require 'el-get nil t) (url-retrieve "https://raw.github.com/dim...
Function-like macros are similar to inline functions, these are useful in some cases, such as temporary debug log: #ifdef DEBUG # define LOGFILENAME "/tmp/logfile.log" # define LOG(str) do { \ FILE *fp = fopen(LOGFILENAME, "a"); \ ...
This attribute is applied to the class property. You can use ConcurrencyCheck attribute when you want to use existing columns for concurrency check and not a separate timestamp column for concurrency. using System.ComponentModel.DataAnnotations; public class Author { public int AuthorId { ...
We can create a Map from a list of tuples like this: Map.fromList [("Alex", 31), ("Bob", 22)] A Map can also be constructed with a single value: > Map.singleton "Alex" 31 fromList [("Alex",31)] There is also the empty function. empty :: Map k a ...
A class decorator is just a function that takes the class as its only argument and returns it after doing something with it: function log<T>(target: T) { // Do something with target console.log(target); // Return target return target; } We can then apply ...
This time we are going to declare a class decorator that will add some metadata to a class when we applied to it: function addMetadata(target: any) { // Add some metadata target.__customMetadata = { someKey: "someValue" }; // Return target ret...
We can wrap a class decorator with another function to allow customization: function addMetadata(metadata: any) { return function log(target: any) { // Add metadata target.__customMetadata = metadata; // Return target return target; ...
The regular composition works for unary functions. In the case of binary, we can define (f .: g) x y = f (g x y) -- which is also = f ((g x) y) = (f . g x) y -- by definition of (.) = (f .) (g x) y = ((f .) . g) x y Thus,...
Extensions can add new subscripts to an existing type. This example gets the character inside a String using the given index: 2.2 extension String { subscript(index: Int) -> Character { let newIndex = startIndex.advancedBy(index) return self[newIndex] } } var my...
In the Xcode, you have three separate areas of working - Navigators (in red), Debug area(in green) and Utilities(in blue). The workspace window always includes the editor area. When you select a file in your project, its contents appear in the editor area, where Xcode opens the file in an appropri...
Install webpack-dev-middleware via npm npm i -D webpack-dev-middleware webpack-hot-middleware Modify webpack.config.js Add webpack-hot-middleware/client to each items defined in "entry" Add new webpack.HotModuleReplacementPlugin() to "plugins" module.export...

Page 387 of 826