SupportWriter space ↗
A JOURNAL ABOUT TECHNOLOGY

Learn something new.
Write. Share.

A space to connect knowledge, one line of code a day.
Discover tutorials, ideas, and notes from a learning journey.

1967 notes & counting ↙
EDITOR’S PICK ↗
Pentesting

Planning Your First Web Application Pentest: Scope, Safety, and Evidence

Build a focused web pentest plan with clear authorization, realistic objectives, controlled testing, and evidence that developers can use.

D Putu Adi Guna Permana · 3 min read
FOR YOUR CURIOSITY

Latest notes.

HIBERNATE / NOTES</>↗
Hibernate16 Sep 2007

How do I store object in Hibernate?

This example shows you how to store or save Hibernate object to database. The basic steps in creating application in Hibernate will be: Creates the POJO Create hibernate mapping file Register the mapping file in hibernate configuration Create a simple service class to store the object In this example we’ll create a class called Label, […]

Wayan · 4 min read
HIBERNATE / NOTES</>↗
Hibernate14 Sep 2007

How do I create Hibernate’s SessionFactory?

When creating an application the use Hibernate to manage our application persistence object we’ll need a SessionFactory. This factory creates or open a session to talk to a database. To create a SessionFactory we can define the configuration in hibernate.properties, hibernate.cfg.xml or create it programmatically. In this example we’ll use the hibernate.cfg.xml configuration file, which […]

Wayan · 4 min read
CORE API / NOTES</>↗
Core API12 Sep 2007

How do I convert milliseconds value to date?

package org.kodejava.util; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class MillisecondsToDate { public static void main(String[] args) { // Create a DateFormatter object for displaying date information. DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS"); // Get date and time information in milliseconds long now = System.currentTimeMillis(); // Create a calendar object that will convert the date […]

Wayan · 1 min read
MAIL / NOTES</>↗
Mail11 Sep 2007

How do I send an email with attachment?

In this example we create a small program to send email with a file attachment. To send message with attachment we need to create an email with javax.mail.Multipart object which basically will contain the email text message and then add a file to the second block, which both of them is an object of javax.mail.internet.MimeBodyPart. […]

Wayan · 3 min read
CORE API / NOTES</>↗
Core API07 Sep 2007

How do I split a string using Scanner class?

Instead of using the StringTokenizer class or the String.split() method we can use the java.util.Scanner class to split a string. package org.kodejava.util; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class ScannerTokenDemo { public static void main(String[] args) { // This file contains some data as follows: // a, b, c, d // e, f, g, […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API04 Sep 2007

How do I read file line by line using java.util.Scanner class?

Here is a compact way to read file line by line using the java.util.Scanner class. package org.kodejava.util; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class ScannerReadFile { public static void main(String[] args) { // Create an instance of File for data.txt file. File file = new File("README.md"); try { // Create a new Scanner object […]

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

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

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.