If you get permgen space error or OOM (out of memory) error in eclipse add below in vm arguments:
-Xms1G -XX:MaxPermSize=256m
You can modify the same in eclipse.ini
-XX:MaxPermSize=512m
To pass vm arguments in command prompt while running maven, please use below command : mvn test -Dtest=\*ServiceTest -DfailIfNoTests=false -Dfork=true -Dmaven.test.failure.ignore=true -DargLine="-Xms512m -Xmx1024m -XX:MaxPermSize=512m" -DforkMode=pertest
JAR File - Java Archive Files (It contains all the JAVA Classes for the specific module)
WAR File - Web Application Archive (Contains all the JARs, JSP (JavaServer Page), Java Servlets, JAVA Classes , XML files, tag libraries and static Web pages (HTML and related files) that together constitute a Web application.
EAR - EAR (Enterprise Archive) is a file format used by Java EE for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently. It also contains XML files called deployment descriptors which describe how to deploy the modules.
Google site Search - If you want to search something only in specific site with a word you can do. In google search do : Linux shell site:gubendran.blogspot.com
If the attribute name and data-type is same in both the objects you should be good with below code. If you have different attributes create MapId and declare a class and b class and the map name and pass the mapId to the map method.
import org.dozer.Mapper;
salesOrderExportTemplateTO = mapper.map(template, SalesOrderExportTemplateTO.class);
--------------------------------------------------------------------- Simple Logging Facade for Java (SLF4J) (http://slf4j.org/, Check out Example in : http://slf4j.org/manual.html)
The Simple Logging Facade for Java or (SLF4J) serves as a simple facade or abstraction for various logging frameworks, e.g. java.util.logging, log4j and logback, allowing the end-user to plug in the desired logging framework at deployment time. Note that SLF4J-enabling your library/application implies the addition of only a single mandatory dependency, namely slf4j-api-1.6.4.jar. If no binding is found on the class path, then SLF4J will default to a no-operation implementation.
Its a Wrapped Implementation of : AVSL, A Very Simple Logger, Class JDK14LoggerAdapter, Class Log4jLoggerAdapter,Class SimpleLogger
EhCache : (http://ehcache.org/, http://eiconsulting.blogspot.com/2011/10/ehcache-implementation-in-spring.html) Ehcache is a cache library introduced in October 2003 with the key goal of improving performance by reducing the load on underlying resources. Ehcache is not just for general-purpose caching, however, but also for caching Hibernate (second-level cache), data access objects, security credentials, web pages. It can also be used for SOAP and RESTful server caching, application persistence, and distributed caching.
Mock Objects for Unit Testing:http://easymock.org/EasyMock3_1_Documentation.html -
In object-oriented programming, mock objects
are simulated objects that mimic the behavior of real objects in
controlled ways. A programmer typically creates a mock object to test
the behavior of some other object, in much the same way that a car
designer uses a crash test dummy to simulate the dynamic behavior of a human in vehicle impacts.
Lucene is a search library built in Java. Solr is a web application built on top of Lucene. Certainly Solr = Lucene + Added features. Often there would a question, when to choose Solr and when to choose Lucene. (Lucene is a engine, solr is a car) (If there's the need to embed search functionality into your own application (like a desktop application for example), Lucene is the more appropriate choice.)
Dig command to see the traces deep on DNS Configuration
dig qa.services.getcamber.com +trace List open ports and listening services
Command in Linux to list ports
netstat -lnptu
Command in Windows to list ports
netstat -a | find "LISTENING"
Expression to run cronjob on every sunday 2nd and 4th week at 8 PM EST : 0 20 * * 0#2,4 minute (0-59), hour (0-23), day of the month (1-31), month of the year (1-12), day of the week (0-6 with 0=Sunday)
Copy files from directory, copy file with parent directory structure
find . -name 'config.xml' -exec cp --parents \{\} ./jenkins-config-backup \;
Ex: jenkins-config-backup is the folder (destination) we copy the file
Ubuntu sudo unable to resolve host
3) sudo vi /etc/postfix/main.cf (Paste below configuration). Replace myhostname, you can provide relayhost or leave blank
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = glakshmanan-laptop
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = glakshmanan-laptop, localhost.operative.com, localhost
#relayhost = mail.operative.com
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
4) sudo /etc/init.d/postfix restart (Once the configuration is done we need to restart postfix)
5) tail -f /var/log/maillog
Installing software on Ubuntu usually entails using Synaptic or by using an apt-get command from the terminal. Unfortunately, there are still a number of packages out there that are only distributed in RPM format.
There’s a utility called Alien that converts packages from one format to the other. This doesn’t always mean that an rpm will work on your system, though. You will need to install some prerequisite software packages in order to install alien, however. These packages include gcc and make.
Run this command to install alien and other necessary packages:
Connect to remote host without giving passphrase from host (X). Follow steps and you should be good
Run command in your host (X) : ssh-keygen -t rsa
Copy the created .pub file into remote host (Y).
connect to remote host
cat .pub_file >> ~/.ssh/authorized_keys
for k in $TENANTS
do
echo curl -L -d"j_username=supportops@$k.com&j_password=Oper@t1ve&j_inp_password=Oper@t1ve" http://$host:8080/$webapp/api/migrateFinanceInvoices/
ls -LR - List all the files from the recursive directory find -focus - This command also list all the files in recursive directory
du -sh - Disk usage size for the folder (s - size, h - human readable format) Or du -ch | grep total dmesg - If the program dies with out of memory or died you can search in dmesg. (dmesg | grep "Killed process") cat /var/log/kern.log | grep "Killed process"
sudoers: (http://www.mjmwired.net/resources/mjm-fedora-f14.html)
sudoers - list of which users may execute what they want. Certain things if you want to execute you need to have a root permission or switch user to root.
When you try `sudo su` and if it fails than your name is not in sudoers list. In fedora you need to explicitly add the username in sudoers list. Login as root and execute below command to add user.
Execute : echo ' ALL=(ALL) ALL' >> /etc/sudoers If the file doesn't have write permission execute `chown +w /etc/sudoers` How to add url into Fedora Repository ? Its like sources.list in Ubuntu vi /etc/yum.repos.d/fedora.repo
How to Redirect the stderr to a file using tee ?
Syntax : ./shell_script_name.sh 2>&1 | tee -a error.log
mysql -uroot -ppetra123 test < upgrade_pre_phase.sql > error.out 2>&1
nohup - run a command immune to hangups, with output to a non-tty
Add nohup before you run the shell script or command. nohup will create nohup.out in the same script running directory and write the stdout / stderr into the file.
Ex : nohup ./shell_script_name.sh &
& - If you add amp this command will run in the back-ground
Find Folder Size greater than 200 MB find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Finding Disk usage
Top 100 disk usage : du -ka / | sort -n | tail -100
fdisk - partition table manipulator for Linux
fdisk -l - This will list the partition available to mount How to mount space into system from fdisk
Syntax : mount disk folder
ex: mount /dev/sda2(disk) /hadoop(folder) Add export classpath variable in /etc/profile
ex : rsync -avz --exclude *.csv root@targethostname:{$directory}${PWD}
a => Archive
v = > Verbose
z => compress
exclude => will exclude the mentioned files
Alternatives - Point your java to point to different directory from default openJdk
Grep the text recursively against all the filesystem
grep -r "text" /
Make your Terminal display shorter (Your Terminal prompt show small)
export PS1='$' $
Provide the Input command in next line in linux
$ hadoop jar example.jar \
$ > wordCount
(Put backslash and enter will prompt with > in next line to proceed)
Stop / Disable the firewall Type the following two commands (you must login as the root user): # /etc/init.d/iptables save # /etc/init.d/iptables stop
Shell script to read a file line by line #!/bin/bash file="${DIRECTORY}/$fileName.csv" while IFS= read -r line do # display $line or do somthing with $line echo $line done <"$file" Date : 2 day ago : /bin/date --date="2 day ago" +%Y-%m-%d 1 day ago from the given date : /bin/date --date="2013-04-20 1 day ago" +%Y-%m-%d