The sample command can be used to simulate classic probability problems like drawing from an urn with and without replacement, or creating random permutations.
Note that throughout this example, set.seed is used to ensure that the example code is reproducible. However, sample will work without expl...
Use the GitHub repository to get the entire code:
https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users
Copy or clone the repository in your computer.
Now go to your Firebase Console
Create a Firebase Project using the Firebase Console.
Enable the Google Provid...
This will be our example data frame:
df = pd.DataFrame({"color": ['red', 'blue', 'red', 'blue']},
index=[True, False, True, False])
color
True red
False blue
True red
False blue
Accessing with .loc
df.loc[True]
color
True red
True red
...
This will be our example data frame:
color size
name
rose red big
violet blue small
tulip red small
harebell blue small
We can create a mask based on the index values, just like on a column value.
rose_mask = df.index == 'rose'
df[rose_mask...
Opening a browser with to() method.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
class navigateWithTo{
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://www.example.com...
Python
Most commonly used scenario:
open page in new window
switch to it
do something
close it
switch back to parent window
# Open "Google" page in parent window
driver.get("https://google.com")
driver.title # 'Google'
# Get parent window
parent_window = driver...
Data can be extracted from a blastdb using blastdbcmd which should be included in a blast installation. You can specify from the options below as part of -outfmt what metadata to include and in what order.
From the man page:
-outfmt <String>
Output format, where the available format sp...
public class ExpandBarDynamicContentExample {
private final Display display;
private final Shell shell;
public ExpandBarDynamicContentExample() {
display = new Display();
shell = new Shell(display);
shell.setLayout(new FillLayout());
// Create...
/**
* Add meta box to post types.
*
* @since 1.0.0
*/
function myplugin_add_meta_box() {
// Set up the default post types/
$types = array(
'post',
);
// Optional filter for adding the meta box to more types. Uncomment to use.
// $types = apply_filters( 'mypl...
Every Heroku app runs in at least two environments: on Heroku (we’ll call that production) and on your local machine (development). If more than one person is working on the app, then you’ve got multiple development environments - one per machine, usually. Usually, each developer will also have a te...
Reagent is an interface between ClojureScript and react. It allows you to define efficient React components using nothing but plain ClojureScript functions and data, that describe your UI using a Hiccup-like syntax.
Example:-
(defn sample-component []
[:div
[:p "I am a component!"...
DB backup
Database backup is a must before starting any Dynamics CRM upgrade process. This is mandatory as to always have the option to rollback in case of any major roadblock.
Wrong Estimation
DO NOT underestimate the work involved in a CRM Upgrade process.
Audit your current Microsoft Dynamics...
This example helper class interacts with the finger print manager and performs encryption and decryption of password. Please note that the method used for encryption in this example is AES. This is not the only way to encrypt and other examples exist. In this example the data is encrypted and decryp...
(Beginner level; IDE: CLion)
First, install boost from the Cygwin mirror: open the install exe, search for boost, install the packages.
After boost is installed: it will be located in /usr/include/boost. This is where everything is. All #include statements will be a path from the boost folder,...
Instead of specifying connection parameters like user and password (see a complete list here) in the URL or a separate parameters, you can pack them into a java.util.Properties object:
/**
* Connect to a PostgreSQL database.
* @param url the JDBC URL to connect to. Must start with "jdbc:...
You can start Solr by running bin/solr from the Solr directory and this will start Solr in the background, listening on port 8983.
$ bin/solr start
To change the port Solr listens on, you can use the -p parameter when starting, such as:
$ bin/solr start -p 8984
Since Solr is a server, it is more...