"Lung linh bóng nước con đò, Nhớ sao Chợ Mới câu hò thủy chung
Quê tôi miền đất anh hùng, Hôm nay vẫn đẹp vô cùng ai ơi!"

"Giờ thăm lại trường xưa trong khoảnh khắc
Cảnh còn đây người đi mất từ lâu..."

"對我而言台灣留下非常深刻的印象,我所去的每一個地方,我所見過的每一個人,這都是緣分!
再見大家,再見台灣!"

A greeting from Vietnam.

Sunday, August 25, 2013

Some useful procedures for Oracle

1. Drop everything in a user tablespace:
BEGIN
   FOR cur_rec IN (SELECT object_name, object_type
                     FROM user_objects
                    WHERE object_type IN
                             ('TABLE',
                              'VIEW',
                              'PACKAGE',
                              'PROCEDURE',
                              'FUNCTION',
                              'SEQUENCE'
                             ))
   LOOP
      BEGIN
         IF cur_rec.object_type = 'TABLE'
         THEN
            EXECUTE IMMEDIATE    'DROP '
                              || cur_rec.object_type
                              || ' "'
                              || cur_rec.object_name
                              || '" CASCADE CONSTRAINTS';
         ELSE
            EXECUTE IMMEDIATE    'DROP '
                              || cur_rec.object_type
                              || ' "'
                              || cur_rec.object_name
                              || '"';
         END IF;
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line (   'FAILED: DROP '
                                  || cur_rec.object_type
                                  || ' "'
                                  || cur_rec.object_name
                                  || '"'
                                 );
      END;
   END LOOP;
END;
2. Truncate all tables of the current user:
BEGIN
    FOR T in (SELECT table_name FROM user_tables) LOOP
      EXECUTE IMMEDIATE 'TRUNCATE TABLE '||T.table_name;
    END LOOP;

    FOR T in (SELECT table_name FROM user_tables) LOOP
      EXECUTE IMMEDIATE 'ALTER TABLE '||T.table_name||' ENABLE ALL CONSTRAINTS';
    END LOOP;
END;

Something about Oracle

1. Steps to connect to Oracle server using SQL Developer after installing:
1. Navigate to Configuration and Migration Tools, choose Database Configuration Assistant.
2. Create a database (be sure to remember the Global DB name or SID)
3. Create a Net Service Name in Net Configuration Assistant (Host Name is your PC name) to allow accessing the database across the network.
4. Create a Schema as sysdba: run {Oracle_dbhome}/bin/sqlplus.exe then type in the following commands:
User: sys as sysdba
Password: {leave empty}
create user sample_schema IDENTIFIED BY oracle_pass;
grant dba to sample_schema;
grant connect to sample_schema; 
5. Open SQL Developer (client).
6. Create a connection with non-sysdba role.

2. Import from dmp file:
1. Open cmd.
2. Run "imp file=.dmp show=y" to view the user who exported the dump file (source user).
3. Execute the following command:
imp scott/tiger@example file=<file>.dmp fromuser=<source> touser=<dest>
5. Open SQL Developer (client).
6. Create a connection with non-sysdba role.

3. So many system tables?
When you log in with SYSDBA users, there will be very many system tables you see. This may make you chaotic. But this problem can be solved by creating a new user and then log in again with that new created user!

4. Operations with DATE datatype
For inserting, use TO_DATE function according with date format specified in second parameter:
insert into TAIKHOAN(NGAYDANGKY)
values (TO_DATE('2013/08/25 21:02:44', 'yyyy/mm/dd hh24:mi:ss'));

For selecting, updating or deleting, use TO_CHAR to cast date value to string:
select TO_CHAR(NGAYSINH, 'dd/mm/yyyy') 
from SINHVIEN;

You are doing everything right by using a to_date and to_char function and specifying the time format. The trouble is just that when you select a column of DATE datatype from the database, the default format mask doesn't show the time. If you issue a
alter session set nls_date_format = 'dd/MON/yyyy hh24:mi:ss'
you will see that the time successfully made it into the database!

