Tutorial by Examples: dc

A whole class may be declared as friend. Friend class declaration means that any member of the friend may access private and protected members of the declaring class: class Accesser { public: void private_accesser1(); void private_accesser2(); }; class PrivateHolder { public: P...
Here is an example of how to import a function that is defined in an unmanaged C++ DLL. In the C++ source code for "myDLL.dll", the function add is defined: extern "C" __declspec(dllexport) int __stdcall add(int a, int b) { return a + b; } Then it can be included into ...
Download your preferred version from Lightbend with curl: curl -O http://downloads.lightbend.com/scala/2.xx.x/scala-2.xx.x.tgz Unzip the tar file to /usr/local/share or /opt/bin: unzip scala-2.xx.x.tgz mv scala-2.xx.x /usr/local/share/scala Add the PATH to ~/.profile or ~/.bash_profile or ...
Many commands and programs in the remote side are screen-based (e.g. mc) or they need to ask password (e.g. sudo), to be able to run these kind of programs you can use option -t. ssh -t [email protected] sudo ls / [sudo] password for alice: bin root dev etc home lib mnt opt proc root run usr ...
public class IntStack { private IntStackNode head; // IntStackNode is the inner class of the class IntStack // Each instance of this inner class functions as one link in the // Overall stack that it helps to represent private static class IntStackNode { privat...
When creating a nested class, you face a choice of having that nested class static: public class OuterClass1 { private static class StaticNestedClass { } } Or non-static: public class OuterClass2 { private class NestedClass { } } At its core, static nested c...
class MyHello { def sayHello() { "Hello, world" } } def cl = { sayHello() } cl() // groovy.lang.MissingMethodException cl.delegate = new MyHello() cl(); // "Hello, world" Used extensively by Groovy DSLs.
For example we have WordCountService with countWords method: class WordCountService { def countWords(url: String): Map[String, Int] = { val sparkConf = new SparkConf().setMaster("spark://somehost:7077").setAppName("WordCount")) val sc = new SparkContext(sp...
The sensor values returned by Android are with respective to the phone's coordinate system (e.g. +Y points towards the top of the phone). We can transform these sensor values into a world coordinate system (e.g. +Y points towards magnetic North, tangential to the ground) using the sensor managers ro...
BroadcastReceivers are used to receive broadcast Intents that are sent by the Android OS, other apps, or within the same app. Each Intent is created with an Intent Filter, which requires a String action. Additional information can be configured in the Intent. Likewise, BroadcastReceivers register ...
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=password&username=[USERNAME]&password=[PASSWORD] &client_id=[APP_KEY]&client_secret=[APP_SECRET] Source
Odoo v8.0 way is to add corresponding record in the XML file: ​Add XML file to the manifest (i.e. __openerp__.py file.): ... 'data' : [ 'your_file.xml' ], ​... Then add following record in 'your_file.xml': <openerp> <data> <template id="...
Note: you should use this way if you've installed a "website" module and you have a public website available. Add following record in 'your_file.xml': <openerp> <data> <template id="assets_frontend" name="your_module_name assets" inherit...
Add following record in 'your_file.xml': <openerp> <data> <template id="assets_common" name="your_module_name assets" inherit_id="web.assets_common"> <xpath expr="." position="inside"> <link rel...
Example uses basic HTTP syntax. Any <#> in the example should be removed when copying it. The _cat APIs are often convenient for humans to get at-a-glance details about the cluster. But you frequently want consistently parseable output to use with software. In general, the JSON APIs are meant...
Callbacks are often used to provide error handling. This is a form of control flow branching, where some instructions are executed only when an error occurs: const expected = true; function compare(actual, success, failure) { if (actual === expected) { success(); } else { failure...
A class or struct can also contain another class/struct definition inside itself, which is called a "nested class"; in this situation, the containing class is referred to as the "enclosing class". The nested class definition is considered to be a member of the enclosing class, b...
LocalBroadcastManager is used to send Broadcast Intents within an application, without exposing them to unwanted listeners. Using LocalBroadcastManager is more efficient and safer than using context.sendBroadcast() directly, because you don't need to worry about any broadcasts faked by other Applic...
Avoid code repetition in constructors by setting a tuple of variables with a one liner: class Contact: UIView { private var message: UILabel private var phone: UITextView required init?(coder aDecoder: NSCoder) { (message, phone) = self.dynamicType.setUp() su...
First make utility class or use this method in class needed public class UIUtils { public static BitmapImageViewTarget getRoundedImageTarget(@NonNull final Context context, @NonNull final ImageView imageView, final float radius) { retur...

Page 10 of 28