字幕组成品列表(Beta)
  • 写在前面
  • Android 平台
    • Game On! 游戏开发系列 - 031
      • Pie Noon - 1503060393
      • The Death of Base Game Activity - 1504030543
      • Surviving OpenGL Context Loss - 1504030546
      • WebP for Game Devs - 1504030547
      • Saved Games In-Depth (Part 1) - 1504070556
      • Saved Games In-Depth (Part 2) - 1504030548
      • Smaller Flipbook Textures with CRABBY - 1504030544
      • Google Tag Manager - 1504030545
      • Flatbuffers - 1505050794
      • Achievement Point Pointers - 1505050796
      • Frequency Scaling - 1505050797
      • Meet the Management APIs - 1501140367
      • Y U Ship Broken Games - 1505050795
    • Android 性能优化 - 088
      • Garbage Collection in Android - 1503170425
      • Performance Cost of Memory Leaks - 1503170424
      • Rendering Performance 101 - 1501130351
      • Understanding Overdraw - 1501130352
      • Understanding VSYNC - 1501130353
      • Tool - Profile GPU Rendering - 1501130354
      • Why 60fps? - 1501130355
      • Android UI and the GPU - 1501130356
      • Invalidations, Layouts, and Performance - 1501130357
      • Overdraw, Cliprect, QuickReject - 1501130358
      • Tool - Memory Monitor - 1501130363
      • Battery Performance 101 - 1501130364
      • Understanding Battery Drain on Android - 1501130365
      • Battery Drain and WakeLocks - 1501130366
      • Memory Performance 101 - 1504170661
    • I/O 2014 Android 开发专题 - 089
      • Activity Transitions - 1504020505
      • Building Apps For Android TV - 1504020520
      • Building great Android media experiences - 1504020510
      • Building a quality app from start to finish - 1504020515
      • App Indexing API - 1504020507
      • What's new in WebView - 1504010484
      • Bluetooth Low Energy - 1504010486
      • Building impressive Android media experiences - 1504010493
      • The next Generation of Authentication - 1504020497
      • Don't Alpha That Pixel! - 1504020523
      • NFC + HCE Your phone in an interactive world - 1504020509
      • Demystifying encodes and decodes of WebM - 1504020521
      • Google Cloud Messaging - 1504020524
      • Getting your Game on the Big Screen - 1504020518
      • I hear you like realtime memes - 1504020511
      • Offerize your App - 1504020506
      • Using the Android Job Scheduler - 1504020504
      • From Holo to Material - 1504020526
      • Under the Hood of Android Auto - 1504020501
      • Isolation for Android App Developers - 1504020498
      • Android Work - 1504010496
      • ExoPlayer: Adaptive video streaming on Android - 1504010489
      • Sample rates and resampling: Why can't we all just agree? - 1504010488
      • Drive Android API - 1504010485
    • Android Studio - 004
      • Layout Editor (Ep 3, Android Studio) - 1503290479
      • Introducing Gradle (Ep 2, Android Studio) - 1503170426
    • I/O 2014 Android 分发主题 - 091
      • Introduction to Google Play - 1504030534
      • Google Play: building your user community - 1504030535
      • Optimizing Apps for Education - 1504030536
      • Succeeding in Education Technology - 1504030530
      • Subscriptions Made Easy with Google Play - 1504030531
      • The world is your playground - go global with Google - 1504030533
      • Maximizing discoverability on Google Play - 1504030538
    • Android Auto - 003
      • Introduction to Android Auto - 1504130615
      • Android Auto Messaging - 1504130617
      • Android Auto Audio - 1504130616
    • Android Wear - 006
      • Designing for Android Wear - 1503210448
      • How We Customized Google Apps for Android Wear - 1503210450
      • Fullscreen apps for Android Wear - 1503210445
      • New Notification Features for Android Wear - 1503210446
      • Building Cloud-powered wearable Apps - 1503210449
      • An Introduction to Android Wear - 1503190435
      • Google I/O 2014 - Android Wear: The developer's perspective - 1503210442
      • Devoxx 2014 Interviews: Android Wear - 1503210440
      • DevBytes: Watch Faces for Android Wear - 1503210439
    • Android TV - 005
      • Using the Leanback library - 1504080588
      • Beach Buggy Racing Multiplayer with Nearby Connections (Play Services) - 1503060387
    • Android for Work - 106
      • Android for Work for Developers - 1503060390
      • App Configurations, Testing and Launchers - 1504110590
    • IO Bytes 2014 - Android - 066
      • Chrome Apps on Android and iOS - 1501080014
      • Perf Primer CPU, GPU and your Android game - 1501080017
  • Chrome 平台
    • IO Bytes 2014 - Chrome and Web - 067
      • Using the PageSpeed API - 1505070815
      • Fabulous Forms for the multi-device web - 1505070816
      • Testing multi-screen web pages - 1505070817
      • Responsive images today - 1505070819
      • Web Performance Testing at YouTube - 1505070828
      • Building sites for the multi-device web - 1505070820
      • Deep dive: Google Cloud Messaging for Chrome - 1505070827
  • Google 创业者资源
    • Coffee with a Googler - 012
      • Chat with Allen Huang of AndroidTV - 1503040384
      • Chat with Fred Chung about developer advocacy - 1503070395
      • Google Fit platform with Michelle Haq - 1503210443
      • Android Auto Product Manager Andrew Brenner - 1501120027
      • Chat with Francis Ma about Google Play services - 1501120028
    • Root Access For Startups - 077
      • What we learned building plug-ins for Android, with startup Magnet - 1503230453
      • How to use crowdfunding to your advantage, with startup Hale Devices - 1503280462
      • How to overcome customer objections when selling tech, with startup Guesswork - 1503280458
    • First Things First - 029
      • Getting started with Android: A crash-course in developing for Android - 1504120601
      • How to ask a question: conducting research for your startup - 1504120603
      • MVP Design Hacks: transform your hot idea into a validated prototype - 1504120602
      • Build something people want: Solving real problems - 1504120605
    • How I - 061
      • Use BigQuery to find my most valuable customers - 1504070573
      • Manage beta testing communities using Google Play - 1504070572
      • Use paper wireframing to build native prototypes - 1504070570
      • Used social media and $0 marketing to get 68 million users - 1504070568
      • Prep to fundraise with four questions - 1504070564
      • Validated my idea in 2 days (with no code) - 1504070562
      • Build open platforms on Android - 1504120596
      • Get cheap, automatic analytics for my business using BigQuery - 1504070571
      • Write press releases to get international media coverage - 1504070569
      • Test beta-product features using Google Apps - 1504070563
      • Use URL builder to measure ROI on social media - 1504070561
      • Use events to build DeadSocial's brand - 1504070557
      • Use BigQuery to visualize streaming data - 1503220452
      • Find, screen, and hire developers - 1503120406
      • Drive engagement with social challenges - 1504070558
  • 设计
    • DesignBytes - 017
      • Paper and Ink: The Materials that Matter - 1505050793
  • 云计算
    • DevBytes: Google Cloud Platform - 021
      • Powering the next killer app with the Google Cloud Platform - 1504210672
      • Introduction to Google Cloud Endpoints - 1504210675
      • The Beauty of Scale with Google Cloud Platform - 1504210678
    • Google Cloud Platform - Big Data - 105
      • GDELT & BigQuery: Understand the world - 1502200379
    • Uncategorized - 999
      • Introducing Google Cloud Platform Resources - 1501190370
  • Google 应用开发
    • Launchpad Online - 072
      • The Setup: Creating new apps using Google APIs - 1503190428
      • Listing your files in Google Drive - 1503190429
      • Customizing Google Analytics for your startup - 1503290473
      • The Launchpad Online series - 1503190427
      • Getting started with Google Analytics - 1503290472
      • Accessing Google Maps from a spreadsheet?!? - 1502220381
      • Change the world in 10 lines of code - 1503080398
    • Google Play Services - 054
      • Google Play services 6.1 - 1503290481
      • Google Play Services 7.0 - 1503200437
      • Google Play Services 6.5 - 1501080015
    • 谷歌地图 iOS SDK - 053
      • Maps Live: New Features in the Google Maps Mobile APIs for Android and iOS - 1504300777
    • Google 移动搜索开发 - 055
      • Is your app in the Google index? - 1504120598
      • Get more engaged users with Google Search for Developers - 1503070397
    • DevBytes: Google Cast - 020
      • Google Cast SDK for Android - 1504180666
      • Media Router Framework - Part 1 - Media Router API - 1504180667
      • Overview for Google Cast Receivers - 1504180664
      • Google Cast SDK for iOS - 1504180663
    • Getting Started with the Google Maps SDK for iOS - 035
      • Getting started with the Google Maps SDK for iOS, Part 1 - 1504270757
    • IO Bytes 2014 - Wearables - 070
      • Voice Driven GDK Glassware - 1505280836
    • Route 85 - 078
      • Introducing Route 85 - 1501120022
      • Quick Tip: Don't Default that Switch! - 1501190371
      • OpenInChrome on iOS, Part 1 - 1501120023
      • OpenInChrome on iOS, Part 2 - 1501120024
      • OpenInChrome on iOS, Part 3 - 1501120025
      • OpenInChrome on iOS, Part 4 - 1501120026
    • DevBytes 2014 - 019
      • Web Components - Template - 1505040789
      • Wearable DataLayer API - 1505050792
      • Using srcset for responsive images - 1505050790
      • The picture element for art direction - 1505050791
    • Uncategorized - 999
      • Sun Surveyor brings augmented reality to photographers using Google Maps APIs - 1504200668
      • Snappy travels with the Roads API - 1503060392
      • Easy Maps Apps in Java and Python - 1501140030
  • Google 广告平台
  • Polymer
    • Polycasts - 076
      • The Awesome Power of Auto-Binding Templates -- Polycasts #08 - 1502220382
      • Content Switcheroo with Core-Pages -- Polycasts #09 - 1502200380
      • Core Iconset -- Polycasts #02 - 1505040788
  • Web 平台
    • HTTP 203 - 062
      • Gotchas - 1501140368
      • Font Rendering - 1501080016
    • Web Components - 081
      • DevBytes: Web Components - Overview - 1504250709
  • 宣传视频
    • Uncategorized - 999
      • Google Developers - 1501150369
      • I/O Extended 2014 - Join me - 1502220383
  • Google 各类开发者会议
    • 2014 Chrome 开发者高峰会议 - 009
      • Keynote - Chrome Dev Summit 2014 (Darin Fisher) - 1503120407
      • TLS All the Things! - Security with Performance(Chris Palmer) - 1503140412
      • Let’s build some apps with Polymer!(Rob Dodson) - 1503150415
      • Day One Closing Remarks(Sundar Pichai) - 1503150417
      • Chrome Leadership panel - 1503160422
      • Fundamentals of Mobile Web Development(Matt Gaunt) - 1503150416
    • 2015 游戏开发者大会中 - 039
      • FlatBuffers - 1504150640
      • Games for Google Cast - 1504150637
      • Top 10 Things Android Game Developers Should Know v 3.0 - 1504150643
      • Automate Publishing for Google Play APIs - 1504150639
      • 3 Game Design Mistakes You're Making - 1504150636
      • Android TV - 1504150638
      • How to Go Viral Without Really Trying - 1504150641
    • Devoxx 2014 Interviews - 024
      • What's new in Android 5.0 Lollipop - 1504260740
      • Android Tools - 1504260743
      • BigQuery and user-defined functions - 1504260744
    • IO Bytes 2014 - 065
      • Dart in Google Cloud - 1505070810
      • Big genomic data on Google Cloud Platform - 1505070811
      • Easy International Checkout with Chrome - 1505070802
      • Google developer tools and APIs for iOS - 1503190436
      • Whet your appetite with IO Bytes - 1501080021
    • PlayTime@Shanghai - 095
      • 主题演讲 Chris Yerga - 1504060549
      • 如何成功地开发你的应用 Ellie Powers - 1504060550
      • 在Google上营利 Brahim Elbouchikhi - 1504060551
      • Playtime Shanghai event sizzle reel - 1504070552
    • Project Google I/O 2015 - 098
      • Project Tango Mobile 3D tracking and perception - 1506120857
      • Democratizing Education - 1506120868
      • Improve your Android app’s accessibility - 1506120864
      • Google Cloud Messaging 3.0 - 1506120844
      • Developers connecting the world through Google Play - 1506120862
  • 开源开放技术
    • Compressor Head - 013
      • The Trailer, Season 2 - 1503060385
      • Behind the Scenes - 1503210441
      • Arithmetic Compression (Ep 5, Compressor Head) Google - 1503070394
      • Introducing Compressor Head - 1502120372
      • Episode 1 (Variable Length Codes) - 1502120373
      • Episode 2 (The LZ77 Compression Family) - 1502120374
      • Episode 3 (Markov Chain Compression) - 1502120375
