Thursday, July 31, 2008

Send an SMS from J2ME application

By using this code we can send SMS from J2ME application.
public class SMSSender implements Runnable {
private String message;
private String phoneNumber;
private AmarMIDlet midlet;
private MessageConnection smsconn = null;

public SMSSender(AmarMIDlet midlet) {
this.midlet = midlet;
}

public void run() {
try {
// Open the message connection.
smsconn = (MessageConnection) Connector.open("sms://:50001");
// Create the message.
TextMessage txtmessage = (TextMessage) smsconn.newMessage(MessageConnection.TEXT_MESSAGE);
txtmessage.setAddress("sms://+" + phoneNumber);// !!
txtmessage.setPayloadText(message);
smsconn.send(txtmessage);
} catch (Exception e) {
midlet.displayAlert(e.toString());
}

if (smsconn != null) {
try {
smsconn.close();
} catch (IOException ioe) {
ioe.printStackTrace();
midlet.displayAlert(ioe.toString());
}
}
}

public void send(String message, String phoneNumber) {
this.message = message;
this.phoneNumber = phoneNumber;
Thread t = new Thread(this);
t.start();
}

}

Make a Call with J2ME application

You can do it by using the method platformRequest().

public class PhoneCall extends MIDlet {
public void startApp() {
System.out.println("will call now");
boolean possible = false;
try {
possible = this.platformRequest("tel:01911008019");
} catch (Exception e) {
Alert alert = new Alert(e.getMessage());
Display.getDisplay(this).setCurrent(alert, Display.getDisplay(this).getCurrent());

}

Alert alert = new Alert("it's " + possible);
Display.getDisplay(this).setCurrent(alert, Display.getDisplay(this).getCurrent());
}

protected void pauseApp() {
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}

}

Wednesday, July 30, 2008

J2ME: Identification of Location API in mobile

Before using the Location API we need to know whether the api is in the mobile or NOT.

import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;

public class IdentifyLocationAPI extends MIDlet implements CommandListener {
private Display mDisplay;
private Alert alert;

public void startApp() {
mDisplay = Display.getDisplay(this);
//It will return the version number
String s=System.getProperty("microedition.location.version");
alert=new Alert("Information",s,null,null);
alert.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(alert);
}

public void commandAction(Command c, Displayable s) {

}

public void pauseApp() {

}

public void destroyApp (boolean unconditional) {

}
}

Jaane Tu Ya Jaane Na: Movie Review

The story begins at the airport. With a story. When Rotlu, Jiggy, Bombs and Shaleen offer to tell Mala the tale of Jai and Aditi.

The story is simple but entertainer. It started like the movie "Chalte Chalte" and ends with the movie "Ashiqi". I mean, the whole thing is seems to be familiar. Its kind of traditional hindi movie.

The first half of the movie is just without any fact, any twist ..... but enjoyable if it can be enjoyed with the friends. But the second half...it must need something....but i didnt find anything. The actors are not up to the mark though many told that they have done outstanding.

The music was good enough. And the Nasiruddin in the portrait was funny character.

Verdict:
Its good not better. Nothing new.

Sarkar Raj: Movie Review

Cast: Amitabh Bachchan, Abhishek Bachchan, Aishwarya Rai
Director: Ram Gopal Varma

Sarkar Raj featuring Bollywood’s first family is a mediocre sequel to Ram Gopal Varma’s unimpressive Godfather-inspired 2005 gangster flick Sarkar.

A gangstar movie need a lot of blood and gore. But There’s just no velocity in Sarkar Raj, the movie is all flat. Its full of talking , most of the shot is taken in soft lighting. And lot of work is done on shade.

Verdict:
Its not bad .... not bad at all. But not good either.

Monday, July 28, 2008

Get SQLTEXT from the snapshots with CPU_TIME

/*
FOR EXECUTION : EXECUTIONS_DELTA
FOR CPU TIME: CPU_TIME_DELTA
FOR DISK READ: DISK_READS_DELTA
FOR BUFFER GETS: BUFFER_GETS_DELTA
*/
SELECT SQL_TEXT,X.CPU_TIME FROM DBA_HIST_SQLTEXT DHST,
(SELECT DHS.SQL_ID SQL_ID,SUM(DHS.CPU_TIME_DELTA) CPU_TIME
FROM DBA_HIST_SQLSTAT DHS
WHERE DHS.SNAP_ID IN(SELECT SNAP_ID FROM DBA_HIST_SNAPSHOT
WHERE BEGIN_INTERVAL_TIME>=TO_DATE('07/20/2008','MM/DD/YYYY')
AND END_INTERVAL_TIME<=TO_DATE('07/27/2008','MM/DD/YYYY'))
GROUP BY DHS.SQL_ID) X WHERE X.SQL_ID=DHST.SQL_ID
ORDER BY X.CPU_TIME DESC;

Thursday, July 24, 2008

ORA-12712: new character set must be a superset of old character set.

We can get the following error while changing the character set in oracle.
SQL> Alter database CHARACTER SET UTF8;
Alter database CHARACTER SET UTF8
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set

Then what we have to do,
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE UTF8;

Database altered.

SQL>
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.

After restarting verify the nls_parameters..
SQL> select * from v$nls_parameters;

Wednesday, July 23, 2008

Character Set Scanner utility of Oracle

After running the csscan we will get three file,
scan.txt
scan.out
scan.err
Now what we have to check in scan.txt:
A) There can't be any "EXEPTIONAL" data ... if we have then we have not done the check whether the utility is installed ot not.
B)export all the data that is "CONVERTIBLE" and then delete the data. export all the data that is "CONVERTIBLE" and then delete the data. You just need to set the NLS_LANG while taking the dump. If you have indexes on those tables, you will get entries in scan.txt under the "[Indexes to be Rebuilt]" section.
c)If there is any "Lossy" data then those rows contain code points that are not currently stored correctly
D)If you have any entries under Truncation That means that the total amount of space needed to store a string can exceed the defined column size.

scan.out is the output of the csscan command.

And in scan.err we will get the rowid of rows whose data should be resized. Or the column should be increased.

Character set migration utility schema not installed

We can get the following error while running the csscan utility.
Character set migration utility schema not installed

See the following link,
click

ld.so.1: csscan: fatal: libclntsh.so.10.1: open failed: No such file or directory Killed

While running the csscan , we may encounter the following error
$ORACLE_HOME/bin/csscan

ld.so.1: csscan: fatal: libclntsh.so.10.1: open failed: No such file or directory Killed


The above error is seen when the LD_LIBRARY_PATH variable is not set.
Make sure you Set the LD_LIBRARY_PATH variable, before running the csscan as shown below :

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Changing the Character Set in Oracle

if, the new character set is a strict superset of the current character set, it is possible to use the ALTER DATABASE CHARACTER SET to expedite the change in the database character set.

WARNING: Attempting to change the database character set to a character set that is not a strict superset can result in data loss and data corruption. To ensure data integrity, whenever migrating to a new character set that is not a strict superset, you must use export/import. It is essential to do a full backup of the database before using the ALTER DATABASE [NATIONAL] CHARACTER SET statement, since the command cannot be rolled.

The syntax is:

ALTER DATABASE [] CHARACTER SET ;
ALTER DATABASE [] NATIONAL CHARACTER SET ;

for example:
ALTER DATABASE CHARACTER SET WE8ISO8859P1;

