2018-11-22

restart google drive cmd





Source URL:
https://www.reginout.com/help-center/google-drive-not-syncing-learn-how-to-fix-this-problem/





taskkill /f /im googledrivesync.exe

"C:\Program Files\Google\Drive\googledrivesync.exe"




2018-11-16

Exception while configure log4j 1.2 by java.util.Properties & PropertyConfigurator.configure


Scenario:

Exception while configure log4j 1.2  by  java.util.Properties & PropertyConfigurator.configure


log4j:WARN No appenders could be found for logger (com.test.TestLog).
log4j:WARN Please initialize the log4j system properly.


Searched by: WARN No appenders could be found for logger after PropertyConfigurator.configure java.util.Properties

found: Log4J warn please help me urgent - Experts Exchange
















Source URL: https://www.experts-exchange.com/questions/24432318/Log4J-warn-please-help-me-urgent.html


> after my application loading then my log file successfully creating file and writing what every error into the log file

because it is working fine, and is not causing your error

> but why that error is coming.....................

because other parts of the application are trying to use log4j before it is configured


2018-11-13

Practice in 1440


Practice in 1440


Source URL: https://www.youtube.com/watch?v=-Qy2vist-XQ&t=274s

The 15 secrets successful people know about time management.

So here are the 15tips , incase u r in hurry;)

41% of items that people put on their to-do lists are never done at all, to-do lists is the graveyard, is important but not urgent

1) Time is ur most valuable and scarcest source (1440 mins a day)
2) Identify ur most imp task and do it first.
3) Work from ur calendar not from a to- do list.
4) To overcome procrastination beat ur future self.
5) There will be always more to do
6) Always carry a notebook(to capture info.)
7) Control ur inbox( to avoid distractions)
8) Schedule and attend meetings as a last resort(say no to things)
9) Say no to everything that doesnt support ur immediate goals
10) Follow the powerful pareto principle (80/20 rule)
11) Focus on ur unique strengths and passion.
12) Batch ur work with recurring themes.
13) If u can do a task in less than 5 mins , do it immediately
14) Routinely use early mornings to strength ur mind ur body and ur spirit.
15) Productivity is about energy and focus and not time. And follow pomodoro technique, take breaks , sleep properly , do exercise,eat properly.
And watch full video to get proper explanations.




2018-11-12

apache 2.4.6 virtualhost reverse proxy tomcat proxy:error] [pid 3363] AH00940: HTTP: disabled connection for (localhost)



sudo tail -200f /etc/httpd/logs/yourdomainname-error_log



[Mon Nov 12 19:40:54.576505 2018] [proxy:error] [pid 3363] AH00940: HTTP: disabled connection for (localhost)
[Mon Nov 12 19:40:54.615281 2018] [proxy:error] [pid 3365] AH00940: HTTP: disabled connection for (localhost)



Source URL: https://serverfault.com/questions/382076/apache-proxy-not-working-for-a-localhost-port


Here is the solution for your problem:
To turn on this boolean you simple have to use this line (root permissions)
setsebool -P httpd_can_network_connect on
or
sudo setsebool -P httpd_can_network_connect on
Hope that helps. Reference see here: https://wiki.centos.org/TipsAndTricks/SelinuxBooleans







apache 2.4.6 virtual host reverse proxy Your browser sent a request that this server could not understand


The case i hit this is due to apache configuration version issue.

Source URL: https://stackoverflow.com/questions/10445455/apache-dont-have-permission-to-access-on-this-server-when-i-am-using-virtua

This configuration was valid for apache version 2.2
First check your apache version by typing apachectl -V in your terminal.
If it shows something like this
Server version: Apache/2.4.27 (Ubuntu)
Server built:   2018-04-18T14:20:05
then your apache version has updated but the conf you are using is deprecated.
So instead of
2.2 configuration:
Order allow,deny
Allow from all
use this:
2.4 configuration:
Require all granted
For further documentation related to the upgrade, follow the official docs:




2018-11-05

org.apache.maven.plugin.war.WarMojo cannot compile





hint source URL: https://issues.apache.org/jira/browse/MWAR-279


sample solution:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<url>http://maven.apache.org</url>

<properties>
<jdk.version>1.7</jdk.version>
<context.path>wilasBase2</context.path>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>

<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>

</dependencies>
<build>
<finalName>x</finalName>
<plugins>
<!-- Maven compiler plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>

</plugins>
</build>
</project>

2018-10-18

java regex between multiple lines



Searched by: java regex between multiple lines

Source URL:
https://stackoverflow.com/questions/3651725/match-multiline-text-using-regular-expression



First, you're using the modifiers under an incorrect assumption.
Pattern.MULTILINE or (?m) tells Java to accept the anchors ^ and $ to match at the start and end of each line (otherwise they only match at the start/end of the entire string).
Pattern.DOTALL or (?s) tells Java to allow the dot to match newline characters, too.
Second, in your case, the regex fails because you're using the matches() method which expects the regex to match the entire string - which of course doesn't work since there are some characters left after (\\W)*(\\S)* have matched.
So if you're simply looking for a string that starts with User Comments:, use the regex
^\s*User Comments:\s*(.*)
with the Pattern.DOTALL option:
Pattern regex = Pattern.compile("^\\s*User Comments:\\s+(.*)", Pattern.DOTALL);
Matcher regexMatcher = regex.matcher(subjectString);
if (regexMatcher.find()) {
    ResultString = regexMatcher.group(1);
} 
ResultString will then contain the text after User Comments:
