Powered by GitBook
On this page
  • 译者信息
  • 解说词中文版:

Was this helpful?

  1. Google 应用开发
  2. Launchpad Online - 072

Change the world in 10 lines of code - 1503080398

PreviousAccessing Google Maps from a spreadsheet?!? - 1502220381NextGoogle Play Services - 054

Last updated 5 years ago

Was this helpful?

视频发布时间

2014年12月16日

视频介绍

Coming up with a compelling idea for a new service is a challenge, and building an app that realizes your vision is even more difficult. However, if you harness some of today’s more powerful tools, you can leapfrog others and get to market sooner! In less than 15 minutes, Google engineer Wesley Chun will show how, in about 10 lines of code, you can build a skeleton app to get started. It features a well-known online service that is already available to most of your users. Add your special sauce and change the world!

视频推介语

暂无,待补充。

译者信息

翻译

润稿

终审

原始链接

中文字幕

翻译流水号

加入字幕组

柚子皮

xin.zhang

——

1503080398

解说词中文版:

我是Wesley Chun 来自Google

你可能知道我是Python社区的成员

但是在这个视频中 我将要使用一些Python工具

向你展示如何用不到10行代码

创建一个面向全球的应用

来改变世界

对的 我为你下一次创业出了个主意

假设你想要做成一个非常成功的事业