But before changing the character set, its reccomended to use the Character Set Scanner utility. To install the CSSCAN schema.
$sqlplus / as sysdba
sql>$ORACLE_HOME/rdbms/admin/csminst.sql
To execute the utility:
$$ORACLE_HOME/bin/csscan
Here we can get the error like,
ld.so.1: csscan: fatal: libclntsh.so.10.1: open failed: No such file or directory Killed
The, we need to do,
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
After the successful completion of the scan three report files will be created scan.txt,scan.out and scan.err.In my case I have exported the database objects with exceptions as specified in the scan.out and plan to import it back after the database conversion is done.
Now,

SQL> SHUTDOWN IMMEDIATE; -- or NORMAL
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM ENABLE RESTRICED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE CHARACTER SET new _character_set_name;
SQL> SHUTDOWN IMMEDIATE; -- or NORMAL
SQL> STARTUP;

Monday, July 21, 2008

All about ANYDATA Datatype



ANYDATA DATATYPE:

CREATE:
CREATE TABLE tab1( col1 SYS.ANYDATA );
INSERT:
INSERT INTO tab1 VALUES(SYS.ANYDATA.convertVarchar2('Rajender Singh'));

INSERT INTO tab1 VALUES(SYS.ANYDATA.convertDate(SYSDATE));

INSERT INTO tab1 VALUES(SYS.ANYDATA.convertNumber(1972));
DATATYPE:
select TAB1.*,sys.anydata.gettypename(TAB1.COL1) typename from TAB1;
DATA:
create or replace
package pkg_temp1
as

function getnumber (anydata_p in sys.anydata) return number;
function getdate (anydata_p in sys.anydata) return date;
function getvarchar2 (anydata_p in sys.anydata) return varchar2;

end;
/
show errors

create or replace
package body pkg_temp1
as

function getnumber (anydata_p in sys.anydata) return number is
x number;
thenumber_v number;
begin
x := anydata_p.getnumber(thenumber_v);
return (thenumber_v);
end;

function getdate (anydata_p in sys.anydata) return date is
x number;
thedate_v date;
begin
x := anydata_p.getdate(thedate_v);
return (thedate_v);
end;

function getvarchar2 (anydata_p in sys.anydata) return varchar2 is
x number;
thevarchar2_v varchar2(4000);
begin
x := anydata_p.getvarchar2(thevarchar2_v);
return (thevarchar2_v);
end;

end;
/
show errors

select tab1.*,sys.anydata.gettypename(TAB1.COL1) typename,
case
when sys.anydata.gettypename(TAB1.COL1) = 'SYS.NUMBER' then
to_char(pkg_temp1.getnumber(TAB1.COL1))
when sys.anydata.gettypename(TAB1.COL1) = 'SYS.DATE' then
to_char(pkg_temp1.getdate(TAB1.COL1),'dd-mon-rrrr hh24:mi:ss')
when sys.anydata.gettypename(TAB1.COL1) = 'SYS.VARCHAR2' then
pkg_temp1.getvarchar2(TAB1.COL1)
end
thevalue
from TAB1
/

SET SQL PROMPT TO DATABASE NAME

spool set_prompt.sql
select 'set sqlprompt '||value||'>'
from sys.v$parameter where name='db_name';
spool off
start set_prompt.sql


The content of the resulting script, SET_PROMPT.SQL, will look like this:
set sqlprompt V715>
and when run the command will change your prompt from the default
SQL>
to
V715>

Suppress A New Line Between Select Statements In Sqlplus Script

Spool test.log
SELECT 'FIRST LINE' FROM DUAL;
SELECT 'SECOND LINE' FROM DUAL;
SPOOL OFF;


Then we got the following output,
FIRST LINE
SECOND LINE

But if we want like,
FIRST LINE SECOND LINE

Then, we need to modify the query,
select t1.c1||' '||t2.c2
from (select 'FIRST LINE' c1 from dual) t1,
(select 'second LINE' c2 from dual) t2;

Embedding sqlplus commands directly in a script

The standard way to do this is to wrap the sqlplus login using the << EOF script method; all lines are fed into sqlpus up till the final EOF marker.
sqlplus -s /nolog << EOF
connect sys/change_on_install as sysdba
desc dual
select * from dual;
exit;
EOF
Passing a parameter from the shell to sqlplus

fred="hello"
sqlplus -s /nolog << EOF
connect / as sysdba
select '$fred' from dual;
quit
EOF

Running a shell script / operating system command from sqlplus
in SQLPLUS, you just type, for example, host(ls -al) to get the command to run. You do NOT type: host('ls -al') this will NOT work.

Create a Variable in SQLPLUS to Limit Query Results using a List

select * from dept where deptno in ( '10','20','30');
Now I want to declare one vaibale to hold that string let us say declare dept_string = '10','20','30'. Create variable as follows,
define dept_string = '(''10'',''20'',''30'')';
OR
define dept_string = "('10','20','30')";
select * from dept where deptno in &deptno
The above query will give the desired result.

How to create HTML with SQL*Plus

This article gives an overview about the possibilities of creating HTML. It is easy to migrate scripts from CHARACTER mode to HTML, because all of the SQL*Plus tags are converted to HTML tags without any code-change, like TTITLE, BTITLE.

For example,
sql>set markup html on spool on
sql>spool test.html
//QUERY
sql>spool off
sql>set markup html off spool off

Change the background to black and print your Text in Pink:
set markup html on spool on HEAD ' Forth Test SQL*Plus and HTML ' Body 'TEXT=hotpink bgcolor=black'
spool c:\ex4.html

TTITLE CENTER 'All rows from Dept' Skip 1 Left 'Left arranged' Right 'right arranged' Skip 3
BTITLE CENTER 'End of report' Skip 3
select * from dept;
spool off
set markup html off spool off




Pass a Unix Variable into a PL/SQL Program

I am using the Oracle SQL*Plus environment and need to pass a variable from
the UNIX command line into a PL/SQL program.
set serveroutput on
set verify off
/* plsql starts here */
declare
my_filename varchar2(20);
begin
my_filename := '&1'; /* &1 represents the 1st command line argument */
dbms_output.put_line(my_filename);
/* call your stored procedure here */
end;
/

At the command line type the following:
sqlplus scott/tiger @my_script.sql hello

CHANGE SQLPROMPT TO REFLECT USER

We can set the SQL*Plus prompt to reflect the username instead of SQL>.
Use these SQL*Plus commands:
column D22 new_value VAR
select username D22 from user_users;
set sqlprompt '&&VAR>'

QUERY ON VARCHAR COLUMN WHERE VALUE CONTAINS '%'

If a select statement is issued using a "%" in the where clause, the results
are incorrect. For instance, if select is issued as:
select * from emp where ename like '%';
all rows are returned.So, What we have to do,
select * from emp where instr(ename, '%') <> 0;

Display Large Precision Numbers in SQL*Plus

For example, when creating a table like:
SQL> create table t1 (id number(17,3));


Then inserting a value like:
SQL> insert into t1 values(99999999999999.999);
Selecting from the table shows:
SQL> select * from t1;

ID
----------
1,0000E+14
A NUMBER column's width equals the width of the heading or the width of the FORMAT plus one space for the sign, whichever is greater. If you do not explicitly use FORMAT, then the column's width will always be at least the value of SET NUMWIDTH. What we have to do,
SQL> set NUMWIDTH 18
SQL> select * from t1;

ID
------------------
99999999999999.999
OR,
SQL> column id format 99999999999999999.999
SQL> select * from t1;

ID
----------------------
99999999999999.999

HOST COMMAND IS EXECUTED BEFORE SQL STATEMENT

I was trying to write a script that executes a HOST command after executing some SQL statements. But the HOST command is being executed before the SQL statements.

