This file contains 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
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; | |
import org.springframework.messaging.Message; | |
import org.springframework.messaging.MessageChannel; | |
import org.springframework.messaging.simp.stomp.StompHeaderAccessor; | |
import org.springframework.messaging.support.ChannelInterceptorAdapter; | |
public class StompInboundChannelInterceptor extends ChannelInterceptorAdapter { | |
static final Log LOG = LogFactory.getLog(StompInboundChannelInterceptor.class); |
This file contains 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
SELECT pg.* | |
FROM programmers pg | |
WHERE EXISTS( | |
SELECT pp.programmer_id | |
FROM programmers_projects pp | |
WHERE | |
pp.programmer_id = pg.programmer_id AND | |
pp.project_id IN (1, 2) -- or whatever condition to filter the projects | |
) |
This file contains 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
Criteria criteria = session.createCriteria(Programmer.class); | |
criteria.add(Restrictions.sqlRestriction( | |
"EXISTS(" + | |
"SELECT pp.programmer_id " + | |
"FROM programmers_projects pp " + | |
"WHERE " + | |
"pp.programmer_id = {alias}.programmer_id AND " + | |
"pp.project_id IN (1, 2) )" | |
)); |
This file contains 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
SELECT ... | |
FROM ... | |
WHERE ... | |
ORDER BY ST_Distance(...) |
This file contains 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
import org.hibernate.Criteria; | |
import org.hibernate.HibernateException; | |
import org.hibernate.criterion.CriteriaQuery; | |
import org.hibernate.criterion.Order; | |
public class PostgisDistanceOrder extends Order { | |
private boolean ascending; | |
private String propertyName; | |
private double fromLatitude; |
This file contains 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
# do configure | |
./configure --prefix=/usr --without-mecab | |
# compile nfkc.c manually before make | |
cd lib | |
../libtool --tag=CC --mode=compile \ | |
gcc -I. -I.. -Wall -O0 -fno-strict-aliasing -g -MT nfkc.lo \ | |
-MD -MP -MF .deps/nfkc.Plo -c -o nfkc.lo nfkc.c | |
# do make |
This file contains 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
-- add temporary column for storing geometry with correct SRID | |
select AddGeometryColumn('places', 'geom_4301', 4301, 'GEOMETRY', 2); | |
-- add temporary column for storing geometry with target SRID | |
select AddGeometryColumn('places', 'geom_4326', 4326, 'GEOMETRY', 2); | |
BEGIN; | |
-- set the source temporary column with geometries with corrected SRID | |
UPDATE places SET geom_4301 = 'SRID=4301;POINT('|| ST_X(geom) || ' ' || ST_Y(geom) || ')'; |
This file contains 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
public static final String SPACE = "[\\s\u3000]"; | |
public static final String NUMBER = "[0-9\uff10-\uff19]"; // 0-90-9 | |
public static final String HYPHEN = "[-\uff0d\u2212]"; | |
public static final String NOT_NUMBER_OR_HYPHEN = "[^" + NUMBER.substring(1, NUMBER.length()-1) + HYPHEN.substring(1); | |
public static final String REGEX_POSTCODE = | |
"(?:" + NOT_NUMBER_OR_HYPHEN.substring(0, NOT_NUMBER_OR_HYPHEN.length() - 1) + "\\)]|^)" + | |
"\u3012?" + | |
SPACE + "*(" + NUMBER + "{3})" + | |
SPACE + "*" + HYPHEN + |
This file contains 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
private static String toHankakuNumbers(String zenkaku) { | |
if (zenkaku == null) | |
return null; | |
StringBuffer ret = new StringBuffer(); | |
char [] src = zenkaku.toCharArray(); | |
for (char c : src) { | |
if (c >= 0xff10 && c <= 0xff19) { | |
ret.append((char)(c - 65248)); | |
} else { | |
ret.append(c); |
This file contains 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
public static final String SPACE = "[\\s\u3000]"; | |
public static final String NUMBER = "[0-9\uff10-\uff19]"; // 0-90-9 | |
public static final String HYPHEN = "[-\uff0d\u2212]"; | |
public static final String NOT_NUMBER_OR_HYPHEN = "[^" + NUMBER.substring(1, NUMBER.length()-1) + HYPHEN.substring(1); | |
public static final String SEPARATOR = "[\\(\\)" + HYPHEN.substring(1, HYPHEN.length()-1) + "]"; | |
public static final String REGEX_PHONEFAX = | |
"(?:" + NOT_NUMBER_OR_HYPHEN + "|^)" + | |
SPACE + "*(" + NUMBER + "{2,4})" + | |
SPACE + "*" + SEPARATOR + |
OlderNewer