Posts

Showing posts from May, 2016

Title13

Title13 $this->x = “111”; 可取用函式外的變數 this 指的就是類別 <?php class test1 { var $x ; var $y = "000" ; function aa () { $x = "222" ; $this ->x = "111" ; } } class test2 { function cc () { } } ?> 類C語言 類VB語言 $物件變數= new 類別名稱(); <?php class test1 { var $x ; var $y = "000" ; function aa () { $x = "222" ; $this ->x = "111" ; // 呼叫裡面的 //return $x ; // 呼叫外面的 return $this ->x ; // 呼叫外面的 } function bb () { } } class test2 { function cc () { } } $x = new test1(); echo $x ->y; // result:000 $x ->y= "0x0" ; // result:0x0 echo "<br>" ; echo $x ->aa(); // result: 111 ?> new的時候 就會執行一遍 fun

PHP 第三方

PHP 第三方 發送mail php mailer SMTP 1.發送mail需要一個mail主機發送,gmail有提供smtp的功能 2.D3.js

Title9

Title9 X echo "" ; X print <?php header( "location:https://www.google.com.tw/" ); ?> 輸出時間秒數 <?php echo time() ; ?> 輸出人類看得懂的時間格式 <?php echo date( "Y/m/d H:i:s" ) ; //如果不輸入時間數值預設就是現在時間 ?> echo phpinfo(); 找到.ini的路徑 然後將改為台北 然後必須重啟 [ Date ] ; Defines the default timezone used by the date functions ; Will be changed by MAMP to system timezone date .timezone = "asia/taipei" http://php.net/manual/en/function.date.php 使用者秒數 <?php echo strtotime( "2016-06-01" ); ?> 轉換格式 <?php echo "<br>" ; $d = "2016-05-01" ; $d =strtotime( $d ); $d =date( "m/d/Y" , $d ); echo $d ; ?> 除錯用 exit(); <?php echo "<br>" ; $d = "2016-05-01" ; $d =strtotime( $d ); $d =date( "m/d/Y" , $d ); echo $d ; exit (); $d = "2016-05-01" ;

Title3

Title3 給 Laravel 初學者的幾點建議 http://oomusou.io/laravel/laravel-for-newbie/ 新北市樹林國小 LARAVEL 工作坊 http://www.laravel-dojo.com/workshops/201507-ntpc

Title12

Title12 #內建關鍵字沒有區分大小寫 #變數有區分大小寫 <?php if ( $a == $b ){ echo "Rhyme? And Reason?" ; //一般的敘述句要分號 } echo "Hello, world" //最後一行可以不加分號 ?> 空白與斷句 空白不影響斷行,但要縮排增進可閱讀性 註解 有三種註解風格 1.shell 2.C++ 3.C shell風格註解 ######### #####shell註解 ######### C++ 風格註解 //////////////////////////// //////C++ 風格註解 //////////////////////////// C語言風格註解 /* */ 無法對php標記結尾限制 /* ?>*/ 也不支緣巢狀包覆 /* b=2; / 這是b變數 / */ 字面常數 null 1733 0XFE 1.452 ‘Hi’ “Goodbye” true 識別字 必須是ASC|| 字母 底線_ 或是ASCII 0x7F~ 0xFF之間的字母 變數名稱 以$宣告,區分大小寫 函式名稱 函式大小寫無關 類別名稱 無關大小寫 常數 define __CLASS__ __DIR__ (as of PHP 5.3) __FILE__ __FUNCTION__ __LINE__ __METHOD__ __NAMESPACE__ (as of PHP 5.3) __TRAIT__ (as of PHP 5.4) __halt_compiler abstract (PHP 5) and array() as break callable case catch (PHP 5) class clone (PHP 5) const continue cfunction (PHP 4 only) declare default die() do ech

Title11

Title11 The NULL value for Objective-C objects (type id ) is nil . While NULL is used for C pointers (type void * ). (In the end both end up holding the same value (0x0). They differ in type however.) In Objective-C: nil (all lower-case) is a null pointer to an Objective-C object. Nil (capitalized) is a null pointer to an Objective-C class. NULL (all caps) is a null pointer to anything else (C pointers, that is). [NSNull null] is a singleton for situations where use of nil is not possible (adding/receiving nil to/from NSArrays e.g.) In Objective-C++: All of the above, plus: null (lowercase) or nullptr (C++11 or later) is a null pointer to C++ objects. So to check against nil you should either compare against nil (or NULL respectively) explicitly: if (getCaption == nil) ... or let ObjC / C do it implicitly for you: if (!getCaption) ... This works as every expression in C (and with Objective-C being a superset thereof) has an implicit boolean value

Title10

Title10 AutoLayout http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions 1x 2x 3x 水平距離 垂直距離 寬 高 Label只設置距離 但有預設大小所以也不會有問題 ScollView 寬高不能用距離定義 必須定義右邊界跟下邊界 priorty https://www.raywenderlich.com/ IOS day by day heroku wordpress bitnami

Swift 特色

Swift 特色 1.Value Type & Reference Type 2.Protocol Oriented 3.Thinking Functionally #Book: Functional Swift Value Type Equatable make sense == Independernt data across Reference Type Comparing instance makes sense === sharing Instance lifetime is tied to external effects // : Playground - noun : a place where people can play import UIKit class APersonWhoWantToEatApple { var apple : Apple? func eatApple() { if var apple = apple { apple.bitten += 1 print (apple.bitten) } else { print ( "no apple" ) } } } // Compare Let Apple & struct Apple struct Apple { var bitten = 0 ; } let apple = Apple () let jonSnow = APersonWhoWantToEatApple() let tyrionLannister = APersonWhoWantToEatApple() jonSnow.apple = apple tyrionLannister.apple = apple jonSnow.eatApple() tyrionLannister.eatApple() WWDC 2015 Build Better WWDC 2015 Prot

Php 簡介

Php 簡介 #php不同環境下的安裝 http://php.net/manual/zh/install.php #php標準語法 <!doctype html> < html > < head > < meta charset = "UTF-8" > < title > </ title > </ head > < body > <?php echo "Hello , world" ; ?> </ body > </ html > #組態頁 <?php phpinfo(); ?> #表單 資料庫存取表單值主要透過 $_POST $_GET 確認在處理網頁時 php.ini的 REGISTER_GLOBALS 設定時必須是關閉的 <!doctype html> < html > < head > < meta charset = "UTF-8" > < title > Personalized Greeting Form </ title > </ head > < body > <?php if(!empty($_POST['name'])){ echo " Greetings, { $_POST [ 'name' ]}, and welcome. ";} ?> < form action = "<?php echo $_SERVER['PHP_HELP'];?>" method = "post" > Enter your name : <

PTT 註冊程序

Objective-C Learn-Apple

Objective-C Learn About Objective-C Objective-C is the primary programming language you use when writing software for OS X and iOS. It’s a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. It also adds language-level support for object graph management and object literals while providing dynamic typing and binding, deferring many responsibilities until runtime. Objective-C的就是你的OS X和iOS編寫軟件時所使用的主要程式語言。 這是繼承自C語言的一種程式語言,並提供物件導向功能和動態。 Objective-C的繼承了語法,基本類型和判斷流程的C語言,並增加了語法定義的類和方法。 它還增加了語言級的支持對象圖管理和對象文本,同時提供弱型別與強型別的語言支持,延遲執行許多責任,直到執行時期。 名詞解釋: > runtime 執行時期(Run time)在電腦科學中代表了一個電腦程式運作、執行的時期,從開始執行到終止執行。與執行時期相對的其他時期包括: 設計時期(design time)、編譯時期(compile time)、鏈結時期(link time)、與載入時期(load time)。 而執行環境是一種為正在執行的程式或程式提供軟體服務的虛擬機械環境。它有可能是由作業系統自行提供,或由執行此程式的母程式提供。

FMDB

FMDB FMDB教學 http://www.ios122.com/2015/09/fmdb/ https://bonjouryentinglai.wordpress.com/2011/03/20/fmdb%EF%BC%9A%E6%88%91%E7%9A%84sqlite%E6%95%91%E6%98%9F/

For Loops in PHP 1/7

What's a Loop? Programming can be tough work, and sometimes it's made tougher by having to do the same thing over and over. Let's say we want to  echo  a list of leap years  in the editor. You might think we'd have to type: <?php echo 2004 ; echo 2008 ; echo 2012 ; // And so on ?> But there's a better way! A  loop  is a useful bit of code that repeats a series of instructions for you. For instance, instead of typing  echo many times like we did above, we can simply use the code in the editor to the right! Instructions Check out the  for  loop in the editor. See how it  echo s the value for  $leap , adds four to it, then repeats? Click Save & Submit Code to learn how it all works! What's a Loop? 1/7 < html > < head > < title > Leap Years </ title > </ head > < body > <?php for ( $leap = 2004 ; $leap < 2050 ; $leap = $leap + 4 )

AP102 2016/5/27

Title7 popView的定義視窗 類別smallViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view . self.preferredContentSize = CGSizeMake( 200 , 200 ); } DetailViewController 解決錨點位置 //sourceRect 出現泡泡的地方 //bounds -( void ) prepareForSegue:(UIStoryboardSegue *)segue sender:( id )sender{ // You may need to check id of segue UIViewController * vc =segue .destinationViewController ; UIPopoverPresentationController*popoverPresentationController = vc .popoverPresentationController ; popoverPresentationController .sourceRect = [sender bounds]; } 選擇Segue 可在main storyboard 可選擇方向 多重storyboard 一開始建立四個btn 然後分別為push 1 ,2 moodel 1,2 然後建立 push1跟model1 的IBAction 然後建立第二個storyboard 增加viewcontroller 調整Top bar改為TransLucent Navigation 增加一個navigation item - ( IBAction )push1BtnPressed:( id )sender { UIStoryboard * push = [UIStoryboard storyboardWithName:@ "Push" bundle: nil

設計模式

設計模式 http://openhome.cc/Gossip/DesignPattern/index.html

AP102 2016/05/27

Title8 開一個master detail 自訂的類別 // // DataManager.h // HelloMyPhotoViewer // // Created by Financialbrain on 2016/5/27. // Copyright © 2016年 DarisCode. All rights reserved. // #import <Foundation/Foundation.h> @interface DataManager : NSObject // +(instancetype)sharedInstance; @end // // DataManager.m // HelloMyPhotoViewer // // Created by Financialbrain on 2016/5/27. // Copyright © 2016年 DarisCode. All rights reserved. // #import "DataManager.h" // _ 代表被包在裡面 沒事不給人家碰 // static 一啟動就配置 不因為任何原因回收記憶體 static DataManager *_singletonDataManager; @implementation DataManager // +(instancetype)sharedInstance{ if (_singletonDataManager == nil ){ _singletonDataManager = [DataManager new]; } return _singletonDataManager; } @end 進到MasterViewController.m -> #import "DataManager.h" @interface MasterViewController () @property NSMutableArray *objects; @end @implementation Maste

For Loops in PHP 2/7

For Loops in PHP 2/7 < html > < head > < title > For Loops </ title > </ head > < body > < p > <?php // Echoes the first five even numbers for ( $i = 2 ; $i < 11 ; $i = $i + 2 ){ echo $i ; } ?> </ p > </ body > </ html >

安裝CocoaPods

安裝CocoaPods 打開terminal gem install cocoapods -V 加上-V 可以顯示指令正在動作 因為要有點久所以最好可以看到安裝的過程 選擇single-view 創造一個專案 然後建立在桌面上 然後回到終端機 ls cd Desktop/ //創造Podfile檔案 touch Podfile ls open Podfile //進入 https://cocoapods.org/?q=AFN //複製 source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'AFNetworking' , '~> 3.0' pod install -V 然後會出現 Setting up CocoaPods master repo 如果安裝失敗 輸入 pod repo remove master pod setup “` Setting up CocoaPods master repo Cloning spec repo master from https://github.com/CocoaPods/Specs.git (branch master ) $ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master Cloning into ‘master’… Checking out files: 100% (88167/88167), done. $ /usr/bin/git checkout master Already on ‘master’ Your branch is up-to-date with ‘origin/master’. Setup completed Analyzing dependencies Inspecting targets to integrate [!] Unable to find a target named MyApp

SQLite

SQLite https://simpholders.com/ –>可以在本機端裝DB http://sqlitebrowser.org/– >可以用SQlite的GUI https://github.com/ccgus/fmdb– >Xcode 的freamWork //建立資料表location create table location( longitude double NOT NULL , latitude double NOt NULL ) //宣告成為PRIMARY KEY id INTEGER NOT NILL PRIMARY KEY , //快速索引longitude欄位的資料 create index locationindex on location(longitude); create table location( longitude double NOT NULL , latitude double NOt NULL PRIMARY KEY (longitude,latitude)); ) insert insert into location( longitude, latitude ) values ( 5.4 , 5.533 ); update update location set longitude = 5.9654 , latitude = 5.8645 delete 整列刪掉 <br> delete from location where longitude = 5.9654 ; query select * from location; * =>every column select longitude from location; select longitude,latitude from location order by longitude asc ; 小於5.5 select longitude,latitude from location where longitude &l

AP102 2016/5/26 下午

AP102 2016/5/26 下午 RSS Reader on IOS Master-Detail Application Project-name:HelloMyRss The view on iPad and iPhone is different. On iPad view the TableViewController will at the left side. And The iPhone 6 plus have other view ! when the monitor is straight the view is the same with iPhone. But when you rotate the monitor the view is the same with iPad. 1.import SystemConfiguration.framework 2.copy Reachability.h 3.This log is show both the if and else condition! 2016 -05-26 14 :11 :08 .073 HelloMyRSS [2040:257955] Reachability Flag Status : -- ------- networkStatusForFlags 2016 -05-26 14 :11 :08 .074 HelloMyRSS [2040:257955] NetWork not available . - (void)viewDidLoad { [ super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self .navigationItem.leftBarButtonItem = self .editButtonItem; UIBarButtonItem *addButton = [[ UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarBut