After connecting to phoenix with sqlline.py:
- !outputformat csv
- !record data.csv
- select * from system.catalog limit 10;
- !record
- !quit
import java.text.RuleBasedCollator; import java.util.Arrays; import java.util.Collections; import java.util.Vector; /** * Created by nhchon on 2/6/2018 4:12 PM. */
public class Viet { //More about RuleBasedCollator see https://docs.oracle.com
//javase/tutorial/i18n/text/rule.html
public static void main(String s[]) throws Exception { // copy from JackV
Vector<String> list = new Vector<String>(
Arrays.asList(new String[]{"Duy", "Dũng", "Trinh", "Lan", "Đạt", "1", "a"})); final String rules = "<0<1<2<3<4<5<6<7<8<9<@"+ "<a,A<á<à<ả<ã<ạ<ă<ắ<ằ<ẳ<ẵ<ặ<â<ấ<ầ<ẩ<ẫ<ậ"+ "<b<c<d,D<đ,Đ<e<é<è<ẻ<ẽ<ẹ<ê<ế<ề<ể<ễ<ệ<f<g<h"+ "<i<í<ì<ỉ<ĩ<ị<j<k<l<m<n<o<ó<ò<ỏ<õ<ọ<ô<ố<ồ<ỗ"+ "<ộ<ơ<ớ<ờ<ở<ỡ<ợ<p<q<r<s<t"+ "<u<ú<ù<ủ<ũ<ụ<ư<ứ<ừ<ử<ữ"+ "<v<w<x<y<ý<ỳ<ỷ<ỹ<ỵ<z"; RuleBasedCollator ru = new RuleBasedCollator(rules); Collections.sort(list, ru); for (int i = 0, l = list.size(); i < l; i++) System.out.println(list.elementAt(i)); } }
Result:
C:\Java\jdk1.8.0_112\bin\java
1 a Duy Dũng Đạt Lan Trinh
System.out.println(System.getProperty("java.io.tmpdir"));
In MS Windows the temporary directory is set by the environment variable TEMP
. In XP, the temporary directory was set per-user as Local Settings\Temp.
If you change your TEMP environment variable to C:\temp
, then you get the same when you run : -Djava.io.tmpdir=C:\temp
US-Pacific
time zone, X milliseconds since the epoch in GMT-0 (London), X milliseconds since the epoch in India, etc. In short, when it’s 1273947282085 milliseconds since the epoch, it’s 1273947282085 milliseconds since the epoch everywhere in the world at the same time regardless of what time zone you’re sitting in. And since Java’s util.Date
is simply a snapshot of the number of milliseconds at a specific point in time, you can see why Date doesn’t care about your time zone. It’s irrelevant.java.util.Date
into a different time zone? You can’t, and that question makes no sense. That’s like asking me to “take a picture of the sound.” Here’s some crap code that you should not use, but I’ve put it here for illustrative purposes:// Do NOT use this, it does nothing and makes no sense.
public static final Date convertIntoTimeZone(final Date date, final TimeZone tz) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.setTimeZone(tz);
return cal.getTime();
}
Date
into a different time zone, but you can use Java’s handy DateFormat class to format a Date
into the time zone of your choice. To put it differently, let Date
do its thing — then, when you’re ready to display or print out a String
representation of Date
, that’s when you tell DateFormat what time zone you want it in. So, here’s some code that makes sense, and actually works:final Date currentTime = new Date();
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d, yyyy hh:mm:ss a z");
// Give it to me in US-Pacific time.
sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
System.out.println("US-Pacific time: " + sdf.format(currentTime));
// Give it to me in GMT-0 time.
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
System.out.println("GMT time: " + sdf.format(currentTime));
// Or maybe Zagreb local time.
sdf.setTimeZone(TimeZone.getTimeZone("Europe/Zagreb"));
System.out.println("Zagreb time: " + sdf.format(currentTime));
// Even 10 hours and 10 minutes ahead of GMT
sdf.setTimeZone(TimeZone.getTimeZone("GMT+0010"));
System.out.println("10/10 ahead time: " + sdf.format(currentTime));
String.join(",", yourListString);
String content = yourListObjs.stream() .map(obj -> obj.toString()) .collect(Collectors.joining(System.lineSeparator()));
list.sort(String::compareToIgnoreCase);
Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...