Let's say your launch activity is called MainActivity, in your app com.example.myapp.
In the manifest:
<activity
android:name=".MainActivity"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
...
Bridge pattern decouples abstraction from implementation so that both can vary independently. It has been achieved with composition rather than inheritance.
Bridge UML diagram from wikipedia:
You have four components in this pattern.
Abstraction: It defines an interface
RefinedAbstraction: It ...
If the value of the href-attribute begins with tel:, your device will dial the number when you click it. This works on mobile devices or on computers/tablets running software – like Skype or FaceTime – that can make phone calls.
<a href="tel:11234567890">Call us</a>
Most de...
SUB function allows to substitute text inside awk
sub(regexp, replacement, target)
where regexp could be a full regular expression
$ cat file
AAAAA
BBBB
CCCC
DDDD
EEEE
FFFF
GGGG
$ awk '{sub("AAA","XXX", $0); print}' file
XXXAA
BBBB
CCCC
DDDD
EEEE
FFFF
GGGG
...
# example data
DT = data.table(iris)
DT[, Bin := cut(Sepal.Length, c(4,6,8))]
To apply the same summarizing function to every column by group, we can use lapply and .SD
DT[, lapply(.SD, median), by=.(Species, Bin)]
# Species Bin Sepal.Length Sepal.Width Petal.Length Petal.Width
# 1...
To declare a bean, simply annotate a method with the @Bean annotation or annotate a class with the @Component annotation (annotations @Service, @Repository, @Controller could be used as well).
When JavaConfig encounters such a method, it will execute that method and register the return value as a b...
Enabled directory index means that if someone access to any folder which don't contains index.php , index.html, index.htm or any other default file defined in DirectoryIndex in apache configuration then all files in that folder will be listed in browser if you try to visit that page.
Often director...
When expecting someone to reproduce an R code that has random elements in it, the set.seed() function becomes very handy.
For example, these two lines will always produce different output (because that is the whole point of random number generators):
> sample(1:10,5)
[1] 6 9 2 7 10
>...
Configuring your environment
RabbitMQ looks for an set of environment variables in /etc/rabbitmq/rabbitmq-env.conf. If it does not exist, it assumes default values. All values in rabbitmq-env.conf get exported to the environment the RabbitMQ server runs in with a RABBITMQ_ prefix; this prefix is no...
From the documentation :
In C#, arguments can be passed to parameters either by value or by
reference. Passing by reference enables function members, methods,
properties, indexers, operators, and constructors to change the value
of the parameters and have that change persist in the calling
e...
Throughout the topics and examples here we'll see many declarations of variables, functions and so on.
As well as their name, data objects may have attributes. Covered in this topic are declaration statements like
integer, parameter :: single_kind = kind(1.)
which gives the object single_kind...
Using the document-ready event can have small performance drawbacks, with delayed execution of up to ~300ms. Sometimes the same behavior can be achieved by execution of code just before the closing </body> tag:
<body>
<span id="greeting"></span> world!
<sc...
You can make a task available to Artisan and to your application in the app/Console/Kernel.php file.
The Kernel class contains an array named $commands which make your commands available to your application.
Add your command to this array, in order to make it available to Artisan and your applicat...
This example displays a transaction for an image view with only two images.(can use more images as well one after the other for the first and second layer positions after each transaction as a loop)
add a image array to res/values/arrays.xml
<resources>
<array
name=&...
If your team is following a rebase-based workflow, it may be a advantageous to setup git so that each newly created branch will perform a rebase operation, instead of a merge operation, during a git pull.
To setup every new branch to automatically rebase, add the following to your .gitconfig or .gi...
You can call an instance method using the . special form:
(.trim " hello ")
;;=> "hello"
You can call instance methods with arguments like this:
(.substring "hello" 0 2)
;;=> "he"
You can create instance of objects in one of two ways:
(java.awt.Point. 0 1)
;;=> => #object[java.awt.Point 0x3776d535 "java.awt.Point[x=0,y=1]"]
Or
(new java.awt.Point 0 1)
;;=> => #object[java.awt.Point 0x3776d535 "java.awt.Point[x=0,y=1]"]
The permutation method, when called with a block yields a two dimensional array consisting of all ordered sequences of a collection of numbers.
If this method is called without a block, it will return an enumerator. To convert to an array, call the to_a method.
ExampleResult[1,2,3].permutation#<...