2015年8月26日 星期三

【MIS】在 Windows 7 上安裝 IIS 7.5 & ASP


使用 : 參考[1]

按一下 [開始],再按一下 [控制台]。

在 [控制台] 中,按一下 [程式集],再按一下 [開啟或關閉 Windows 功能]。

在 [Windows 功能] 對話方塊中,按一下 [Internet Information Services],再按 [確定]。

驗證:
安裝 ASP
驗證:
設定:
按下右邊套用按鈕儲存此設定 測試檔案: 以筆記本 Note 寫個小程式,以 test.html 檔名儲存 <HTML> <BODY> 測試 </BODY> </HTML> 測試結果:
Win XP 環境安裝 1. 控制台: 新增或移除程式 > 新增 / 移除 Windows 元件 2. 出現 Windows 元件精靈視窗,點選 Indexing Service 及 Internet Information Services (IIS) Referebce: 1. https://technet.microsoft.com/zh-tw/library/Cc725762.aspx 2. 【資訊】 Win7安裝IIS伺服器與asp.net架站設定教學 3. Win7 IIS伺服器安裝asp.net架站設定教學 4. 執行 ASP.Net 的詳細環境 5. http://shaocian.blogspot.tw/2013/03/aspnet-iis7.html

2015年8月20日 星期四

【Oracle ERP Note 】ORACLE_UNQNAME not defined


Problem:

Try to start up Oracle OEM, and get the following error:

[prodba]$ emctl status agent
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

Solution:

[prodba]$ export $ORACLE_UNQNAME=LAB

LAB is Oracle SID

Then, the system will start the process, emagent.

[root@dev ~]# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 :::3938                     :::*                        LISTEN      7689/emagent
tcp        0      0 :::1158                     :::*                        LISTEN      7669/java

Reference:

1. https://community.oracle.com/thread/2195939

2015年8月19日 星期三

【Easy Flow 】EasyFlow 更改文具資料


以 Vsphere 工具 login,至路徑 開始 > 程式集 > Microsoft SQL Server 7.0 > Enterprise Manager,此時會出現 "SQL Server Enterprise Manager" 視窗

點選到路徑 Console Root > Microsoft SQL Servers > E-Flow (Windows NT) > Databases > EF2KWeb > Tables, 此時會列出所有 Table

在 book 這 Table 上,點選 Open Table > Return Top ... (若點選 Return all rows 會很耗時),此時出現 SQL 指令視窗

SELECT TOP 1000 *
FROM [dbo].[book]

刪除下列 items:

Keyin 下列SQL指令,輸入完,按下 Verify SQL 按鈕,再按下 Run 按鈕

DELETE FROM [dbo].[book]
WHERE name = '釘書針 雄獅#10 藍盒' and id = '1002011.01.001';

DELETE FROM [dbo].[book]
WHERE name = '釘書針 雄獅#10 綠盒' and id = '1002011.01.101';

name                   id               unit      price

釘書針 雄獅#10 藍盒     1002011.01.001   合        876
釘書針 雄獅#10 綠盒     1002011.01.101   合        36

之後,Keyin 下列命令,新增一筆資料:

INSERT INTO [dbo].[book]
(name, id, unit, price)
VALUES
('訂書針 Plus 10 號針','1110010.01.001','合',90);

Reference: https://jerry2yang.wordpress.com/2011/04/20/easyflow-%E4%BF%AE%E6%94%B9%E9%9B%BB%E5%AD%90%E8%A1%A8%E5%96%AE%E7%9A%84%E7%B6%B2%E9%A0%81%E5%85%83%E4%BB%B6%E5%B1%AC%E6%80%A7/ http://www.dotblogs.com.tw/felixfu/category/11386.aspx 2. 小花爸技術網站

2015年8月13日 星期四

【Oracle ERP Note 】查看 Oracle EBS AP & DB Component Versions


查看 Oracle EBS 在 AP 與 DB 安裝那些 Component 及其版本資訊,可使用以下 command 得知。

查看 Oracle AP Component Versions:

