This example will help to verify the given time is within a period or not.
To check the time is today, We can use DateUtils class
boolean isToday = DateUtils.isToday(timeInMillis);
To check the time is within a week,
private static boolean isWithinWeek(final long millis) {
return System.c...
\documentclass{beamer}
\mode<presentation>
\usetheme{AnnArbor}
\usecolortheme{seahorse}
\title[Short topic]{Awesome long topic}
\author[Name]{Full name}
\institute[Institute short form]{Full name of institute}
\date{\today}
\begin{document}
\maketitle
\end{document}
Large chunks of code can also be "commented out" using the preprocessor directives #if 0 and #endif. This is useful when the code contains multi-line comments that otherwise would not nest.
#if 0 /* Starts the "comment", anything from here on is removed by preprocessor */
/*...
defmodule Selection do
def sort(list) when is_list(list) do
do_selection(list, [])
end
def do_selection([head|[]], acc) do
acc ++ [head]
end
def do_selection(list, acc) do
min = min(list)
do_selection(:lists.delete(min, list), acc ++ [min])
end
defp m...
Developers often need to design web sites that allow users to upload a CSV file. Usually there is no reason to save the actual CSV file since the data will processed and/or stored in a database once uploaded. However, many if not most, PYTHON methods of parsing CSV data requires the data to be rea...
You can perform the same change instead of using Vue.$set by using the Array prototype's splice()
new Vue({
el: '#app',
data:{
myArr : ['apple', 'orange', 'banana', 'grapes']
},
methods:{
changeArrayItem: function(){
//this will not work
...
If yoi have nested array, the following can be done
new Vue({
el: '#app',
data:{
myArr : [
['apple', 'banana'],
['grapes', 'orange']
]
},
methods:{
changeArrayItem: function(){
this.$set(this.myArr[1], 1, 'strawbe...
If we want to look at a scene as if we had photographed it with a camera, we must first define some things:
The position from which the scene is viewed, the eye position pos.
The point we look at in the scene (target).
It is also common to define the direction in which we look. Technically we n...
Drupal console brings scaffolding to the Drupal ecosystem and makes it easy to generate a content entity.
In most instances you will find it easier to work with a custom entity within a custom module.
Step 1 : Generate a module
vendor/bin/drupal generate:module
Follow the prompts and create yo...
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity ROM is
port(
address : in std_logic_vector(3 downto 0);
dout : out std_logic_vector(3 downto 0)
);
end entity ROM;
architecture RTL of ROM is
type MEMORY_16_4 is array (0 to 15) ...
Last In First Out (Stack) Memory
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity LIFO is
generic(
WIDTH : natural := 8;
DEPTH : natural := 128
);
port(
I_DATA : in std_logic_vector(WIDTH - 1 downto 0); --Input Data Line
...
#include <iostream>
int main()
{
int value;
std::cout << "Enter a value: " << std::endl;
std::cin >> value;
std::cout << "The square of entered value is: " << value * value << std::endl;
return 0;
}