понедельник, 28 декабря 2009 г.

New Technologies

XLS

XML/RMI
XML over RMI JMS

JSP - Presentation Level
Session Java Beans - Business Logic Level
Entity Java Beans - Core Level (JDBC)

четверг, 17 декабря 2009 г.

Настройки java

Системные настройки

Environment Variables
JAVA_HOME = C:\Program Files\Java\jdk1.5.0
ANT_HOME = D:\apps\ant
PATH = %ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%

четверг, 3 декабря 2009 г.

Команды

chmod 755 <filename>



chmod +r <fileName> - право на чтение файла всем

chmod calculator

755 means read and execute access for everyone and also write access for the owner of the file. When you perform chmod 755 filename command you allow everyone to read and execute the file, owner is allowed to write to the file as well.




ls -l <имя файла> - даёт описание файла

Shell-скрипты

Тьюториалы

Написание скриптов на Bourne Shell

Написание несложных Bourne-скриптов

Скрипты - это просто

среда, 2 декабря 2009 г.

Диаграммы

UML - Unified Modelling Language

Visual Case Tool - UML Tutorial

Unified Modeling Language (UML) Tutorial

понедельник, 30 ноября 2009 г.

четверг, 26 ноября 2009 г.

Sample Schemas

Oracle® Database
Sample Schemas
10g Release 2 (10.2)
B14198-01

Можно установить через dbca. Скрипт на схему лежит:

$ORACLE_HOME\demo\schema\human_resources

среда, 25 ноября 2009 г.

String

Вывод с параметрами

char x = 'x';
int cast = (int)x;
int codePoint = String.valueOf(x).codePointAt(0);
char again = (char)codePoint;
System.out.printf("x = %s cast = %d codePoint = %d again = %s%n",
x, cast, codePoint, again);

if ( s.equals ( "abc" ) ) echo ( "matched" );
Java Glossary | String

пятница, 20 ноября 2009 г.

Кластерная база

Настройка строки коннекта кластерной базы


В общем виде (из Oracle® Fusion Middleware Service Registry
10g Release 3 (10.3)
E13665-01
Product Documentation, p. 37):

jdbc:oracle:thin:@
(DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP) (HOST=host1) (PORT=1521)
)
(ADDRESS= (PROTOCOL=TCP) (HOST=host2) (PORT=1521)
)
(LOAD_BALANCE=yes)
(CONNECT_DATA= (SERVER=DEDICATED) (SERVICE_NAME=SID)
)
)

Работающая:

jdbc:oracle:thin:@(DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xs1-vip) (PORT=1521))(ADDRESS= (PROTOCOL=TCP) (HOST=xs2-vip) (PORT=1521))(LOAD_BALANCE=yes)(CONNECT_DATA= (SERVER=DEDICATED) (SERVICE_NAME=DEMO)))

Расшифровка:

(DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP) (HOST=xs1-vip) (PORT=1521)
)
(ADDRESS= (PROTOCOL=TCP) (HOST=xs2-vip) (PORT=1521)
)
(LOAD_BALANCE=yes)
(CONNECT_DATA= (SERVER=DEDICATED) (SERVICE_NAME=DEMO)
)
)

понедельник, 16 ноября 2009 г.

Oracle in Unix

Запуск Oracle AS:
/export/home/oracle/product/10.1.3.1/OracleAS_1/opmn/bin/opmnctl status
startall, stopall

Отключение узла (инстанса) кластера RAC:

srvctl stop instance -h
srvctl stop instance -d demo -i demo1

Прим.:
-d - database
-i - instanse

Запуск кластера:

/u01/app/crs/bin/crs_stop -all
/u01/app/crs/bin/crs_start -all
/u01/app/crs/bin/crs_stat

/u01/app/crs/bin/srvctl stop instance -h
/u01/app/crs/bin/srvctl stop instance -d demo -i demo1
- вырубить один из инстансов (инстанс demo1) кластера (кластер demo)

Unix

Добавить раскладку клавиатуры:

Fedora: шпаргалка по настройке тёти Клавы

Поменять локаль (с us на ru): /etc/sysconfig/i18n
LANG="ru_RU.UTF-8"
#LANG="en_US.UTF-8"

Выход из vi:

(с Shift):
:w to save your file but not quit vi (this is good to do periodically in
case of machine crash!).
:q to quit if you haven't made any edits.
:wq to quit and save edits (basically the same as ZZ).


Было:
-rwx------
chmod 775 <имя файла>
Стало:
-rwxrwxr-x

