If you make a commit as the wrong author, you can change it, and then amend
git config user.name "Full Name"
git config user.email "[email protected]"
git commit --amend --reset-author
Android Studio's Live templates can offer quite a few shortcuts for quick logging.
To use Live templates, all you need to do is to start typing the template name, and hit TAB or enter to insert the statement.
Examples:
logi → turns into → android.util.Log.i(TAG, "$METHOD_NAME$: $content$&q...
Caffe can run on multiple cores. One way is to enable multithreading with Caffe to use OpenBLAS instead of the default ATLAS. To do so, you can follow these three steps:
sudo apt-get install -y libopenblas-dev
Before compiling Caffe, edit Makefile.config, replace BLAS := atlas by BLAS := open
A...
What's between \Q and \E is treated as normal characters
#!/usr/bin/perl
my $str = "hello.it's.me";
my @test = (
"hello.it's.me",
"hello/it's!me",
);
sub ismatched($) { $_[0] ? "MATCHED!" : "DID NOT MATCH!" }
my @match = (
...
After adding PrimeFaces to your JSF project, you can start using it in your pages using the namespace:
xmlns:p="http://primefaces.org/ui"
or, for PrimeFaces Mobile:
xmlns:p="http://primefaces.org/mobile"
This example should render a spinner:
<html xmlns="http...
It is sometimes required for a process to concurrently write and read the same "data".
The ReadWriteLock interface, and its ReentrantReadWriteLock implementation allows for an access pattern that can be described as follow :
There can be any number of concurrent readers of the data. If...
using System;
using System.Runtime.InteropServices;
namespace ComLibrary
{
[ComVisible(true)]
public interface IMainType
{
int GetInt();
void StartTime();
int StopTime();
}
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.N...
It can be difficult to test functions with poor asymptotic complexity using quickcheck as the random inputs are not usually size bounded. By adding an upper bound on the size of the input we can still test these expensive functions.
import Data.List(permutations)
import Test.QuickCheck
longRunn...
A class decorator is just a function that takes the class as its only argument and returns it after doing something with it:
function log<T>(target: T) {
// Do something with target
console.log(target);
// Return target
return target;
}
We can then apply ...
This time we are going to declare a class decorator that will add some metadata to a class when we applied to it:
function addMetadata(target: any) {
// Add some metadata
target.__customMetadata = {
someKey: "someValue"
};
// Return target
ret...
We can wrap a class decorator with another function to allow customization:
function addMetadata(metadata: any) {
return function log(target: any) {
// Add metadata
target.__customMetadata = metadata;
// Return target
return target;
...
Extensions add new functionality to an existing class, structure, enumeration, or protocol type. This includes the ability to extend types for which you do not have access to the original source code.
Extensions in Swift can:
Add computed properties and computed type properties
Define instance ...
In the Xcode, you have three separate areas of working - Navigators (in red), Debug area(in green) and Utilities(in blue).
The workspace window always includes the editor area. When you select a file in your project, its contents appear in the editor area, where Xcode opens the file in an appropri...
Install webpack-dev-middleware via npm
npm i -D webpack-dev-middleware webpack-hot-middleware
Modify webpack.config.js
Add webpack-hot-middleware/client to each items defined in "entry"
Add new webpack.HotModuleReplacementPlugin() to "plugins"
module.export...
PhpStorm can be very slow in large files as its performing so many inspections. One quick and easy way to speed up PhpStorm is to render using OpenGL. Previously in a 5000 line file it would give the 'eye' symbol in the top right for a long time before changing to a tick (or red/yellow box). After O...
You can configure lint by adding a lintOptions section in the build.gradle file:
android {
//.....
lintOptions {
// turn off checking the given issue id's
disable 'TypographyFractions','TypographyQuotes'
// turn on the given issue id's
enable 'Rtl...
You can disable Lint checking from your Java and XML source files.
Configuring lint checking in Java
To disable Lint checking specifically for a Java class or method in your Android project, add the @SuppressLint annotation to that Java code.
Example:
@SuppressLint("NewApi")
@Override...
The Leaflet package is designed to integerate with Shiny
In the ui you call leafletOutput() and in the server you call renderLeaflet()
library(shiny)
library(leaflet)
ui <- fluidPage(
leafletOutput("my_leaf")
)
server <- function(input, output, session){
out...