2013-03-04

One simple trick to make WebLogic admin easier

Setting well-known WebLogic paths as Unix environment variables can make daily administration easier. For example,

export WLHOME=/home/weblogic/Oracle/Middleware/user_projects/domains/base_domain
export WLBIN=${WLHOME}/bin
export WLLOG=${WLLOG}/servers/AdminServer/logs

This is preferable to using Unix aliases such as

alias gotolog='cd /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServers/logs'

Benefits
  • Easy to navigate
    Being able to quickly and easily switch between any WebLogic log and bin directory via
    cd $WLLOG
    cd $WLBIN

    makes production debugging much less stressful than fumbling around Oracle WebLogic notoriously long and nested directory structures. This is especially important when you are debugging a real-time production issue on multiple WebLogic Unix servers with your eight bosses watching over your shoulders.

  • Flexible and reusable
    The environment variables can be used in a number of situations.
    cd $WLLOG
    tail -f $WLLOG/AdminServer.log
    ls $WLLOG
    tar cvf archiveLogs.tar $WLLOG


  • Usable by developers
    Java developers can get the Unix environment variable via
    System.getenv("WLLOG");
    They can also directly use it in their bash shell scripts. This makes the same code portable across multiple WebLogic domains and environments without having to modify their code.

  • Self-documenting
    Other admins can type
    set | grep "^WL"

    and see the real paths for WebLogic. This is helpful if you have to change WebLogic directories or are on a unfamiliar server.

2013-03-03

Ignore Git

  • How do I find the global ignore configuration file?
    git config --get-all core.excludesfile

    (In svn, the global ignore configuration file is al
    ways ~/.subversion/config)

  • How do I create a global ignore file if one is not configured?
    git config --global core.excludesfile ~/.gitignore_global

    (In svn, just create the text file ~/.subversion/config)

  • What do I put in the global ignore configuration text file?
    You can find examples of .gitignore_global at
    https://github.com/github/gitignore/tree/master/Global

    (In svn, just add this line into ~/.subversion/config
     global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo  *.rej *~ #*# .#* .*.swp .DS_Store *.class
    )

  • How do I configure ignores specific to a project?
    In the project directory, you can create or edit either the file .git/info/exclude or .gitignore. It has the same format as the global ignore.

    (In svn,
    Configure .svnignore as local ignore file:
    svn propset svn:ignore -F .svnignore /path/to/svn/workspace

    Configure just one ignore:
    svn propset svn:ignore "files_to_ignore" /path/to/svn/workspace

    Configure a group of ignores:
    svn propedit svn:ignore /path/to/svn/workspace

    View what is ignored
    svn propget svn:ignore /path/to/svn/workspace
    )

2013-03-02

Android Project .gitignore

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project
.settings/
.metadata/

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/

# PMD files
.pmd
reports/

# SVN files
.svn/

# Mac OS X
.DS_Store

Unix Environment Variables

  • How do I show all my environment variables?
    set

  • How do I show a specific environment variable, like PATH?
    set | grep -e "^PATH="

  • How do I set an environment variable, like ORACLE_HOME?
    export ORACLE_HOME=/usr/oracle

  • How do I delete a environment variable?
    unset ORACLE_HOME

  • How do I append to an environment variable, like appending /users/sbin to PATH?
    export PATH=${PATH}:/users/sbin

  • How do I reuse other environment variables, like adding ORACLE_HOME to PATH?
    export PATH=${PATH}:${ORACLE_HOME}

  • How do I pass environment variables to Unix shell scripts without changing my environment?
    PATH=${PATH}:/usr/local ./myShellScript.sh

  • How do I make my changes to environment variables permanent?
    Create or edit the file ~/.bashrc and add the export command to that file. For example, to make the change to ORACLE_HOME permanent, add the following line to ~/.bashrc
    export ORACLE_HOME=/usr/oracle

    After saving the file ~/.bashrc, then execute the command
    source ~/.bashrc

  • What is the difference between ~/.bash_profile and ~/.bashrc? Or setting ~/.bashrc did not make my environment variable changes permanent.
    For a detailed explanation, please read Josh Staiger's article.

    But pragmatically it doesn't matter. Just make ~/.bash_profile execute ~/.bashrc. Create or edit ~/.bash_profile and add the following line
    [ -r ~/.bashrc ] && . ~/.bashrc

Generate Ant build.xml for Android project

If you created an Android project in the Android Developer Tools IDE, the build.xml for Ant is not generated by default.

To create an Ant build.xml for an Android project, use the following command

$ANDROID_SDK_PATH/tools/android update project -p projectPath

To see more useful Android command lines, click here.