Posts

Showing posts from August, 2018

Counting up Java source code lines on Eclipse

Image
I use the open source Eclipse plugin called StepCounter. Download the latest jar file from https://github.com/takezoe/stepcounter/releases . Please download the latest jar file It will be placed in Eclipse’s plugins folder. For example path: /path/to/eclipse/plugins/jp.sf.amateras.stepcounter_3.0.3.201404150124.jar Restart Eclipse and complete install it. Let’s try it. Right click on the project and select "Step Counter" -> "Count Step Number" A view named count result is displayed. It also counts the number of blank lines and lines of comments. It can not count the number of lines in class file or jar file. You can also export to Excel.

How to set X-Forward-For on Apache httpd

I think you want to use X-Forwarded-For when you use a load balancer. Because the IP address acquired by the web server becomes the IP address of the load balancer. In this article I will show how to restrict IP using X-Forwarded-For and how to output X-Forwarded-For to the log. Apache httpd introduced in this article is installed based on chef. X-Forwarded-For logging Restrict IP with X-Forwarded-For X-Forwarded-For logging vim /etc/httpd/conf/httpd.conf Create a custom log definition called "combined" . LogFormat " %h %l %u %t \" %r \" %> s %b \" %{Referer} i\" \"%{User-Agent}i\"" combined ↓ LogFormat " %h %l %u %t \" %r \" %> s %b \" %{Referer} i\" \"%{User-Agent}i\" \"%{X-Forwarded-For}i\"" combined vim /etc/httpd/sites-enabled/000-default 000-default is the file setting VirtualHost. Set to use combined. CustomLog / var / log

How to logrotate tomcat's catalina.out

The tomcat introduced in this article was installed by chef. But it will be a usable way even if it is not so. A catalina.out of tomcat can be set with a configuration file called conf/logging.properties and basiclly it has already setuped logs rotation with a date. For this setting, catalina.out logs added date suffix are output. But tomcat keeps logging to catalina.out after log rotation. In near future, size of catalina.out gets bloated and it will be consumed local disk spaces. I would like to introduce how to deal with such cases. Edit the configuration file of the tomcat start script. vim /etc/init.d/tomcat7 First, comment out the following part. $SU " $TOMCAT_USER " -c "touch $CATALINA_OUT " ↓ # $S U "$TOMCAT_USER" -c "touch $CATALINA_OUT" Next, change it to use rotatelogs command. org.apache.catalina.startup.Bootstrap " $@ " start \ >> " $CATALINA_OUT " 2 >& 1 & echo

Major Maven goals

Maven is a project management tool. It has many goals which can build and deploy your projects. This article introduces about how to use goals with sample commnds. Generate project Goals mvn compile mvn test-compile mvn test mvn package mvn clean mvn install mvn site mvn idea:idea mvn eclipse:eclipse Plugins mvn jar:jar mvn war:war Tips Generate project First, you must generate test project. mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app This command with those parameters will be able to generate a project. The archetypeGroupId parameter shuld be specifiled a package prepared by maven. You can also create original archetypeGroupId by myself. The groupId shuld be specified a name of package you like. The artifactId shuld be specified a name of project you like. Executing this command, you have to input any parameter to generate project. Choose a number or apply fil

How to show different lines on WinMerge

Select from above menu bar View -> Diff Context . And you will be able to confirm parts of differents. In addition you can choose the number of previous and next lines with the difference. For example, if you select 1, you can also check one previous and next line with the difference line. Of course you can confirm only lines with differences by choosing 0.

How to install Adobe Reader into offline machines

Adobe Reader is major pdf reader now. If you want to install it you have to get that installer from the internet. Additionally that installer must be connected to internet because it downloads software through the internet. Therefore your target machine shuld be connected to internet. However, there are cases where on-premises often any machines can’t connect to the internet. This article has how to resolve that problem. Answer: Download offline installer latest version from the following url. ftp://ftp.adobe.com/pub/adobe/reader/win/ At August 28th, 2018 the latest version is 11.x. ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/ These offline installer can be installed Adobe Reader without the internet. Let’s copy it to offline machines and get the greatest pdf reader !