- 博客(0)
- 资源 (6)
空空如也
android-a programmer's guide
1 What Is Android? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Brief History of Embedded Device Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Open Handset Alliance and Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Introduction to Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Downloading and Installing Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Why Eclipse? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Downloading and Installing the JRE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Downloading and Installing Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3 Downloading and Installing the Android SDK . . . . . . . . . . . . . . . . . . . . . . . 21
Downloading the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Downloading and Installing the Android Plugin for Eclipse . . . . . . . . . . . . . . . . . . . . . . 24
Configuring the Android Plugin for Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4 Exploring the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
What Is in the Android SDK? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Android Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Android Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Try This: Run the API Demos Sample Application . . . . . . . . . . . . . . . . . . . . . . . . . 41
Android Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Application Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Standard ASP Application Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Android Application Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5 Application: Hello World! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Creating Your First Android Project in Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Examining the Android-Created Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
AndroidManifest.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Referenced Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Hello World! Again . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Hello World! Using an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Hello World! Code-Based UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Hello World! XML-Based UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Try This: Use TextView and ImageView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6 Using the Command-Line Tools and the Android Emulator . . . . . . . . . . . . 83
Creating a Shell Activity Using the Windows CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Running the ActivityCreator.bat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
The Project Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Creating the Hello World! Activity in the Windows CLI . . . . . . . . . . . . . . . . . . . . . . . . 95
Editing the Project Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Adding the JAVA_HOME Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Compiling and Installing the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Hello World! on Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Configuring the PATH Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Try This: Create an Image-Based Hello World! in the CLI . . . . . . . . . . . . . . . . . . . 115
7 Using Intents and the Phone Dialer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
What Are Intents? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Using the Dialer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Placing a Call from Your Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Adding the Intent to Your Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Editing Activity Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Modifying the AndroidPhoneDialer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Adding a Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Implementing an EditText View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Try This: Modify the AndroidPhoneDialer Project . . . . . . . . . . . . . . . . . . . . . . . . . . 145
8 Lists, Menus, and Other Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Building the Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Intent Code for the .xml File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Intent Code for the .java File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Modifying the AndroidManifest.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Using the Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Creating the Activity for AutoComplete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
CheckBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
EditText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
RadioGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Spinner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Try This: Modify More View Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
9 Using the Cell Phone’s GPS Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Using the Android Location-Based API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Creating a kml File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
What Is a track File? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Getting the nmea File in Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Getting the nmea File in Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Reading the GPS with the Android Location-Based API . . . . . . . . . . . . . . . . . . . . . . . . 212
Creating the AndroidLBS Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Passing Coordinates to Google Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Adding Zoom Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Try This: Toggling Between MapView’s Standard and Satellite Views . . . . . . . . . . 232
10 Using the Google API with GTalk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Configuring the Android Emulator for GTalk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Implementing GTalk in Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Creating the Activity’s Layout in the GoogleAPI.xml . . . . . . . . . . . . . . . . . . . . . 245
Adding Packages to GoogleAPI.java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Implementing the View.OnClickListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Compiling and Running GoogleAPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Try This: Add a Settings Feature to Your GoogleAPI Activity . . . . . . . . . . . . . . . . 255
11 Application: Find a Friend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Creating a SQLite Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Creating a Custom Content Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Editing the strings.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Creating Your Content Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Creating the FindAFriend Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Editing AndroidManifest.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Creating the NameEditor Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Creating the LocationEditor Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Creating the FriendsMap Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Creating the FindAFriend Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Running the FindAFriend Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Try This: Real-Time Location Updating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
12 Android SDK Tool Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Android Emulator Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Android Debug Bridge Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
2010-07-21
Linux 下的C编程基础
在LINUX中进行C语言编程的基本技能。
熟悉LINUX系统下的开发环境
熟悉Vi的基本操作
熟悉Emacs的基本操作
熟悉Gcc编译器的基本原理
熟悉使用Gcc编译器的常用选项
熟悉使用Gdb调试技术
熟悉Makefile基本原理及语法规范
熟悉使用autoconf和automake来生成Makefile
2009-12-13
O'Reilly: DNS and BIND, 4th Edition
Copyright
Preface
Versions
What's New in the Fourth Edition?
Organization
Audience
Obtaining the Example Programs
Contacting O'Reilly
Conventions Used in This Book
Quotations
Acknowledgments
Chapter 1. Background
Section 1.1. A (Very) Brief History of the Internet
Section 1.2. On the Internet and internets
Section 1.3. The Domain Name System in a Nutshell
Section 1.4. The History of BIND
Section 1.5. Must I Use DNS?
Chapter 2. How Does DNS Work?
Section 2.1. The Domain Name Space
Section 2.2. The Internet Domain Name Space
Section 2.3. Delegation
Section 2.4. Name Servers and Zones
Section 2.5. Resolvers
Section 2.6. Resolution
Section 2.7. Caching
Chapter 3. Where Do I Start?
Section 3.1. Getting BIND
Section 3.2. Choosing a Domain Name
Chapter 4. Setting Up BIND
Section 4.1. Our Zone
Section 4.2. Setting Up Zone Data
Section 4.3. Setting Up a BIND Configuration File
Section 4.4. Abbreviations
Section 4.5. Host Name Checking (BIND 4.9.4 and Later Versions)
Section 4.6. Tools
Section 4.7. Running a Primary Master Name Server
Section 4.8. Running a Slave Name Server
Section 4.9. Adding More Zones
Section 4.10. What Next?
Chapter 5. DNS and Electronic Mail
Section 5.1. MX Records
Section 5.2. What's a Mail Exchanger, Again?
Section 5.3. The MX Algorithm
Chapter 6. Configuring Hosts
Section 6.1. The Resolver
Section 6.2. Sample Resolver Configurations
Section 6.3. Minimizing Pain and Suffering
Section 6.4. Vendor -Specific Options
Chapter 7. Maintaining BIND
Section 7.1. Controlling the Name Server
Section 7.2. Updating Zone Data Files
Section 7.3. Organizing Your Files
Section 7.4. Changing System File Locations in BIND 8 and 9
Section 7.5. Logging in BIND 8 and 9
Section 7.6. Keeping Everything Running Smoothly
Chapter 8. Growing Your Domain
Section 8.1. How Many Name Servers?
Section 8.2. Adding More Name Servers
Section 8.3. Registering Name Servers
Section 8.4. Changing TTLs
Section 8.5. Planning for Disasters
Section 8.6. Coping with Disaster
Chapter 9. Parenting
Section 9.1. When to Become a Parent
Section 9.2. How Many Children?
Section 9.3. What to Name Your Children
Section 9.4. How to Become a Parent: Creating Subdomains
Section 9.5. Subdomains of in-addr.arpa Domains
Section 9.6. Good Parenting
Section 9.7. Managing the Transition to Subdomains
Section 9.8. The Life of a Parent
Chapter 10. Advanced Features
Section 10.1. Address Match Lists and ACLs
Section 10.2. DNS Dynamic Update
Section 10.3. DNS NOTIFY (Zone Change Notification)
Section 10.4. Incremental Zone Transfer (IXFR)
Section 10.5. Forwarding
Section 10.6. Views
Section 10.7. Round Robin Load Distribution
Section 10.8. Name Server Address Sorting
Section 10.9. Preferring Name Servers on Certain Networks
Section 10.10. A Nonrecursive Name Server
Section 10.11. Avoiding a Bogus Name Server
Section 10.12. System Tuning
Section 10.13. Compatibility
Section 10.14. The ABCs of IPv6 Addressing
Section 10.15. Addresses and Ports
Section 10.16. IPv6 Forward and Reverse Mapping
Chapter 11. Security
Section 11.1. TSIG
Section 11.2. Securing Your Name Server
Section 11.3. DNS and Internet Firewalls
Section 11.4. The DNS Security Extensions
Chapter 12. nslookup and dig
Section 12.1. Is nslookup a Good Tool?
Section 12.2. Interactive Versus Noninteractive
Section 12.3. Option Settings
Section 12.4. Avoiding the Search List
Section 12.5. Common Tasks
Section 12.6. Less Common Tasks
Section 12.7. Troubleshooting nslookup Problems
Section 12.8. Best of the Net
Section 12.9. Using dig
Chapter 13. Reading BIND Debugging Output
Section 13.1. Debugging Levels
Section 13.2. Turning On Debugging
Section 13.3. Reading Debugging Output
Section 13.4. The Resolver Search Algorithm and Negative Caching (BIND 8)
Section 13.5. The Resolver Search Algorithm and Negative Caching (BIND 9)
Section 13.6. Tools
Chapter 14. Troubleshooting DNS and BIND
Section 14.1. Is NIS Really Your Problem?
Section 14.2. Troubleshooting Tools and Techniques
Section 14.3. Potential Problem List
Section 14.4. Transition Problems
Section 14.5. Interoperability and Version Problems
Section 14.6. TSIG Errors
Section 14.7. Problem Symptoms
Chapter 15. Programming with the Resolver and Name Server Library Routines
Section 15.1. Shell Script Programming with nslookup
Section 15.2. C Programming with the Resolver Library Routines
Section 15.3. Perl Programming with Net::DNS
Chapter 16. Miscellaneous
Section 16.1. Using CNAME Records
Section 16.2. Wildcards
Section 16.3. A Limitation of MX Records
Section 16.4. Dialup Connections
Section 16.5. Network Names and Numbers
Section 16.6. Additional Resource Records
Section 16.7. DNS and WINS
Section 16.8. DNS and Windows 2000
Appendix A. DNS Message Format and Resource Records
Section A.1. Master File Format
Section A.2. DNS Messages
Section A.3. Resource Record Data
Appendix B. BIND Compatibility Matrix
Appendix C. Compiling and Installing BIND on Linux
Section C.1. Instructions for BIND 8.2.3
Section C.2. Instructions for BIND 9.1.0
Appendix D. Top-Level Domains
Appendix E. BIND Name Server and Resolver Configuration
Section E.1. BIND Name Server Boot File Directives and Configuration File Statements
Section E.2. BIND 4 Boot File Directives
Section E.3. BIND 8 Configuration File Statements
Section E.4. BIND 9 Configuration File Statements
Section E.5. BIND Resolver Statements
Colophon
Index
2009-05-15
MySQL中文参考手册
MySQL是一个精巧的SQL数据库管理系统,虽然它不是开放源代码的产品,但在某些情况下你可以自由使用。由于它的强大功能、灵活性、丰富的应用编程接口(API)以及精巧的系统结构,受到了广大自由软件爱好者甚至是商业软件用户的青睐,特别是与Apache和PHP/PERL结合,为建立基于数据库的动态网站提供了强大动力。
MySQL有瑞典的T.c.X公司负责开发和维护,MySQL的用户手册很单纯,只有一个集中的<MySQL Reference Manual>,但其内容覆盖了MySQL的所有信息,因此该手册是了解和掌握MySQL的绝佳文献。
虽然对MySQL的开发不能出一份力,但可为它的推广使用尽一份心,面对500多页的参考手册,知道要精确译出它决非易事,但愿几个月的心血能为大家提供一丝微薄的帮助。
由于本人水平有限,文中肯定有不准确的地方,敬请在阅读过程中不吝指出。文中不明之处,请参阅手册原文。
本文的内容针对MySQL 3.23.7alpla,实际上很多内容是通用的。另外,参考手册的几个附录也是很有价值的,但由于时间有限,未能译出,可参见原文。
2009-05-12
PHP函数集 PHP手册
Apache特定函数库 图形函数库 GNU记录函数库
数组函数库 IMAP,POP3和NNTP函数库 Perl相容正规表达函数库
拼字检查函数库 LDAP函数库 正规表达函数库
BC高精准度函数库 邮件函数库 信号与共享记忆体函数库
历法函数库 数学函数库 Session函数库
COM函数库 Mcrypt编码函数库 Shockwave Flash函数库
Class/Object函数库 Mhash函数库 SNMP函数库
日期与时间函数库 杂项函数库 字符串函数库
目录函数库 MySQL函数库 URL函数库
动态载入函数库 网路函数库 变量函数库
文件系统函数库 PDF函数库 Vmailmgr函数库
FDF函数库 信用卡交易函数库 WDDX函数库
FTP函数库 PHP选项与资讯函数库 XML函数库
GNU gettext函数库 程式执行函数库 YP/NIS函数库
HTTP函数库 Pspell函数库 压缩函数库
ICAP函数库 GNU Readline函数库
PHP4新增的部份语法
2009-05-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人