#所有php的动态页面均交由apache处理
location ~ .(php)?$ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:88;
}
#所有静态文件由nginx直接读取不经过apache
location ~ .*.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$
{ expires 15d; }
location ~ .*.(js|css)?$
{ expires 1h; }
ref: (http://www.ha97.com/5119.html)
一些觀念
ref : (http://www.itlearner.com/article/4508)
實作補充
ref : (http://stackoverflow.com/questions/3434182/apache-and-ultimate-config-for-nginx-to-serve-all-virtual-hosts-in-the-right-way)
//避免直接ip訪問
在nginx/conf.d/default.conf裡加上並寫上自己對應的rewrite rule ex:http://yourdomain.com$request_uri?
server {
listen 80 default_server;#ip
server_name ip;
rewrite ^ http://mrshih.com$request_uri?;
}
2012年10月12日 星期五
2012年9月12日 星期三
升級到xcode4.5後facebook sdk有遇到問題
問題如下
Ld /Users/shih/Library/Developer/Xcode/DerivedData/food-csyywpmvwokybxdzxglwpmdzfgug/Build/Intermediates/food.build/Debug-iphoneos/food.build/Objects-normal/armv7s/food normal armv7s
cd /Users/shih/Desktop/food
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -L/Users/shih/Library/Developer/Xcode/DerivedData/food-csyywpmvwokybxdzxglwpmdzfgug/Build/Products/Debug-iphoneos -F/Users/shih/Library/Developer/Xcode/DerivedData/food-csyywpmvwokybxdzxglwpmdzfgug/Build/Products/Debug-iphoneos -F/Users/shih/Desktop/food/../../Documents/FacebookSDK -filelist /Users/shih/Library/Developer/Xcode/DerivedData/food-csyywpmvwokybxdzxglwpmdzfgug/Build/Intermediates/food.build/Debug-iphoneos/food.build/Objects-normal/armv7s/food.LinkFileList -dead_strip -lsqlite3.0 -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=5.0 -framework MapKit -framework MobileCoreServices -framework CoreLocation -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework FacebookSDK -o /Users/shih/Library/Developer/Xcode/DerivedData/food-csyywpmvwokybxdzxglwpmdzfgug/Build/Intermediates/food.build/Debug-iphoneos/food.build/Objects-normal/armv7s/food
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/shih/Documents/FacebookSDK/FacebookSDK.framework/FacebookSDK for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決辦法:
專案 => TARGET => Build Settings => Vaild Architectures => armv7 armv7s
把armv7 armv7s 改成 armv7
2012年9月2日 星期日
在storyboard下使用scroll view如何視覺化編輯畫面
1.
選擇controller的Inspector標籤
size屬性選擇Freeform
2.
選擇scroll view的Inspector標籤的右邊那個標籤
看到view那裏,編輯你要的width, height
接著就會看到storyboard上的controller的可編輯範圍出現變化了
3.
接著設計你的view
然後outlets scrollview的controller程式碼上,設定你在storyboard上的width, height
選擇controller的Inspector標籤
size屬性選擇Freeform
2.
選擇scroll view的Inspector標籤的右邊那個標籤
看到view那裏,編輯你要的width, height
接著就會看到storyboard上的controller的可編輯範圍出現變化了
3.
接著設計你的view
然後outlets scrollview的controller程式碼上,設定你在storyboard上的width, height
[self.sc setContentSize:CGSizeMake(320,600)];
DONE.
參考來源:
http://stackoverflow.com/questions/9288070/visually-arrange-subviews-in-a-large-uiscrollview
2012年8月28日 星期二
MBProgressHUD 方便建造thread, 並且不檔到navigation item(比如back)
http://github.com/matej/MBProgressHUD
.h檔部分
#import "MBProgressHUD.h"
.....{
MBProgressHUD *HUD;
}
.m檔部分
- (void) viewDidLoad{
[super viewDidLoad];
HUD = [[MBProgressHUD alloc] initWithView:self.tv];
// 這裡是navigation的item如back在有loading image時可以用的關鍵,記住initWithView不可以指定 self.view,因為這樣以來loading會覆蓋過整個view,關鍵是要另外指定一個較小不是全範圍的view如table view來init.
[self.tv addSubview:HUD];
// 這裡則是要指定那個較小的view去做addSubview:HUD,如此以來執行的時候也可以按navigation的item了
HUD.delegate = self;
HUD.labelText = @"Loading";
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}
- (void) myTask {
// Do something usefull in here instead of sleeping ...
// 背景運作的code如網路載入資料等放這...
.h檔部分
#import "MBProgressHUD.h"
.....
MBProgressHUD *HUD;
}
.m檔部分
- (void) viewDidLoad{
[super viewDidLoad];
HUD = [[MBProgressHUD alloc] initWithView:self.tv];
// 這裡是navigation的item如back在有loading image時可以用的關鍵,記住initWithView不可以指定 self.view,因為這樣以來loading會覆蓋過整個view,關鍵是要另外指定一個較小不是全範圍的view如table view來init.
[self.tv addSubview:HUD];
// 這裡則是要指定那個較小的view去做addSubview:HUD,如此以來執行的時候也可以按navigation的item了
HUD.delegate = self;
HUD.labelText = @"Loading";
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}
- (void) myTask {
// Do something usefull in here instead of sleeping ...
// 背景運作的code如網路載入資料等放這...
}
- (void)hudWasHidden {
// Remove HUD from screen when the HUD was hidded
[HUD removeFromSuperview];
}
2012年8月20日 星期一
兩個view controller資料傳送呼叫顯示等
---------------------------------------------------------------------------
1 呼叫 2 出來
[self performSegueWithIdentifier:@"upload to location" sender:nil];
---------------------------------------------------------------------------
1 傳送data到 2
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
id dv = segue.destinationViewController;
[dv setValue:@"123,111" forKey:@"gps"];
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
2 返回 1 (不透過nav bar 的back button)
UIViewController *prevVC = [self.navigationController.viewControllers objectAtIndex:1];//1 is level
[self.navigationController popToViewController:prevVC animated:YES];
指定回去的leval,1就是leavl
---------------------------------------------------------------------------
2 傳送data回 1 (需要實作delegate)
step1 :(在page2的.h檔定義delegate)
//--delegate部分
@protocol page2Delegate <NSObject>
@optional
- (void)passValue:(NSString *)value;
@end
//--
//--
@property (nonatomic, weak) id<LocationDelegate> delegate;
//--
---------------------------------------------------------------------------
step2 : 在page1裡載入delegate
#import "page2.h"//實作協定用
@interface uploadViewController : UIViewController<page2Delegate>
- (void)passValue:(NSString *)value{
//在這裡實作協定
}
---------------------------------------------------------------------------
strp3:在pag1呼叫page2時,指定自己是page2的delegate
strp3:在pag1呼叫page2時,指定自己是page2的delegate
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
id dv = segue.destinationViewController;
[dv setValue:self forKey:@"delegate"];
}
---------------------------------------------------------------------------
step4 :在page2適當的call method,讓delegate執行這個method
[self.delegate passValue:@"pass from 2 data string"];
/*
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
locationViewController *uploadView = [storybord instantiateViewControllerWithIdentifier:@"location"];
[self.navigationController pushViewController:uploadView animated:YES];
*/
訂閱:
文章 (Atom)

