George Opritescu

Developer from somewhere

spring devtools idea settings

Problem: code not getting reloaded when something changes.

Solution: found here

  • add devtools to your dependencies
  • go to Preferences -> Build, execution, deployment -> Compiler and check “Build project automatically”
  • press cmd-shift-a , and select registry
  • find and check compiler.automake.allow.when.app.running
// some code here
Read More

postgres reassign owned

Problem: wanted to change everything owned by one user to be owned by another user.

Solution: found here

reassign owned by old_user_name to new_user_name;
Read More

generate pem file from crt and key

Problem: have a .key and a .crt and want to generate a .pem file from them.

Solution:

  • found here: a simple cat will do
cat server.crt server.key > server.includespk.pem
Read More

ssh log files on centos

Problem: want to see logs for failed ssh attempts on CentOS.

Solution: look at /var/log/secure

Read More

java deserialization with jackson

Been debugging a deserialization issue for 3 hours. Turns out I had this in my code:

import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonSetter;

When, it should have been these:

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Read More

javascript format currency with intl

Problem:

Solution:

  • step 1
// some code here
Read More

hbase scan example

Problem: want to perform a scan on a table, and list the values.

Solution:

        Scan scan = new Scan();
        ResultScanner scanner = someTable.getScanner(scan);

        for(Result row : scanner) {

            List<Cell> cells = row.listCells();

            for(Cell c : cells) {
                byte columnFamily[] = CellUtil.cloneFamily(c);
                byte qualifier[] = CellUtil.cloneQualifier(c);
                byte value[] = CellUtil.cloneValue(c);
                System.out.println("columnFamily:" + Bytes.toString(columnFamily) +
                    " qualifier:" + Bytes.toString(qualifier) + " value:" + Bytes.toString(value));
            }
        }
Read More

java hbase obtain column families for a particular table

Problem: want to obtain column families for a particular table.

Solution:

        Connection conn = ConnectionFactory.createConnection(config);
        Admin admin = conn.getAdmin();

        TableName transactionTableName = TableName.valueOf("some_table");
        HTableDescriptor tableDesc = admin.getTableDescriptor(transactionTableName);
        // this will contain all of them
        HColumnDescriptor colDesc[] = tableDesc.getColumnFamilies();
Read More

git merge unrelated histories

Problem: want to merge 2 branches that don’t share a common history.

Solution:

git merge --allow-unrelated-histories somebranch
Read More
git

view principals in a kerberos keytab file

Problem: want to see principals in a keytab file.

Solution:

  • start ktutil
ktutil
  • read your keytab file:
ktutil:  read_kt /path/to/some.keytab
  • list them:
ktutil: list
Read More