推向市场的时间非常重要 你需要加快脚步

并且使用工具尽快地发布你的产品

一种方式是从一个MVP(最小可行性产品)开始

很快就能看见我们是否能够搭建一个web或者移动应用

当然之后这些都可以有

或者 你可以只是简单的做一个用户可以使用的

原型产品

那我们该怎么做呢

有什么是每个人上网时都会用到的

对了 电子邮件

我们会从某个人或某台电脑收到邮件

你也会给别人发邮件

但是你发过邮件给一个电脑吗

你待会就知道怎么实现了

因为这可以帮助你

跳过第一版的原生实现

因为邮件服务在所有的设备上都是兼容的 不管是移动端 还是桌面端

这也意味着我们只专注于

搭建一个能接收邮件的应用

那为什么做一个接收邮件的应用是个好主意呢

许多服务都发送email 但是这没什么意思

因为这只是一个简单的函数调用

但是 接受并且处理这些信息的话

这就有趣得多 而且非常带劲

就像宇宙大爆炸一样

你的用户向你的应用发送邮件

你的应用响应这些请求

想像一下

你可以发送邮件给某个人

但是你能向某个应用发送邮件吗

当然

还有 用户并不需要下载一个应用

因为他们的设备上

已经有了邮件服务

通过允许用户向你的应用发送指令