[prodmgr@sun bin]$ echo $ADPERLPRG
/u01/apps/DEV/apps/tech_st/10.1.3/perl/bin/perl
[prodmgr@sun bin]$ $ADPERLPRG $FND_TOP/patch/115/bin/TXKScript.pl 
                              -script=$FND_TOP/patch/115/bin/txkInventory.pl 
                              -txktop=$APPLTMP 
                              -contextfile=$CONTEXT_FILE  
                              -outfile=$APPLTMP/Report_App_Inventory_20150813-2.html 
                              -reporttype=text
Enter Apps password ?
*** ALL THE FOLLOWING FILES ARE REQUIRED FOR RESOLVING RUNTIME ERRORS
*** STDOUT   = /u01/apps/DEV/inst/apps/DEV_sun/logs/appl/rgf/TXK/txkInventory_Fri_Aug_14_07_25_54_2015_stdout.log
Reportfile /u01/apps/DEV/inst/apps/DEV_sun/appltmp/Report_App_Inventory_20150813-2.html generated successfully.


查看 Oracle AP Component Versions:

[proddba@sun bin]$ $ADPERLPRG $ORACLE_HOME/appsutil/bin/TXKScript.pl 
                              -script=$ORACLE_HOME/appsutil/bin/txkInventory.pl 
                              -txktop=$ORACLE_HOME/appsutil/temp 
                              -contextfile=$CONTEXT_FILE 
                              -outfile=$ORACLE_HOME/appsutil/temp/Report_DB_Inventory_20150813.html
Enter Apps password ?
*** ALL THE FOLLOWING FILES ARE REQUIRED FOR RESOLVING RUNTIME ERRORS
*** STDOUT   = /u01/proddb/proddb/11.2.2/appsutil/temp/TXK/txkInventory_Fri_Aug_14_07_25_00_2015_stdout.log
Reportfile /u01/proddb/proddb/11.2.2/appsutil/temp/Report_DB_Inventory_20150813.html generated successfully.



2015年8月10日 星期一

【Swift 筆記 Draft】Enumeration 類型: enum

Syntax 語法

enum EnumerationName
{
   case enumValue1
   case enumValue2
   ...
   case enumValueN
}

或

enum EnumerationName
{
   case enumValue1, enumValue2, ... , enumValueN
}

enum 的變數 / 常數被定義時,其 member 不會像 C、Objective-C 一樣給予默認 default 的整數值。可以用點 (.) 符號來引用 enum 的成員 member。 在 switch 條件式中,若 case 中列舉所有 member,則無需有 default,但若 case 只列舉其中的 member,此條件式仍需要 default。 組合 emnu 的 member 組合 enum 的 member,其資料型態類似 tuple。例如:

enum Product
{
   case Car (String, String, Int) // (Model, Company, Year)
   case TV (String, String) // (Type, Material)
}
emnu 的 member 的原始值 enum Animal: String { case Name = "Cat" case Age = 2 } 引用: 引用時,不可直接飲用,需透過函式 toRaw() println(Animal.Name.toRaw()) Reference 1. Enumerations, https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Enumerations.html

【Swift 筆記 Draft】閉包 Closure


Syntax 語法:


{ (parameters) -> returnType in statements }
我們以下列為範例:

var students = ["John","David","Claire","Alvin"]

func sortAsc(s1:String, S2:String)->Bool {
   return s1 < s2
}

var sortedStudents = sorted(students,sortAsc)
閉包 closure 為 expression 表達式,可作為函式之參數使用。例如: var sortedStudents = sorted(students, {(s1:String, S2:String)->Bool in return s1 < s2} ) 閉包簡化 1: 省略參數資料型態 students 此 Array 的元素資料型態為 String,而閉包參數的資料型態亦為 String,此時可省略後者資料型態之宣告。例如:

var sortedStudents = sorted(students, {(s1, s2) -> Bool in return s1 < s2} )
閉包簡化 2: 省略返回值 函式 sorted 為 Swift 內建函式[參考:1],其以函式為參數,而這函式參數的回傳值為 Bool,所以可省略此閉包的回傳值。例如:

