Fahri NH

Plan the Future, Do the Day, Learn the Past

Nov 22, 2017 - 2 minute read - Comments - Gear

How to Update Pomera DM100 Firmware

Pomera DM100 is a distraction-free digital writing tool. Think mini laptop with only text editor application loaded.

It comes from Japan. It means its manual is in all Japanese. It becomes hard when you want to do the crucial procedure (like upgrading firmware) AND Google Translate doesn’t help you much.

I can only follow some steps in its updating guide web page and the rest of important steps in PDF are not translatable by Google Translate.

In the end, I have successfully updated my Pomera DM100 to the latest firmware.

Here are the steps:

Nov 8, 2017 - 3 minute read - Comments - Java

Java: How To Autodetect The Charset Encoding of A Text File and Remove Byte Order Mark (BOM)

TLDR;

Required dependencies (pom.xml) :

 1 2 3 4 5 6 7 8 910
<dependency>
    <groupId>com.ibm.icu</groupId>
    <artifactId>icu4j</artifactId>
    <version>60.1</version>
</dependency>
<dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.6</version>
</dependency>

Autodetect the charset encoding of a text file or input stream then ‘remove’ (skip) Byte Order Mark (BOM) while reading based on detected charset :

 1 2 3 4 5 6 7 8 9101112131415161718
File inputFile = new File("/Users/fahri/Downloads/UNKNOWN_TEXT.txt");

BOMInputStream bomInputStream = new BOMInputStream(new BufferedInputStream(new FileInputStream(inputFile)),
        ByteOrderMark.UTF_8, ByteOrderMark.UTF_16BE, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_32BE, ByteOrderMark.UTF_32LE);

System.out.println("HAS BOM : " + bomInputStream.hasBOM());

CharsetDetector detector = new CharsetDetector();
detector.setText(bomInputStream);

CharsetMatch charsetMatch = detector.detect();
System.out.println("CHARSET MATCH : " + charsetMatch.getName());

BufferedReader br = new BufferedReader(new InputStreamReader(bomInputStream, charsetMatch.getName()));
for (String line = br.readLine(); line != null; line = br.readLine()) {
    System.out.println(line);
}
br.close();

Jul 23, 2017 - 1 minute read - Comments - Mini Tips

Oracle XE 11g dengan Docker

12345678
$ docker pull wnameless/oracle-xe-11g
$ docker run -d -p 1022:22 -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g
$ docker ps -a
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                    PORTS               NAMES
4fe7a1024ed3        wnameless/oracle-xe-11g   "/bin/sh -c '/usr/..."   5 weeks ago         Exited (137) 4 days ago                       practical_williams
$ docker start practical_williams
# or
$ docker start 4fe7a1024ed3

Jul 22, 2017 - 2 minute read - Comments - Drafts

Static Blog dengan Hugo, Github Pages (Travis CI, Cloudflare)

Github

Jul 22, 2017 - 1 minute read - Comments

Hello World

12345
class HelloWorld {
  static public void main( String args[] ) {
    System.out.println( "Hello World!" );
  }
}

123
fun main(args : Array<String>) {
    println("Hello, world!")
}

1
console.log("Hello World");

123
defmodule HelloWorld do
  IO.puts "Hello, World!"
end

12345
package main
import "fmt"
func main() {
  fmt.Printf("Hello World\n")
}