Search This Blog

2017/01/13

Dynamic SQL in Oracle

Had a case which need to use daynamic SQL and execute immediate statement. Share and memo a solution.

Customer's Needs:
There're two tables, A and B.
1. Update some columns in table B
2. The name of columns which will be updated are saved in table A(colname)
3. The columns' new value are saved in table A(colvalue)
4. Before get data from table A, we don't know which column will be updated.

Method:
1. Get data from table A and put in an cursor.
2. Create a dynamic SQL
3. Execute dynamic SQL

Code:

2017/01/11

Chrome page refresh: normal/hard/hard with cache cleared up

Quick keys
Normal: Ctrl+R
Hard: Ctrl+Shift+R

Hold left click to refresh button or right click refresh button to call out menu, then left click the option.

Detection: if device is iPad/iPhone or Android or PC

Use navigator to get information of device.

Code:
<script>
var _device = navigator.userAgent;
var isMobile = _device.indexOf("Mobile") > 0;
var isAndroid = _device.indexOf("Android") > 0;
var isPad = _device.indexOf("iPad") > 0;
var isiPhone = _device.indexOf("iPhone") > 0;
if(isMobile && !isPad){
  // device is mobile
  if(isiPhone){
    // device is iPhone
  } else if(isAndroid){
    // device is Android
  }
} else if(isPad){
  // device is iPad
} else {
  // device is PC
}
</script>

2017/01/05

Tab select sample without redirect


Html:
<div class="tabs">
<ul>
<li><a id="tab_1" onclick="showTabContent(this.id);">Tab 1</a></li>
<li><a id="tab_2" onclick="showTabContent(this.id);">Tab 2</a></li>
<li><a id="tab_3" onclick="showTabContent(this.id);">Tab 3</a></li>
</ul>
</div>
<div class="tabContent" id="tabContent1">Content 1</div>
<div class="tabContent" id="tabContent2" style="display:none;">Content 2</div>

2017/01/04

Fix rigidbody2D.velocity not suported in Unity 5.*

Use
GetComponent<Rigidbody2D>()
instead of
rigidbody2D.velocity

Example:
GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x,0);