var sortedStudents = sorted(students, {(s1, s2) in return s1 < s2} )
閉包簡化 3: 省略 return 保留字 已知閉包的回傳資料型態為 Bool,且無其他程式 statements,可省略此 return 保留字。例如:

var sortedStudents = sorted(students, {(s1, s2) in s1 < s2} )
閉包簡化 4: 省略閉包重複參數 S1 與 S2 參數 S1 與 S2 在閉包中重複,可再簡化,但 Swift 不允許簡化為 {(, ) in s1 < s2} ) 或 {(s1, s2) in < } )。前者無法將 S1 與 S2 這兩個參數帶入,而後者雖能帶入此參數,但 Swift 無法判斷是 S1 < S2 或 S2 < S1。因此 Swift 採用腳本 Script 命令中帶入參數的方式,使用 $0, $1, ... 等表示參數1 ,參數 2 等。例如:

var sortedStudents = sorted(students, {$0 < $1} )
閉包簡化 5: 閉包參數再簡化 閉包 {$0 < $1} 表達式說明為 2 個參數的比較,在此僅以 < 此符號即可表達,所以我們可再省略 $0 與 $1 這兩個參數。例如:

var sortedStudents = sorted(students, < )
尾隨閉包 Tailing Closure 尾隨閉包顧名思義為函式最後一個參數被宣告為閉包。若此函式只有此唯一閉包參數,可將閉包寫在函式外面。例如:

var sortedStudents = sorted(students){$0 < $1}
若函式只有一個參數要帶入到閉包,我們可改寫如下:

var sortedStudents = sorted{$0 < $1}
Reference 1. Swift Standard Library Reference, https://developer.apple.com/library/ios/documentation/General/Reference/SwiftStandardLibraryReference/Array.html sorted(_:) Returns an array containing elements from the array sorted using a given closure. Declaration func sorted(isOrderedBefore: (T, T) -> Bool) -> [T] Discussion Use this method to return a new array containing sorted elements from the array. The closure that you supply for isOrderedBefore should return a Boolean value to indicate whether one element should be before (true) or after (false) another element: let array = [3, 2, 5, 1, 4] let sortedArray = array.sorted { $0 < $1 } // sortedArray is [1, 2, 3, 4, 5] let descendingArray = array.sorted { $1 < $0 } // descendingArray is [5, 4, 3, 2, 1] 2. http://chain.logdown.com/tags/swift

【Swift 筆記 Draft】第 5 講: Function


參數的Default值定義

定義 fun 時,可設定參數的 default 值。

fun payTicket(price:Int = 800)-> Int {
   return " Ticket price is \(price)"
}

payTicket()
payTicket(1200)


可變參數

函數的參數個數多少未知,但每個參數具有相同的 data type。運用時,可視這可變參數為一個數組。

fun dailyBooking(expenses:Int ...) -> Int {
   var totalExpense:Int = 0
   for expense in expenses {
     totalExpense += expense
   }
   return totalExpense
}

dailyBooking(10,20)
dailyBooking(10,20,30)


參數的傳值或傳址:

參數的傳值是 call by value,而傳址是 call by address。

傳值是呼叫者 copy 相同的值,讓被呼叫的函式 function 使用。兩者各占記憶體 RAM。

傳址是呼叫者將其值得 address,讓被呼叫的函式 function 參考,兩者都參考到相同、且唯一的記憶體 RAM。 

參數的 data type 被宣告為類別 class 時,其呼叫 function 時是傳址 call by address,其他如宣告為整數型、浮點 floating point 、布爾 boolean 、字串 string、元組 tuples、集合 array / dictionary、列舉 enumeration 、結構 struct 等都是傳值 call by value。但,後者可強制使用 inout 這修飾 keyword,命令其只傳址,不過在呼叫時,要在變數前加上位址符號 &。

fun swap(inout x:Int, inout y:Int) {
   var temp:Int
   temp = x
   x = y
   y = temp
}

var num1 = 10, num2 = 20
swap(&num1, &num2)
println("num1: \(num1), num2:\(num2)")

函式的返回值 Return Value:

無返回值