5. How to display UTF8 string in Oracle client?
You may face problems in displaying the same Unicode string in your web application and in Oracle client software (such as SQL Developper).

4.1. For web application configuration, you just add following tag to your HTML content:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

4.2. For Oracle client software, you need to know about NLS_LANG environment parameter. It sets the language and territory used by the client application and the database server. It also indicates the client’s character set, which corresponds to the character set for data to be entered or displayed by a client program.

The NLS_LANG parameter has three components: language, territory, and character set. Specify it in the following format, including the punctuation:
NLS_LANG = language_territory.charset 

Now, let's access Run dialog, press regedit to do something.
(Vào Run, gõ regedit, sao đó trỏ đến node registry như đường dẫn sau rồi đặt giá trị cho nó)
+ From the Registry Editor, you point to HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb11g_home1. 
+ Double click on NLS_LANG node. 
+ Set the value to AMERICAN_AMERICA.AL32UTF8.

Next, please restart your machine so that our change can take effect.

Okay, until now, maybe I put a stop for my minitut here. Thank you for reading it!
(Nguyen My)

Duyên

Dòng đời tan họp họp tan,
Cũng như xuân đến rồi tàn thế thôi,
Thời gian kia lững lờ trôi,
Hữu duyên ắt sẽ tới hồi gặp nhau!
(25/8/2013)

Sunday, August 18, 2013

CHÀO ĐỜI

Thế giới nào đưa con đến nơi đây,
Để mầm sống nên hình trong bụng mẹ,
Từng bước đi mẹ cũng đà nhấc khẽ,
Để trong lòng con trẻ giấc bình yên.
Dẫu ngoài trời gió lạnh thổi triền miên,
Con vẫn ấm nơi riêng con được hưởng,
Những đêm trường mẹ mệt nằm tịnh dưỡng,
Con cũng đành đá đạp đến tàn canh.
Sáng tinh sương mẹ thiêm thiếp chưa thành,
Thì con muốn ra đời không chút đợi,
Rồi mẹ cũng chiều con nào có ngại,
Sau cơn đau quằn quại mẹ hằng mong,
Con oe oe cất tiếng khóc lọt lòng,
Mẹ mừng rỡ nhìn đứa con đỏ hỏn,
Nước mắt rơi mừng ước mơ đã trọn,
Nguyện cuộc đời sướng khổ cũng vì con.
Ơn sinh thành dưỡng dục sánh đầu non,
Tình của mẹ như ngọn nguồn biển cả,
Nếu đảo được dòng thời gian hối hả,
Khi chào đời con tặng mẹ bài thơ!
(NM - 19/8/2013)

Thursday, August 15, 2013

Install a Zend project

1. Copy the project source to www.
2. Copy Zend library to www.
3. Open httpd.conf and add these commands:
      NameVirtualHost *:80
      <VirtualHost *:80>
          ServerName btg
          DocumentRoot "C:\Program Files\EasyPHP-5.3.9\www\btg\public"
          SetEnv APPLICATION_ENV "development"
          <Directory "C:\Program Files\EasyPHP-5.3.9\www\btg\public">
              DirectoryIndex index.php
              AllowOverride All
              Order allow,deny
              Allow from all
          </Directory>
      </VirtualHost>

4. Open hosts file and add this command:
127.0.0.1       localhost btg
5. Open php.ini and modify the include_path:
            include_path = ".;${path}\php\includes;${path}\www\zend\library"
(replace btg and the url to yours!)

Monday, August 5, 2013

[Sưu tầm] Quê Bác Ba Phi

MV do ca sĩ Kyo York thực hiện nói về các tỉnh miền Tây

Sưu tầm: Lòng mẹ

Từ ngôn từ cho đến giai điệu của bài vọng cổ, nghe mà thấu cõi lòng. Tình mẹ quả thật bao la, những khổ đau mà mẹ chịu đựng để sinh thành nên con, cho đến ngày con khôn lớn, làm sao có thể kể xiết!