private Panel displayPanel; // assuming: setup complete
public void showMeals() {
List<Meal> meals = fetchAllMeals();
for (Meal meal : meals) {
JButton mealButton = createMealButton(meal);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee { | |
String name; | |
abstract double computeSalary(); | |
} | |
class Regular extends Employee { | |
double workHours; | |
double hourlyRate; |
Image grabbed from ElasticCloudApps.com
- 3 Linux machines with Installed JDK 1.7+
- Default setup is 3 Replicas
- Apache ActiveMQ 5.13.4 (stable)
- Extract to
/opt/activemq/apache-activemq-5.13.4
(We call this ACTIVEMQ_HOME from now on)
- Extract to
- Apache Zookeeper 3.4.8 (stable)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void square(int i) { i ** 2 } | |
def rng = new Random() | |
List numbers = (1..10000000).collect { rng.nextInt(11) } | |
long start, end | |
start = System.currentTimeMillis() | |
numbers.each(this.&square) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dnf groupinstall -y gnome | |
systemctl enable gdm | |
shutdown -r now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for db_name in "$@" | |
do | |
echo " * Current DB: $db_name" | |
psql --host=localhost --user=postgres -c "DROP DATABASE $db_name;" | |
psql --host=localhost --user=postgres -c "CREATE DATABASE $db_name;" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
byte=$(head -c 1 /dev/random | cat); | |
flip=$(printf '%d\n' "'$byte'"); | |
if [ $((flip % 2)) -eq 0 ]; | |
then | |
echo 'HEADS' | |
else | |
echo 'TAILS' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//javascript: | |
var r=0; | |
var x = [0.1, 0.25, 1.6, 300, 300]; | |
var y = [0.05, 0.24, 0.24, 200, 200]; | |
var imgs = document.getElementsByTagName("img"); | |
setInterval(function A() { | |
for(i=0; i-imgs.length; i++){ |