-
Archives
- May 2026
- April 2026
- November 2025
- December 2024
- November 2024
- June 2024
- September 2023
- March 2023
- August 2022
- April 2022
- September 2021
- September 2020
- March 2019
- March 2018
- June 2017
- May 2017
- November 2016
- September 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- April 2015
- December 2014
- October 2014
- September 2014
- May 2014
- April 2014
- March 2014
- January 2014
- November 2013
- October 2013
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
-
Meta
Author Archives: ronaldpringadi
Delete Postgres Cache
1234#!/bin/bash sync echo 1 > /proc/sys/vm/drop_caches service postgresql-9.3 restart
Posted in Database, PostgreSQL
Comments Off on Delete Postgres Cache
Java Flight Recorder: a profiler that’s already in your JVM
If you’re running anything on the JVM (Java Virtual Machine) in production and you’ve never opened a Flight Recorder file, you’re leaving a free profiler on the table. Java Flight Recorder (JFR) is a low-overhead event recorder built into the … Continue reading
Posted in java
Comments Off on Java Flight Recorder: a profiler that’s already in your JVM
Check which database object depends on (has reference to) your table
12345678910111213141516SELECT R.TABLE_NAME FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE u INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS FK ON U.CONSTRAINT_CATALOG = FK.UNIQUE_CONSTRAINT_CATALOG AND U.CONSTRAINT_SCHEMA = FK.UNIQUE_CONSTRAINT_SCHEMA AND U.CONSTRAINT_NAME = FK.UNIQUE_CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE R ON R.CONSTRAINT_CATALOG = FK.CONSTRAINT_CATALOG AND … Continue reading
Posted in Database, PostgreSQL
Comments Off on Check which database object depends on (has reference to) your table
Postgres function to devide-and-conquer (iterate) your big query
Create a postgres function to devide-and-conquer (iterate) your big query 1234567891011121314151617181920212223242526272829303132333435363738394041TRUNCATE TABLE YOUR_NEW_BIG_TABLE; DROP FUNCTION IF EXISTS pg_iterator(); CREATE OR REPLACE FUNCTION pg_iterator() RETURNS void AS $BODY$ DECLARE vOffsetRecord INT; vTotal INT; vLimit … Continue reading
Posted in Database, PostgreSQL
Comments Off on Postgres function to devide-and-conquer (iterate) your big query
Crontab header
123456# minute (0-59), # | hour (0-23), # | | day of the month (1-31), # | | | month of the year (1-12), # … Continue reading
Add user in mysql
The classic three-liner for adding a MySQL user, run from a mysql shell connected as root or another account with the CREATE USER privilege. Replace each placeholder with your own value. 123CREATE USER ‘YOUR_USER_NAME’@’CONNECTING_FROM_WHERE’ IDENTIFIED BY ‘THIS_USER_PASSWORD’; GRANT ALL PRIVILEGES … Continue reading
Posted in MySQL
Comments Off on Add user in mysql
Using grep as highlighter
1$ grep –color -E ‘^|pattern1|pattern2’ file name
TCL programming
A reusable expect dispatcher I kept around for running the same kind of operation across a list of servers — untar an index, restart a service, patch a config file. The trick is that the script reads the first command-line … Continue reading
Posted in Linux, TCL/Expect
Comments Off on TCL programming
Simple unit test is bash file
Consider the following 3 files: 1. shellTestFramework.sh 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/bin/bash # Copyright (c) Ronald Pringadi # Before each Test function setUpTest(){ #"Please overwrite this function on your unit test. Something that need to be done before each test" … Continue reading
Posted in Bash
Comments Off on Simple unit test is bash file
Multithreading in Java using ThreadPoolExecutor
ThreadWorker is your custom class. 123456789try { ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(MAX_THREAD_SIZE); for (int i = 1; i Random randomGenerator = new Random(); executor.submit(new ThreadWorker("worker" + i, randomGenerator.nextInt(10))); LOG.info(i); } } catch (Exception e) { LOG.error("Hmm something is not right.", … Continue reading
Posted in java
Comments Off on Multithreading in Java using ThreadPoolExecutor