Java expressions are evaluated following the following rules:
Operands are evaluated from left to right.
The operands of an operator are evaluated before the operator.
Operators are evaluated according to operator precedence
Argument lists are evaluated from left to right.
Simple Example
I...
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA' \
--prune-empty --tag-name-filter cat -- --all
Add your file with sensitive data to .gitignore to ensure that you don't accidentally commit it again.
echo "YOUR-FILE-WITH-SE...
BFG Repo cleaner is an alternative to git filter-branch. It can be used to remove sensitive data or large files that were committed wrongly like binaries compiled from the source. It is written in Scala.
Project website: BFG Repo Cleaner
Requirements
The Java Runtime Environment (Java 7 or above ...
Normally the jvm's garbage collection (gc) is transparent to the user (developer/engineer).
GC tuning is normally not required unless the user faces a memory leak or has an application that requires large amount of memory - both of which eventually lead to an out-of-memory exception which compels t...
Resource loading in Java comprises the following steps:
Finding the Class or ClassLoader that will find the resource.
Finding the resource.
Obtaining the byte stream for the resource.
Reading and processing the byte stream.
Closing the byte stream.
The last three steps are typically accomp...
The simplest react component without a state and no properties can be written as:
import * as React from 'react';
const Greeter = () => <span>Hello, World!</span>
That component, however, can't access this.props since typescript can't tell if it is a react component. To access ...
VueJS can be used to easily handle user input as well, and the two way binding using v-model makes it really easy to change data easily.
HTML :
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
{{message}}
<input v-model="...
This technique relies on adding thick borders to the link itself to build the button's CTA. Using borders is universally understood by email clients, but limit button appearance solid colors.
<table width="100%" border="0" cellspacing="0" cellpadding="0"&g...
This technique uses a combination of border-based and padding-based buttons, styling the link with both padding and at least a solid 1px border. The background color needs to be applied to the instead of the in this instance because Outlook does recognize horizontal padding on the tag (since it's...
This button derives from this example by Email on Acid. It is entirely code-based, so it will display without images downloaded, and the entire button is hoverable + clickable.
Additionally, this example also includes spacers to help control how much vertical space appears before and after the butt...
If the first parameter is NOT NULL, NVL2 will return the second parameter. Otherwise it will return the third one.
SELECT NVL2(null, 'Foo', 'Bar'), NVL2(5, 'Foo', 'Bar') FROM DUAL;
NVL2(NULL,'FOO','BAR')NVL2(5,'FOO','BAR')BarFoo
A function that extends the functionality of the array by creating an object oriented remove function.
// Need to restrict the extension to elements that can be compared.
// The `Element` is the generics name defined by Array for its item types.
// This restriction also gives us access to `index(...
This is for those moving to data.table >= 1.9.8
You have a data set of pet owners and names, but you suspect some repeated data has been captured.
library(data.table)
DT <- data.table(pet = c("dog","dog","cat","dog"),
owner = c("...
SQL Server 2012 / 2014
DECLARE @RowsPerPage INT = 10, @PageNumber INT = 4
SELECT OrderId, ProductId
FROM OrderDetail
ORDER BY OrderId
OFFSET (@PageNumber - 1) * @RowsPerPage ROWS
FETCH NEXT @RowsPerPage ROWS ONLY
SQL Server 2005/2008/R2
DECLARE @RowsPerPage INT = 10, @PageNumber INT = ...
For getting the next 10 rows just run this query:
SELECT * FROM TableName ORDER BY id OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY;
Key points to consider when using it:
ORDER BY is mandatory to use OFFSET and FETCH clause.
OFFSET clause is mandatory with FETCH. You can never use, ORDER BY …
FETC...
Since every Applicative Functor is a Functor, fmap can always be used on it; thus the essence of Applicative is the pairing of carried contents, as well as the ability to create it:
class Functor f => PairingFunctor f where
funit :: f () -- create a context, carrying nothing ...
Dependenct Injection Intro
An application is composed of many objects that collaborate with each other. Objects usually depend on other objects to perform some task. When an object is responsible for referencing its own dependencies it leads to a highly coupled, hard-to-test and hard-to-change code...
Let's say we have a form like the one below. We want to send the data to our webserver via AJAX and from there to a script running on an external server.
So we have normal inputs, a multi-select field and a file dropzone where we can upload multiple files.
Assuming the AJAX POST request was succ...