48
iSlide @ KSDG

KSDG-iSlide App 開發心得分享

Embed Size (px)

Citation preview

Page 1: KSDG-iSlide App 開發心得分享

iSlide @ KSDG

Page 2: KSDG-iSlide App 開發心得分享

2013-12-21 Hackathon

Page 3: KSDG-iSlide App 開發心得分享

i,m teamworkinnovation, maker

Page 4: KSDG-iSlide App 開發心得分享

i,m teamwork

Page 5: KSDG-iSlide App 開發心得分享

i,m teamwork

(D??i) Black Hand

Page 6: KSDG-iSlide App 開發心得分享

Motivation

Page 7: KSDG-iSlide App 開發心得分享

Too far to see clearly

Page 8: KSDG-iSlide App 開發心得分享

Cannot attend

Page 9: KSDG-iSlide App 開發心得分享

Server RequirementsHTTP Server

Websocket ServerREVEAL.js

Page 10: KSDG-iSlide App 開發心得分享

Client Requirements瀏覽器必須支援 Websocket

Page 11: KSDG-iSlide App 開發心得分享

Will my browser support?

Page 12: KSDG-iSlide App 開發心得分享

說這麼多,不如大家一起體驗

Page 13: KSDG-iSlide App 開發心得分享

Connected to the wifi AP

Ap name

ksdg-guest

Password

88888888

Page 14: KSDG-iSlide App 開發心得分享

Open browser

192.168.43.1:8080

Page 15: KSDG-iSlide App 開發心得分享

對不起,雛形偶爾會失靈

Page 16: KSDG-iSlide App 開發心得分享

reveal.jsSlid.es

Page 17: KSDG-iSlide App 開發心得分享

Create Slide

Page 18: KSDG-iSlide App 開發心得分享

Edit Slide

Page 19: KSDG-iSlide App 開發心得分享

Export Slide

Page 20: KSDG-iSlide App 開發心得分享

Android HTTP ServerHTTP 基本觀念

Page 21: KSDG-iSlide App 開發心得分享

index.html <!doctype html> <html> <head> <link type="text/css" href="/css/test.css"> </head> <body> <h1>test<h1> </body> </html>

Page 22: KSDG-iSlide App 開發心得分享

test.css h1{ color:#FF0000; }

Page 23: KSDG-iSlide App 開發心得分享

First Round ServerSocket mServerSocket = new ServerSocket(8080); Socket mSocket = serverSocket.accept(); PrintStream mPrintStream = new PrintStream(socket.getOutputStream()); File mFile = new File("index.html"); FileInputStream mFileInput = new FileInputStream(mFile); BufferedReader buf = new BufferedReader(new InputStreamReader(mFileInput)); String html; while ((html = buf.readLine()) != null) { mPrintStream.print(html); }

Page 24: KSDG-iSlide App 開發心得分享

為什麼沒有 css ...?

Page 26: KSDG-iSlide App 開發心得分享

Second Round mPrintStream.print("HTTP/1.0 200 OK\r\n"); Date now = new Date(); mPrintStream.print("Date: " + now + "\r\n"); mPrintStream.print("Server: weitsai \r\n"); mPrintStream.print("Content-length: " + mFile.length() + "\r\n");

String contentType = ""; if (fileName.endsWith("html")) { contentType = "text/html"; } else if (fileName.endsWith("css")){ contentType = "text/css"; }

mPrintStream.print("Content-type: " + contentType + "\r\n\r\n");

Page 27: KSDG-iSlide App 開發心得分享

上色囉∼〜~

Page 28: KSDG-iSlide App 開發心得分享

WebSocket1. A protocol providing full-duplex communication channel

over TCP2. Save bandwidth, reduce latency3. Exposed via a JavaScript interface in HTML5 compliant

browsers

Page 29: KSDG-iSlide App 開發心得分享

Create a WebSocket var ws = new WebSocket("ws://echo.websocket.org");

Page 30: KSDG-iSlide App 開發心得分享

Receive data ws.onmessage = function (evt) { alert("Got the message: " + evt.data); }

Page 31: KSDG-iSlide App 開發心得分享

Android hasn't supported

Websocket ServerJava - WebSocket

Page 32: KSDG-iSlide App 開發心得分享

Minimum Required JDKJava 1.5

Android 1.6

Page 33: KSDG-iSlide App 開發心得分享

Examplepublic class AndroidServer extends WebSocketServer { @Override public void onClose(WebSocket arg0, int arg1, String arg2, boolean arg3){ } @Override public void onError(WebSocket arg0, Exception arg1) { } @Override public void onMessage(WebSocket arg0, String arg1) { } @Override public void onOpen(WebSocket arg0, ClientHandshake arg1) { }}

Page 34: KSDG-iSlide App 開發心得分享

onOpen @Override public void onOpen(WebSocket arg0, ClientHandshake arg1) { arg0.send(mPage); }

Page 35: KSDG-iSlide App 開發心得分享

sendToAll public void sendToAll(String text) { Collection<WebSocket> con = connections(); synchronized (con) { for (WebSocket c : con) { c.send(text); } } }

Page 36: KSDG-iSlide App 開發心得分享

Dynamically create QR code ?

qrcode.js

Page 37: KSDG-iSlide App 開發心得分享

Create QR code var qrcode = new QRCode("test", { text: "http://jindo.dev.naver.com/collie", width: 128, height: 128, colorDark : "#000000", colorLight : "#ffffff", correctLevel : QRCode.CorrectLevel.H });

Page 38: KSDG-iSlide App 開發心得分享

How to get local ipAndroid auto injection JavaScript

Page 39: KSDG-iSlide App 開發心得分享

iSlide Topology

Page 40: KSDG-iSlide App 開發心得分享

LAN

Page 41: KSDG-iSlide App 開發心得分享

WAN

Page 42: KSDG-iSlide App 開發心得分享

特別感謝因為他們讓我少走許多冤枉路

Page 43: KSDG-iSlide App 開發心得分享
Page 44: KSDG-iSlide App 開發心得分享

KSDG

Page 45: KSDG-iSlide App 開發心得分享

Eric

Page 46: KSDG-iSlide App 開發心得分享

Marty

Page 47: KSDG-iSlide App 開發心得分享

Q&A

Page 48: KSDG-iSlide App 開發心得分享

Thank You