2018-10-11

Project Facets doesn't have 1.8 as option for java.


Java compiler level does not match the version of the installed Java project facet. PROJECT_ABC123 Unknown Faceted Project Problem (Java Version Mismatch)





source URL: https://stackoverflow.com/questions/28995358/getting-project-facet-java-version-1-8-is-not-supported-in-eclipse-luna

I solved the problem. Go to Project Properties -> Project Facets -> Runtime -> New -> Add a tomcat server and in JRE select JRE1.8.0_XX.




2018-09-18

Why most posts telling slf4j is better than apache commons log to work with log4j.


Edited: 2019-Aug-08_pm063733

Recently due to some event, lead me to double check again about:


  1. slf4j
  2. log4j
  3. apache commons logging


Which facts so far I found were showing different story...






https://commons.apache.org/proper/commons-logging/

1.0.4 Release - 16 Jun 2004

The 1.0.4 release of commons-logging is a service release containing support for both the 1.2.x and 1.3.x series of Log4J releases.






https://www.slf4j.org/news.html

13 April 2005 - start of work on SLF4J project

Launch of the SLF4J project. Work has begun on the web-site, svn repositories as well as the source code.






https://www.quora.com/What-is-the-best-logging-framework-for-Java-for-new-projects

https://stackoverflow.com/questions/41633278/can-we-use-all-features-of-log4j2-if-we-use-it-along-with-slf4j-api/41635246#41635246

https://www.google.com/search?q=apache+common+logging+vs+slf4j&oq=apache+common+logging+vs+slf4j&aqs=chrome..69i57j0l2.1034j0j7&sourceid=chrome&es_sm=93&ie=UTF-8




java best logging framework

https://stackoverflow.com/questions/41498021/is-it-worth-to-use-slf4j-with-log4j2

https://www.loggly.com/blog/benchmarking-java-logging-frameworks/

https://stackify.com/compare-java-logging-frameworks/

http://www.java-logging.com/comparison/

https://www.baeldung.com/java-logging-intro




















2018-08-20

Spring JpaRepository Hibernate Jackson Junit Test, Controller.








Error:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: xx.xx.xx.db.xx.xx.xx.xx, could not initialize proxy - no Session at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:588) [hibernate-core-5.3.3.Final.jar:5.3.3.Final] at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:207) [hibernate-core-5.3.3.Final.jar:5.3.3.Final] at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:151) [hibernate-core-5.3.3.Final.jar:5.3.3.Final] at org.hibernate.collection.internal.PersistentBag.size(PersistentBag.java:261) [hibernate-core-5.3.3.Final.jar:5.3.3.Final] at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:97) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:25) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3893) [jackson-databind-2.9.5.jar:2.9.5] at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3207) [jackson-databind-2.9.5.jar:2.9.5]



Config to clear error:


Reference URL:
https://coderleaf.wordpress.com/2016/11/07/jackson-serialization-and-hibernate-lazy-loading/

@Configurationpublic class WebMvcConfig extends WebMvcConfigurationSupport{     @Override    protected void extendMessageConverters( List<HttpMessageConverter<?>> converters ) {        for ( HttpMessageConverter<?> converter : converters ) {            if ( converter instanceof MappingJackson2HttpMessageConverter ) {                MappingJackson2HttpMessageConverter jacksonConverter = (MappingJackson2HttpMessageConverter) converter;                                ObjectMapper objectMapper = jacksonConverter.getObjectMapper();                                 //--- register hibernateModule in MappingJackson2HttpMessageConverter.objectMapper                objectMapper.registerModule(new Hibernate4Module());                 //--- other configurations                jacksonConverter.setPrettyPrint( true );                objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);                                objectMapper.enable(SerializationFeature.INDENT_OUTPUT);            }        }                 super.configureMessageConverters(converters);    } }






xml config to clear error

Reference URL:
https://stackoverflow.com/questions/43946323/spring-and-mappingjackson2httpmessageconverter-and-registermodule




<mvc:annotation-driven>
    <mvc:message-converters register-defaults="true">
        <bean
            class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
            <property name="objectMapper" ref="objectMapper" />
        </bean>
    </mvc:message-converters>
</mvc:annotation-driven>

<bean id="objectMapper"
    class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean">

    <property name="featuresToDisable">
        <array>
            <util:constant
                static-field="com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS" />
        </array>
    </property>

    <property name="dateFormat">
        <bean class="java.text.SimpleDateFormat">
            <constructor-arg type="java.lang.String" value="yyyy-MM-dd"></constructor-arg>
        </bean>
    </property>

    <property name="modulesToInstall"
        value="
        com.fasterxml.jackson.datatype.jdk8.Jdk8Module,
    com.fasterxml.jackson.datatype.jsr310.JavaTimeModule,
    com.fasterxml.jackson.module.paramnames.ParameterNamesModule" />
</bean>













Google Referrals