Author Archives: ronaldpringadi

CentOS 6 repo Settings

To fix repo settings in CentOS 6 1. make sure there is no proxy or funny settings in vi /etc/yum.conf 2. There are a couple of files within /etc/yum.repos.d/. Make sure the url are correct (accessible) and enabled=1 ll /etc/yum.repos.d/ … Continue reading

Posted in Linux | Leave a comment

Show Linux Partition Tree Mountpoint and If SSD


Posted in Linux | Leave a comment

Setting log4j log level programmatically

12345678910111213141516private static void setupLog4j() {         System.out.println("setupLog4j");         BasicConfigurator.resetConfiguration();         // Start clean.         Logger.getRootLogger().removeAllAppenders();         // Create appender         ConsoleAppender console … Continue reading

Posted in java | Leave a comment

Print java stack trace from anywhere

Need to know which code call a specific location? Dump the stack trace: 1LOG.trace(ExceptionUtils.getStackTrace(new Throwable()));

Posted in java | Leave a comment

Knowing you exception class name

To know what is your exception class name, in case you want to have a more specific catch. 1234        } catch (Exception e){             LOG.error("SQL error when processing " + requestId+". Exception … Continue reading

Posted in java | Tagged | Leave a comment

SELinux directory permission

To check SELinux directory permission you need to -z for example 1ls -Z /var/www/html If something is incorrect you can re-adjust some of the directory permission: 1chcon -R -t httpd_sys_content_t /var/www/html

Posted in Linux, Operating System | Leave a comment

RedHat / Centos Firewall

To add an exception to firewall In RedHat/CentOS 6 12345iptables –line -vnL iptables -A INPUT -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT iptables -A INPUT -p tcp -s -j ACCEPT iptables -D INPUT -p tcp -s … Continue reading

Posted in Linux, Operating System | Leave a comment

Bash string comparison

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465#!/bin/bash function test(){ echo "" echo "TEST $1" echo "VAR_1: $VAR_1 VAR_2: $VAR_2 " if [ "$VAR_1" = "false" ]; then echo " VAR_1 is false"; fi if [ "$VAR_2" = "false" ]; then echo " VAR_2 is false"; fi … Continue reading

Posted in Bash, Linux | Leave a comment

Show postgres lock SELECT AS blocked_pid, blocked_activity.usename AS blocked_user, AS blocking_pid, blocking_activity.usename AS blocking_user, blocked_activity.query AS blocked_statement, blocking_activity.query AS current_statement_in_blocking_process FROM pg_catalog.pg_locks blocked_locks JOIN pg_catalog.pg_stat_activity blocked_activity ON = JOIN pg_catalog.pg_locks blocking_locks ON blocking_locks.locktype = blocked_locks.locktype AND blocking_locks.DATABASE IS … Continue reading

Posted in Database, PostgreSQL | Leave a comment

Check all table size in Postgres

The “tables ” is in information_schema The “pg_class” is in System Catalogs 1234567SELECT ist.TABLE_NAME, reltuples AS "entries", pg_size_pretty(relpages::BIGINT*8*1024) AS SIZE FROM information_schema.TABLES ist INNER JOIN pg_class c ON (ist.TABLE_NAME = c.relname) WHERE ist.table_catalog=’ip2_sync_master’ AND ist.table_schema=’public’ ORDER BY relpages DESC, ist.TABLE_NAME … Continue reading

Posted in Database, PostgreSQL | Leave a comment