...
1.5. Khi nào thì nên sử dụng UDP
Rất nhiều ứngdụng trên Internet sử dụng UDP. Dựa trên các ưu và nhược điểm của
UDP chúng ta có thể kết luận UDP có ích khi:
Sử dụngcho các phương thức truyền ...
ds.close();
Khi xử lý gói tin ứngdụng phải làm việc trực tiếp với một mảng byte. Tuy nhiên nếu
ứng dụng là đọc văn bản thì ta có thể sử dụng các lớp từ gói vào ra để chuyển đổi giữa
mảng byte ... ta đã đề cập tới việc càiđặt các chương trình
UDP trong Java bằng cách sử dụng hai lớp DatagramPacket và DatagramSocket. Một số
chương trình mẫu cũng được giới thiệu để bạn đọc tham khảo và...
... this point we’ve finished with what we consider our basic introduction to the
SDK
.
Since this is an introductory
SDK
book, it’s been our main goal to show you all the fun-
damentals before ... our introduction to the iPhone
SDK
, we’re not done yet.
We’re going to finish this book by looking at some of the neat tools that are available
inside the
SDK
, including a look at internet-related ... blocks that you need when you begin programming on your own.
To briefly review them all:
■
The
SDK
is built on top of Objective-C and is supported by a large set of frame-
works called the iPhone...
... You’re
placing buttons on the toolbar that call three methods:
choosePic:
,
takePic:
(when
a camera’s available), and
savePic:
.
choosePic:
C
and
takePic:
D
are similar methods. Each ... integrated into the rest of
your application, it’s a pretty good choice—it often works well for video, but it’s a
somewhat more questionable choice for audio.
The Media Player framework includes two ... select
photographs? That’s the topic of our next section.
18.3 Accessing photos
You can use the
SDK
to access pictures from an
iPhone’s photo library or its camera roll. You can also
allow...
... within a graphical context. You only
“paint” a path when it’s complete, at which point you can choose to either fill it or
stroke it.
Many of the functions required to define and draw paths ... variables
B
391An introduction to Core Animation
There are two other ways that you can draw using the
SDK
: Core Animation and
Open
GL
. We don’t have the space in this introductory book to give full-length ...
array
Applies the transformation
392
C
HAPTER
19
Graphics: Quartz, Core Animation, and OpenGL
include
anchorPoint
,
backgroundColor
,
opacity
,
position
,
transform
, and several
others. This means...
... a better choice when you’re interacting
C
422
C
HAPTER
20
The web: web views and internet protocols
with the internet already, but when you need to use other
SDK
features, the
SDK
offers ... design an
SDK
web app, not an
HTML
-based web app, and
now you need to know how to do so.
In this chapter, we’re going to cover the major ways to access the internet from the
SDK
. You can ... Maps’ presentation will slowly improve
through future releases of the
SDK
.
Debugging
We haven’t talked about debugging your SDK program much in this book, primarily
for reasons of space. Here’s...
... that’s mostly iPhone
discussion
iDevKit http://idevkit.com/ Forums and news
iPhone Dev SDK http://www.iphonedevsdk.com/ Forums
iPhone Development http://iphonedevelopment.
blogspot.com/
Blog with ... mechanism special-
ized for searches
UISegmentedControl UIControl
A control for making one of sev-
eral choices
UISlider UIControl
A control for setting discrete
values
Table A.1 A listing of the most ...
CSR
, download a certificate, and download a provisioning
profile. From that point, the member can choose to compile onto a device rather than
to the iPhone Simulator by changing the pop-up window...
...
these functions until we discuss the
SDK.
In the next chapter we’ll look at more of the differences between web develop-
ment and the SDK so that you can better choose which of them to use for any ... command,
CSS tricks, and other methods in chapter 3.
And for SDK developers: note this is an issue for you as well, since the SDK s
UIWeb-
View
class scales the screen just like mobile Safari ... Chapter 14
explains how to use touches, events, and actions in the
SDK. Even though some things
will be taken care of for you, as an SDK developer you’ll still need to change your way
of thinking...
... apps Web Chapters 4–6, 8
Dashcode Web Chapter 7
SDK native apps SDK Chapters 10–19
SDK web apps SDK Chapter 20
28 CHAPTER 2 Web development or the SDK?
and to bootstrap you up to the point where ... well.
25Integrated iPhone development
THE SDK CONTINUUM
SDK development is even more of a continuum than web programming. As you learn
more about Apple’s
SDK frameworks, you’ll gradually add new ... pro-
gram with. Nonetheless, we’ve outlined two broadly different sorts of SDK programming.
SDK native apps are those SDK applications that make use only of the iPhone itself, not
the internet...
... Dashcode, the topic of chapter 7.
SDK docs. The SDK docs are available at http://developer.apple.com/iphone/.
We’ll talk about them in greater depth when we get to the SDK, in chapter 10.
There’s ... able to
choose whether to have status-like bars or bottom bars depending on the needs of
your program. Once you’ve made a choice, you can just pick the right class of objects
from the SDK and ...
already used in the SDK s
UIWebView
class).
We also saw our first hints at core iPhone functionality: the chrome and events.
The chrome will be a minor issue when you’re doing SDK development....
... than in
the SDK at the time of this writing. The SDK s SQLite is covered in chapter 16.
The WebKit’s touch event handling is another element that we’ll see closely mirrored
in the SDK. Both use ... a SDK
programmer, since under the SDK an event will always contain the touches that trig-
gered it. The WebKit’s gesture abstraction saves programmers some time; it’s not
available in the SDK, ...
Lessons for SDK developers
Engineers at Apple have been leading the charge in the design of the WebKit. It’s here
that we really start to see commonalities between WebKit and SDK development...
... class="group">Entered <? echo $recent[$i][entrydate]; ?>
<?
}
$lastdate = $recent[$i][entrydate];
?>
<li>
<a href="display-entry.phtml?mainid=<?
echo $recent[$i][mainid]; ... $recent[$i][mainid]; ?>" target="_self"><?
echo $recent[$i][title]; ?></a>
<i><? echo $recent[$i][authors]; ?></i>
<?
}
?>
</ul>
</body>
[XHTML?]
You ...
opportunity arises to do something cool.
Lessons for SDK developers
Although iUI is a web-only library, it provides some of the best insights into SDK de-
velopment, primarily because Joe Hewitt did...
... overlap.
lighter
Blending choice Where the shapes overlap, the color value is added.
darker
Blending choice Where the shapes overlap, the color value is subtracted.
xor
Blending choice Where the shapes ... of each other.
Value Type Summary
source-over
Stacking choice New shapes are drawn on top of existing content.
destination-over
Stacking choice New shapes are drawn behind existing content.
copy
New ... offer an interesting (if orthogonal) way to cre-
ate web apps.
Lessons for SDK developers
When you start using the SDK, you’re going to have access to a few different drawing
libraries. One...
... for SDK developers
As with the WebKit, Dashcode is being managed at Apple and thus shares a lot of its
design sense with the SDK. Although Dashcode itself will never be of direct use for
an SDK ... Dashcode’s parts, such as the lists, should look quite familiar to SDK de-
velopers, as they match up with the same ideas used in the SDK. But it’s probably
Dashcode’s concept of a variety of pages ... controller
(the
stackLayout
) that is most important for SDK developers. This matches not only
the MVC architectural model, which is core to the SDK and which we’ll meet in a couple
of chapters,...
... Simulator comes as part of the iPhone SDK, but even if you’re not
planning to do any SDK programming, it might be worth getting the current version
of the
SDK (though the download is quite large, ... an important consideration in profiling. The iPhone’s
Lessons for SDK developers
In all honesty, we don’t have much for you SDK developers this time. Most of our dis-
cussion in this chapter ... with SDK development. The only point of particular
relevance is the section on iPhone profiling.
Thinking about energy consciousness is going to be even more important when we
get into SDK...
... provides a
development platform for doing this sort of programming called the
SDK (software
development kit). The SDK includes a set of tools, frameworks, and templates that
we’ll meet fully ... 154
SDK programming
for web developers
We’ve spent the last six chapters talking about how to program ... languages
■
Object-oriented programming languages
■
The MVC architectural pattern
158 CHAPTER 9 SDK programming for web developers
9.1.3 File structure and directives
When you look at the file...