The command "PAUSE" that can be used here to get rid of this problem. PAUSE command requires the user to press "return" key to proceed. For example,

spool test.log
select * from a;
spool off
host cp test.log ./sadat/
pause
spool test1.log
select * from b;
spool off
host cp test1.log ./sadat/
pause
...............
....

Oracle's Analytical Function CUBE

The CUBE clause return rows containing a subtotal for all combinations of columns along with a total at the end.

CREATE TABLE TEST (NAME VARCHAR2(20),SALARY NUMBER);
INSERT INTO TEST VALUES('SADAT',100);
INSERT INTO TEST VALUES('NAJMUS',200);
INSERT INTO TEST VALUES('SADAT',300);
INSERT INTO TEST VALUES('NAJMUS',400);

SELECT NAME,SUM(SALARY) FROM TEST GROUP BY NAME;

NAME SUM(SALARY)
-------------------- -----------
SADAT 400
NAJMUS 600

SELECT NAME,SUM(SALARY) FROM TEST GROUP BY CUBE(NAME);

NAME SUM(SALARY)
-------------------- -----------
1000
SADAT 400
NAJMUS 600

Again,
ALTER TABLE TEST ADD CITY VARCHAR2(20);
UPDATE TEST SET CITY='BOGRA' WHERE NAME='SADAT';
UPDATE TEST SET CITY='RAJSHAHI' WHERE NAME='NAJMUS';
INSERT INTO TEST VALUES('NAURIN',150,'RAJSHAHI');

SELECT CITY,NAME,SUM(SALARY) FROM TEST GROUP BY CUBE(NAME,CITY);

CITY NAME SUM(SALARY)
-------------------- -------------------- -----------
1150
BOGRA 400
RAJSHAHI 750
SADAT 400
BOGRA SADAT 400
NAJMUS 600
RAJSHAHI NAJMUS 600
NAURIN 150
RAJSHAHI NAURIN 150

Generate numbers 1 to N from a query without any PL/SQL

select rownum from ( select 1 from dual group by cube (1,1,1,1,1,1)) where rownum<&maxlimit+1

The logic behind this query is that, the CUBE is generating 2^n rows where n is the number of arguments to the CUBE function. In this case the inner subquery generates 2^6 rows i.e. 64 rows with value 1 which means you can generate numbers up to 64. If we give 7 1s in the CUBE , then we can generate up to 128. Simply, range can be increased by increasing the number of arguments to the CUBE function.

Pass Bind Variable to Substitution Variable

How to pass "order by" clause built in pl/sql block over to sql script.

COLUMN command with NEW_VALUE option can be used.

-- declare a bind variable
var bind_var varchar2(100)

-- assign it a value
begin
:bind_var :='order by name';
end;
/
--pass the value into substitution variable
COLUMN b_var_alias new_value subs_var
select :bind_var b_var_alias from dual;

select name from TEST &&subs_var;

How to SELECT Columns as Rows Using SQL

CREATE TABLE TEST(ID NUMBER, A VARCHAR2(10), B VARCHAR2(10), C VARCHAR2(10));
INSERT INTO TEST VALUES(1,'a1','b1','c1');
INSERT INTO TEST VALUES(2,'a2','b2','c2');
INSERT INTO TEST VALUES(3,'a3','b3','c3');
INSERT INTO TEST VALUES(4,'a4','b4','c4');
commit;

SELECT * FROM (
SELECT ID,A FROM TEST
UNION
SELECT ID,B FROM TEST
UNION
SELECT ID,C FROM TEST );

ID A
---------- ----------
1 a1
1 b1
1 c1
2 a2
2 b2
2 c2
3 a3
3 b3
3 c3
4 a4
4 b4
4 c4

Prevent Execution of TRUNCATE Command in SQL*PLUS

Insert the following line in SYSTEM PRODUCT_USER_PROFILE:

SQL> insert into PRODUCT_USER_PROFILE (PRODUCT, USERID, ATTRIBUTE, CHAR_VALUE) values ('SQL*Plus','%','TRUNCATE','DISABLED') ;

A user can truncate his own tables by default and truncate other user's tables
if granted 'drop any table' privilege.

SQL*PLUS uses PRODUCT_USER_PROFILE to provide product-level security.
PRODUCT_USER_PROFILE can be used to disable certain SQL and SQL*Plus commands in the SQL*Plus environment on a per-user basis.

And to enable the SQL and SQL*Plus commands,
sql>conn system
sql>delete from PRODUCT_USER_PROFILE where........

In the same way, we can restrict commands like create,alter etc.

AUTOTRACE Option in sqlplus

we can control the report by setting the AUTOTRACE system variable.

SET AUTOTRACE OFF : No AUTOTRACE report is generated. This is the
default.
SET AUTOTRACE ON EXPLAIN : The AUTOTRACE report shows only the optimizer execution path.
SET AUTOTRACE ON STATISTICS : The AUTOTRACE report shows only the SQL
statement execution statistics.
SET AUTOTRACE ON : The AUTOTRACE report includes both the
optimizer execution path and the SQL statement execution statistics.
SET AUTOTRACE TRACEONLY : Like SET AUTOTRACE ON, but suppresses the
printing of the user's query output, if any.



The user must have the PLUSTRACE role granted and a PLAN_TABLE table created in your schema. For creating the table we can execute the following script,
@$ORACLE_HOME/rdbms/admin/utlxplan.sql

Who I am in V$SESSION

In a database, all users use the same userid like 'sadat'. Then,

SELECT USER FROM DUAL;

USER
------------------------------
SADAT

And in V$SESSION,
SELECT USER,AUDSID FROM V$SESSION;

USER SUDSID
----------------
SADAT 1234
SADAT 2345
SADAT 4567
SADAT 7654

To get the information about me, we can get audsid from the following sql,

select userenv('SESSIONID') from dual;

USERENV('SESSIONID')
--------------------
1234

Now,

select user,audsid,serial#, osuser,terminal from v$SESSION where audsid = 1234;

COLLECT function in oracle

'COLLECT' ... its really an useful function. We can easily understand the use of this with the following example...

create table test(a varchar2(10),b number);
insert into test values('a',1);
insert into test values('a',2);
insert into test values('a',3);
insert into test values('b',1);
insert into test values('b',2);
insert into test values('b',3);

CREATE or replace type test_t AS TABLE OF number;

select a,CAST(COLLECT(b) as test_t) from test group by a;

A CAST(COLLECT(B)ASTEST_T)
--------------------------------------------------------------------------------
a TEST_T(1, 2, 3)
b TEST_T(1, 2, 3)


Lastly,if the column is varchar2 type,then create type of varchar2.

CREATE or replace type test_t AS TABLE OF varchar2(200);

TEMPORARY Tablespaces and TEMPFILES in oracle

Unlike normal data files, TEMPFILEs are not fully initialised (sparse). When you create a TEMPFILE, Oracle only writes to the header and last block of the file. This is why it is much quicker to create a TEMPFILE than to create a normal database file.

One cannot remove datafiles from a tablespace until you drop the entire tablespace. However, one can remove a TEMPFILE from a database. Look at this example:

SQL> ALTER DATABASE TEMPFILE '/oradata/temp02.dbf' DROP INCLUDING DATAFILES;

If you remove all tempfiles from a temporary tablespace, you may encounter error: ORA-25153: Temporary Tablespace is Empty. Use the following statement to add a TEMPFILE to a temporary tablespace:

SQL> ALTER TABLESPACE temp ADD TEMPFILE '/oradata/temp03.dbf' SIZE 100M;

