Skip to content

Instantly share code, notes, and snippets.

View alanhay's full-sized avatar

Alan Hay alanhay

  • Edinburgh, Scotland
View GitHub Profile
Get the JetBrains Runtime
The plain version should do:
https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-25.0.2-windows-aarch64-b329.66.zip
Set it as JVM for the run configuration and add the VM arg: -XX:HotswapAgent=fatjar
Set up the Save Actions plugin: 'Active Save actions on save..(first option) and select Reload files un running debugger
String pattern = "^[^:]+:[^:]+$";
String test = "key:value";
boolean isValid = test.matches(pattern);
#no whitespace
String pattern = "^[^\\s:]+:[^\\s:]+$";
String test = "key:value"; // valid
boolean isValid = test.matches(pattern);
-- Top 100 Users In A Given Tag
--
-- What better way to learn interesting things about tags you are interested in than to check out the top 100 users in that tag?
--
-- Inspired by this query:
--
-- http://data.stackexchange.com/stackoverflow/s/1688/c-top100-users
DECLARE @TagName nvarchar(25) = ##Tag:string##
Dependency:
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc3</artifactId>
<version>1.15</version>
<!-- <scope>test</scope> -->
</dependency>
https://github.com/amardaxini/acts_as_flying_saucer.wiki.git
@alanhay
alanhay / gist:975471cf0728a14f3610
Created October 8, 2014 17:48
Clone an Existing Repository to a new Location and Import to Eclipse
Create a new Empty Repository in GitHub.
From the root of the local git repo:
>> git clone https://github.com/alanhay/spring-data-jpa-bootstrap.git .\spring-data-jpa-scratchpad
Update the remote 'origin' to point to the new empty repo:
>> git remote set-url origin https://github.com/alanhay/spring-data-jpa-scratchpad.git
@alanhay
alanhay / gist:10722095
Created April 15, 2014 10:45
Javascripot auto focus
<script type="text/javascript">
$(document).ready(function() {
// focus on the first visible and enabled input field or textarea
$(":input:visible:enabled").each(function() {
if (($(this).attr('type') == 'text') && ($(this).is('input'))){
$(this).focus();
return false;
}
if ($(this).is('textarea')){
$(this).focus();

These steps can be used to install OSGI wrapped Oracle driver to Spring Roo's cache dir

  1. install oracle driver (eg ojdbc6.jar) to your local maven repository

  2. use the pom file in a new osgi-ojdbc project from above or create one using roo's addon create wrapper

If you create using ROO's add on, make sure the tag has the content from above pom.xml

@alanhay
alanhay / gist:9534438
Created March 13, 2014 18:51
OpenJPA Unsupported Runtime Unenhanced.
Hi John,
Good detective work with the Google searching. It sounds like you hit a
classic problem with the RuntimeUnenhancedClasses support. If the OneToMany
is not loaded immediately (ie. EAGER), there was no hook in place to cause
the loading at a later time.
But, if you are using one of the Enhancement mechanisms [1], then you should
not see this problem. If you interrogate the A entity instance via a
debugger, then the LAZY configured "bs" should be null. But, once you call
getBs(), then OpenJPA should be loading that collection.
package com.sample.dao.impl
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;