目前僅支援Firefox、Chrome
在firefox按下: Ctrl + Shift + K (Win) | Cmd + Shift + K (Mac)
在Chrome按下: Ctrl + Shift + J (Win) | or Cmd + Alt + J (Mac)
切換到console並輸入以下文字,再按下enter(可參考下圖,以chrome為例)
document.cookie="VISITOR_INFO1_LIVE=ST1Ti53r4fU";
重新整理後所看到就是新版面啦!
document.cookie="VISITOR_INFO1_LIVE=ST1Ti53r4fU";
UIActionSheet *myActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"cancel" otherButtonTitles:@"AAA", @"BBB", @"CCC", @"DDD", nil];
myActionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[myActionSheet showInView:self.view];
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"buttonIndex = %d", buttonIndex);
}
UIWebView *myWeb = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"URL Here!"]];
[myWeb loadRequest:request];
[self.view addSubview:myWeb];
UIViewController *myViewController = [[UIViewController alloc] init];
UIWebView *myWeb = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, myViewController.view.frame.size.width, myViewController.view.frame.size.height)];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"URL Here!"]];
[myWeb loadRequest:request];
[myViewController.view addSubview:myWeb];
[self.navigationController pushViewController:myViewController animated:YES];
//更新指定cell
NSIndexPath *path = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
NSArray *myArray = [NSArray arrayWithObjects:path, nil];
[myTableView reloadRowsAtIndexPaths:myArray withRowAnimation:UITableViewRowAnimationFade];
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSIndexPath *a = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
NSArray *my = [NSArray arrayWithObjects:a, nil];
[myTableView reloadRowsAtIndexPaths:my withRowAnimation:UITableViewRowAnimationFade];
}
[myTableView reloadData]
-(void)navivationToTheAddress:(NSString *)address{
//導航起點的經緯度
NSString* myLatitude = @"0.0";
NSString* myLongitude = @"0.0";
NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?f=d&source=s_d&saddr=%@,%@&daddr=%@", myLatitude, myLongitude, address];
//將地址的中文轉碼
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//開啟Maps導航
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
}
//section height
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 0.0;
}
//cell height
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;{
//set cell size
return 100.0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {}
// cell 為cell的名稱,也就是所定義的"UITableViewCell *cell"
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
setSelection(position, animate)
imageGallery.setSelection(position, animate)
private Connection connect = null;
private Statement statement = null;
private ResultSet resultSet = null;
public static final String MYSQL_IP = "192.168.0.100";
public static final String MYSQL_DBNAME = "Book";
public static final String MYSQL_USERNAME = "isken";
public static final String MYSQL_PASSWORD = "isken";
public ArrayList bookList() throws Exception {
ArrayList results = new ArrayList();
try {
String script = "SELECT id, name, URL FROM Book";
Log.e("Isken", "script = "+script);
// This will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
Log.e("Isken", "jdbc:mysql://"+MYSQL_IP+"/+MYSQL_DBNAME+?"+ "user="+MYSQL_USERNAME+"&password="+MYSQL_PASSWORD);
// Setup the connection with the DB
connect = (Connection) DriverManager.getConnection("jdbc:mysql://"+MYSQL_IP+"/+MYSQL_DBNAME+?"+ "user="+MYSQL_USERNAME+"&password="+MYSQL_PASSWORD);
Log.e(PAGETAG, "connection is success");
// Statements allow to issue SQL queries to the database
statement = (Statement) connect.createStatement();
// Result set get the result of the SQL query
resultSet = statement.executeQuery(script);
while (resultSet.next()) {
MyObj obj = new MyObj();
String id = resultSet.getString("id");
String name = resultSet.getString("name");
String url = resultSet.getString("URL");
obj.setId(id);
obj.setName(name);
obj.setURL(url);
results.add(obj);
}
Log.e(PAGETAG, "results size = "+results.size());
} catch (Exception e) {
throw e;
} finally {
close();
}
return results;
}
double objLatitude = 25.066319;
double objLongitude = 121.557541;
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("google.streetview:cbll="+ objLatitude+","+objLongitude+"&cbp=1,99.56,,1,-5.27&mz=21"));
startActivity(streetView);
git init
git commit -m "[content]"
git commit "[content]"
git add .
git add [file name] [file name] [file name] ...
git rm [file name]
git mv [old name] [new name]
git log
git reset --hard [path]
//import framework
#import <AVFoundation/AVFoundation.h>
//宣告變數並將這變數交由property管理
AVCaptureSession *torchSession;
@property (nonatomic, retain) AVCaptureSession *torchSession;
@synthesize torchSession;
-(void) openLED{
NSLog(@"click openLED");
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch] && [device hasFlash]){
if (device.torchMode == AVCaptureTorchModeOff) {
NSLog(@"On");
AVCaptureDeviceInput *flashInput = [AVCaptureDeviceInput deviceInputWithDevice:device error: nil];
AVCaptureVideoDataOutput *output = [[AVCaptureVideoDataOutput alloc] init];
AVCaptureSession *session = [[AVCaptureSession alloc] init];
[session beginConfiguration];
[device lockForConfiguration:nil];
[device setTorchMode:AVCaptureTorchModeOn];
[device setFlashMode:AVCaptureFlashModeOn];
[session addInput:flashInput];
[session addOutput:output];
[device unlockForConfiguration];
[output release];
[session commitConfiguration];
[session startRunning];
[self setTorchSession:session];
[session release];
}
else {
NSLog(@"Off");
[torchSession stopRunning];
}
}
}
- (void)dealloc {
[torchSession release];
[super dealloc];
}
Intent i = new Intent( Intent.ACTION_CALL );
i.setData(Uri.parse("tel:"+"Phone number"));
startActivity(i);
<uses-permission android:name="android.permission.CALL_PHONE"/>
#import "ImageSwitcher.h"
ImageSwitcher *imgSwitcher = [[ImageSwitcher alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 60)];
[self.view addSubview:imgSwitcher];
[imgSwitcher release];
//init出來並且設定位置
UIScrollView *myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
//設定內容大小
[myScrollView setContentSize:CGSizeMake(900, 900)];
//設定可以捲動
[myScrollView setScrollEnabled:YES];
//加進去self
[self.view addSubview:myScrollView];
//point就是要滑動到的點,0,0為原點
[myScrollView setContentOffset:CGPointMake(0, 0) animated:YES];
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=getLayoutInflater();
View row;
//直接去抓xml的方式來定義內容
row=inflater.inflate(R.layout.custom_row, parent, false);
TextView title=(TextView)row.findViewById(R.id.title);
TextView subtitle=(TextView)row.findViewById(R.id.subtitle);
ImageView myImage = (ImageView)row.findViewById(R.id.myImage);
return (row);
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="left"
>
<ImageView
android:id="@+id/myImage"
android:src="@drawable/my"
android:layout_width="100px"
android:layout_height="100px"
</ImageView>
<LinearLayout
android:gravity="left"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="100px">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="8pt"
android:singleLine="true">
</TextView>
<TextView
android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subtitle"
android:textSize="6pt"
android:singleLine="true">
</TextView>
</LinearLayout>
</LinearLayout>
public class MyObj{
private String title;
private String subtitle;
private Drawable imageDrawable;
}
MyObj myObj = (MyObj)myArray.get(position);
NSString *mail = [NSString stringWithFormat:@"Mail here"];
NSString* urlString = [NSString stringWithFormat:@"mailto:%@", mail];
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
NSString *tel = [NSString stringWithFormat:@"Phone number here"];
NSString* urlString = [NSString stringWithFormat:@"tel:%@", tel];
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
NSString *tel = [NSString stringWithFormat:@"Phone number here"];
NSString* urlString = [NSString stringWithFormat:@"sms:%@", tel];
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
NSString *address = [NSString stringWithFormat:@"address here"];
NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", address];
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
NSString *addressA = [NSString stringWithFormat:@"addressA here"];
NSString *addressB = [NSString stringWithFormat:@"addressB here"];
NSString* urlString = [NSString stringWithFormat:@"hhttp://maps.google.com/maps?daddr=%@&saddr=%@", addressA, addressB];
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
NSString *id = [NSString stringWithFormat:@"Youtube id here"];
NSString* urlString = [NSString stringWithFormat:@"http://www.youtube.com/v/%@", id];
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
NSString *id = [NSString stringWithFormat:@"iTunes id here"];
NSString* urlString = [NSString stringWithFormat:@"hhttp://itunes.apple.com/tw/app/halftone/id%@", id];
NSString *escaped = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];
#import
@interface DemoXML : UIViewController {
//xml
NSXMLParser *parser;
NSString *parserCurrent;
}
//xml
@property (nonatomic,retain) NSString *parserCurrent;
@end
//xml
@synthesize parserCurrent;
//需要parser的URL
NSString *parserString = @"需要parser的URL";
//若有特別需要轉碼
NSString *escaped = [parserString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//NSXMLParser init
parser = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:escaped]];
//設定Delegate
[parser setDelegate:self];
//開始parser
[parser parse];
//parser < XXXX>
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
//NSLog(@"elementName = %@", elementName);
//NSLog(@"elementName = %d", elementName.length);
//elementName就是其中XXX的部份
parserCurrent = elementName;
}
//parser
-(void) parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
//NSLog(@"didEndElement => elementName = %@ || namespaceURI = %@ || qName = %@", elementName, namespaceURI, qName);
}
//parser <>XXXXXX>
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
NSLog(@"foundCharacters = %@",string);
//如果XML的Tag名稱與所需相同,就做以下動作
if([parserCurrent isEqual:@"title"]){
//Todo something
}
}
//parser結束
-(void) parserDidEndDocument:(NSXMLParser *)parser{
//todo something
}
; Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit. You can enable output buffering during runtime by calling the output
; buffering functions. You can also enable output buffering for all files by
; setting this directive to On. If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On', as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = On
#import <UIKit/UIKit.h>
#import "LoadingView.h"
@interface RootViewController : UITableViewController {
//loading
LoadingView *loading;
}
-(void)initLoading;
-(void)removeLoading;
@end
-(void) initLoading{
loading = [[LoadingView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[self.view addSubview:loading];
[loading release];
}
-(void)removeLoading{
// NSLog(@"subView = %@", [self.view subviews]);
for(UIView *subview in [self.view subviews]) {
if([subview isKindOfClass:[LoadingView class]]) {
NSLog(@"remove Loading = %@", subview);
[subview removeFromSuperview];
} else {
}
}
}
[self initLoading];
[self removeLoading];