Unlike datafiles, tempfiles are not listed in V$DATAFILE and DBA_DATA_FILES. Use V$TEMPFILE and DBA_TEMP_FILES instead.

How does one create Temporary Tablespaces?
SQL> CREATE TEMPORARY TABLESPACE temp
TEMPFILE '/oradata/mytemp_01.tmp' SIZE 20M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 16M;

ORA - 01113

This error occurs when a datafile needs recovery.This error is usually followed with ORA-1110 error which will indicate the name of the datafile that needs media recovery. For example,

ORA-01113: file 28 needs media recovery
ORA-01110: data file 28: '/oradata/test.dbf'

When the database is open, then the datafiles, controlfiles, redolog files must be synchronized. And the error indicates that, the specified datafile is unsynchronized now.This implies that the checkpoint SCN (System Commit Number) of all datafiles must be the same.If the database crashes during a hot backup and try to restart it without doing recovery, you will likely get ORA-1113 for at least one of the datafiles in the tablespace that was being backed up, since its SCN will probably be lower than that of the controlfile and the datafiles in other tablespaces.

Now, different steps should be maintained in different situation, Likewise, if this happens at startup after crash with tablespace in hot backup, then what we have to do in mount mode,we have to find out which datafiles are in hot backup mode,
SQL>SELECT V1.FILE#, NAME
FROM V$BACKUP V1, V$DATAFILE V2
WHERE V1.STATUS = 'ACTIVE' AND V1.FILE# = V2.FILE# ;
SQL> ALTER DATABASE DATAFILE 'full path="" name=""' END BACKUP;
SQL>ALTER DATABASE OPEN;

And, If it happens at startup after restoring a tablespace or datafile from backup,then
SQL>STARTUP MOUNT;
SQL>RECOVER DATAFILE 'full path="" name=""';
SQL>RECOVER TABLESPACE;
SQL>RECOVER DATABASE;
SQL>ALTER DATABASE OPEN;

But things could be worse,if the database in noarchive mode then,
SQL>SELECT FILE#, CHANGE# FROM V$RECOVER_FILE;
SQL>SELECT V1.GROUP#, MEMBER, SEQUENCE#, FIRST_CHANGE#
FROM V$LOG V1, V$LOGFILE V2
WHERE V1.GROUP# = V2.GROUP# ;

Now we have to compare the CHANGE# with the FIRST_CHANGE#.If the CHANGE# is GREATER than the minimum FIRST_CHANGE# of your logs, the datafile can be recovered. If the CHANGE# is LESS than the minimum FIRST_CHANGE# of your logs, the file
cannot be recovered.If the datafile is in a temporary or index tablespace, you may drop it with an ALTER DATABASE DATAFILE 'full path name' OFFLINE DROP statement and then open the database. Then, drop the tablespace and recreate it. But if the tablespace is SYSTEM or rollback tablespace then we have to restore from the backup.

If this error comes when trying to online a datafile or tablespace then,
SQL>RECOVER DATAFILE 'path';
OR
sql>RECOVER TABLESPACE 'path'
OR
SQL>RECOVER DATABASE;

Then open the database. And lastly, if it happens when recovering using backup controlfile option to do incomplete recovery like, "RECOVER DATABASE USING BACKUP CONTROLFILE" ption without specifying the "UNTIL CANCEL" option, then upon "ALTER DATABASE OPEN RESETLOGS;" you will encounter the ORA-1113 error.
Then,
SQL>RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
SQL>ALTER DATABASE OPEN RESETLOGS;

Generate Random number in j2ME

As there is no package named Math in javaME , we can not use the method Math.Random . So its a question 'How to generate random number in Midlet?'.

The solution is :
SOURCE CODE:

Random generator = new Random();
generator.setSeed(System.currentTimeMillis());
float f = generator.nextFloat();

10000 BC [2008]

10000 BC directed by Roland Emmerich.As the Ice Age is ending, the Yagahl people are struggling to survive. A young, blue-eyed girl named Evolet is found and brought back to the tribe. The Old Mother realized that the child is fulfilling a prophecy and will save the Yagahl.

D'Leh (Steven Strait) swore his heart to Evolet when she first came to the tribe. Then they are torn apart by mysterious men arriving on horseback who kidnap many of the Yagahl, including Evolet, for slave trade.D'Leh embarks on a rescue mission with his father figure Tic'Tic (Cliff Curtis).Along the way, they encounter different lands, new people, and strange creatures including giant birds akin to a killer ostrich.

Its really good mixer of history and fantasy. Also a romantic story. I enjoyed that and waiting to enjoy it in big screen.

Sunday, July 20, 2008

Example of Location Api in Midlet (source code)

To work out this example the mobile must have JSR 179 package. The mobile need to be gps enabled.The application will display your current coordinates in Latitude, Longitude.


import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.location.*;

public class LocationApiTest extends MIDlet implements CommandListener
{
private Display display;
private Form form;
private Command cmdExit,cmdOK;
private StringItem si;

public loctest()
{
display =Display.getDisplay(this);
form = new Form("Location Api test");
cmdExit = new Command("Exit",Command.EXIT,5);
cmdOK = new Command("OK",Command.OK,1);
si = new StringItem("Geo Location", "Click OK");
form.append(si);
form.addCommand(cmdOK);
form.addCommand(cmdExit);
form.setCommandListener(this);
}

public void startApp()
{
display.setCurrent(form);
}


public void pauseApp(){
}

public void destroyApp(boolean flag) {
notifyDestroyed();
}

public void commandAction(Command c, Displayable d){
if (c == cmdOK){
Retriever ret = new Retriever(this);
ret.start();
} else if (c == cmdExit) {
destroyApp(false);
}
}

public void displayString(String string){
si.setText(string);
}
}

class Retriever extends Thread {

private loctest midlet;

public Retriever(loctest midlet){
this.midlet = midlet;
}

public void run(){
try {
checkLocation();
} catch (Exception ex){
ex.printStackTrace();
midlet.displayString(ex.toString());
}
}

public void checkLocation() throws Exception{
String string;
Location l;
LocationProvider lp;
Coordinates c;
// Set criteria for selecting a location provider:
// accurate to 100 meters horizontally
Criteria cr= new Criteria();
cr.setHorizontalAccuracy(100);

// Get an instance of the provider
lp= LocationProvider.getInstance(cr);

// Request the location, setting a half-minute timeout
l = lp.getLocation(30);
c = l.getQualifiedCoordinates();

if(c != null ) {
// Use coordinate information
double lat = c.getLatitude();
double lon = c.getLongitude();
string = "\nLatitude : " + lat + "\nLongitude : " + lon;
} else {
string ="Location API failed";
}
midlet.displayString(string);
}
}

Run mobile browser or any other application or services from Midlet

What I wanted to do... I tried to communicate between mobile browser and an mobile application. Then I got the method "javax.microedition.midlet.MIDlet.platformRequest()".

The platformRequest() method takes one input argument, a String URL that it passes to the platform's application management software (AMS).The AMS examines the scheme of the URL and decide which application to be invoked. This method returns TRUE if the current application must exit to run the new application or service otherwise returns FALSE.And it throws a ConnectionNotFoundException if the platform cannot handle the URL argument.

J2ME Wireless Toolkit Support:
What you have to do is just add the following line in the system.config file of toolkit's lib directory.
com.sun.midp.midlet.platformRequestCommand:"C:\Program Files\Mozilla Firefox\firefox.exe"