你就开启了无限的可能性

比如同步用户配置

向亲戚转账 订购药品

淘点东西 或者开关家里或公司里的

电视 炉子或者闹钟

所有这些都通过发往你应用的

正确填写的邮件信息实现

想像一下 先给你妈妈发邮件 然后向你的房子发邮件

让它把灯关了 因为你早上赶着去机场

是不是很厉害

自动处理也是可以升级的

实现在很短的时间内同时处理成百上千的邮件

然后执行这些请求

现在 这已经非常像一个 C/S 模型了

如果你熟悉的话

话说回来 我们怎么才能通过10行以内的代码实现这些呢

有了GAE的帮助

你不需要了解硬件

操作系统 网络编程

数据库 最重要的是 你甚至不需要了解email服务器

同样的 Python能够让你用很少的代码实现很多的功能

Python的语法非常简单 即使你不知道Python

你也可以跟着指南做 然后

用你喜欢的语言去实现

还有 虽然这个视频是面向初学者的

但是我们不准备向你介绍如何在GAE上开发

所以如果你没接触过的话 去看网站上的新手指南

然后你就清楚了

准备好了之后 创建一个Hello Worldd的app

不管是用你下载GAE时的启动器

还是从指南中复制的代码

我们将从这儿开始

我们只需要修改配置文件 app.yaml

