Technology and Family Thoughts

This is my blog where I hope to post information about what I am doing technically and what my family is up to. I hope you enjoy

Thursday, January 2, 2020

Docker Commands

Start Container


#  start container in interactive mode
> docker run -it    /bin/bash

# Break out of container without stopping
> Ctl-P, Ctl-Q

# start docker container in daemon mode
> docker run -it -d --name 'delaney'   bash
> docker attach delaney
# Another option to attach
> docker exec -it delaney bash


# start nginx in docker container
> docker run -d -P nginx:latest  --name delaney
> docker inspect delaney | grep IPAddress
> curl

# start SonarQube in docker container
docker run -d --name sonarqube -p 9000:9000 sonarqube

# start Jenkins Server in docker container
docker run -ti --name receiver-jenkins -p 8080:8080 -p 50000:50000 -v jenkins-data:/var/jenkins_home jenkins/jenkins:lts

Tuesday, July 7, 2015

Family Travel Trip

I had the pleasure of traveling for 10 months around the globe with my family; 3 teenagers and my wife.  We had some great times and have some great memories.  We also had some very difficult time, but I don't quite remember them all.  

I created a seperate website that contains all of my photos and trip notes.  Hope you enjoy:
Delaney Family Travel

Tuesday, June 2, 2015

Useful UNIX Commands

FIND Command

Remove Certain Files in a Search/Find
 find . -name '*.log' -exec rm -fr {} \;
Search for a class file inside a jar file 

 find . -name '*.jar' -exec bash -c "echo {} && jar tvf {} | grep Name_Searching_For " \;
See if a certain process is listening on a port 

 netstat -an | grep LISTEN 

Checking open files

Shows Files Open Related to Java or ACES
echo /proc/`ps -ef | grep java | grep -v grep | awk '{ print $2 }'`/fd | xargs ls -1 | wc -l
Shows Files Open Related to Java or ACES
ls /proc//fd | wc -l 
Shows All of the Processes and the Tree
pstree -A | more

Monitoring processes

top -u aces;        // once it comes up….press "1" to see all the cores
top -H -u aces;     // once it comes up….press "1" to see all the cores  [will show you the thread usage as opposed to the CPU usage]
mpstat -P ALL;      // shows overall CPU usage
Monitoring Performance
/usr/bin/sar 1 20;         //  Run sar command 20 times…with 1 second between it

Monitoring Disk I/O

Monitor Input/Output Devices
iostat -d -x -N   

:  name of device more /etc/fstab show you the mount point to ACES directory
: number of seconds between each capture of IO
: number of times to run default forever
more /etc/fstab (file that tells you the names of mount points) df -k (will also tell you the mount points) iostat output
await: avg. time servicing request (svctm) + avg. time waiting in request queue.
svctm: avg. time servicing request

await should be close to svctm, means all time spent processing io. If wait greater svctm means io requests are waiting in queue a long time and there is a PROBLEM!

Monitor IO for Each CPU 

mpstat   -P all

Java Garbage Collector Monitoring

jstat -gc   

Options
* -gc
* -gcutil
* -gcnew
* -gccapacity
If want to monitor GC stats on actual server put following in JBoss startup
-verbose:gc (print the GC logs) 
-Xloggc: (for more comprehensive GC logging) 
-XX:+PrintGCDetails (for more detailed output) 
-XX:+PrintTenuringDistribution (displays the tenuring thresholds assumed by the JVM)

Java Stack Dump of Running Process

jstack  > 

Tuesday, June 22, 2010

Displaying SQLite Data from Android Application

As I was building my Android application that uses an SQLite database I needed to determine what the actual data in the tables were due to the fact I had a bug in my application.   I need a tool like sqlplus, toad or PLSQL that enables one to peer into the tables.       I thought I could do this using the DDM perspective in the Eclipse Android plugin but this does not enable one to do so or rather I could not find a way to do this.

So here where the steps that I took to peer into my SQLite database tables.

First you need to get access to the SQLite database file where the information is stored.   Since I am building using Eclipse I Pull the file via the DDMS view within Eclipse.  The image below shows how this can be done within the Eclipse IDE.



After selecting on your database, in my case TASKS_DATABASE, you then select the Pull File you need to save it on your file system.   Pull File will grab the file from your emulater and place it onto you file system directory.

Once saved you need a tool that will help you peer inside this data.  I found a nice tool called SQLite Database Browser to do this exact task.    After unzipping the downloaded file.  Launch the database browser and Open the SQLite database file you just downloaded.   Here is a screen shot of the SQLite utility before loading the file I just pulled from Eclipse DDM view.


This shows three database tables within my SQLite database.  Choose the one you want to view and select on Browse Data.  This will display the contents of the data as shown below.



Use this tool to peer inside your data like you would with Oracle PL/SQL or Toad tools into Oracle.

Now I did this for the database that resides on the Emulator.   I believe you cannot do this to a database that reside on a real Android OS phone due to security reasons.  Or at least I hope not.


There is also another way to view what is in your SQLite tables via the adb shell and querying the database from the shell.

First need to get into the adb shell and cd to the directory where your applications database resides.
In this example I cd  data/data.

Now you need to cd to the application directory.
You will see the TASK_DATABASE file.  To get into the database you now execute the following.
>sqlite3 TASKS_DATABASE   shown below.

You can execute SQL to see what is in the tables.

Wednesday, June 9, 2010

Google Maps Key

To get a Google Maps API key one has to first create an MD5 certificate fingerprint using the keytool from Java SDK.

Here is how I created that certificate using the keystore tool included in the JDK.
keystore -genkey -v -keystore delaney_keys.keystore -alias delaney_keys

You will go through a series of questions such as: name, city, password, etc
At the end of all the questions your keystore in my case delaney_keys.keystore will be created.

Now to get the MD5 key you execute the following command.

keystore -list -alias  delaney_keys  -keystore delaney_keys.keystore
You will be prompted for your password you entered above and once entered successfully the MD5 Certificate will be printed on the command line.

Using this to obtain your Google API Key
Go the Google API Registration page

Accept the terms on the agreement and enter the MD5 certificate that the keytool printed out above.  After entering the MD5 and submitting the page you will be displayed with a valid Google Maps API key that you can then use within your Android application to call the Google Maps API.

Monday, May 24, 2010

Formatting LogCat Output

The output from an Android Logcat application can be quite difficult to determine problems especially without being in debug your application.   Logcat is a great way to view the logs.  I found a really nice python script that enables one to format the Logcat log so that the log types DEBUG, WARN, INFO, etc are colored making it easier to view.

Here is the output of such a log after piping the logcat to the python script;
This is a terminal output of the Logcat log.  I captured this while running my Android application in debug mode within Eclipse.  This log is much easier to read than the logcat that is within Eclipse.

How did I do this?   execute the following on the terminal command line.
adb logcat |  ~/tools/scripts/coloredlogcat.py

The coloredlogcat.py is a python script I got from colored.   I stole this script from Jeff Sharkey, thanks Jeff.

Monday, May 17, 2010

Chrome Browser Plugin/Extension

Found this awesome little Chrome Browser plugin from BuiltWith .  Actually Firefox calls them plugins for Chrome it is an extension.

With this extension you can determine all of the technologies any non-https website you visit uses.  You will be able to determine what client side technologies and server-side web servers they use.  

I used to determine this information by checking out the url and viewing the source of the page I was visiting for the libraries they pull into the page.   This nice little extension enables one to simple ask.

I have not viewed how BuildWith is doing this.  Not sure if they have a database of this information they have collected or they are determining this information at run-time.


Here is the href to the extension
Layout-->Edit HTML -->