Now its ready to test that method. Souce Code:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class platformRequestExample extends MIDlet implements CommandListener {

private TextBox mTextBox;
private Command URLCommand;
private Command ExitCommand;
private Command OKCommand;

public platformRequestExample() {
mTextBox = new TextBox("URL:", "", 100, TextField.URL);

URLCommand = new Command("URL", Command.SCREEN, 1);
ExitCommand = new Command("Exit", Command.EXIT, 0);
OKCommand = new Command("Submit", Command.OK, 0);

mTextBox.addCommand(ExitCommand);
mTextBox.addCommand(OKCommand);
mTextBox.addCommand(URLCommand);
mTextBox.setCommandListener(this);
}

public void startApp() {
Display.getDisplay(this).setCurrent(mTextBox);
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void commandAction(Command c, Displayable d) {
boolean flag;
if (c.getCommandType() == Command.EXIT) {
notifyDestroyed();
} else if (c == OKCommand) {
try {
flag=platformRequest(mTextBox.getString()); // open the wap browser.
} catch (Exception e) {
System.out.println(e.getMessage());
}
} else if (c == URLCommand) {
mTextBox.setConstraints(TextField.URL);
mTextBox.setTitle("Enter a URL:");
mTextBox.setString("http://www.google.com.bd/search?hl=en&q=TEST");
}
}

}

Check Applet is loaded or Not

function check(){
if (document.applets && document.applets.appletName && document.applets.appletName.isActive())
alert("active");
else{
alert("inactive");
setTimeout("check()",1000);
}
}

Timer in JavaScript

Syntax:

window.setTimeout(param1, param2, param3)

Parameters:
param1 Required; a function name or string of code that will execute when the timeout has elapsed.
param2 Required; the length of the timeout in milliseconds.
param3 Optional; param1's script language.
JScript,
vbscript,
vbs,
javascript,
XML.

Example:

< name="counter">< type="text" size="8" name="d2">< /form>

var seconds=5 ;
document.counter.d2.value='5' ;

function display(){
if (seconds>0){
seconds--;
setTimeout("display()",1000) ;
}
document.counter.d2.value=seconds;
}
display();


Thursday, July 17, 2008

IELTS essay writting: Part 1

If you decided on an opinion essay, give it a proper structure.

1) Introduction is a must. You don’t believe you could get a good grade without introduction, do you?
2) 3 paragraphs are also necessary – three is a magical number. It can do wonders to your overall band score.
3) Conclusion. You do not want to infuse your examiner with a feeling of incompleteness.

First of all, you should not wander off trying to find ideas in the darkest parts of your mind.We will get some obvious hints right from the assignment.

About three paragraph if the product is about a product:
Introduction – topic and opinion in short(Simply speaking, let’s rewrite the assignment).
Paragraph 1 - staff working conditions are important
Paragraph 2 - employers should research and improve the working conditions
Paragraph 3 - concentrating more on their product is bad
Conclusion – short summary of paragraphs

Now we have to rephrase our ideas. And this is the hardest part to me as we have to use our vocabulary. so nothing we can do but remember some basic expressions. If you get stuck, just write down whatever comes to your mind looking at the key words of the assignment.

Example:
research: analyze, explore, inquire, investigate, look into, study
marketing: advertising, promoting, pushing products
working condition: situation, state, work load
stress at work: pressure, nervous tension, difficulty, hardness, strain
ignore: disregard, do not take into account, close the eyes to
employers: managers, bosses
staff work: force, personnel, employees
concentrate on the product: consider closely, direct attention, fix attention, focus, give attention
do a lot of damage to overall productivity
friendly environment

To make a paragraph we have to follow some rules like,
The first rule - KEEP IT AS SIMPLE AS POSSIBLE
Be practical – simple ideas come easy and take less effort to develop.
Don’t be tempted to amaze your examiner with profound knowledge of slang, idioms and pedantic words.

The second rule – DEVELOP YOUR PARAGRAPHS
A good paragraph must have
1) Topic sentence (statement)
2) Arguments – 3 arguments advisable, each followed by
3) Supporting details
4) Transition words and markers

I could arrange it in order of development steps.  
THE WORST  :
I am ugly (only statement, undeveloped - no arguments, no supporting details).
 
SLIGHTLY BETTER  :
I am ugly. I am old, bald and untidy (statement, 3 arguments, no supporting details)
 
MUCH BETTER  :
Statement - I am ugly.
Argument1 - I am old.
Supporting detail 1 - I was born before the World War II.
Argument 2 - I am bald.
Supporting detail 2 - You could see your reflection in the top of my head.
Argument 3 - I am untidy.
Supporting detail 3 - I have dirty marks all over my clothes.

Summary
(The gaps are here to be filled in with additional words that make your writing smooth or cohesive.)
… I am ugly. … I am old. I was born before the World War Two. … I am bald. You could see your reflection in the top of my head. … I am untidy. I have dirty marks all over my clothes.
 
THE BEST  :
(transition words and markers added)
In my opinion, I am ugly. First of all, I am old. I was born before the World War II. Secondly, I am bald. You could see your reflection in the top of my head. Finally, I am untidy. I have dirty marks all over my clothes.

Timing issues and MY ESSAY:
Time you will spend on each paragraph depends on your ability to produce consistent chunks of text approximately 50 – 70 words in length. The words left to build up a 250 word essay might be divided between the introduction and conclusion. In my case it takes about 7-8 minutes per paragraph.

My Photography

Its so simple to take a snap now a days. Just press the button and see the preview. But things can be better. A beautiful place can be shown as bad and nothing beautiful can be shown as really cool. So, the responsibility goes to photographer.

I am not a good photographer, but its my hobby. I just do it for fun and keep the time in my hard disk, thats it. I bought my first digital camera 4 and half years ago in 2003. It was only 3.2 MP. At that time, it wasn't bad one. And I was really happy to use it. And Still I have that and use it.

From my experience, the first thing is to choose the camera. We must consult with our friends, seniors before buying a camera. And read the manual, its really important. We have to be a little bit creative to get some good shot. We must have patience to be a photographer. And the photo editors, we must have to be familiar with some of them. Its need to give life to a dead photo.

Digital Picture Framing


To be a photographer, you must have knowledge about decoration of a picture. One of this task is framing. Its really easy to give a frame to a picture. And it increase the beauty of that pic. Sometimes it works really good. Try it.

You can get free framing software from here,
Download

Stardust [2007]

Stardust...its a fantasy movie. This movie is a fairy tale having swashbuckling, evil witches, greedy princes etc. Its based on the novel by Neil Gaiman and Charles Vess.

The hero named Tristian wanted to marry victoria and he made a deal to bring stone of fallen start that are shown by them. And he got a beautiful woman instead of stone of star and he reached there by using a magic candle that was presented by her mother. And the star(woman) had fallen in love with Tristian. Some other three witches also tried to get her
to attain immortal youth. And the princes are trying to get her to get the stone that she is wearing.

At last, tristian understand that his love is the star(
Yvaine) not the Victoria. He goes to protect her from the witches and Yvaine save themselves with her shine.And he become the king by touching the stone that Yvaine is wearing as he was the only blood line of the King.

I enjoyed this movie in big screen, so it was really great to me. This movie is a perfect combination of adventure,romance and fantasy. I watch this with one of my best friends and it does not diminish the status of our joy. So, watch this movie with anyone, he/she will enjoy it.

Transformers [2007]

Its not a new movie... released in 2007. I have seen this movie 4 times. And each time, I really enjoyed. I hated the word "transformer" as a TV serial was shown in JETIX channel all day long. And my cousin was fan of that. He didnt let anyone to see TV when that program showed.

