SELECT to_date(‘19700101′,’yyyymmdd’) + (TIMESTAMP_VALUE/1000/24/60/60) AS date_time FROM TABLENAME;
Read MoreSolutions for ‘Intellij IDEA Java classes not auto compiling on save’
Try some options below: 1. mvn idea:idea 2. cd yourporject/path, rm *.iml *.ipr *.iws, the reopen idea, maven build again 3. Alt+shift+A, Type:Registry choose compiler.automake.allow.when.app.running to check
Read MoreChange fields order when using XStream
xstream_field_order 1. XMLSequence : annotation which will be used for TestXml class 2. TestXml : Class for xstream fields 3. PartialSeqFieldKeySorter: customize the sort fields, defined fields which you will display in XML import com.thoughtworks.xstream.converters.reflection.FieldKey; import com.thoughtworks.xstream.converters.reflection.FieldKeySorter; import com.thoughtworks.xstream.core.util.OrderRetainingMap; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; public class PartialSeqFieldKeySorter implements FieldKeySorter { […]
Read MoreChange blob to clob,vice versa in oracle
Conditions 1. blob not save too much content, and text 2. backup blob text to clob 3. oracle v11 blob to clob –Add new clob column ALTER TABLE TABLENAME ADD (CLOB_COLUMN CLOB); –copy blob value to clob UPDATE TABLENAME SET CLOB_COLUMN = UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(BLOB_COLUMN,2000)); –drop blob ALTER TABLE TABLENAME DROP COLUMN BLOB_COLUMN; –rename clob column, name […]
Read MoreApple script: Backup Mac Notes to PDFs
1. Open Notes and click folder you want to backup 2. Open script and copy content to Mac ScriptEditor and run, or choose scpt to run in ScriptEditor 3. Gen pdfs 4. OS: Catalina 10.15.X Can further modify based on it set cnt to 58 set i to 0 tell application “System Events” repeat cnt […]
Read Moreoracle sql : to_char from date
24hours SELECT TO_CHAR(date_column,’YYYY-MM-DD HH24:MI:SS’) FROM tablename
Read MoreMockito for JUnit5 test cases
1. One of NPE solutions for mock SomeClass someclass = mock(SomeClass.class,Mockito.RETURNS_DEEP_STUBS); 2. Assert Any Exceptions assertThrows(RunTimeException.class, ()->{ //logic code }); 3. Mock/Test private method @InjectMocks PrivateInClass privateInClass; ReflectionTestUtils.invokeMethod(privateInClass, “privateMethodName”, param1, param2, …); 4. Mock final class Add below file in test path …/test/resources/mockkito-extensions/org.mockito.plugins.MockMaker MockMaker content mock-maker-inline
Read MoreBloomRPC cant import proto files issue and solutions
1. Try to import path which includes all files are needed as class and resources 2. When shows “boolmrpc e is not a construtor, error construct request” need to check proto files whether are correct 1) one or more proto files are not necessary 2) grammar errors in porto 3) related files in the import […]
Read MoreForify fix for DocumentBuilderFactory : XML External Entity Injection
Reference code: DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); documentBuilderFactory.setFeature(“http://xml.org/sax/features/external-general-entities”, false); documentBuilderFactory.setFeature(“http://xml.org/sax/features/external-parameter-entities”, false); documentBuilderFactory.setFeature(“http://apache.org/xml/features/disallow-doctype-decl”, true); documentBuilderFactory.setXIncludeAware(false); documentBuilderFactory.setExpandEntityReferences(false); ……
Read MoreOverride tomcat version of springboot in pom
We know org.springframework.boot 2.2.1 version includes tomcat 9.027 version, if we need to upgrade to 9.037, we need to add it like below in pom.xml <tomcat-embed.version>9.0.37</tomcat-embed.version> <dependencyManagement> <dependencies> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>${tomcat-embed.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-el</artifactId> <version>${tomcat-embed.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-websocket</artifactId> <version>${tomcat-embed.version}</version> </dependency> </dependencies> Suggest to use Maven Helper plugin for Idea to see
Read More