Saturday, December 04, 2010

Oracle 11g alert log location

Oracle alert log contains much useful information about your Oracle database, but do you know where is it located and how could you find it out?
  1. Connect to the database with SQL*Plus or another query tool, such as SQL Developer.

  2. Query the V$DIAG_INFO view as shown in "Viewing ADR Locations with the V$DIAG_INFO View".

  3. To view the text-only alert log, without the XML tags, complete these steps:

    1. In the V$DIAG_INFO query results, note the path that corresponds to the Diag Trace entry, and change directory to that path.

    2. Open file alert_SID.log with a text editor.

  4. To view the XML-formatted alert log, complete these steps:

    1. In the V$DIAG_INFO query results, note the path that corresponds to the Diag Alert entry, and change directory to that path.

    2. Open the file log.xml with a text editor.

Monday, September 06, 2010

How to use Android Market on Android Emulator 2.2

After some digging, finally I got android market working on Android emulator 2.2 running on Windows Vista. Here is the steps,:
  • Start SDK Setup.exe and create an AVD - android-2.2
  • Copy system.img coming with the SDK platform to the newly created AVD.
cd c:\Users\dliu\.android\avd\android-2.2.avd
copy c:\labs\android-sdk-windows\platforms\android-8\images\system.img .
  • Start the emulator by using command line:
c:\labs\android-sdk-windows\tools>emulator -avd android-2.2 -partition-size 96
  • Pull build.prop from the emulator for editing:
c:\labs\android-sdk-windows\tools>adb.exe pull /system/build.prop .
  • Comment out ro.config.nocheckin=yes line from the build.prop file just pulled out from the emulator.
  • Push back the updated build.prop file to the emuloator
C:\labs\android-sdk-windows\tools>adb.exe remount
C:\labs\android-sdk-windows\tools>adb.exe push build.prop /system/build.prop
C:\labs\android-sdk-windows\tools>adb.exe push c:\labs\r21-update-nexusone-modacocustomcustomrom-withadditions-chinese-signed\system\app\GoogleServicesFramework.apk /system/app
C:\labs\android-sdk-windows\tools>adb.exe push c:\labs\r21-update-nexusone-modacocustomcustomrom-withadditions-chinese-signed\system\app\Vending.apk /
system/app
C:\labs\android-sdk-windows\tools>adb shell rm /system/app/SdkSetup.apk
  • Stop the emulator and delete the files: userdata-qemu.img, userdata.img, cache.img
  • start the emulator by using command line again, you should get the Android Market in your emulator.

Sunday, April 25, 2010

SAP IDES 4.7

The best place to start learning SAP is to try out the SAP IDES, International Demonstration and Education System. Here are some of the default settings for IDES 4.7 after installation:
  • Client ID: 800
  • Login user/pwd: sap*/06071992
  • Login user/pwd: ddic/19920706

Saturday, April 10, 2010

How to remote debug Tomcat server code?

Either you are a developer of Tomcat or you would like to see how the Tomcat works in a live mode, you may want to set a few break points in the Tomcat codes and to see the code in the live run. How could you set up remote debug for tomcat? Thanks for the JPDA(Java Platform Debug Architecutre) we can easily achieve this goal.
  • Start tomcat server with remote debug enabled with JVM parameters: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y and make sure you setting suspend=y to let the tomcat server suspend and wait for debugger to attach to it.
  • Start your debugger, I am using Intellij Remote Debug, and here is the settings: Host: localhost Port: 8000
That is all. Happy debugging.

Sunday, April 04, 2010

Install lxml on Cygwin

To install lxml on Cygwin you need jump through a few hoops, to save who wants to get it done smoothly, I write down the necessary steps:
  • Make sure install the following package for cygwin by using Cygwin setup libxml2, libxml2-devel, libxslt, libxslt-devel, python-libxml2, python-libxslt
  • If you got lots of errors about debug format:
    • try to add -gdwarf-2 to CFLAGS
      • export CFLAGS="-gdwarf-2"

Using pip, virtualenv, and virtualenvwrapper in Cygwin

I have been using pip, virtualenv, and virtualenvwrapper in Cygwin for long time, it is pretty handy to isolate my development environment for each python projects I am working on. But I still need to think about what need to be done to setup all the pip, virtualenv, and virtualenvwrapper on Cygwin. To save my time and help anybody would like to setup the stuff on Cygwin, I recorded the process as following:
  • Use Cygwin setup to install Python for Cygwin.
  • Install easy_install in your Cygwin: download and run ez_setup.py in Cygwin.
  • Install pip by using easy_install: eazy_install pip.
  • pip install virtualenv
  • pip install virtualenvwrapper
  • add the following lines into your ~/.bashrc
    • export WORKON_HOME=/cygdrive/c/labs/virtualenvs
      source /usr/bin/virtualenvwrapper_bashrc
That is all, now you can create a new virtualenv in your Cygwin: mkvirtualenv my-first-env. You can use pip to install the specific packages you need for your virtualenv. To activate your virtualenv: workon my-first-env. To deactivate your virtualenv: deactivate. To remove the virtualenv: rmvirtualenv my-first-env.

Monday, March 29, 2010

Using HQL Console for JPA facet in Intellij

You got a complicated HQL or JPAQL in your code that has some problems, you need to verify what exactly the query is doing, how should you go ahead to test run it in your database? One option is that you can read the HQL or JPAQL and manually translate it to SQL statement and run the sql statement in your Database, however, this method is error prone and tedious. Another option is use the HQL Console came with Intellij, I found this method is easy and more accurate comparing to the previous options. Here is how I did it:
  • Create a DataSource in Intellij, let's name it datasource_1
  • Go to the Project->View:J2EE structure->right click the module your pojos are located in, edit the JPA facet properties to set datasource_1 maps to the desired Persistent Unit, and set the default JPA provider to: Hibernate.
  • Project->View:J2EE structure->right click the Persistent Unit, you should be able to start HQL Console.
  • You can paste your HQL or JPAQL in the HQL Console and try it out, or you can generate SQL for it and run the SQL in your DB.
Update: In Intellj 9, there is a little bit change where you can find the Persistent Unit to start HQL Console, you should click the Persistence tab on the left corner of Intellij 9.