1. fun name(parameters) { ... }  // 無返回值
2. fun name(parameters) -> () { ... }  //返回空的 tuples
3. fun name(parameters) -> Void { ... } //返回Void的類型
返回多個數值

【Swift 筆記 Draft】第 4 講: Flow Control 流程控制


循環 loop 語句:

1. for-in
2. for-condition-increment
3. while
4. do ... while

分支語句:

5. if condition
6. switch

跳轉語句:

7. fallthrough
8. where clause
9. break, continue
10. 可跳轉的標籤


for-in:

for index in 1 ... 10 { ...}

for _ in 1 ... 10 { ... } //當 index 在 { ... } 不被使用時
let nums = [1, 2, 3, 4, 5] for num in nums { ... } let dict1 = ["key1":1,"key2":2 ] for (key,value) in dict1 { ... } for character in "hello, world" { ... } for-condition-increment:

for initialization; condition; increment { ... }
while

while condition { ... }
do ... while

do { ... } while condition
無限循環:

for ; ; { ... }
while true { ... }
do { ... } while true
if condition

if condition { ...}

if condition { ...} else { ... }

if condition1 { ... }
else if condition2 { ... }
else { ... }
switch 可用於 Integer / Floating Point / Character / String / Tuple 等類型的數據做比較。

switch condition {
   case value1:
      statement1
   case value2, value3:
      statement2
   ...
   default:
      statementN+1
}
例如:範圍 range 比較: let weight = 80 switch weight { case 0 ..< 50: println("lower than standard") case 50: println("perfect") case 51 ... 200: println("above the standard) default: println("Not applicable") } where clause where: 在 case 中增加篩選條件 let weight = 80 switch weight { case let (x) where x < 50: println("lower than standard") case let (x) where x == 50: println("perfect") case let (x) where x > 50: println("above the standard") default: println("Not applicable") } 將 weight 這值 binding 到一個臨時的 constant / variable。(例如:x) fallthrough: fallthrough 為貫穿 case 而設計。例如: var n = 1 var x = 2 switch x { case 1: n++ case 2: n++ fallthrough case 3: n++ default: n++ } println("n = \(n)") //此時 n = 3 break, continue continue: 結束本次loop,進入下一個 loop break: 結束當前 statements 執行 可跳轉的標籤Label: forLabel:for index1 in 1 ... 5 { for index2 in 1 ... 5 { ... break forLabel } }

【Swift 筆記 Draft】第 3 講(2):字典 Dictionary


1. Dictionary 由 key 與 value 所組成,各 element 以逗號 , 區隔
2. Dictionary 以 key 來搜尋相對應的 value
3. Dictionary 中的 element 沒有次序關係
4. Dictionary 若以 var 宣告,可新增修改除集合資料的 element。

宣告 Dictionary:

var name:Dictionary = ["first":"Rob", "last":"Hsu"]
var name:[String: String] = ["first":"Rob", "last":"Hsu"]
var name =["first":"Rob", "last":"Hsu"]
Dictionary 以 Dictionary 來宣告,這裡 T1, T2 表示泛型 Generic Type,T1 是 key,而 T2 是 value。 宣告 empty dictionary:

var name = Dictionary()
var name = [String: String]()
清空Dictionary name: name = [:] 新增、修改、刪除 Dictionary 之 element dictionaryName[key] = value 新增:  name["second"] = "Mary" // name = ["first":"Rob", "last":"Hsu", "sechond":"Mary"] 修改: name["first"] = "John" name.updateValue("Wang", forKey:"Rob") // name = ["first":"Rob","last":"Wang"] name["first"] = nil // name = ["last":"Hsu"] 刪除: name["first"] = nil // delete name.removeValueForKey("Rob") Getter / Setter: println(name["Bob"]) 將 value 轉換為指定的 data type: (1) 將 String 轉換為 Int 類型的值: var dict1 = ["key1":"10", "key2":"20"] var num1:Int? = dict1["key1"]?.toInt() (2) 將原本是 Int 的 NSObject 值轉換為 Int 類型的值: var dict2 = ["key1":"10", "key2":20] var num2:Int = dict2["key2"] as Int (3) 將原本是 String 的 NSObject 値轉換為 Int 類型的值: var dict2 = ["key1":"10", "key2":20] var num3:Int? = (dict2["key1"] as? String)?.toInt() Dictionary Iteration: 與 Array 不同,Dictionary 有兩個集合,所以 iteration 可以針對 key 或 value 操作。 enum 字典中的 key 與 value:

for (key, value) in dictName
{
  ...
}
或是

for key in dictName.keys
{
   ...
}

for value in dictName.values
{
   ...
}
當 Dictionary 類型變成 NSDictionary 時,可先將其轉成 Dictionary:

for key in (dictName as Dictionary).keys
{
   ...
}
var dict2 = ["key1":"10", "key2":20] for key in (dict2 as Dictionary).keys { println(key) } 將 key 與 value 轉換成 Array: var dict1 = ["key1":"10", "key2":"20"] let keys = Array(dict1.keys) let values = [String](dict1.values)

【Swift 筆記 Draft】第 3 講(1): 數組 Array


1. Array 是一組有次序的,由相同 data type 的 element 構成的集合 collection。
2. Array 中的 element 可以重複出現。
3. 以 let 宣告的 array 為不可變資料,無法新增修改刪除,而以 var 宣告的 array 資料可以。

 Swift 可新增、修改、刪除 Array 中的元素 element。(其他語言不可)


宣告與init

let colorArray = ["red","white","black"] // read only
println(colorArray)

var colorArray:[String] = ["red","white","black"] // read / write
var colorArray:Array = ["red","white","black"]

Array 中的 element,其 data type 需一致。若不一致,其 data type 轉換為 cocoa library 中的 NSArray / NSMutableArray。

var mixedTypeArray = ["abc", 1]

宣告 empty Array:

var nullArray1 = [String]()
var nullArray2:[String] = []
var nullArray3:Array = []

若宣告為下列,則不會使用 Swift 的 Array 這 data type,而是轉換成 NSMutableArray:

var nullArray = []

宣告固定長度 Array:

var fixedLengthArray = [Int](count:3, repeatedValue:1)


Array 相加:

var array1 = [1, 2, 3]
var array2 = [4, 5,6]
var array3 = array1 + array2 // [1,2,3,4,5,6]

Array 的 getter / setter:

var array1 = [1, 2, 3]
println(array1[0])  // 1
array1[0] = 0 // array1[1] = [0, 2, 3]

Array 區間 range 之 Assignment:

arrayName[min ... max] = [item1, item2, ...,itemn]
arrayName[min ..< max] = [item1, item2, ...,itemn]

var num[0 ... 2] = [1, 2, 3]

Array 新增、刪除 element:

append : array1.append(9) // array1 = [1,2,3,9]
+ : array1 += [8] // array1 = [1,2,3,8]
insert : array1.insert(7,atIndex:array1.count) // array1 = [1,2,3,7]
removeLast : array1.removeLast  // array1 = [1,2]
removeAtIndex : array1.removeAtIndex(0) // array1 = [2, 3]
removeAll
empty
count

Array Iteration:

var array1 = [1, 2, 3]
for i in array1 {
  println("i = \(i)")
}

for (index, value) in enumerate(array1){
  println("index \(index): \(value)")

執行結果:

index 0: 1
index 1: 2
index 2: 3

2015年8月6日 星期四

以 IE 瀏覽奇摩股市,除去安全性提示

Problem

以 IE 瀏覽奇摩股市時,會提示:"此網頁包含不使用安全 HTTPS 連線傳送的內容,這可能危害整個網頁的安全性"
(在 Google Chrome 不會有此現象)


Solution

1. 工具 > 網際網路選項 > 安全性

2. 更改"網際網路"設定

網際網路 > 自訂等級
跨網域存取資料來源 設定 啟用
顯示混合的內容  設定 啟用

3. 更改"近端內部網路"設定

近端內部網路 > 自訂等級
跨網域存取資料來源 設定 啟用
顯示混合的內容  設定 啟用




prettyPrint();