Posts

Showing posts from February, 2012

Database Transaction State

Image
A transaction needs many state to complete a transaction process. A transaction must be in one of the following states: Active:  Active is the first stage of a transaction. It is initial state of any transaction. The transaction stays in this state when the transaction execute first time. Partially committed: After the final statement of a transaction just has been executed. That state is called the partially committed state. Failed : When normal statement cannot proceed in middle time, we call it failed. Aborted: After the transaction has been rolled back or restored that is called the aborted state. Committed : The successful completion of the transaction is called the committed state. Summary of transaction state: A transaction starts in the active state. When it finishes its final statement, then it enters the partially committed state. So the summary of transaction state is, When a transaction execute its first program we call it active state. When the transaction just com

Two column div using simple CSS

Image
This is a fairly simple post on how to align 2 <Div> in parallel to form a 2 column structure. Imagine, I wish to create a blog system where on left should be an avtar pic while right part contains comment text. Keep it simple, imagine following HTML block: <div style="float:left; padding-right:20px;">                 <div style="height:30px; width:50px; background-color:Red">avatar</div> </div> <div >     Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do <br />                 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do <br />                 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do <br />                 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do <br /> </div> This HTML block renders as following: This looks good. Watch for 3rd line of Lorum ipsum which wraps automatically below avatar pic. This might be an ideal des

[Note] rxvt-unicode settings in .Xdefaults

URxvt.buffered: true URxvt.geometry: 80x24 URxvt.background: black URxvt.foreground: lightgray URxvt.font: xft:Terminus:pixelsize=10 URxvt.inputMethon: scim URxvt.imLocale: zh_TW.UTF-8 URxvt.perl-ext: default, matcher URxvt.urlLauncher: /usr/local/bin/firefox URxvt.matcher.button: 1 URxvt.cursorUnderline: True URxvt.cursorBlink: True

How to construct a B+ tree with example

Image
A B+ tree contains n-1 search key values K1K2…….Kn-1 and have n pointers.   In a B+ tree the data are ordered  sequentially.  The leaf node may hold up to n pointers and must hold at least N/2 pointers. The root node must hold at least two pointers, unless the tree consists of only one node.  Now we construct a B+ tree. Construct a B+ tree for the following set of key values: (2,3,5,7,11,17,19,23,29,31) Assume that the tree is initially empty and values are added in ascending order. Construct a B+ tree where the pointer number is Four. Solution: When a node exceeds n-1 search key value then we split it into two nodes. First node contains (ceiling(n-1)/2) values.  2 nd node contains remaining node. Copy the smallest search key value of the second node to the parent node. Let's start, we know each node has N pointer and has N-1 search key values. In our example pointer number is 4, so the search key value is 4-1=3. So each node has 4 pointers and 3 search key value. The first node i

Homebrew uninstall

You can uninstall Homebrew, the package manager, with following steps: cd `brew --prefix`  rm -rf Cellar  brew prune  rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew  rm -rf ~/Library/Caches/Homebrew And you may refer to the FAQ from Homebrew's wiki page.