Saturday, March 23, 2024

How can we use svg file as a icon of v-btn (vuetify button) ?

<template>
  <v-btn>
    <CustomIcon />
    Click me
  </v-btn>
</template>

<script>
// Import your SVG file
import CustomIcon from '@/assets/CustomIcon.svg';

export default {
  components: {
    CustomIcon, // Define CustomIcon as a component
  },
};
</script>

Thursday, March 21, 2024

Is Java "pass-by-reference" or "pass-by-value"?

Java is technically considered pass-by-value.

Here's why it can be confusing:

  • In Java, primitive data types (like int or double) are directly copied and passed by value to methods.
  • For objects (which are references), a copy of the reference is passed, not the object itself. This reference points to the object's location in memory.

So, while you might think modifying an object passed to a method would change the original object (pass-by-reference behavior), it actually only modifies the copy of the reference within the method. The original object remains unchanged.

New features of Java 22 !!!

Hello, I want to share couple of new features about java 22.

Language Improvements:

  • Unnamed variables & patterns (JEP 456): This enhancement allows you to use an underscore (_) to denote unused variable declarations or nested patterns. This improves code readability when a variable needs to be declared but isn't actually used.

Libraries:

  • Foreign Function & Memory API (JEP 454): This major addition enables Java programs to interact with code and data residing outside the Java runtime environment. This opens doors for improved performance and integration with native code.

Performance:

  • Regional Pinning for G1 (JEP 423): This feature reduces garbage collection latency by implementing regional pinning in the G1 collector. This essentially eliminates the need to disable garbage collection during critical JNI (Java Native Interface) regions.

Other noteworthy features:

  • Support for Unicode 15.1: Java 22 keeps pace with the evolving character set by incorporating Unicode 15.1. This means your programs can now handle a wider range of characters.
  • Locale-Dependent List Patterns: This feature tailors list formatting based on the user's locale, ensuring culturally appropriate presentation of lists.
  • New method in java.util.random.RandomGenerator: A new equiDoubles() method simplifies generating pairs of floating-point numbers with the same mathematical representation.

Additionally:

  • Java 22 comes with several preview features that are still under development, such as virtual threads and scoped values, which aim to enhance concurrency capabilities.

For a more comprehensive exploration of Java 22 features, you can refer to the official Oracle blog post "https://blogs.oracle.com/java/post/the-arrival-of-java-22" or the JDK 22 release notes https://www.oracle.com/java/technologies/javase/22-relnote-issues.html.

Tuesday, November 26, 2019

How to Retrieve all unread emails using javamail with POP3 protocol

This code will be work

Flags seen = new Flags(Flags.Flag.RECENT);
FlagTerm unseenFlagTerm = new FlagTerm(seen, false);
messages = inbox.search(unseenFlagTerm);

How to fix Plugin with id 'com.github.dcendents.android-maven' not found. in android studio

This is all depend your gradle version. please check https://github.com/dcendents/android-maven-gradle-plugin i found my solution in there.

 dependencies {
    // The gradle plugin and the maven plugin have to be updated after each version of Android
    // studio comes out
    classpath 'com.android.tools.build:gradle:3.1.1'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}

Friday, February 15, 2019

Docx4j unexpected element (uri:“http://schemas.openxmlformats.org/wordprocessingml/2006/main”, local:“p”)

Docx4j unexpected element (uri:“http://schemas.openxmlformats.org/wordprocessingml/2006/main”, local:“p”) I am trying add html table in to the another word table' cell.


  • I can add html table in to the another word table' cell. (OK) 
  • I can generated last word document call lastDocument.docx (OK) 
  • I can not load again WordprocessingMLPackage.load(lastDocument.docx), throw this exception Docx4j unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"p") this is my code:

This code will be run


Tr workingRow = (Tr) XmlUtils.deepCopy(templateRow);
    List<?> textElements = WMLPackageUtils.getTargetElements(workingRow, Text.class);

    List<Tc> tcList = WMLPackageUtils.getTargetElements(workingRow, Tc.class);
    Tc tc = WMLPackageUtils.getTc(tcList, "${Replace_Tex1}");

    XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
    XHTMLImporter.setParagraphFormatting(FormattingOption.IGNORE_CLASS);
    XHTMLImporter.setTableFormatting(FormattingOption.IGNORE_CLASS);
    for (Object object : textElements) {
        Text text = (Text) object;
        if (!text.getValue().equals("${Replace_Tex1}"))
            continue;
        String replacementValue = (String) replacements.get(text.getValue());
        //text.setValue(replacementValue);
 R r = (R) text.getParent();
     P paragraphOfText = wordMLPackage.getMainDocumentPart().createParagraphOfText("");
     paragraphOfText.getContent().clear();

     r.getContent().clear();eviewtable.getContent().add(new Tr(new Tc(itemTable, new Paragraph())));
     tc.getContent().addAll(XHTMLImporter.convert(replacementValue, null));
     tc.getContent().add(paragraphOfText);

Friday, August 29, 2014

Generate java file from wsdl

Hi, The wsimport tool is used to parse an existing Web Services Description Language (WSDL) file and generate required files -java class or java files etc.- for web service client to access the published web services. This wsimport tool is available in the $JDK/bin folder. And wsimport tool come with jdk 1.&+

#wsimport -keep -d (for your generate files directory) -verbose http://kirazibrahim.blogpsot.com.tr/ws/server?wsdl

How can we use svg file as a icon of v-btn (vuetify button) ?

<template>   <v-btn>     <CustomIcon />     Click me   </v-btn> </template> <script> // Import your SVG ...