What is the opposite of GROUP_CONCAT in MySQL?

You could use a query like this: SELECT id, SUBSTRING_INDEX(SUBSTRING_INDEX(colors, ‘,’, n.digit+1), ‘,’, -1) color FROM colors INNER JOIN (SELECT 0 digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3) n ON LENGTH(REPLACE(colors, ‘,’ , ”)) <= LENGTH(colors)-n.digit ORDER BY id, n.digit Please see fiddle here. Please notice that this query … Read more

What is this date format? 2011-08-12T20:17:46.384Z

The T is just a literal to separate the date from the time, and the Z means “zero hour offset” also known as “Zulu time” (UTC). If your strings always have a “Z” you can use: SimpleDateFormat format = new SimpleDateFormat( “yyyy-MM-dd’T’HH:mm:ss.SSS’Z'”, Locale.US); format.setTimeZone(TimeZone.getTimeZone(“UTC”)); Or using Joda Time, you can use ISODateTimeFormat.dateTime().

Android TextView Justify Text

TextView in Android O offers full justification (new typographic alignment) itself. You just need to do this: Kotlin if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { textView.justificationMode = JUSTIFICATION_MODE_INTER_WORD } Java if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { textView.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD); } XML <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:justificationMode=”inter_word” /> Default is JUSTIFICATION_MODE_NONE (none in xml).

How to format date and time in Android?

You can use DateFormat. Result depends on default Locale of the phone, but you can specify Locale too : https://developer.android.com/reference/java/text/DateFormat.html This is results on a DateFormat.getDateInstance().format(date) FR Locale : 3 nov. 2017 US/En Locale : Jan 12, 1952 DateFormat.getDateInstance(DateFormat.SHORT).format(date) FR Locale : 03/11/2017 US/En Locale : 12.13.52 DateFormat.getDateInstance(DateFormat.MEDIUM).format(date) FR Locale : 3 nov. 2017 US/En … Read more

How to nicely format floating numbers to string without unnecessary decimal 0’s

In short: If you want to get rid of trailing zeros and locale problems, then you should use: double myValue = 0.00000021d; DecimalFormat df = new DecimalFormat(“0”, DecimalFormatSymbols.getInstance(Locale.ENGLISH)); df.setMaximumFractionDigits(340); //340 = DecimalFormat.DOUBLE_FRACTION_DIGITS System.out.println(df.format(myValue)); //output: 0.00000021 Explanation: Why other answers did not suit me: Double.toString() or System.out.println or FloatingDecimal.toJavaFormatString uses scientific notations if double is less … Read more

Correct format specifier to print pointer or address?

The simplest answer, assuming you don’t mind the vagaries and variations in format between different platforms, is the standard %p notation. The C99 standard (ISO/IEC 9899:1999) says in §7.19.6.1 ¶8: p The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printing characters, in an implementation-defined … Read more