Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

JDBC / CATATAN</>
JDBC11 Jun 2013

How to establish connection to a database using Properties object?

In the following code snippet, you will see how to pass some connection arguments when connecting to a database. To do this, we can use the java.util.Properties class. We can put some key value pairs as a connection arguments to the Properties object before we pass this information into the DriverManager class. Let’s see the […]

Wayan · 2 menit baca
CORE API / CATATAN</>
Core API10 Apr 2013

How to get random key-value pair from Hashtable?

package org.kodejava.example.util; import java.util.Hashtable; import java.util.Random; public class HashtableGetRandom { public static void main(String[] args) { // Create a hashtable and put some key-value pair. Hashtable<String, String> colors = new Hashtable<>(); colors.put("black", "#000"); colors.put("red", "#f00"); colors.put("green", "#0f0"); colors.put("blue", "#00f"); colors.put("white", "#fff"); // Get a random entry from the hashtable. String[] keys = colors.keySe...

Wayan · 1 menit baca
SWING / CATATAN</>
Swing10 Apr 2013

How to define JRadioButton label position?

In this code snippet you’ll see how to define JRadioButton label position. By default, the label will be displayed on the right side of the button. In the code below you will see some examples for placing the label on the left side, at the top and the bottom of the JRadioButton. To define the […]

Wayan · 2 menit baca
REGEX / CATATAN</>
Regex10 Apr 2013

How to truncate a string after n number of words?

package org.kodejava.regex; public class GetNumberOfWordsFromString { public static void main(String[] args) { String text = "The quick brown fox jumps over the lazy dog."; String one = truncateAfterWords(1, text); System.out.println("1 = " + one); String two = truncateAfterWords(2, text); System.out.println("2 = " + two); String four = truncateAfterWords(4, text); System.out.println("4 = " + four); String […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API03 Apr 2013

How to get the file name when using WatchService?

package org.kodejava.io; import java.io.IOException; import java.nio.file.*; import static java.nio.file.StandardWatchEventKinds.*; public class WatchServiceGetFilename { public static void main(String[] args) { try { // Create a WatchService and register the logDir path with the // WatchService for ENTRY_CREATE. WatchService watcher = FileSystems.getDefault().newWatchService(); Path logDir = Paths.get("F:/Temp"); logDir.register(watcher, ENTRY_CREATE); while (true) { WatchKe...

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API03 Apr 2013

How to monitor file or directory changes?

package org.kodejava.io; import java.io.IOException; import java.nio.file.*; import static java.nio.file.StandardWatchEventKinds.*; public class FileWatchDemo { public static void main(String[] args) { try { // Creates a instance of WatchService. WatchService watcher = FileSystems.getDefault().newWatchService(); // Registers the logDir below with a watch service. Path logDir = Paths.get("F:/Temp/"); logDir.register(watcher, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE); // Monito...

Wayan · 1 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.