Here I have shared a code snippet for implementing endless scrolling in recycle view.
Step 1:
First make a one abstract method in Recycleview adapter like below.
public abstract class ViewAllCategoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public abstract void lo...
DECLARE @ID AS INT;
SET @ID = (SELECT MIN(ID) from TABLE);
WHILE @ID IS NOT NULL
BEGIN
PRINT @ID;
SET @ID = (SELECT MIN(ID) FROM TABLE WHERE ID > @ID);
END
Catalan numbers algorithm is Dynamic Programming algorithm.
In combinatorial mathematics, the Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects. The Catalan numbers on nonnegative integers n are a set of numbers t...
A palindrome is a word that can be read both ways, like 'kayak'.
This example will show how to find if a given word is a palindrome using Python3.
First, we need to turn a string into a stack (we will use arrays as stacks).
str = "string"
stk = [c for c in str] #this makes an array: [&...
According to Wikipedia:
[A] software design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into source or machine code. It is a description or template for how to solve ...
Viewchild offers one way interaction from parent to child. There is no feedback or output from child when ViewChild is used.
We have a DataListComponent that shows some information. DataListComponent has PagerComponent as it's child. When user makes a search on DataListComponent, it gets a data fro...
public class KnapsackProblem
{
private static int Knapsack(int w, int[] weight, int[] value, int n)
{
int i;
int[,] k = new int[n + 1, w + 1];
for (i = 0; i <= n; i++)
{
int b;
for (b = 0; b <= w; b++)
{
...
Suppose, that we have three users :
The Administrator of the database > admin
The application with a full access for her data > read_write
The read only access > read_only
With below queries, you can set access privileges on objects created in the future in specified schema.
ALTER ...
If you're Using VueJS2 and like to use JSX along with it. In this case,to use the slot, the solution with example is below.We have to use this.$slots.default It's almost like this.props.children in React JS.
Component.js :
export default {
render(h) { //eslint-disable-line
return (
...
var x = 5;
var str = "if (x == 5) {console.log('z is 42'); z = 42;} else z = 0; ";
console.log("z is ", eval(str));
The use of eval is strongly discouraged. See the Remarks section for details.
Aggregation is used to perform complex data search operations in the mongo query which can't be done in normal "find" query.
Create some dummy data:
db.employees.insert({"name":"Adma","dept":"Admin","languages":["german","f...
This is an example code to create and execute the aggregate query in MongoDB using Spring Data.
try {
MongoClient mongo = new MongoClient();
DB db = mongo.getDB("so");
DBCollection coll = db.getCollection("employees");
//Equivalent to $m...
When defining a new trait it is possible to enforce that types wishing to implement this trait verify a number of constraints or bounds.
Taking an example from the standard library, the DerefMut trait requires that a type first implement its sibling Deref trait:
pub trait DerefMut: Deref {
fn...
An easy way to get an input from a user is by using the prompt() method.
Syntax
prompt(text, [default]);
text: The text displayed in the prompt box.
default: A default value for the input field (optional).
Examples
var age = prompt("How old are you?");
console.log(age); // Pri...