How to publish JetBrains Rider plugin for opentelemetry/honeycomb

I had the chance to work with honeycomb.io 2 weeks ago, mainly I was changing the code which sends data too appinsights azre now needed to send data to honeycomb too. It was not too complex but it is hard to catch those log lines and make sure if we called the endpoint correctly and what data we sent. There is wonderful plugin for that for appinsights https://github.com/Socolin/ApplicationInsightsRiderPlugin but there was no plugin whcih can show opentelemetry calls, yes honeycomb.io uses OTEL protocol meaning opentelemetry which is kind of industry standard now for observability. ...

October 6, 2024 · 2 min · Özkan Pakdil

Creating Installers for Java Applications with jpackage

Jpackage, a powerful tool introduced in Java 14. In this blog post, I’ll explore how to use jpackage to create installers for different operating systems, with a focus on creating an MSI installer for Windows. What is jpackage? jpackage is a packaging tool that comes bundled with the Java Development Kit (JDK) since version 14. It allows developers to package Java applications into platform-specific packages that can be easily distributed and installed. It contains the JRE in the generated package and one trigger executable for specified platform. jpackage supports creating various types of installers, including: ...

June 29, 2024 · 2 min · Özkan Pakdil

Spring boot 3 RestClient and RestTemplate logging http requests and response

In Spring boot(SB) 2 the configuration was different, now in SB3 we need to configure the rest client differently. Before SB3 there was RestTemplate now there is new Rest api coming in spring world. Find more details here. Adding the required dependency which will do the real http logging here. implementation 'org.apache.httpcomponents.client5:httpclient5:5.3.1' The big difference is properties configuration, it is changed and not documented on spring site logging.level.org.apache.hc.client5.http.wire=DEBUG logging.level.org.apache.hc.client5.http=DEBUG Using only “wire” will give request/response dump. And that extra http=DEBUG will give connection and more debug log, find it at the end of the page. ...

May 18, 2024 · 8 min · Özkan Pakdil

How to use resources(file and memory) in try

I wrote a small piece of code to do some pdf encryption with openpdf, and intellij`s sonarlint was complaining about “Resources should be closed” more details here non compliant public class PasswordProtectedPDF { private static final Logger logger = Logger.getLogger(PasswordProtectedPDF.class.getName()); static final String USER_PASSWORD = "111"; static final String OWNER_PASSWORD = "111"; public static void main(String[] args) { try { File f = new File("1_protected.pdf"); FileOutputStream out = new FileOutputStream(f); File pdfFile = new File("1.pdf"); PdfReader reader = new PdfReader(pdfFile.getPath()); PdfStamper stamper = new PdfStamper(reader, out); HashMap<String, String> info = new HashMap<>(); info.put("Producer", ""); reader.getInfo().forEach((key, value) -> { logger.info("Key: " + key + ", Value: " + value); }); stamper.setInfoDictionary(info); stamper.setEncryption(USER_PASSWORD.getBytes(), OWNER_PASSWORD.getBytes(), PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128); stamper.close(); logger.info("Password protected PDF created successfully."); } catch (IOException e) { logger.severe("Error creating password protected PDF: " + e.getMessage()); } } } Compliant public class PasswordProtectedPDF { private static final Logger logger = Logger.getLogger(PasswordProtectedPDF.class.getName()); static final String USER_PASSWORD = "111"; static final String OWNER_PASSWORD = "111"; public static void main(String[] args) { try ( FileOutputStream out = new FileOutputStream(new File("1_protected.pdf")); PdfReader reader = new PdfReader(new File("1.pdf").getPath()) ) { PdfStamper stamper = new PdfStamper(reader, out); HashMap<String, String> info = new HashMap<>(); info.put("Producer", ""); reader.getInfo().forEach((key, value) -> { logger.info("Key: " + key + ", Value: " + value); }); stamper.setInfoDictionary(info); stamper.setEncryption(USER_PASSWORD.getBytes(), OWNER_PASSWORD.getBytes(), PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128); stamper.close(); logger.info("Password protected PDF created successfully."); } catch (IOException e) { logger.severe("Error creating password protected PDF: " + e.getMessage()); } } } just a reminder we can define multiple resources in try block ...

April 18, 2024 · 2 min · Özkan Pakdil

Character isEmoji and some others added to java 21

In java 21 we get new API for emojis like below isEmoji(int codePoint) isEmojiComponent(int codePoint) isEmojiModifier(int codePoint) isEmojiModifierBase(int codePoint) isEmojiPresentation(int codePoint) isExtendedPictographic(int codePoint) here is a working example public static void main(String[] args) { StringBuilder sb = new StringBuilder(); sb.appendCodePoint(0x1F600); // Grinning face sb.appendCodePoint(0x1F601); // Grinning face with big eyes sb.appendCodePoint(0x1F602); // Grinning face with tears sb.appendCodePoint(0x1F923); // Rolling on the floor laughing sb.appendCodePoint(0x1F970); // Smiling face with hearts sb.appendCodePoint(0x1F60D); // Smiling face with heart-eyes sb.appendCodePoint(0x1F929); // Star-struck sb.appendCodePoint(0x1F618); // Face blowing a kiss sb.appendCodePoint(0x1F617); // Kissing face sb.appendCodePoint(0x263A); // Smiling face System.out.println(sb); var codePoint = Character.codePointAt("😃", 0); var isEmoji = Character.isEmoji(codePoint); System.out.println("😃 is an emoji: " + isEmoji); int[] surrogates = { 0xD83D, 0xDC7D }; String alienEmojiString = new String(surrogates, 0, surrogates.length); System.out.println(alienEmojiString); } seeing these emojis in vscode ...

November 20, 2023 · 1 min · Özkan Pakdil