AWK from Solihin

 >>
 >>awk -F"|" '{print $11}' MM_20120228_000027208.dat | grep TMNET | sort -u
 TMNET
 >>grep TMNET MM_20120228_000027208.dat | awk -F"|" '{ print $3 }' | sort -u
 0031515
 >>awk '{ }' MM_20120228_000027208.dat
 >>awk '{i}' MM_20120228_000027208.dat
 >>awk -F"|" '{ s=substr($2,2,1); if(s==8)print $0}' MM_20120228_000027208.dat
 >>awk -F"|" '{ s=substr($2,3,1); if(s==3)print $0}' MM_20120228_000027208.dat

Eclipse hot key

Edit

  • Ctrl+1 — Quick Fix: press while cursor is positioned at member variable, parameter, selection, warnings, errors, …
  • Ctrl+Space — Context Assist: press after a ., or to use macros (forwhilesysout, …). Press in class-scope to automatically create method declarations.
  • Ctrl+Shift+O — Organize Imports
  • Ctrl+Shift+F — Reformat source
  • Alt+Shift+T — Show Refactor Quick Menu

Navigation

  • Ctrl+J — Incremental Search
  • Ctrl+Shift+T — Search a type, with search on typing. You can use only the upcase letters (e.g. type “MIL” to find MouseInputListener)
  • Ctrl+F6 — Switch between last used files
  • F3 — Open declaration
  • Ctrl+Alt+H — Open Call Hierarchy

Commenting

  •  Ctrl+Shift+/ – Toggling comment

Show all Hot Key

Ctrl+Shift+L

To maintain connection to MySQL while idle in hibernate.

Add this in hibernate configuratuion.

<property name=“hibernate.c3p0.preferredTestQuery”>select 1;</property>

Git Cheatsheet

Create new branch and push to remote
$ git branch name -> create local branch
$ git push origin name -> push local branch to remote

pulling code from a remote branch and create a new local branch
$ git checkout -b [local branch name] [remote branch name]

delete remote branch
$ git push origin :name

list branch in remote repo
$ git branch -r

Switch to a master branch
$ git checkout master

merging code from other branch to master (–no-ff is to always create commit object to avoid losing
info about historical existence of another branch and groups together all commits
$ git merge –no-ff [other branch name]

delete local branch
$ git branch -d name

tag a commit for future reference (can be used for the purpose of versioning)
$ git tag -a [tag name] -m “[some description]“

To see how many commits created since the last tag or given tag
$ git describe –tags

push all tags to remote
$ git push –tags

push one tag to remote
$ git push origin [tag name]

list existing tags
$ git tag -l

checkout a tagged revision and create a branch
$ git checkout -b name tags/[tag name]

Update on 08th May 2o12

Delete Branch at Remote:
$ git push origin –delete name

To remove a tag on the remote server:
$ git push origin :refs/tags/[tag name]

Resource:

http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

Filter, grep and split file in Linux

Filter only file MM* that contain 20111201

egrep -h “\|20111201\|” MM* > file_1

Split file, each file will contain 500000

split -l 50000 file_1 MM_20111201_000000000

Skip any line that start with FH

egrep -v “^FH\|” MM_20111203_000000000_XX.aa > abc

About Killing Session at Oracle

Get The session ID by this query:

 

select * from v$session
where program like 'sqlplus@s61cj185%'</pre>
set feedback off
 set serveroutput on size 9999
 column username format a20
 column sql_text format a55 word_wrapped
 begin
 for x in
 (select username||'('||sid||','||serial#||') ospid = '|| process ||
 ' program = ' || program username,
 to_char(LOGON_TIME,' Day HH24:MI') logon_time,
 to_char(sysdate,' Day HH24:MI') current_time,
 sql_address,
 sql_hash_value
 from v$session
 where status = 'ACTIVE'
 and rawtohex(sql_address) <> '00'
 and username is not null ) loop
 for y in (select sql_text
 from v$sqlarea
 where address = x.sql_address ) loop
 if ( y.sql_text not like '%listener.get_cmd%' and
 y.sql_text not like '%RAWTOHEX(SQL_ADDRESS)%' ) then
 dbms_output.put_line( '--------------------' );
 dbms_output.put_line( x.username );
 dbms_output.put_line( x.logon_time || ' ' || x.current_time || ' SQL#=' || x.sql_hash_value);
 dbms_output.put_line( substr( y.sql_text, 1, 250 ) );
 end if;
 end loop;
 end loop;
 end;
 /

And kill using this query:

ALTER SYSTEM DISCONNECT SESSION ’7,36875′ IMMEDIATE;

or
ALTER SYSTEM KILL SESSION ‘sid,serial#’ IMMEDIATE

Unlock user account for Oracle

Steps to unlock User

sqlplus /nolog;
conn / as sysdba;
alter user <usernme> account unlock;
Follow

Get every new post delivered to your Inbox.