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 ...
SELECT SYSDATE();
This function returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context. It returns the date and time in the current time zone.
SELECT NOW();
This function is a...
The dimension attribute on an object specifies that that object is an array. There are, in Fortran 2008, five array natures:1
explicit shape
assumed shape
assumed size
deferred shape
implied shape
Take the three rank-1 arrays2
integer a, b, c
dimension(5) a ! Explicit shape (default ...
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
...
(This is a request for a good example that shows how to construct a SELECT using CONCAT, then prepare+execute it. Please emphasize the use of @variables versus DECLAREd variables -- it makes a big difference, and it is something that novices (include myself) stumble over.)
# example data
DT = data.table(iris)
DT[, Bin := cut(Sepal.Length, c(4,6,8))]
summary is handy for browsing summary statistics. Besides direct usage like summary(DT), it can also be applied per-group conveniently with split:
lapply(split(DT, by=c("Species", "Bin"), drop=TRU...
# 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...
Setup Ruby On Rails on Ubuntu 16.04 Xenial Xerus
All commands should be run in Linux terminal (hotkey: Ctrl + Alt + T)
You need to install Ruby on your local machine in development environment.
The first step is to install some dependencies for Ruby.
sudo apt-get update
sudo apt-get install git...
In molecular biology and genetics, GC-content (or guanine-cytosine content, GC% in short) is the percentage of nitrogenous bases on a DNA molecule that are either guanine or cytosine (from a possibility of four different ones, also including adenine and thymine).
Using BioPython:
>>> from...
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...
Problem
There is a series of repeating elements in page that you need to know which one an event occurred on to do something with that specific instance.
Solution
Give all common elements a common class
Apply event listener to a class. this inside event handler is the matching selector elemen...
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
>...
Be aware that Microsoft Excel 2013 (and higher) uses Single Document
Interface (SDI) and that Excel 2010 (And below) uses Multiple Document
Interfaces (MDI).
This implies that for Excel 2013 (SDI), each workbook in a single instance of Excel contains its own ribbon UI:
Conversely for Excel...
A function is a block of code that will be called several times during the execution. Instead of writing the same piece of code again and again, one can write this code inside a function and call that function whenever it is needed.
A function :
Must be declared in a class or a module
Returns a...
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...