But the movie is really cool. A teenager got involved in a war between the robots. The action of the robots is really spectacular. I think, no one can get boring with that action . And the sound effect....it was awesome. I saw the movie 3 times in my desktop, but last time I enjoyed in big screen in STAR cineplex. It was just outstanding.

You can get the information about cineplex from here,
http://www.cineplexbd.com/

Two type of tickets are available here.....120 taka and 170 taka per head. But I think, you will not feel that 'its a wastage of money'.

Tashan [2008]

This movie is directed by Vijay Krishna Acharya. And cast by Akshay Kumar,Saif Ali Khan, Kareena Kapoor, Anil Kapoor.

May be This is the worst movie I have seen in recent years. The story was also bogus. And the action...it was great comedy. They try to show Akshai kumar as a chinese hero or something like this. But the music.... it wasnt that much bad.

So, If u have really some time to waste....then watch it.

What is Love

Love ....What a smart word! We all think about this word. Human being are created in that way. American psychologist Zick Rubin try to define love by "three factors constitute love: attachment, caring and intimacy".But according to me,love is one of the most amazing thing in the world. Again, It could be the most hurtful feeling in the world.

There are two more words those are lust and infatuation. These three words are totally different. But most relationships are combination of them in some degree. But we always try to feel only one feeling that is love. Sometimes it overlaps, this is very much true.Psychologist Robert Sternberg said that, love has three different components: intimacy, commitment, and passion.

I believe, everybody has the ability to love. Some people get that very easily and some struggle for that. And there are also some people, those have really bad luck.They cant face their love. It can be without saying that, its really tough to love someone truly. To love, we have to Empathize,Expect nothing in return,Realize it can be lost and it must be unconditional.

Keep in mind that "True love is neither physical, nor romantic. True love is an acceptance of all that is, has been, will be and will not be." :) . U have to feel it. No one can make you feel that.

A Memorable Day

It was 30th june,2008....my birth day. I wanted to do something special or a little bit exceptional like what is not done within last few years. But I didn't find anything to do.

It was a working day, but didn't have that much work in my hand. Suddenly one of my colleague told me, please come to reception room. I wondered, what could be the discussion. And I was just stunned to see the situation. One of my best friend came with a birth day cake and some other stuffs. And became surprised that, everything was preplanned. We enjoyed the time to a great extend.

Now, whats next! Me and my friend was thing thinking ........ what can be done. And got a plan to go "Dhaka shishu park". I went there since I was eight or nine years old. And we took two ticket of volvo bus to Shahbag and the park is just walking distance from the bus stand. Its really cheap, the entry fee is only 8 taka and each ride needs exactly the same amount. Approximately there are more or less 10-12 rides available. we took three of them as most of the rides are for children. Most important thing is, my friend was the sponsor of that day.

The day was really coooool.

System.out.println in J2ME

I was trying to get some simple output by using System.out.println. It is only possible in Wireless Toolkit console but not in mobile device.

The code with println() will run normally in toolkit as well as in handset. But there is no way to get the output in mobile where the output is available in console of Java Wireless Toolkit.

Bluetooth and J2ME

jGPS is a JAVA-API that makes the handling of GPS devices a lot easier. Most of the GPS devices use their own protocol along with the NMEA standard.NMEA has been standardized for communications from GPS device to host.jGPS is a new product. It is in a quite early stage, so it does by far not yet include all of the manufacturer-specific protocols.

I tested this in windows operating system. What we have to do is,
1. download jgps.jar and jGPS.dll.

2.copy the native libs to the system32 directory and integrate the jar with the projects jars.

