Tutorial by Examples

private static final String TAG = "IntentBitmapFetch"; private static final String COLON_SEPARATOR = ":"; private static final String IMAGE = "image"; @Nullable public Bitmap getBitmap(@NonNull Uri bitmapUri, int maxDimen) { InputStream is = context.getConten...
Let's make a hello world web script. Web scripts have a descriptor, a controller, and, optionally, a view. These files must follow a naming convention. This descriptor is named helloworld.get.desc.xml. <webscript> <shortname>Hello World</shortname> <description>Hello ...
The Hello World Web Script handles GET HTTP methods. But what if you want to create data on the server? For that your web script should handle POST. Here is a simple example that creates new folders in Company Home. It is invoked by making a POST call with a JSON body that looks like: {'name':'tes...
A single instance of Node.js runs in a single thread. To take advantage of multi-core systems, application can be launched in a cluster of Node.js processes to handle the load. The cluster module allows you to easily create child processes that all share server ports. Following example create the ...
interface IGreeter { void Greet(); } class Greeter : IGreeter { public void Greet() { Console.WriteLine("Hello World"); } } class SpanishGreeter : IGreeter { public void Greet() { Console.WriteLine("Hola Mundo"); } ...
interface IService { void ProcessRequest(); } interface IRepository { IEnumerable<string> GetData(); } class HelloWorldRepository : IRepository { public IEnumerable<string> GetData() { return new[] { "Hello", "World" }; } ...
Dagger 2 supports creating a component from multiple modules. You can create your component this way: @Singleton @Component(modules = {GeneralPurposeModule.class, SpecificModule.class}) public interface MyMultipleModuleComponent { void inject(MyFragment myFragment); void inject(MyServic...
QRCodeReaderView implements an Android view which show camera and notify when there's a QR code inside the preview. It uses the zxing open-source, multi-format 1D/2D barcode image processing library. Adding the library to your project Add QRCodeReaderView dependency to your build.gradle dependen...
This example describes passing an event using the Otto Event Bus. To use the Otto Event Bus in Android Studio you have to insert the following statement in your modules gradle file: dependencies { compile 'com.squareup:otto:1.3.8' } The event we'd like to pass is a simple Java object: pu...
To receive an event it is necessary to implement a method with the event type as parameter and annotate it using @Subscribe. Furthermore you have to register/unregister the instance of your object at the BusProvider (see example Sending an event): public class MyFragment extends Fragment { pri...
Variables in Go are always initialized whether you give them a starting value or not. Each type, including custom types, has a zero value they are set to if not given a value. var myString string // "" - an empty string var myInt int64 // 0 - applies to all types of int an...
In slices the zero value is an empty slice. var myIntSlice []int // [] - an empty slice Use make to create a slice populated with values, any values created in the slice are set to the zero value of the type of the slice. For instance: myIntSlice := make([]int, 5) // [0, 0, 0, 0, 0] - a s...
When creating a struct without initializing it, each field of the struct is initialized to its respective zero value. type ZeroStruct struct { myString string myInt int64 myBool bool } func main() { var myZero = ZeroStruct{} fmt.Printf("Zero values are: %q, %d...
A layout is a view file, which is extended by other views which inject blocks of code into their parent. For example: parent.blade.php: <html> <head> <style type='text/css'> @yield('styling') </style> </head> <body> ...
Shortcodes are useful when you want to be able add more complex elements inline into the normal content editor. A shortcode in it's simplest for would look like this: function my_shortcode( ){ return "This is a shortcode"; } add_shortcode( 'my_shortcode', 'my_shortcode' ); It w...
Here is an example of a simple button short code: <?php function my_button_shortcode( $atts ) { // Parse the input attributes and assgn default values for the // attributes that are not specified on the shortcode $a = shortcode_atts( array( 'id' => '', 'ur...
Orphan nodes/vertices are those lacking all relationships/edges. MATCH (n) WHERE NOT (n)--() DELETE n
btn class of Twitter-bootstrap can be used with any of the following html elements. anchor button input with both type="button" and type="submit" Below are examples of all possible use cases of btn class <a class="btn" href="#" role="button&qu...
twitter-bootstrap-3 has provided four different sizes of buttons Large button btn-lg Default button does not require any btn size Small button btn-sm Extra small button btn-xs <button type="button" class="btn btn-lg">Large button</button> <button type=...
Overriding properties (both read-only and mutable): abstract class Car { abstract val name: String; open var speed: Int = 0; } class BrokenCar(override val name: String) : Car() { override var speed: Int get() = 0 set(value) { throw UnsupportedOpera...

Page 839 of 1336