和主要的控制文件main.py

不管你信不信 搭建这个app只需要几步而已

首先 创建模版应用

完成

第二步 启用接收email

只需要改下配置

第三 导入email处理库

第四 添加调用这个库的代码

最后 链接所有emai消息到那个

第四步中写的处理器上

步骤二只是一个配置的修改 对吗

所以 添加这两行红色的代码

到你的配置文件app.yaml中

这是一个新的功能 入站服务

在处理器功能之上运行

GAE提供许多入站服务

这里我们只关心email相关的

这就是我们需要做的

这样之后

你的应用现在能够接收邮件

其他的代码改动

只涉及控制器 也就是main.py 现在我们看一下

现在我们导入GAE中处理邮件的组件

对了 我们替换掉了文件顶部

自动生成的注释

这样更便于看代码

现在加上这两行红色的代码

第一行是导入logging

我们在原型中要做的

就是记录下应用接收到的邮件信息的发送方

当然你可以实现更多的功能 但是我们才刚开始

第三行导入了GAE处理邮件接收的代码

这你应该能猜得出

那为什么按这样的顺序导入文件呢

这是Python的推荐做法

像logging这样系统级的导入优先

其次是第三方库 比如这里的webapp2

接下来是本地SDK工具 比如GAE的API

最后 如果你要使用一些本地模块的话 这些最后导入

现在 我们来处理收到的邮件

这通过添加这个三行的控制类实现

这个receive方法提取发送方地址并打印它

你也可以获取其他的邮件属性

因为为了改变世界

你要使用其他所有的东西

比如邮件对象和内容

还有接收方和发送方的邮箱地址

最后一步 重定向所有的入站邮件请求

到那个我们刚刚添加的控制器上

当别人访问你的应用时

看见了Hello World 你觉得这是怎么实现的呢

第14行 它把发往首页的请求跳转到

那个5~7行的MainHandler类

仔细看一下13~16行那个

作为转发表的应用变量

每个路径都是(path-handle)这样二元组的形式

所以我们需要为进站邮件添加点东西

当GAE处理入站邮件

消息就会被发送到你的应用上的某个指定路径

也就是/_ah/mail/emailaddress这样的形式

既然我们要用同一个处理器处理这些邮件

我们需要使用一个正则表达式

匹配所有这样的地址 因此我们使用了(.+)

用于重定向到邮件处理器

对了 别忘了第14行末尾的逗号

这也就是这行被标红的原因

否则的话 就会报错

我刚刚帮你解决了一个面试问题

高兴去吧

这就是全部要做的了

不算导入语句和空行的话

我们只用差不多10行代码完成了所有工作

如果你非常严格

