@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private NestedObject nestedObject;
example usage in a test method:
when(nestedObject.getStatusInfo().getValue().getStatus()).thenReturn(1);
// riscv64-elf-gcc -Os -mcmodel=medany -nostdlib -march=rv64gc -Wl,-T,qemu.ld -o vga-hello.elf boot.S main.c | |
// qemu-system-riscv64 -machine virt -device VGA -smp 1 -kernel vga-hello.elf | |
.section .text | |
.global _start | |
.global _enter | |
_start: | |
_enter: | |
//1: j 1b |
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private NestedObject nestedObject;
example usage in a test method:
when(nestedObject.getStatusInfo().getValue().getStatus()).thenReturn(1);
I came across HikariCP
and I was amazed by the benchmarks and I wanted to try it instead of my default choice C3P0
and to my surprise I struggled to get the configurations
right probably because the configurations differ based on what combination of tech stack you are using.
I have setup Spring Boot
project with JPA, Web, Security
starters (Using [Spring Initializer][1]) to use PostgreSQL
as a database with HikariCP
as connection pooling.
I have used Gradle
as build tool and I would like to share what worked for me for the following assumptions:
This gist is related to SO post https://stackoverflow.com/questions/26490967/how-do-i-configure-hikaricp-in-my-spring-boot-app-in-my-application-properties-f
// tested in Chrome and Firefox | |
this.onPaste = function (event) { | |
if($(event.target).is(':focus')) { | |
// actually typing on the element, stop paste progation to outside paste handler | |
event.stopPropagation(); | |
// intercept paste and format the text | |
event.preventDefault(); | |
var newText = (event.originalEvent || event).clipboardData.getData('text/plain'); | |
newText = newText.replace(/\r?\n/g, ' '); |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
#include <stdio.h> | |
#include <stdlib.h> // atoll | |
#include <stdint.h> // uint64_t | |
#include <inttypes.h> // PRIu64 | |
static const char *humanSize(uint64_t bytes) | |
{ | |
char *suffix[] = {"B", "KB", "MB", "GB", "TB"}; | |
char length = sizeof(suffix) / sizeof(suffix[0]); |