Now we are ready to write our application,
public class GPSReader implements GPSListener {
static int count = 0;
NMEAHandler nh = null;
String lon = "Not yet read";
String lat = "Not yet Read";

public String getLat() {
return lat;
}

public String getLon() {
return lon;
}

public GPSReader() {
try {
nh = new NMEAHandler(1, "myApp", "COM4", 9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
nh.command(GPSConstants.CMD_INIT, 0);
}
catch (ConnectException x) {
System.out.println(" Something is going wrong");
JOptionPane.showMessageDialog(null, x.getMessage(),"Error", JOptionPane.INFORMATION_MESSAGE);
}
nh.registerListener(this);
}

public void actionPerformed(GPSEvent ev) {
Position p = null;
if (ev.getTransType() == GPSEvent.POS_TRANS) {
p = (Position) ev.getData();
Descriptor wa = p.getProperty("LONGITUDE");
Descriptor wb = p.getProperty("LATITUDE");
lon = wa == null ? "" : (String) wa.getValue().toString();
lat = wb == null ? "" : (String) wb.getValue().toString();
System.out.println("Latitude/Longitude = [" + lat + "][" + lon + "]");
}
}

public void portClose() {
try {
nh.close();
} catch (Exception e) {
System.out.println("While closing: " + e.getMessage());
JOptionPane.showMessageDialog(null, e.getMessage(),"Error", JOptionPane.INFORMATION_MESSAGE);
}
}
}

Retrieve GPS data from the receiver

jGPS is a JAVA-API that makes the handling of GPS devices a lot easier. Most of the GPS devices use their own protocol along with the NMEA standard.NMEA has been standardized for communications from GPS device to host.jGPS is a new product. It is in a quite early stage, so it does by far not yet include all of the manufacturer-specific protocols.

I tested this in windows operating system. What we have to do is,
1. download jgps.jar and jGPS.dll.

2.copy the native libs to the system32 directory and integrate the jar with the projects jars.

Now we are ready to write our application,
public class GPSReader implements GPSListener {
static int count = 0;
NMEAHandler nh = null;
String lon = "Not yet read";
String lat = "Not yet Read";

public String getLat() {
return lat;
}

public String getLon() {
return lon;
}

public GPSReader() {
try {
nh = new NMEAHandler(1, "myApp", "COM4", 9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
nh.command(GPSConstants.CMD_INIT, 0);
}
catch (ConnectException x) {
System.out.println(" Something is going wrong");
JOptionPane.showMessageDialog(null, x.getMessage(),"Error", JOptionPane.INFORMATION_MESSAGE);
}
nh.registerListener(this);
}

public void actionPerformed(GPSEvent ev) {
Position p = null;
if (ev.getTransType() == GPSEvent.POS_TRANS) {
p = (Position) ev.getData();
Descriptor wa = p.getProperty("LONGITUDE");
Descriptor wb = p.getProperty("LATITUDE");
lon = wa == null ? "" : (String) wa.getValue().toString();
lat = wb == null ? "" : (String) wb.getValue().toString();
System.out.println("Latitude/Longitude = [" + lat + "][" + lon + "]");
}
}

public void portClose() {
try {
nh.close();
} catch (Exception e) {
System.out.println("While closing: " + e.getMessage());
JOptionPane.showMessageDialog(null, e.getMessage(),"Error", JOptionPane.INFORMATION_MESSAGE);
}
}
}

GPS simulator

GPS simulator is used for developing software that will receive data from a GPS device. It just eliminates the need of the real hardware[GPS device]. You can get some simulator here,
http://www.sailsoft.nl/gpssimul.htm

The simulators can generate the NMEA sentences and send them to the COM ports.

GPS system

GPS:
A typical GPS receiver calculates its position using the signals from four or more GPS satellites.Four satellites are needed since the process needs a very accurate local time.In other words, the receiver uses four measurements to solve for four variables: x, y, z, and t. These values are then turned into more user-friendly forms, such as latitude/longitude or location on a map, then displayed to the user.

Each GPS satellite has an atomic clock, and continually transmits messages containing the current time at the start of the message, parameters to calculate the location of the satellite.The receiver uses the arrival time to compute the distance to each satellite, from which it determines the position of the receiver using geometry and trigonometry.

Technical description
The current GPS consists of three major segments. These are the
1. space segment (SS): GPS satellites
2. control segment (CS): US Air Force monitoring stations
3. user segment (US): user's GPS receiver

Wednesday, July 16, 2008

Fun with Number (Domino)

We all know domino(sokka). Lets guess two numbers from them (1 to 6). Then multiply by 5 with one of them and add 7 with the result. Multiply it by 2 and lastly add the other number with the result. Now take the result and subtract 14 from that. e.g.
1 and 6
Now, 1*5=5
5+7=12
12*2=24
24+6=30
Now, 30-14=16
So, we got the answer .... 1 and 6.

Math Tricks [multiply by 11in your Head]

Easily we can do it if the number having two digits like 34;

1. Sum up the digits: 3+4=7
2.Put the number between the digits: 374

If the total is more than 10 like 78.

1. Sum up the digits: 7+8=15
2. Put 5 between them and add the carry with the first digit: 858

A number divide by 13

Math is really fun. We can easily find out where a number is divisible with 13 or not. What we have to do.. we have to take off the last digit and multiply it by 9. Then subtract the result from the digits you have left.If the result is 0 or dividable by 13, then the number will divide by 13.e.g.
312
Take off last digit: 2
multiply by 9 with 2: 9*2=18
subtract: 31-18=13
So, 312 is divisible by 13.

Tuesday, July 15, 2008

A number divide by 7

Math is really fun. We can easily find out where a number is divisible with 7 or not. What we have to do.. we have to take off the last digit and multiply it by 2. Then subtract the result from the digits you have left.If the result is 0 or dividable by 7, then the number will divide by 7. e.g.
786234
Take off the last digit...that is 4.
Multiply by 2 .... 4*2=8
Subtract this from the other digits....(78623-8)=78615
do the same thing again and again until u get a good number that is divisible by watching the number.

One more method: its applicable only if the number is having more than 2 digit.What we have to do..we have to take off the last two digit and multiply the remaining digits by 2. Then add the result with the number that was taken off. Now check whether the result is divisible by 7 or not. e.g.
2723
Take off last two digit: 23
Multiply by 2 with remaining number: 27*2=54
Then add: 54+23=77
so,2723 is divisible by 7.

A number divide by 11

Math is really fun. We can easily find out where a number is divisible with 11 or not. What we have to do.. we have to put (or imagine) alternate + and - signs in front of the digits and then sum up. If the result is 0 or dividable by 11, then the number will divide by 11. e.g.
235698
so, +2 -3 +5 -6 +9 -8 = -1
235698 will not divide by 11. But if the number is,
235697
so, +2 -3 +5 -6 +9 -7 = 0
235698 will divide by 11.

Awesome adventure in Khagrachari

It was really a big plan for 22nd intake of rangpur cadet college as we thought that the number of people will be at least 10-12. But we were not that much lucky. At last, four of us agreed to go to Khagrachari ...we are sadik,imtiaj,toufiq and myself. Our friend mohibbul managed 6 tickets of Chittagong with 50% cost. So still there was a chance to increase the number of people. At last imtiaj managed his 4 other class mates named sakib,jony,abdullah and lemon. They all are so frienly and we enjoyed the tour so much.

Now let me tell something about the tour. we supposed to start at 11:30 pm from Dhaka. Unfortunately the train was late and we had to start after 12:30 pm and reached at Chittagong around 7 pm. Then we took our breakfast as usual ..... porata , egg, dal-vaji and tea. Now time to go to oxygen from where we had to start for Khagrachari. Unfortunately we didn't able to catch the bus of 9:00 AM as all the tickets were sold , so we started at 10:00 PM. The ticket price was 140 taka per person and it was 112 km from Chittagong. The journey took approximately 3.5 hours.

The funny things started from here.... The police force was waiting to receive us with a Land Cruiser. What a hot reception ! I just stunned to see this. The fact was that, toufiq's uncle was something in police force and he managed those arrangement from Dhaka. And the Land Cruiser was really helpful for us for the whole tour. Without that... I thing it would be really difficult to enjoy Khagrachari. The vehicle took us to a rest house and 3 rooms were allocated for us. So, it was so easy to accommodate ourselves there.

About the meals.... I've visited many places and have eaten many items . But it was the first time where we got invitation for lunch,dinner and breakfast from the SP. What a honor! Tour is really cool when everything is free .... accommodation, meal, transport . Wow! ;-). The items were also good but i think the tradition of khagrachari is to eat a little bit more chilly in curry. But it was good. And about the last lunch in Khagrachari, it was arranged by our friend captain rashedujjaman. I dont think that... I could eat all the items. Its not for the bad test its for the number of items. He offered us to make a choice from rice,polao and chinese. As we were leaving that day, we chose rice. The items were fish (small as well as big), chicken, cow's brain, vorta, dal etc and drinks. Lastly we had to choose from coffee and pineapple juice.

We left Khagrachari at 5:15 PM and after reaching Chittagong we bought tickets of GREENLINE VOLVO. And the dinner !!!! hahahaha...it was also free ;-). The sponsor was arafat vai, he was an ex-student of DU. We finished our dinner at 'Zaman Hotel' near from the GREENLINE counter. Some of us ate kacchi biriani and some took morog polao. borhani and drinks was also served :-). The bus started from Chittagong at 12:00 AM and we finished our tour by landing in Dhaka about 6 o'clock.

A Cool tour in Sylhet

I should start from the scratch.I mean.... how the plan came, how we managed the tickets, how we managed hotels spending time bla,bla,bla.

It was on 4th june. One of my best friend called me and said, "Lets go to Sylhet on 5th june". And I am always positive for the tour whatever its summer,winter or rainy season.The first challenge was to collect the tickets. At 9 AM , I tried to buy tickets for the trains from banani. The price of tickets was promising as its only 180 taka to get SHOVON CHAIR. But we didnt have that much good luck...there was no tickets as it was Thursday (weekend). So, the next option was BUS. And luckily we got two tickets of GREENLINE(scania). The worth of the ticket was 450 taka. Actually, the way we got the ticket is also a good story but i dont wanna describe this in my blog.

We left dhaka at 7:30 PM and reached Syhet at around 12:00 PM. Sylhet was totally an unknown place for both of us. But fortunately, my friend had a colleague from Sylhet and he took the responsibility of hotel reservation.As Sylhet is a MAZAR oriented city, it was really tough to get a good room on Thursday. Still we got a room that was not bad,but........ Anywa...only for spending night, it was good enough.

Now, time to hang out.....my friend's colleague said that, "jaflong is good, but volaganj is better". So, we took a CNG and started to volaganj. It took around 1 hour to reach volaganj. And the sights beside the road were really awesome. And the volaganj..... it was simply cool.The weather was outstanding ...just after the rain. The view was magnificent... the hills, the clean water, boats everything was just amazing. We saw Cherapunji from the BD border.The day labors were collecting rocks. One more thing I should add that we got from the CNG driver, usually its a great place for rock dust, but it wasnt there as the rain fell in the morning. Thanx Allah for helping us.

Our second trip was in the MC college. It was a stunning, cool enough to walk without dripping in sweat.Its an outstanding place to date.But we didn't have that much time as we went JAKARIA PARK. One more thing, we got lot of tea garden while getting back from the volagonj.And we went to a mazar where a huge number of monkeys were just waiting for the people. We bought biscuit and one of monkeys just snatch that away from me. It was really funny. And the JAKARIA PARK, its a artificial park with two deers,some birds, some small rides,lakes,some exclusive bungalows etc. But the area was big enough and its also a really cool place to date. Here is a catch, its really far from the city and the entry fee is 50 taka per person.

