2016年7月18日 星期一
iOS Development with Swift Tutorial (version bucky)
Windows IDE : IBM Sandbox
學習網址
https://www.youtube.com/playlist?list=PL6gx4Cwl9DGDgp7nGSUnnXihbTLFZJ79B
影片數量 : 40部
預計學習時間 : 10小時
開始時間 : 2016/7/18
結束時間 : 2016/7/19(暫停, 使用vmware練習效率極低)
1 - Apple Developer Registration
2 - iOS Developer Program
3 - Installing Xcode 6
4 - Setting Up a New Project
5 - Quick Tour of the Interface
6 - Creating a Simple Design
2016年7月17日 星期日
iOS Session
lesson 1,2
2016/7/14, 2016/7/15
(10hours)
Github : https://github.com/jicianho/XCode-Tutorial
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
var question:Int = 23 ; var q1:Int = 4
var emotion:String = " 😂"
//Edit -> emoji
var name:String = "James"
Int.max
print("people \(name) \(question) emotion is \(emotion) ")
if emotion.isEmpty{
print (" the string was emptied")
}else{
print (emotion+name)
}
//str can addtion by "+" or ".write"
name.write("ho")
// String of SWIFT is value type
var newStr:String = name
newStr.write("Hello")
if name.hasPrefix("Ja"){
print("yes")
}
// uppercased let String uppercase, is a new memory space(orginal string still here)
name.uppercased()
name.characters.count
//Constant, Tuple, Optional
//常數 多樣數 可能沒有數
//"let" will let var be constant
let month = 12
var number = 1
let fab = number*2
var strQuestion = "23"
//Int? is mean maybe Int, so it's type Int?, not Int ,if "strQuestion" isn't int, pulse nil
var intques:Int? = Int(strQuestion)
// after Int? , should use "!", ! is warpped
if intques != nil{
var ques:Int = intques!
}
// as same as
if let value = intques{
var ques = value
}
// ? is convert, ! is convert "by force"
var name2:String? = " Bucky "
name2?.write("roberts")
var name3:String? = " Bucky "
name3!.write("roberts")
// all name4 is name4!
var name4:String! = " Bucky "
name4.write("roberts")
//-- Tuple --
var person:(String, Int) = ("Jane", 23)
person.0
person.1
var car:(vendor:String, year:Int) = ("Honda",1999)
car.vendor
car.year
var (x,y):(Int, Int) = (100,20)
x
y
var numa4r:Int? = Int(arc4random_uniform(33445555))
var intNuma4r:Int = numa4r!
if (intNuma4r % 11 == 0) && (intNuma4r % 13 == 0) {
print("Find it!")
}
//-- function --
func abGame(fguess:Int ) -> (fa:Int,fb:Int) {
let fquestion:Int = 23
let fq1:Int = fquestion / 10 ; let fq2:Int = fquestion % 10
let fg1:Int = fguess / 10
let fg2:Int = fguess % 10
var fa:Int = 0 ; if fq1 == fg1 {
fa=fa+1
}
if fq2 == fg2 {
fa=fa+1 }
var fb:Int = 0
if fq1 == fg2 {
fb+=1 }
if fq2 == fg1 {
fb+=1
}
print("\(fa) A \(fb) B")
return (fa,fb)
}
var r = abGame(fguess:23)
abGame(fguess:02)
r.0
r.1
func sum(x1:Int, x2:Int) -> Int{
return x1+x2
}
var sum_num = sum(x1:10,x2:20)
func test(arg:Int){
"Test Int"
}
func test(arg:Float){
"Test Float 123"
}
func test(arg:Double){
"Test Double 123"
}
//test(6.0) // which function is called
var count = 6
while count > 0{
print("**")
count -= 1
}
//"for-in" new write method
for index in 1..<6 {
print("*\(index)*")
}
//same as "do-while"
repeat {
print("*****")
count = count - 1
} while count>0
var input: String = "4321"
for char:Character in input.characters {
var str = "\(char)"
var num = Int(str)!
print("\(num*2)")
}
func password_check(pasw:String){
var num_exist:Bool = false
var upcase_exist:Bool = false
var lowcase_exist:Bool = false
var over_count:Int = 0
for char:Character in pasw.characters {
let str = "\(char)"
let num:Int? = Int(str)
if num != nil {
num_exist = true
}
if str.uppercased() == str {
upcase_exist = true
}
if str.lowercased() == str {
lowcase_exist = true
}
over_count += 1
}
if !num_exist || !upcase_exist || !lowcase_exist || over_count >= 8 {
print("failure")
}else{
print("OK!")
}
}
password_check(pasw: "s")
//-- collecttion --
// is value type
var names_1:[String] = ["Michael", "James", "Robert"]
var names_2:Array<String> = ["Michael", "James", "Robert"]
names_1.count
if names_1.isEmpty {
"Empty"
}else {
"Not empty"
}
names_1[1] = "Allen"
names_1
names_2[0..<2] = ["Scent","Scent"]
names_2
names_2 += ["Bucky"]
names_2.insert("Tom", at: 1)
names_2.remove(at: 2)
var cars:[String] = ["Toyota","BMW"]
cars[1] = "Mercedes"
var vars2 = cars
for (index, object) in cars.enumerated() {
print("index \(index) is \(object)")
}
var ages = Array<Double>(repeating:2.0, count:3)
var name2_sum = 0
for (index, object) in names_2.enumerated() {
name2_sum += object.characters.count
print("\(name2_sum)")
}
print("\(name2_sum)")
var addressBook:Dictionary<String, String> = ["Michael":"0912345678","James":"0988776655", "Robert":"0922334455" ]
//var addressBook:[String:String] = ["Michael":"0912345678","James":"0988776655", "Robert":"0922334455" ]
addressBook.count
addressBook.updateValue("0912345678", forKey: "Michael")
addressBook
addressBook.updateValue("0912345678", forKey: "Bucky")
addressBook.keys
addressBook.values
var dict:[String:Int] = ["Michael": Int(arc4random_uniform(30)),
"James":Int(arc4random_uniform(30)),
"Bucky":Int(arc4random_uniform(30)),
"Jeanifer":Int(arc4random_uniform(30)),
"Yuma":Int(arc4random_uniform(30))]
//array has many dictionry
//watch out type define of array1 and array2
var newArray:[[String:Int]] = []
var newArray2:[(String,Int)] = []
for (name,age) in dict {
if age < 18 {
newArray2.append((name,age))
newArray.append([name:age])
print("\(name),\(age)")
}
}
print("\(newArray)")
print("\(newArray2)")
//--- nsarray ----
var address:[String] = ["1","2"]
//NSMutableArray is immutable array
var nsaddress:NSMutableArray = NSMutableArray()
nsaddress.add("Michael")
print("\(nsaddress)")
var nsAddress2 = nsaddress
nsAddress2.add("James")
print("\(address)")
print("\(nsAddress2)")
//--- struct ---
struct PlayGround {
var question = 23
func randomQuestion(){
}
func abGame(guess:Int) -> (a:Int, b:Int) {
return (0,0)
}
}
var play:PlayGround = PlayGround()
// if var question is has not inital, must give it
//var play:PlayGround = PlayGround(question:9)
//or play.question = 45
//let play2:PlayGround = PlayGround()
//play2.question = 33
// --- lottery picking balls ---
//mutating <--> self (like "this")
struct PlayGround_mutating {
var question:Int
//init is SWIFT's Constructor, like func but without word "func"
init(){
question = 23
randomQuestion()
}
mutating func randomQuestion(){
let num = 2
var balls:[Int] = [Int](repeating: 9, count: 10 )
for index in 0..<balls.count {
balls[index] = index
}
var questions = [Int](repeating: 10, count: num )
for count:Int in 0..<num {
let uValue = UInt32(count)
//every times sub one ball
let selectedIndex:UInt32 = arc4random_uniform(10 - uValue)
let intIndex:Int = Int(selectedIndex)
questions[count] = balls[intIndex]
balls.remove(at:intIndex)
print(questions)
}
self.question = questions[0] * 10 + questions[1]
}
}
//Three define method of array
//var names:[String] = Array<String> or () or [String]
var playg:PlayGround_mutating = PlayGround_mutating()
playg.randomQuestion()
//Struct is value type
//all value will be copied when assignment
var play1:PlayGround = PlayGround()
play1.question = 67
var play2:PlayGround = play1
play2.question = 23
play1.question
play2.question
//--- Object ---
var components:NSURLComponents? = NSURLComponents(string:"https:www.google.com.tw")
components?.scheme = "http"
components?.scheme
//instance is means it's have memory spaces
var newURL = NSURL(string: "http://www.apple.com")
newURL!
var formatter:DateFormatter = DateFormatter()
var date = NSDate()
formatter.dateFormat = "YYYY-MMM-dd GGG hh:mm:ss"
formatter.string(from:date as Date)
//--- Custom Class ---
//(use class complier)
//--- Inheritance ---
//(use class complier)
2016/7/14, 2016/7/15
(10hours)
Github : https://github.com/jicianho/XCode-Tutorial
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
var question:Int = 23 ; var q1:Int = 4
var emotion:String = " 😂"
//Edit -> emoji
var name:String = "James"
Int.max
print("people \(name) \(question) emotion is \(emotion) ")
if emotion.isEmpty{
print (" the string was emptied")
}else{
print (emotion+name)
}
//str can addtion by "+" or ".write"
name.write("ho")
// String of SWIFT is value type
var newStr:String = name
newStr.write("Hello")
if name.hasPrefix("Ja"){
print("yes")
}
// uppercased let String uppercase, is a new memory space(orginal string still here)
name.uppercased()
name.characters.count
//Constant, Tuple, Optional
//常數 多樣數 可能沒有數
//"let" will let var be constant
let month = 12
var number = 1
let fab = number*2
var strQuestion = "23"
//Int? is mean maybe Int, so it's type Int?, not Int ,if "strQuestion" isn't int, pulse nil
var intques:Int? = Int(strQuestion)
// after Int? , should use "!", ! is warpped
if intques != nil{
var ques:Int = intques!
}
// as same as
if let value = intques{
var ques = value
}
// ? is convert, ! is convert "by force"
var name2:String? = " Bucky "
name2?.write("roberts")
var name3:String? = " Bucky "
name3!.write("roberts")
// all name4 is name4!
var name4:String! = " Bucky "
name4.write("roberts")
//-- Tuple --
var person:(String, Int) = ("Jane", 23)
person.0
person.1
var car:(vendor:String, year:Int) = ("Honda",1999)
car.vendor
car.year
var (x,y):(Int, Int) = (100,20)
x
y
var numa4r:Int? = Int(arc4random_uniform(33445555))
var intNuma4r:Int = numa4r!
if (intNuma4r % 11 == 0) && (intNuma4r % 13 == 0) {
print("Find it!")
}
//-- function --
func abGame(fguess:Int ) -> (fa:Int,fb:Int) {
let fquestion:Int = 23
let fq1:Int = fquestion / 10 ; let fq2:Int = fquestion % 10
let fg1:Int = fguess / 10
let fg2:Int = fguess % 10
var fa:Int = 0 ; if fq1 == fg1 {
fa=fa+1
}
if fq2 == fg2 {
fa=fa+1 }
var fb:Int = 0
if fq1 == fg2 {
fb+=1 }
if fq2 == fg1 {
fb+=1
}
print("\(fa) A \(fb) B")
return (fa,fb)
}
var r = abGame(fguess:23)
abGame(fguess:02)
r.0
r.1
func sum(x1:Int, x2:Int) -> Int{
return x1+x2
}
var sum_num = sum(x1:10,x2:20)
func test(arg:Int){
"Test Int"
}
func test(arg:Float){
"Test Float 123"
}
func test(arg:Double){
"Test Double 123"
}
//test(6.0) // which function is called
var count = 6
while count > 0{
print("**")
count -= 1
}
//"for-in" new write method
for index in 1..<6 {
print("*\(index)*")
}
//same as "do-while"
repeat {
print("*****")
count = count - 1
} while count>0
var input: String = "4321"
for char:Character in input.characters {
var str = "\(char)"
var num = Int(str)!
print("\(num*2)")
}
func password_check(pasw:String){
var num_exist:Bool = false
var upcase_exist:Bool = false
var lowcase_exist:Bool = false
var over_count:Int = 0
for char:Character in pasw.characters {
let str = "\(char)"
let num:Int? = Int(str)
if num != nil {
num_exist = true
}
if str.uppercased() == str {
upcase_exist = true
}
if str.lowercased() == str {
lowcase_exist = true
}
over_count += 1
}
if !num_exist || !upcase_exist || !lowcase_exist || over_count >= 8 {
print("failure")
}else{
print("OK!")
}
}
password_check(pasw: "s")
//-- collecttion --
// is value type
var names_1:[String] = ["Michael", "James", "Robert"]
var names_2:Array<String> = ["Michael", "James", "Robert"]
names_1.count
if names_1.isEmpty {
"Empty"
}else {
"Not empty"
}
names_1[1] = "Allen"
names_1
names_2[0..<2] = ["Scent","Scent"]
names_2
names_2 += ["Bucky"]
names_2.insert("Tom", at: 1)
names_2.remove(at: 2)
var cars:[String] = ["Toyota","BMW"]
cars[1] = "Mercedes"
var vars2 = cars
for (index, object) in cars.enumerated() {
print("index \(index) is \(object)")
}
var ages = Array<Double>(repeating:2.0, count:3)
var name2_sum = 0
for (index, object) in names_2.enumerated() {
name2_sum += object.characters.count
print("\(name2_sum)")
}
print("\(name2_sum)")
var addressBook:Dictionary<String, String> = ["Michael":"0912345678","James":"0988776655", "Robert":"0922334455" ]
//var addressBook:[String:String] = ["Michael":"0912345678","James":"0988776655", "Robert":"0922334455" ]
addressBook.count
addressBook.updateValue("0912345678", forKey: "Michael")
addressBook
addressBook.updateValue("0912345678", forKey: "Bucky")
addressBook.keys
addressBook.values
var dict:[String:Int] = ["Michael": Int(arc4random_uniform(30)),
"James":Int(arc4random_uniform(30)),
"Bucky":Int(arc4random_uniform(30)),
"Jeanifer":Int(arc4random_uniform(30)),
"Yuma":Int(arc4random_uniform(30))]
//array has many dictionry
//watch out type define of array1 and array2
var newArray:[[String:Int]] = []
var newArray2:[(String,Int)] = []
for (name,age) in dict {
if age < 18 {
newArray2.append((name,age))
newArray.append([name:age])
print("\(name),\(age)")
}
}
print("\(newArray)")
print("\(newArray2)")
//--- nsarray ----
var address:[String] = ["1","2"]
//NSMutableArray is immutable array
var nsaddress:NSMutableArray = NSMutableArray()
nsaddress.add("Michael")
print("\(nsaddress)")
var nsAddress2 = nsaddress
nsAddress2.add("James")
print("\(address)")
print("\(nsAddress2)")
//--- struct ---
struct PlayGround {
var question = 23
func randomQuestion(){
}
func abGame(guess:Int) -> (a:Int, b:Int) {
return (0,0)
}
}
var play:PlayGround = PlayGround()
// if var question is has not inital, must give it
//var play:PlayGround = PlayGround(question:9)
//or play.question = 45
//let play2:PlayGround = PlayGround()
//play2.question = 33
// --- lottery picking balls ---
//mutating <--> self (like "this")
struct PlayGround_mutating {
var question:Int
//init is SWIFT's Constructor, like func but without word "func"
init(){
question = 23
randomQuestion()
}
mutating func randomQuestion(){
let num = 2
var balls:[Int] = [Int](repeating: 9, count: 10 )
for index in 0..<balls.count {
balls[index] = index
}
var questions = [Int](repeating: 10, count: num )
for count:Int in 0..<num {
let uValue = UInt32(count)
//every times sub one ball
let selectedIndex:UInt32 = arc4random_uniform(10 - uValue)
let intIndex:Int = Int(selectedIndex)
questions[count] = balls[intIndex]
balls.remove(at:intIndex)
print(questions)
}
self.question = questions[0] * 10 + questions[1]
}
}
//Three define method of array
//var names:[String] = Array<String> or () or [String]
var playg:PlayGround_mutating = PlayGround_mutating()
playg.randomQuestion()
//Struct is value type
//all value will be copied when assignment
var play1:PlayGround = PlayGround()
play1.question = 67
var play2:PlayGround = play1
play2.question = 23
play1.question
play2.question
//--- Object ---
var components:NSURLComponents? = NSURLComponents(string:"https:www.google.com.tw")
components?.scheme = "http"
components?.scheme
//instance is means it's have memory spaces
var newURL = NSURL(string: "http://www.apple.com")
newURL!
var formatter:DateFormatter = DateFormatter()
var date = NSDate()
formatter.dateFormat = "YYYY-MMM-dd GGG hh:mm:ss"
formatter.string(from:date as Date)
//--- Custom Class ---
//(use class complier)
//--- Inheritance ---
//(use class complier)
2016年7月11日 星期一
LAMP Server
「L」表示「Linux」作業系統
「A」表示「Apache」網頁伺服器
「M」表示「MySQL」資料庫
「P」表示「PHP」程式語言
sudo tasksel install lamp-server
LAMP使用Apache作為網頁伺服器,網站的預設根目錄是在「/var/www/html」下,剛安裝完LAMP後,會在根目錄下自動放置「index.html」檔案,就是用網頁瀏覽器開啟「http://127.0.0.1/」時看到的網頁。
啟動Apache
sudo service apache2 start
中止Apache
sudo service apache2 stop
重新啟動Apache
sudo service apache2 restart
參考資料
https://magiclen.org/lamp/
「A」表示「Apache」網頁伺服器
「M」表示「MySQL」資料庫
「P」表示「PHP」程式語言
sudo tasksel install lamp-server
LAMP使用Apache作為網頁伺服器,網站的預設根目錄是在「/var/www/html」下,剛安裝完LAMP後,會在根目錄下自動放置「index.html」檔案,就是用網頁瀏覽器開啟「http://127.0.0.1/」時看到的網頁。
啟動Apache
sudo service apache2 start
中止Apache
sudo service apache2 stop
重新啟動Apache
sudo service apache2 restart
參考資料
https://magiclen.org/lamp/
JavaScript ActiveXObject not work for chrome
chrome 不支援 Active 控制
因此原本要做的讀檔要用到ActiveXObject
就沒辦法再chrome執行了
之後可能嘗試html5來進行讀檔?
因此原本要做的讀檔要用到ActiveXObject
就沒辦法再chrome執行了
之後可能嘗試html5來進行讀檔?
2016年7月6日 星期三
讀書心得 富爸爸與窮爸爸
房子、車子等不算資產,而是負債
只要錢是從口袋流出去都是負債
放到口袋才是資產
例如:房地產買賣、收租、股票買賣、債券、專利使用費等
讓錢為你賺錢,不要為錢賺錢
聰明人只請比自己更聰明的人
所以如果你想成為富有,只須在一生中不斷地買入資產就行了。
只要錢是從口袋流出去都是負債
放到口袋才是資產
例如:房地產買賣、收租、股票買賣、債券、專利使用費等
讓錢為你賺錢,不要為錢賺錢
聰明人只請比自己更聰明的人
所以如果你想成為富有,只須在一生中不斷地買入資產就行了。
2016年7月4日 星期一
JavaScript Tutorial
JavaScript 理解
JavaScript 一種可以崁入在HTML的語言
和PHP不同的是JavaScript 是明碼
2016/7/11使用方法幾乎完全等於JAVAif-esle, switch, for等等都相同
- 參數設定 var xxx = "abc" or 123;
- 輸出部分變成 document.write , 記得使用""來做網頁字串輸出
學習網址
https://www.youtube.com/playlist?list=PL46F0A159EC02DF82
影片數量 : 40部
預計學習時間 : 10小時
開始時間 : 2016/7/6
結束時間 : 2016/7/18
Github : https://github.com/jicianho/JavaScript-Tutorial-
1 - Introduction to JavaScript
2 - Comments and Statements
JavaScript 一種可以崁入在HTML的語言
和PHP不同的是JavaScript 是明碼
2016/7/11使用方法幾乎完全等於JAVAif-esle, switch, for等等都相同
- 參數設定 var xxx = "abc" or 123;
- 輸出部分變成 document.write , 記得使用""來做網頁字串輸出
學習網址
https://www.youtube.com/playlist?list=PL46F0A159EC02DF82
影片數量 : 40部
預計學習時間 : 10小時
開始時間 : 2016/7/6
結束時間 : 2016/7/18
Github : https://github.com/jicianho/JavaScript-Tutorial-
1 - Introduction to JavaScript
2 - Comments and Statements
3 - Variables
4 - Different Types of Variables
5 - Using Variables with Strings
6 - Functions
7 - Using Parameters with Functions
8 - Functions with Multiple Parameters
9 - The return Statement
10 - Calling a Function From Another Function
11 - Global & Local Variables
12 - Math Operators
13 - Assignment Operators
14 - if Statement
15 - if/else Statement
16 - Nesting and Fridays!
17 - Complex Conditions
18 - switch
19 - for Loop
20 - while Loop
21 - do while
22 - Event Handlers
23 - onMouseOver & onLoad
24 - Objects
25 - Creating Our Own Objects
26 - Object Initializers
27 - Adding Methods to Our Objects
28 - Arrays
12 - Math Operators
13 - Assignment Operators
14 - if Statement
15 - if/else Statement
16 - Nesting and Fridays!
17 - Complex Conditions
18 - switch
19 - for Loop
20 - while Loop
21 - do while
22 - Event Handlers
23 - onMouseOver & onLoad
24 - Objects
25 - Creating Our Own Objects
26 - Object Initializers
27 - Adding Methods to Our Objects
28 - Arrays
29 - Other Ways to Create Arrays
30 - Array Properties and Methods
31 - join and pop
32 - reverse, push, sort
33 - Add Array Elements Using a Loop
34 - Cool Technique to Print Array
35 - Associative Arrays
36 - Math Objects
37 - Date Objects
38 - Accessing Forms
39 - Accessing Form Elements
40 - Simple Form Validation
30 - Array Properties and Methods
31 - join and pop
32 - reverse, push, sort
33 - Add Array Elements Using a Loop
34 - Cool Technique to Print Array
35 - Associative Arrays
36 - Math Objects
37 - Date Objects
38 - Accessing Forms
39 - Accessing Form Elements
40 - Simple Form Validation
PHP Tutorial
PHP理解
PHP是一種可以崁入在HTML的語言
可以被建成一個 Apache 模組
學習網址
https://www.youtube.com/playlist?list=PL442FA2C127377F07
影片數量 : 200部
預計學習時間 : 30小時
PHP是一種可以崁入在HTML的語言
可以被建成一個 Apache 模組
學習網址
https://www.youtube.com/playlist?list=PL442FA2C127377F07
影片數量 : 200部
預計學習時間 : 30小時
訂閱:
文章 (Atom)