Skip to content

Instantly share code, notes, and snippets.

public static String asciiStringToHexString(String strAscii) {
char[] chars = strAscii.toCharArray();
StringBuilder stringBuilder = new StringBuilder();
for (char aChar : chars) {
String aHex = String.format("%H", aChar);
stringBuilder.append(aHex);
}
String strHex = stringBuilder.toString();
return strHex;
}
{
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
"update.channel": "none",
"update.enableWindowsBackgroundUpdates": false,
"extensions.autoUpdate": false,
"terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
"php.validate.executablePath": "X:\\xampp\\php\\php.exe",
"npm.packageManager": "yarn",
"php.executablePath": "X:\\xampp\\php\\php.exe",
./configure --prefix=/opt/php-7.1 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm
$strLocalTimezone = 'Asia/Makassar';
$carbonNow = Carbon::now($strLocalTimezone);
$strFrom = $carbonNow->format('Y-m-d 00:00:00');
$strUntil = $carbonNow->format('Y-m-d 23:59:59');
$carbonFrom = Carbon::parse($strFrom, $strLocalTimezone);
$carbonUntil = Carbon::parse($strUntil, $strLocalTimezone);
echo $strLocalTimezone;
#note view states:
- when offline
- when online
- when loading
- when loaded
- when no records
- when error
public class PriceHelper {
public static final int ROUND_VALUE = 100;
public static String format(int price) {
Locale locale = new Locale("in", "ID");
NumberFormat currencyInstance = NumberFormat.getCurrencyInstance(locale);
return currencyInstance.format(price);
}
<?php
$input = 12550;
$output = ceil($input / 100) * 100;
echo $output; // 12600
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
# https://stackoverflow.com/questions/29565278/apt-get-upgrade-always-fails-on-mariadb-server-due-to-timezone/33779694#33779694
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo apt-get install mariadb-server
public static ArrayList<Item> getList(Context context) {
String listJson = getPref(context).getString(KEY_LIST, "");
try {
Type listType = new TypeToken<ArrayList<Item>>() {
}.getType();
Gson gson = new Gson();
ArrayList<Item> list = gson.fromJson(listJson, listType);