Monday 25 October 2010

Oracle MetaData...

One of the most useful query to look for a Column in all tables:

SELECT
TABLE_NAME,
COLUMN_NAME
FROM
ALL_TAB_COLUMNS
where
COLUMN_NAME like '%COLUMN_NAME%';

More about it on : http://en.wikipedia.org/wiki/Oracle_metadata

Finding Constraints in Oracle

select * from ALL_CONSTRAINTS where CONSTRAINT_NAME = ''

Wednesday 13 October 2010

Latex on Ubuntu....

Installing Latex on Ubuntu:

Link: http://linuxandfriends.com/2009/10/06/install-latex-in-ubuntu-linux/

This guide explains how to install LaTeX in Ubuntu Linux. LaTeX is a document preparation system for high-quality typesetting. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing.

LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content.

How to install LaTeX in Ubuntu

In Ubuntu Linux, you have to first install LaTeX to use it. This is how LaTeX is installed in Ubuntu.

$ sudo apt-get install texlive

The above command will install a basic subset of TeX Live’s functionality. To install all the packages in the LaTeX distribution, you have to run the following command.

$ sudo apt-get install texlive-full

Gedit LaTeX Plugin

Gedit has a plugin for LaTeX which converts Gedit into a LaTeX editor. You can install the Gedit LaTeX plugin as follows :

$ sudo apt-get install gedit-latex-plugin

Once you install the plug-in, you will have to enable the plug-in in Gedit to begin using it. This is achieved by opening Gedit Preferences (GEdit > Edit > Preferences). Then clicking on the Plugins tab and turning on the “Gedit LaTeX plugin”. Now when ever you open a TeX file, you will have access to the LaTeX menu in Gedit.

Recommended LaTeX Packages

  • latex-beamer – Beamer package is used to create presentations. It is an excellent LaTeX class that supports dynamic effects.
  • TeXPower – Is a bundle of style and class files for creating dynamic online presentations with LaTeX.
  • Prosper – A LaTeX class for writing transparencies.
  • texlive-pictures – This is a LaTeX package for drawing graphics. It contain several classes such as ‘curve’ (for creating resumes), ‘bardiag’ (for bar graphs), ‘pmgraph’ (poor man’s graphics) and so on.
  • texlive-latex-extra – This is a large collection of addon packages for LaTeX. The full list of classes in this package are listed here.

This is the full command I used to install LaTeX on my machine running Ubuntu Linux.


$ sudo apt-get install gedit-latex-plugin texlive-fonts-recommended latex-beamer texpower texlive-pictures texlive-latex-extra texpower-examples imagemagick

Tuesday 12 October 2010

Dealing with LOB in Oracle

Link: http://www.java2s.com/Tutorial/Oracle/0660__Large-Objects/Updateclobdata.htm
SQL>

SQL> CREATE TABLE myClobTable (id NUMBER,clob_data CLOB);

Table created.

SQL>
SQL> CREATE TABLE myLongTable (id NUMBER,long_data LONG);

Table created.

SQL>
SQL> INSERT INTO myLongTable VALUES (100,RPAD('A',200000,'A'));

1 row created.

SQL>
SQL>
SQL> update myClobTable set clob_data =(select to_lob(long_data)from
2 myLongTable where id =100)
3
SQL> drop table myLongTable;

Table dropped.

SQL>
SQL>
SQL> drop table myClobTable;

Table dropped.

Friday 8 October 2010

Apache JMeter...

Apache JMeter is open source software, a 100% pure Java desktop application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

http://jakarta.apache.org/jmeter/index.html

Java Performance Tuning Using Hprof...

Link : http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp?topic=/com.ibm.java.doc.diagnostics.50/diag/tools/hprof.html

Using the HPROF Profiler

HPROF is a demonstration profiler shipped with the IBM® SDK that uses the JVMTI to collect and record information about Java execution. Use it to work out which parts of a program are using the most memory or processor time.