chown <имя пользователя>:<имя группы> <имя файла>
chown oracle:oinstall server.xml
chown oracle:oinstall /import/home/oracle/product/* - меняет пользователя у всех файлов и папок директории
chown -R oracle:oinstall /import/home/oracle/product/* - меняет пользователя у всех файлов и папок директории и во всех вложенных в них файлах и папках

su - вход под root
su oracle - переключение на другого пользователя
ssh as2 - переключение на другой компьютер
~ - директория пользователя ( ~/.. )
pwd - показать путь текущей папки
ll, ls - вывести список файлов

Заход по ssh:

c:\sshd\bin\ssh.exe oracle@192.192.111.104

воскресенье, 15 ноября 2009 г.

Джавские фишечки

\n - new line "\n"
\t - табулятор "\t"
\u2192, \u204B - знаки вопроса ? "\u2192" etc
Escape Sequences

toString

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

getClass().getName() + '@' + Integer.toHexString(hashCode())

суббота, 14 ноября 2009 г.

SQL

Всякие эскуэльные хитрости

Метасимвол "_" представлеют собой любой одиночный символ:

SELECT last_name
FROM employees
WHERE last_name IN '_o%'

---------
last_name
---------

Kochhar
Lorentz
Mourgos

Чтобы выбрать поля, действительно содержащие символ "_" нужно:


SELECT employee_id, last_name, job_id
FROM employees
WHERE job_id LIKE %SA\_% ESCAPE '\'


------
job_id
------

SA_MAN
SA_REP
SA_REP
SA_REP

суббота, 7 ноября 2009 г.

Полезные оракловые штучки

Посмотреть, какой пользователь заблокировал таблицу

select *
from v$locked_object l, dba_objects o
where l.object_id = o.object_id

Действующие блокировки можно посмотреть в:
select * from DBA_DDL_LOCKS;


Очистить корзину

purge recyclebin (от sys)

Разблокировать юзера

alter user SCOTT account unlock

Creation script is $ORACLE_HOME/rdbms/admin/scott.sql

Узнать, по каким полям связаны таблицы

Если разработчик побеспокоился о связях между таблицами и оформил их в виде соответствующих ограничений ссылочной целостности, то информацию об этих ограничениях можно "подглядеть" в системных представлениях: ХХХХ_constraints, ХХХХ_cons_columns, XXХX_tables (в данном случае тебя должны интересовать внешние ключи).
Где ХХХХ_ нужно заменить на нужный префикс:
1) USER_ - объекты, собственником которых является пользователь (учетная запись), выполняющий запрос.
2) ALL_ - все объекты, доступные данному пользователю
3) DBA_ - вообще все объекты в базе данных (нужны соответствующие привилегии)

Если же разработчик такого "сервиса" не предусмотрел, то никто, кроме самого разработчика, не сможет сказать какие таблицы и как связаны между собой.

Полезные системные штучки

Настройки cmd

Самый полный справочник с описанием cmd.exe находится тут - папка Windows/Help/ntcmds.chm

Переход на уровень вверх: cd ..

Переход на два уровня вверх: ../..

Outlook Express
Как отключить всплывающее окошко "Чтобы освободить место на диске, Outlook Express может сжать сообщения" ('To free up disk space outlook express can compact messages'):

Close all programs and as a precaution create a Restore Point first.

Look for this key in the Registry:
HKEY_CURRENT_USER\Identities\{GUID}\Software\Microsoft\Outlook Express\5.0
Double click the Compact Check Count
Select the Base option for Decimal and change the value to 0
This should change both the Hexadecimal and decimal values to zero.
Close the Registry.


EXPLAIN PLAN и AUTOTRACE

EXPLAIN PLAN Usage
DBMS_XPLAN
Очень полезный скрипт explain.sql от товарисчей с oracle-base

cd $oracle_home/rdbms/admin
log into sqlplus as system
run SQL> @utlxplan
run SQL> create public synonym plan_table for plan_table
run SQL> grant all on plan_table to public
exit sqlplus and cd $oracle_home/sqlplus/admin
log into sqlplus as SYS
run SQL> @plustrce
run SQL> grant plustrace to public

Для включения AUTOTRACE (роли plustrace):

To use the AUTOTRACE feature of SQL*Plus, the user must have a PLAN_TABLE in the schema and have PLUSTRACE role granted.

AUTOTRACE configuration is required. Perform the following steps to configure the user for AUTOTRACE:
1. connect sys/change_on_install @$ORACLE_HOME/sqlplus/admin/plustrce.sql
grant plustrace to username;
2. connect username/password @$ORACLE_HOME/rdbms/admin/utlxplan.sql
set autotrace (run sql statement)

пятница, 6 ноября 2009 г.

Конфигурация EM

Второй раз натыкаюсь на одни и те же грабли - указываю порт EM вместо порта лиснера. Горбатого могила исправит.

emca -deconfig dbcontrol db -repos drop
emca -config dbcontrol db -repos create

or

emca -deconfig dbcontrol db
emca -config dbcontrol db -repos recreate

среда, 4 ноября 2009 г.

Установка Oracle Database

Различные проблемы, встретившиеся при установке

1. Запустить только экземпляр, не запуская базу.

Start the instance: sqlplus / as sysdba

[
C:\> sqlplus /nolog
SQL> connect as sysdba
]

После чего можно запустить базу: startup nomount

По-видимому, при установке патча вместе с SHARED_POOL_SIZE и JAVA_POOL_SIZE необходимо также менять переменную SGA_TARGET (до 400M).

Хорошее описание проблемы и решения, но у меня не запустился инстанс через PFILE: тут

четверг, 29 октября 2009 г.

Loop time

2.21 ГГц, 1.00 ГБ ОЗУ


100000000
19:50:41
19:50:48


1000000000
19:51:33
19:52:37


10000000000
19:54:01
20:04:41

package loop_test;

import java.util.Calendar;

import java.text.SimpleDateFormat;


public class loop_test {
public loop_test() {
}

//public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
//public static final String DATE_FORMAT_NOW = "dd-MMMM-yyyy HH:mm:ss";
public static final String DATE_FORMAT_NOW = "HH:mm:ss";

public static void main(String[] args) {
loop_test lt = new loop_test();
Long j = 0L;
Long n = 10000000000L;
System.out.println(n);
System.out.println(lt.now());
for (Long i = 0L; i < n; i++) {
j++;
Math.sqrt(j);
}
System.out.println(lt.now());
}


public String now() {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());
}

}

Log window

JDeveloper didn't show log window


Search for the windowinglayout.xml. In my case it was found in:
~/jdevhome/system/oracle.ide.10.1.3.41.57

After renaming/deleting it, I could get my log window again.
One remark: jDeveloper saves the file after closure. So first close jDeveloper and then remove the file.


пятница, 17 апреля 2009 г.

Кат

Внизу должна быть пицца:


Сообщения «под катом» в Blogspot (альтернативное решение)

Вариант Ramani:

1. Find the

</head>

tag in your template and add all the code from this page before it.

This page:

<b:if cond='data:blog.pageType != "item"'>
<script type="text/javascript">

var fade = false;
function showFull(id) {
var post = document.getElementById(id);
var spans = post.getElementsByTagName('span');
for (var i = 0; i < spans.length; i++) {
if (spans[i].id == "fullpost") {
if (fade) {
spans[i].style.background = peekaboo_bgcolor;
Effect.Appear(spans[i]);
} else spans[i].style.display = 'inline';
}
if (spans[i].id == "showlink")
spans[i].style.display = 'none';
if (spans[i].id == "hidelink")
spans[i].style.display = 'inline';
}
}


function hideFull(id) {
var post = document.getElementById(id);
var spans = post.getElementsByTagName('span');
for (var i = 0; i < spans.length; i++) {
if (spans[i].id == "fullpost") {
if (fade) {
spans[i].style.background = peekaboo_bgcolor;
Effect.Fade(spans[i]);
} else spans[i].style.display = 'none';
}
if (spans[i].id == "showlink")
spans[i].style.display = 'inline';
if (spans[i].id == "hidelink")
spans[i].style.display = 'none';
}
post.scrollIntoView(true);
}

function checkFull(id) {
var post = document.getElementById(id);
var spans = post.getElementsByTagName('span');
var found = 0;
for (var i = 0; i < spans.length; i++) {
if (spans[i].id == "fullpost") {
spans[i].style.display = 'none';
found = 1;
}
if ((spans[i].id == "showlink") && (found == 0))
spans[i].style.display = 'none';
}
}

</script>
</b:if>

2. Find this div for the post-body and add the portion of code in red color.

Note 1: If you are not able to find the lines to change, you may not have expanded the template. Select the checkbox named "Expand Widget Templates", which is right above the template code, to expand it into more code

<div class='post-body' expr:id='"post-" + data:post.id' >

<b:if cond='data:blog.pageType == "item"'>
<style>#fullpost{display:inline;}</style>
<p><data:post.body/></p>
<b:else/>
<style>#fullpost{display:none;}</style>

<p><data:post.body/></p>
<span id='showlink'>
<a expr:href='data:post.url'>Read More......</a>
</span>
<script type='text/javascript'>
checkFull("post-" + "");
</script>
</b:if>

<div style='clear: both;'/> <!-- clear for photos floats -->
</div>

3. Goto Settings->Formatting and at the bottom, you will find the text box provided to specify the "Post template". Copy/paste these lines into that text box and save the settings. (Please DON'T type these lines yourself because you might introduce some spaces that will break the functionality)

Type your summary here
<span id="fullpost">
Type rest of the post here
</span>


среда, 8 апреля 2009 г.

java.lang.OutOfMemoryError

JDeveloper running a simple Java class threw:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

This is a standard java exception treated by adding parameters to java in command line as the default parameters are -Xms32m -Xmx128m.

This case solution was found in a discussion about analogous exception for embedded OC4J.

Just edit Run Configuration adding -Xms512m -Xmx1024m (for example) in Project Properties... | Run/Debug | Edit... | Java Options edit bar