而且认为那个转发表只是一个简单的Python语句的话

那么就只有7行了

如果你只计算我们添加的代码的话

那么就只有6行了

天哪

这就是一个完整的可以实现基本功能的应用了

我们没有创建一个web应用 除非你算上那个Hello World字符

我们也没有创建一个Android或者iOS移动客户端 对吗

但是你也可以去做

通过使用Google Cloud Endpoints

你可以点开上面的视频观看

好了

现在我们启动它

GAE的SDK自带了一个部署服务器 或开发服务器

你可以在把你的应用发布到Google上之前

在本地运行调试它

不管你是通过启动器 还是通过命令行

在本地运行你的应用之前

请确保你已经记下了应用的端口号和管理员控制台的端口号

因为我们都要用到

用你的浏览器访问localhost:8080

你就会看到控制器输出了Hello World

因为我们在开发模式 所以你只能模拟发送邮件

通过访问控制台的开发服务器

所以现在用别的端口(8000)访问你的浏览器

到了这步

我们实际需要的就是左边栏里的入站邮件链接

点开它 你就会看到这个用来发送模拟邮件的表单

在这之前 我来说一下我们首先要发送的是什么

你要清楚你需要验证每一条邮件

因为你需要确保每个请求都是真的

不是垃圾邮件 也不是虚假邮件

最重要的 不是被劫持的邮件

这样的话 未认证用户发来的没有遵守你的服务条款的

非法邮件

比如一个短语密码或者两个元素验证

或者只是没有正确构造的

就会被丢弃或者被记录下来

在这里的邮件正文中 你可以看见

我们有许多的工具可以用来达成这个目的

如果我们在构建多个原型

好的

业务逻辑就是这样

下面我们讲一下发送邮件

GAE的应用会接收所有发送到

xxx@APP_ID.appspotmail.com这样地址的邮件

这里的xxx是收件人 你的应用ID就是主机名

确保在域名中使用appspotmail而不是appspot.com

在这个例子中 我们假装已经为我们的新闻小组

创建了完善的服务 让他们能够

通过简单的命令发布新闻

我们使用发布命令

接收邮件的是我们虚假的应用ID

对了 这是我找到的的别人的应用

所以在生产模式下

不要发送东西到那个地址

在开发模式中 这是没关系的

因为实际上并没有邮件被发送

一旦你点击了发送 并且受到了请求成功的消息

检查一下你的打印日志 确认一下你的处理器被调用了

点击启动器上的记录按钮

或者查看发送到控制台的命令行消息

你会看到 已收到一条消息

来自那个你设置的虚拟地址

在生产模式下运行之前还需要做一些事情

请确保你已经把那个唯一的ID

配置在了app.yaml文件里

然后去启动器 点击发布按钮

你的代码就会在验证之后被发布到Google上

也可以使用命令行工具

应用上线以后

你只需在浏览器中访问yourappID.appspot.com

看看是否有Hello World页面 确认是否已经生效

就像我们在开发服务器上做的一样

现在 打开你最喜欢的邮件客户端

向你的应用发送一条真正的邮件

同样的 你需要发送到xxx@yourappid.appspotmail.com这样的地址

然后去你在cloud.google.com/console上应用控制台

选择你的应用

点击左边栏上的App Engine

点击App Engine自菜单中 点击logs

你就会在屏幕中看到你想要的

你的邮件处理器的

打印日志

真棒

我们接下来要做什么呢

如果你想跳过编码

直接看源码的话 点击这个链接

下载压缩文件

或者 你想要一步步实现的话

在GAE的核心Python应用编程中

你可以找到一个手把手的教程

总而言之

我们刚刚一起创建了一个GAE的Python应用

这个应用能够接收邮件

不到10行代码

现在轮到你改变世界了

说真的 你已经拥有了开启一个新的事业的素质了

继续做吧 在Google云平台上走上人生巅峰

感谢收看

Youtube
Youtube
加入 GDG 字幕组
video_screenshot