A drawable can be tinted a certain color. This is useful for supporting different themes within your application, and reducing the number of drawable resource files.
Using framework APIs on SDK 21+:
Drawable d = context.getDrawable(R.drawable.ic_launcher);
d.setTint(Color.WHITE);
Using android...
There are two types of npm scripts, and the command to run each is slightly different. The first type of npm scripts are "pre-recognized" scripts. These scripts are automatically recognized by npm and don't need a special prefix (as you will see for the other type) to run them. The othe...
Parameters hints can be customized by the user as indicated in this link: http://docs.notepad-plus-plus.org/index.php/Auto_Completion#How_to_create_keyword_auto-completion_definition_files
How to create keyword auto-completion definition files
Since version 5.0 Notepad++ has support for so calle...
// Generate stream that references itself in its evaluation
lazy val primes: Stream[Int] =
2 #:: Stream.from(3, 2)
.filter { i => primes.takeWhile(p => p * p <= i).forall(i % _ != 0) }
.takeWhile(_ > 0) // prevent overflowing
// Get list of 10 primes
assert(primes.take(...
ODS (on-disk structure) version is a number representing version of the database low-level data layout structure (ODS). When a new feature is added to Firebird it might or might not require the structure of database pages or system tables (database metadata) to change. If it does, the ODS version mu...
Copy the package installer unit file to /etc where changes will not be overwritten on an upgrade:
cp /lib/systemd/system/docker.service /etc/systemd/system/docker.service
Update /etc/systemd/system/docker.service with your options on ExecStart:
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0...
Return the index of the first occurrence of a substring (zero if not found)
Syntax: INSTR ( string, substring )
SELECT INSTR('FooBarBar', 'Bar') -- return 4
SELECT INSTR('FooBarBar', 'Xar') -- return 0
Ionic uses Gulp, so install gulp-babel and gulp-plumber.
npm install --save-dev gulp-babel gulp-plumber
Add babel to gulpfile.js like so:
//...
var babel = require("gulp-babel");
var plumber = require("gulp-plumber");
var paths = {
es6: ['./src/es6/*.js'],
sass: ...
QModelIndex does not actually know about it's parent/child indexes, it only contains a row, a column and a pointer, and it is the models responsibility to use this data to provide information an index's relations. The model therefore needs to do a lot of conversions from the void* stored inside the ...
Sometimes you have to deal with structures defined in terms of C data types from Perl. One such application is the creation of raw network packets, in case you want to do something fancier than what the regular socket API has to offer. This is just what pack() (and unpack() of course) is there for.
...
Raycasting means throwing a ray from the mouse position on the screen to the scene, this is how threejs determines what object you want to click on if you have implemented it. Threejs gets that information using an octree, but still in production you may not want to compute the result at each frame ...
For example, in the sentence:
That cake is extremely nice.
The rules of the English language would make cake a noun, extremely an adverb that modifies the adjective nice, and through this analysis the meaning could be understood.
However, this analysis is dependent on us recognising that the...
C#
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Interactions;
namespace WebDriverActions
{
class WebDriverTest
{
static void Main()
{
IWebDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("...
The igraph package for R is a wonderful tool that can be used to model networks, both real and virtual, with simplicity. This example is meant to demonstrate how to create two simple network graphs using the igraph package within R v.3.2.3.
Non-Directed Network
The network is created with this pie...
The elapsedMillis library provides a class with the same name that keeps track of the time that passed since it was created or set to a certain value:
#include <elapsedMillis.h>
#define OUTPIN LED_BUILTIN
#define PERIOD 500
elapsedMillis ledTime;
bool ledState = false;
void setup...