The sun was dropping while we started to our hotels.
At night, we visited Hazrat Shahjalal(R)'s mazar. We were so lucky that we got two first class tickets of train...And the first two hour view from the train was really wonderful.

Overall, it was a simply wonderful way to spend a short weekend and we will definitely go back again, hopefully that will be very soon.

Where to go in Khagrachari

Alutila:
It not too far from the Khagrachori city. The mysterious cave is here and its really mysterious and full of darkness. The cave is approximately 150 meter long. The view from the hill was so spectacular. The river that was seen from top of the hill.... it was just indescribable. It was like someone has put some silver in a planned way.

Before entering the cave we had to arrange light as nothing can be seen in cave. We were 8 in number, so no fear was working. But it can be written without thinking that.... if one person take attempt to cross it then may be he would be afraid to feel the darkness with the only sound of water flow.


Shangkosss Nogor:
There was a temple just after the Alutila hill but we could enter into the temple as it was closed after 5 PM.

Debota Pukur:
I saw 'Boga Lake' in Bandorban. Thats why, I imagined how it would look like. But I didn't have any idea that I have to walk for more than one hour and the way was not so easy. We saw only one person on the way. And the driver told us that, this is the way from where two foreigner was kidnapped. But we really enjoyed with everything.

The Spring:
Its really far from the main town. It took approximately 1 hour to reach there. We get down from our vehicle and walked about half an hour . And again the risk of the way ..... it was so sleepy and narrow. If some one fall from there he would fall into a jungle that 400-500 meter deep from the road. But the spring, that was really beautiful and i think...this is the most gorgeous spring in Bangladesh.

This ride was not so easy...it was so risky and challenging . Any one could be injured from here. But we did it many times.

One more thing I should tell.... it was rainy season. And the day was full of rain. But we didn't stop for that.

Simply it was so adventurous. We enjoyed the tour.

Tour in Gazipur

The name,Humaun ahmed,is known to all.And also his own made shooting spot,Nuhash Polli, is heard by all.Its in gazipur and the only way to go there by rickshaw and the condition of road is not that much good.But if any one wanna go there by car or micro bus.Then its not a problem.

In the same day,we planed to visit national park,gazipur.It was me,atik and ratul.Most probably we walked more than 5 km over there.It was not a dark jungle,but it was something like jungle.It was really good adventurous day for us.

Best tourist place in Bangladesh (Bangladesh)

Proud to be a bangladeshi:
There is nothing more to say about saint martin.The night,the morning,the hot noon,the sunset,sunrise etc everything is so beautiful.
And the chera island,its really extra ordinary.I think,this is the most
beautiful tourist spot in bangladesh.





















Tourist place in Comilla

We went comilla with the ex-cadets of comilla cadet college as guest in a picnic.The two main tourism spots in comilla are moinamoti and war cemetry.This two places are not so far from each other.

Adventure in Bandorban

Best adventurous tourist place in Bangladesh:
We were only two in number.So far we heard after reaching there,its really rare to come bandarban with a two member's group.It was me and my friend rakib.Both of us had a faith that,we can do anything together.
We reached bandarban at 12:30 pm.And came to know that last trip for ruma bazar would leave at 3:30.So we went to shorno mondir by rickshaw.The temple was not made by gold.But everything was golden.And it was on top of a hill and the sight was really beautiful.
We could reach to chander gari station in right time.But we could not get seat in the vehicle,we were on the roof.Fortunately we realize that,its better to sit on the roof,otherwise we missed some great beauty.
The accommodation condition was really bad in ruma bazar at that time.We got a room with a single bed without mattress.Whatever,the night spent.
We had to go boga lake.Two way to go there,whether u have to go by chander gari which is really risky and costly And another way is by walking 6 hrs by enjoying great beauty.So we planed to go by vehicle and come on foot.
Then we mixed up with a group of 7 member.We had to share 400 taka as the fare of chander gari was 1800. Then we got boga lake.That was so cool.
Then we started to the Keokaradong, the highest pick of bangladesh.We got one wonderful water falls on the way.After walking three and half hours we reached the pick.The view was really great from there but the feeling was much better as we were on the highest pick. We could get back within two and half hours.
The night was another beauty.The full moon with boga lake.We slept 9 people in a bed.Actually its not a hotel,it was a room of trivial villagers.But they do business with the tourist.We had to give only 1000 taka for two meals and accommodation of 9 people.
Our next journey was a little bit tougher.We had been walking for more than 5 hours.A wonderful water falls was on the way and lot of small lakes with full of rocks were there.
In the same way,we came to bandarban city from rumabazar and then chittagong to dhaka.
Those who feel themselves adventurous,plz do it.

Monday, July 14, 2008

How to open or untar a file with .tar.gz extension

1.Go to the directory where the file exists.
2.To extract the file,
tar -zxvf yourfilename.tar.gz
It will be extracted in the current directory. If you wanna extract in a different directory then use the -C option. e.g.
tar -C /foldername -zxvf yourfilename.tar.gz

In the same way, we can extract file with .tar extension
tar -zxvf yourfilename.tar
tar -C /foldername -zxvf yourfilename.tar

Saturday, July 12, 2008

Fun with Calendar

Choose Any 3*3 square from a calendar.
July 08
SMTWTHFS


12345
6789101112
13141516171819
20212223242526
2728293031


For example,














111213
181920
252627

Now add those numbers and divide the result with the middle number of the square that is 19 for the given example. We will always get 9 as result.

Distance Calculation between Two Points with given Longitude and Latitude (java code)

This is done by Haversine formula. The formula is like ,

dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin^2(dlat/2) + cos(lat1) * cos(lat2) * sin^2(dlon/2)
c = 2 * arcsin(min(1,sqrt(a)))
d = R * c

R=radius of Earth

The implementation of this function with JAVA is given below,

//Haversine Formula
double DistLatLong(double lat1, double lon1, double lat2, double lon2, char units) {

double dlon, dlat;
dlon = lon2 - lon1;
dlat = lat2 - lat1;
double a = (Math.sin(dlat/2))*(Math.sin(dlat/2)) + Math.cos(lat1) * Math.cos(lat2) * (Math.sin(dlon/2))*(Math.sin(dlon/2));
double c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a) );
double R=0;
// R (Earth Radius) = 3956.0 mi = 3437.7 nm = 6367.0 km
switch(units)
{
case 'S': // STATUTE MILES
R = 3956.0;
break;
case 'N': // NAUTICAL
R = 3437.7;
break;
case 'K': // KILOMETERS
R = 6367.0;
break;
}
return (R * c);
}

Thursday, July 10, 2008

Long operation can be monitored in oracle

Long operation can be monitored in oracle. V$SESSION_LONGOPS is provided for this purpose. There are two columns that describes the time that has been elapsed and time that is remained. Name of the columns are,

TIME_REMAINING: Estimate (in seconds) of time remaining for the operation to complete.
ELAPSED_SECONDS: The number of elapsed seconds from the start of operations

This view displays the status of various operations that run for longer than 6 seconds (in absolute time). The statistics of the objects must have to be gathered to get the real result. We can use ANALYZE command or DBMS_STATS package.

For example,
Start a long operation in one session like,
SQL> select d.table_name,f.type from dictionary d,v$fixed_table f order by 1,2;

then, in another session do the following query,
SQL> select TIME_REMAINING from v$session_longops where TIME_REMAINING > 0;

we will get the result after executing the SQL many times.

search engine

Custom Search