private <T> Supplier<T> abort(Class<T> exception) {
return () -> {
try {
return exception.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
};
}
...
throw abort(MyException.class).get();
if (isLink($content[$i][$j])) {
if (isImageLink($content[$i][$j])) {
$image_src = create_image($content[$i][$j], "img");
$cell = <<<HTML
<td>
<img {$image_src} {$img_style}></td></img>
</td>
HTML;
} else if (isNestedLink($content[$i][$j])) {
$links = explode("!", $content[$i][$j]);
$cell = <<<HTML
<td><a style="color: {$cards_button_bg_color};" href="{$links[1]}" $open_links_in >{$links[0]}</a></td>
HTML;
} else {
//Checking if it's a link or a button
if ($j == $table_button_column) {
//Button HTML
$table_button_text = explode("-", $content[0][$j])[0];
$cell = <<<HTML
<td><a {$open_links_in} href="{$content[$i][$j]}" style="background-color: {$cards_button_bg_color}; color: {$cards_button_text_color};" class="btn">{$table_button_text}</a></td>
HTML;
} else {
// Link HTML
$cell = <<<HTML
<td><a style="color: {$cards_button_bg_color};" href="{$content[$i][$j]}" $open_links_in >{$content[0][$j]}</a></td>
HTML;
}
}
if (cookiesBannerHeight !== 0 && isMobile) {
style = {
top: cookiesBannerHeight === 0 ? 0 : cookiesBannerHeight
}
}
scrollToEl($el.parent().parent().parent());
Someones idea of how to select an element to scroll to.... Please no.
let verificaAdmin_Role = (req, res, next) => {
let usuario = req.usuario;
if (usuario.role === 'ADMIN_ROLE') {
next();
} else {
return res.status(409).json({
ok: false,
err: {
message: 'El usuario no es administrador.'
}
})
}
};
He's our company CTO, with 25+ years of experience. Author https://github.com/juang77"
#define private public
#define protected public
#define class struct
#include "your_private_parts.hpp"
// ...
#undef class
#undef protected
#undef private
// ...
Fails miserably if template <class>
, template <template <class> class>
or their variations are found anywhere inside your header.
:(
Map<Object, List<Element>> groupeUniqueMap =values.stream().collect(Collectors.groupingBy(this::getCompositeGroupKey, Collectors.toList()));
if(groupeUniqueMap.containsKey(Arrays.asList(null,null,null,null,null,null,null)))
return values;
return doReturn();
# Create vpc peering connection
response = ec2.delete_vpc_peering_connection(peer_connection_id)
a part of AWS Landing Zone solution
<h1 className="sidebar-text">
<h1 className="sidebar-text">My Applauses</h1>
</h1>
How do you even miss this... the Console will literally complain in red to you...
// enum - full enumeration of knapsack solutions
// (C) Joshua Knowles
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
FILE *fp; // file pointer for reading the input files
int Capacity; // capacity of the knapsack (total weight that can be stored)
int Nitems; // number of items available
int *item_weights; // vector of item weights
int *item_values; // vector of item profits or values
int *temp_indexes; // list of temporary item indexes for sorting items by value/weight
int QUIET=0; // this can be set to 1 to suppress output
extern void read_knapsack_instance(char *filename);
extern void print_instance();
extern void sort_by_ratio();
extern int check_evaluate_and_print_sol(int *sol, int *total_value, int *total_weight);
void enumerate();
int next_binary(int *str, int Nitems);
int main(int argc, char *argv[])
{
read_knapsack_instance(argv[1]);
print_instance();
enumerate();
return(0);
}
void enumerate()
{
// Do an exhaustive search (aka enumeration) of all possible ways to pack
// the knapsack.
// This is achieved by creating every binary solution vector of length Nitems.
// For each solution vector, its value and weight is calculated.
int i; // item index
int solution[Nitems+1]; // (binary) solution vector representing items packed
int best_solution[Nitems+1]; // (binary) solution vector for best solution found
int best_value; // total value packed in the best solution
double j=0;
int total_value, total_weight; // total value and total weight of current knapsack solution
int infeasible; // 0 means feasible; -1 means infeasible (violates the capacity constraint)
// set the knapsack initially empty
for(i=1;i<=Nitems;i++)
{
solution[i]=0;
}
QUIET=1;
best_value=0;
while(!(next_binary(&solution[1], Nitems)))
{
/* ADD CODE IN HERE TO KEEP TRACK OF FRACTION OF ENUMERATION DONE */
// calculates the value and weight and feasibility:
infeasible=check_evaluate_and_print_sol(solution, &total_value, &total_weight);
/* ADD CODE IN HERE TO KEEP TRACK OF BEST SOLUTION FOUND*/
}
/* ADD CODE TO PRINT OUT BEST SOLUTION */
}
int next_binary(int *str, int Nitems)
{
// Called with a binary string of length Nitems, this
// function adds "1" to the string, e.g. 0001 would turn to 0010.
// If the string overflows, then the function returns 1, else it returns 0.
int i=Nitems-1;
while(i>=0)
{
if(str[i]==1)
{
str[i]=0;
i--;
}
else
{
str[i]=1;
break;
}
}
if(i==-1)
{
return(1);
}
else
{
return(0);
}
}
A genuine UoM lab.
StartCoroutine(Patrol());
public IEnumerator Patrol() {
while(true) {
dt.Walk();
yield return new WaitForSeconds(reactionTime);
}
}
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )";
export KUBECONFIG="${DIR}/my_secret_stuff/kube.conf";
Example on how to get location of the script right
pageEndReached() {
if (!this.endOfResults) {
//load more pages
this.page++;
this.getPosts();
followerCount: null,
postCount: null,
measurementKeys: ["a", "b", "c", "d", "e"],
showDrafts: false,
};
},
nani
if [ $product == "consul" ]
then
aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
rm ${product}-enterprise_${version}+prem_linux_amd64.zip
else
aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
rm ${product}-enterprise_${version}+prem_linux_amd64.zip
fi