To improve the efficiency of your applications, you must know which parts of the code are using large amounts of memory and processor resources. HPROF is an example JVMTI agent and is started using the following syntax:
java -Xrunhprof[:

When you run Java with HPROF, a file is created when the program ends. This file is placed in the current working directory and is called java.hprof.txt (java.hprof if binary format is used) unless a different file name has been given. This file contains a number of different sections, but the exact format and content depend on the selected options.

If you need more information about HPROF than is contained in this section, see http://java.sun.com/developer/technicalArticles/Programming/HPROF.html.

The command java -Xrunhprof:help shows the options available:

heap=dump|sites|all
This option helps in the analysis of memory usage. It tells HPROF to generate stack traces, from which you can see where memory was allocated. If you use the heap=dump option, you get a dump of all live objects in the heap. With heap=sites, you get a sorted list of sites with the most heavily allocated objects at the top. The default value all gives both types of output.
cpu=samples|times|old
The cpu option provides information that is useful in determining where the processor spends most of its time. If cpu is set to samples, the JVM pauses execution and identifies which method call is active. If the sampling rate is high enough, you get a good picture of where your program spends most of its time. If cpu is set to time, you receive precise measurements of how many times each method was called and how long each execution took. Although this option is more accurate, it slows down the program. If cpu is set to old, the profiling data is produced in the old HPROF format.
interval=y|n
The interval option applies only to cpu=samples and controls the time that the sampling thread sleeps between samples of the thread stacks.
monitor=y|n
The monitor option can help you understand how synchronization affects the performance of your application. Monitors implement thread synchronization. Getting information about monitors can tell you how much time different threads are spending when trying to access resources that are already locked. HPROF also gives you a snapshot of the monitors in use. This information is useful for detecting deadlocks.
format=a|b
The default for the output file is ASCII format. Set format to 'b' if you want to specify a binary format, which is required for some utilities like the Heap Analysis Tool.
file=
Use the file option to change the name of the output file. The default name for an ASCII file is java.hprof.txt. The default name for a binary file is java.hprof.
force=y|n
Typically, the default (force=y) overwrites any existing information in the output file. So, if you have multiple JVMs running with HPROF enabled, use force=n, which appends additional characters to the output file name as needed.
net=:
To send the output over the network rather than to a local file, use the net option.
depth=
The depth option indicates the number of method frames to display in a stack trace. The default is 4.
thread=y|n
If you set the thread option to y, the thread id is printed beside each trace. This option is useful if you cannot see which thread is associated with which trace. This type of problem might occur in a multi-threaded application.
doe=y|n
The default behavior is to collect profile information when an application exits. To collect the profiling data during execution, set doe (dump on exit) to n.
msa=y|n
The msa option applies only to Solaris and causes the Solaris Micro State Accounting to be used. This feature is unsupported on IBM SDK platforms.
cutoff=
Many sample entries are produced for a small percentage of the total execution time. By default, HPROF includes all execution paths that represent at least 0.0001 percent of the time spent by the processor. You can increase or decrease that cutoff point using this option. For example, to eliminate all entries that represent less than one-fourth of one percent of the total execution time, you specify cutoff=0.0025.
verbose=y|n
This option generates a message when dumps are taken. The default is y.
lineno=y|n
Each frame typically includes the line number that was processed, but you can use this option to suppress the line numbers from the output listing. If enabled, each frame contains the text Unknown line instead of the line number.
TRACE 1056: java/util/Locale.toUpperCase(Locale.java:Unknown line) java/util/Locale.(Locale.java:Unknown line) java/util/Locale.(Locale.java:Unknown line) sun/io/CharacterEncoding.aliasName(CharacterEncoding.java:Unknown line)

Thursday 7 October 2010

Iterating over collection variables [PL/SQL]

REF: http://www.adp-gmbh.ch/ora/plsql/coll/iterate.html

These are cook book recipes that show, for each of the three collection types, how to iterate over their elements.

Nested tables

declare   type table_varchar  is table of varchar2(10);    var_table_varchar  table_varchar; begin   var_table_varchar  := table_varchar('one', 'two', 'three', 'four');    for elem in 1 .. var_table_varchar.count loop     dbms_output.put_line(elem || ': ' || var_table_varchar(elem));   end loop; end; / 
1: one 2: two 3: three 4: four 

Index by tables

declare   type assoc_varchar  is table of varchar2(10) index by pls_integer;    var_assoc_varchar  assoc_varchar;    elem varchar2(10); begin   var_assoc_varchar(40) := 'forty';   var_assoc_varchar(10) := 'ten';   var_assoc_varchar(30) := 'thirty';   var_assoc_varchar(20) := 'twenty';    elem := var_assoc_varchar.first;   while elem is not null loop     dbms_output.put_line(elem || ': ' || var_assoc_varchar(elem));     elem := var_assoc_varchar.next(elem);   end loop; end; / 
10: ten 20: twenty 30: thirty 40: forty 

varrays

declare   type varray_varchar is varying array(20) of varchar2(10);    var_varray_varchar varray_varchar; begin   var_varray_varchar  := varray_varchar('un', 'deux', 'trois', 'quattre');    for elem in 1 .. var_varray_varchar.count loop     dbms_output.put_line(elem || ': ' || var_varray_varchar(elem));   end loop; end; / 
1: un 2: deux 3: trois 4: quattre 

Wednesday 6 October 2010

WITH Clause Oracle

WITH AS (subquery_sql_statement)
SELECT FROM ;

More in with : http://psoug.org/reference/with.html

SQL Function Reference: Oracle vs. SQL Server

NICE LINK : http://www.sql-ref.com/


*same for both databases
Math Functions
Function Oracle SQL Server
Absolute valueABSABS
Arc cosineACOSACOS
Arc sineASINASIN
Arc tangent of nATANATAN
Arc tangent of n and mATAN2ATN2
Smallest integer >= valueCEILCEILING
CosineCOSCOS
Hyperbolic cosineCOSHCOT
Exponential valueEXPEXP
Round down to nearest integerFLOORFLOOR
Natural logarithmLNLOG
Logarithm, any baseLOG(N)N/A
Logarithm, base 10LOG(10)LOG10
Modulus (remainder)MODUSE MODULO (%) OPERATOR
PowerPOWERPOWER
Random numberN/ARAND
RoundROUNDROUND
Sign of numberSIGNSIGN
SineSINSIN
Hyperbolic sineSINHN/A
Square rootSQRTSQRT
TangentTANTAN
Hyperbolic tangentTANHN/A
TruncateTRUNCN/A
Highest number in listGREATESTN/A
Lowest number in listLEASTN/A
Convert number if NULLNVLISNULL
Standard deviation STDDEV STDEV
Variance VARIANCE VAR
String Functions
Function Oracle SQL Server
Convert character to ASCIIASCIIASCII
String concatenateCONCAT(expression + expression)
Convert ASCII to characterCHRCHAR
Return starting point of character in character string (from left)INSTRCHARINDEX
Convert characters to lowercaseLOWERLOWER
Convert characters to uppercaseUPPERUPPER
Pad left side of character stringLPADN/A
Remove leading blank spacesLTRIMLTRIM
Remove trailing blank spacesRTRIMRTRIM
Starting point of pattern in character stringINSTRPATINDEX
Repeat character string multiple timesRPADREPLICATE
Phonetic representation of character stringSOUNDEXSOUNDEX
String of repeated spacesRPADSPACE
Character data converted from numeric dataTO_CHARSTR
SubstringSUBSTRSUBSTRING
Replace charactersREPLACESTUFF
Capitalize first letter of each word in stringINITCAPN/A
Translate character stringTRANSLATEN/A
Length of character stringLENGTHDATALENGTH or LEN
Greatest character string in listGREATESTN/A
Least character string in listLEASTN/A
Convert string if NULLNVLISNULL
Date Functions
Function Oracle SQL Server
Date addition (use +) DATEADD
Date subtraction (use -) DATEDIFF
Last day of month LAST_DAY N/A
Time zone conversion NEW_TIME N/A
First weekday after date NEXT_DAY N/A
Convert date to string TO_CHAR DATENAME
Convert date to number TO_NUMBER(TO_CHAR()) DATEPART
Convert string to date TO_DATE CAST
Get current date and time SYSDATE GETDATE()

Tuesday 5 October 2010

dumprep.exe 100% CPU...

If dumpprep.exe process is using 100% of your CPU just simply read this:

dumprep.exe is (or should be) a legitimate Microsoft program, one that runs when a program has a critical error and cannot be restored.

Process File: dumprep or dumprep.exe

Process Name: Dump Reporting Tool

Description: Microsoft provided Windows Error Dump Reporting Tool that creates memory dump reports that you can send back to Microsoft for further analysis.

The tool is found on Windows XP/2003.

*****************

To fix this problem simply turn off your systems "error reporting".

First check with Task Manager if dumprep.exe is running - if it is stop the process.

Then:

Start > Control Panel > System > Advanced > Error Reporting > select "Disable error reporting"

Problem solvered :)

REF: http://forums.whirlpool.net.au/archive/596370

Azure OpenAI Architecture Patterns & Deployment Patterns

Sharing some useful links that will help customers architect Azure OpenAI solution using the best practices: (1) Azure OpenAI Landing Zone r...