Monday, October 28, 2013

Both the Mac and iOS versions get overhauls

Both the Mac and iOS versions get overhauls
Probably the most noticeable change, beyond new icons, is the general UI redesign that both the Mac and iOS versions of iLife and iWork have received. On iOS especially it’s clear to see iOS 7 influences here and there, and gone is the chintz that made the iPhone and iPad apps in particular feel a little dated.
iWork family
The beauty here is definitely more than skin deep though.
Under the hood, all iOS iWork and iLife apps are now 64-bit, making them the perfect partner not just for iOS 7, but for the iPhone 5s, iPad Air and iPad mini devices.
GarageBand received a sizeable update on both platforms too, with the iOS version now allowing users to include up to 16 tracks in a project – an increase on the 8 that were previously supported. In fact, those with 64-bit devices will be able to knock that up to 32 tracks.
Apple also made a big deal of iWork and iLife’s iCloud interoperability, with iCloud syncing making real-time collaboration a possibility as well as ensuring that the latest versions of your documents and projects are always with you.
iWork Mac
On the Mac, Pages and Numbers have received some new features. Pages for example now features a context sensitive side panel that will change depending on what is required of it, and Numbers can now offer interactive charts to those that want them. New animations and the like are also worthwhile additions, if a little mundane.
Less mundane is the new Drummer feature in GarageBand for the Mac. As the name might suggest, Drummer offers musicians an array of drum profiles with more available to buy as an in-app purchase should the need, or want, arise.
Both the iWork and iLife suites have been updated today and are currently rolling out to App Stores worldwide. Both are also free with the purchase of a new Mac or iOS device. If you don’t fit into either of those categories, and haven’t bought the apps in the past, then you’re going to need to pay, unfortunately.
If you’re a heavy user of either suite of apps though, you’ll want to get the updates sooner, rather than later.

1.3. Sub-activities

1.3. Sub-activities

Activities which are started by other Android activities are called sub-activities. This wording makes it easier to describe which activity is meant.

1.2. Starting activities

1.2. Starting activities

To start an activity use the method startActivity(intent). This method is defined on theContext object which Activity extends.
The following code demonstrates how you can start another activity via an intent.
# Start the activity connect to the
# specified class
ntent i = new Intent(this, ActivityTwo.class);
I
tartActivity(i);
s

Intents and intent filter

1. Intents and intent filter

1.1. What are intents?

Intents are asynchronous messages which allow application components to request functionality from other Android components. Intents allow you to interact with components from the own and other applications. For example an activity can start an external activity for taking a picture.
Intents are objects of the android.content.Intent type. Your code can send them to the Android system defining the components you are targeting. For example via the startActivity() method you can define that the intent should be used to start an activity.
An intent can contain data via a Bundle. This data can be used by the receiving component.

Mac OS X JDK Installation

Mac OS X JDK Installation

The Java SE 6 environment or a more recent version should already be installed on the latest Mac OS X versions. To confirm the version that is installed, open a Terminal window and enter the following command:
java -version
Assuming that Java is currently installed, output similar to the following will appear in the terminal window:
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

In the event that Java is not installed, issuing the “java” command in the terminal window should initiate the JDK installation process. 

Windows JDK Installation

Windows JDK Installation

For Windows systems, the JDK may be obtained from Oracle Corporation’s website using the following URL:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Assuming that a suitable JDK is not already installed on your system, download the latest JDK package that matches the destination computer system. Once downloaded, launch the installation executable and follow the on screen instructions to complete the installation process. 

Installing the Java Development Kit (JDK)

Installing the Java Development Kit (JDK)

Both the Eclipse IDE and Android SDK were developed using the Java programming language. Similarly, Android applications are also developed using Java. As a result, the Java Development Kit (JDK) is the first component that must be installed.

Android development requires the installation of the Standard Edition of the Java Platform Development Kit version 6 or later. Java is provided in both development (JDK) and runtime (JRE) packages. For the purposes of Android development, the JDK must be installed. 

System Requirements

System Requirements

Android application development may be performed on any of the following system types: 

  • Windows XP (32-bit)
  • Windows Vista (32-bit or 64-bit)
  • Windows 7 (32-bit or 64-bit)
  • Windows 8
  • Mac OS X 10.5.8 or later (Intel based systems only)
  • Linux systems with version 2.7 or later of GNU C Library (glibc) 

Virtual Execution System (VES)

Virtual Execution System (VES)

The VES (usually referred to as the runtime) is the environment in which the CIL byte code is executed. The VES reads the byte code generated by the C# compiler and uses something called a Just in Time (JIT) compiler to compile the byte code down to the native machine code of the processor on which it is running. While this code is executing it does so in conjunction with a runtime agent which essentially manages the execution process. As a result, this executing code is known as managed code and the process handles issues such as garbage collection (to handle memory allocation and de-allocation), memory access and type safety to ensure that the code does not do anything it is not supposed to do.
A term that is often used in connection with the VES is the Common Language Runtime (CLR). The CLR is officially the name given to Microsoft's implementation of the VES component of the CLI specification.

It is worth noting that the JIT process can introduce a startup delay on execution of an application. One option available with .Net to avoid this problem is to pre-compile CLI byte code down to native machine code using the NGEN compiler. Because the NGEN compilation must take place on the target processor architecture this step is often performed at the point that the application in question is installed by the user. 

The Framework (Base Class and Framework Class Libraries)

The Framework (Base Class and Framework Class Libraries)

The CLI specifies a set of base classes that must be available to executing CLI code, otherwise known as the Base Class Library (BCL). The BCL contains APIs that enable executing CIL code to interact with the runtime environment and the underlying operating system.

Beyond the basics there is also the Framework Class Library. This is a Microsoft library which contains APIs for the creation of graphical user interfaces, database applications, web access and much, much more. 

Common Type System (CTS) & Common Language Specification (CLS)

Common Type System (CTS) & Common Language Specification (CLS)

As mentioned previously a number of different programming languages target the CLI allowing, for example, code from C# sources to interact with code from Visual Basic. In order to achieve this feat, each language must have the same concept of how data types are stored in memory. The CTS, therefore, defines how a CLI compatible language must view the bit patterns of values and layout and behavior of objects to ensure interoperability.
The CLS is essentially a subset of the CTS aimed at creating interoperable libraries

Thursday, October 24, 2013

Android 4.0 for Users

Android 4.0 for Users


Simple, beautiful, beyond smart

Android 4.0 builds on the things people love most about Android — easy multitasking, rich notifications, customizable home screens, resizable widgets, and deep interactivity — and adds powerful new ways of communicating and sharing.
Refined, evolved UI
Focused on bringing the power of Android to the surface, Android 4.0 makes common actions more visible and lets users navigate with simple, intuitive gestures. Refined animations and feedback throughout the system make interactions engaging and interesting. An entirely new typeface optimized for high-resolution screens improves readability and brings a polished, modern feel to the user interface.
Virtual buttons in the System Bar let users navigate instantly to Back, Home, and Recent Apps. The System Bar and virtual buttons are present across all apps, but can be dimmed by applications for full-screen viewing. Users can access each application's contextual options in the Action Bar, displayed at the top (and sometimes also at the bottom) of the screen.

Ice Cream Sandwich

Ice Cream Sandwich

Welcome to Android 4.0!
Android 4.0 delivers a refined, unified UI for phones and tablets and introduces innovative features for users and developers. This document provides a glimpse of the many new features and technologies that make Android 4.0 simple, beautiful, and beyond smart.

Cocoa Frameworks

Cocoa Frameworks

Cocoa is an extremely productive high-level programming environment that gives you complete access to the full power of the operating system, including the signature Mac look and feel. Written in the dynamic Objective-C language, Cocoa provides exciting and animation-rich user experiences, but is easy to augment with your custom behaviors. With integrated support for the Model-View-Controller pattern, Cocoa provides a solid foundation for building state-of-the-art applications. With the Interface Builder tool, it is both easy and fun to drag-and-drop Cocoa controls to design your app’s user interface.

Develop for OS X

Develop for OS X

OS X is the world’s most advanced operating system, built upon a proven UNIX foundation and coupled with a GPU-accelerated desktop, intuitive networking services, and system-wide optimization for multicore CPUs. Along with the Xcode developer toolset, you have a powerful platform upon which to create engaging, innovative, and high-performance apps.

What exactly is C#?

What exactly is C#?

"What does all this history have to do with C#?" I hear you ask. Well, the origins of the C# programming syntax can be traced right back to C and C++. If you are already familiar with C or C++ then you have a big head start in terms of learning C#. In fact the same can be said of syntax similarities between Java, C, C++ and C# syntax. In addition, C# also inherits many of the benefits of Java in terms of memory handling (better known as garbage collection) and an intermediate byte code that negates the need to recompile an application for each target hardware platform. C# is also accompanied by a vast framework of libraries designed to provide the programmer with readymade solutions to just about every imaginable scenario.
Despite these similarities there are differences between the Java and C# infrastructures. The remainder of this chapter will be dedicated to providing an overview of the C# infrastructure.

1.3. Adapters

1.3. Adapters

An adapters manages the data model and adapts it to the individual rows in the list view. An adapter extend the BaseAdapter class.
Every line in the list view consists of a layout which can be as complex as you want. A typical line in a list view has an image on left side and two text lines in the middle as depicted in the following graphic.
Listview example layout
A layout file for a such a line might look like the following.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:padding="6dip" >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentTop="true"
        android:layout_marginRight="6dip"
        android:contentDescription="TODO"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:id="@+id/secondLine"
        android:layout_width="fill_parent"
        android:layout_height="26dip"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@id/icon"
        android:ellipsize="marquee"
        android:singleLine="true"
        android:text="Description"
        android:textSize="12sp" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/secondLine"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_alignWithParentIfMissing="true"
        android:layout_toRightOf="@id/icon"
        android:gravity="center_vertical"
        android:text="Example application"
        android:textSize="16sp" />

</RelativeLayout> 
The adapter would inflate the layout for each row in its getView() method and assign the data to the individual views in the row.
The adapter is assigned to the ListView via the setAdapter method on the ListView object.
Filtering and sorting of the data is handled by the adapter. You need to implement the logic in your custom adapter implementation.

1.2. Using lists in Android

1.2. Using lists in Android

Android provides the ListView or ExpandableListView classes which is capable of displaying a scrollable list of items. ExpandableListView supports also a grouping of items. The items in the list can be of any type.
An adapter is used for managing the items in the list (the data model or data source).

1. Android and Lists

1. Android and Lists

1.1. Using lists in Android

The display of elements in a lists is a very common pattern in mobile applications. The user sees a list of items and can scroll through them. Such an activity is depicted in the following picture.

Listview example

Typically the user interacts with the list via the action bar, for example via a refresh button. Individual list item can be selected, this selection can update the action bar or can trigger a detailed screen for the selection. The following graphic sketches that on the selection of a list item another application is started.

Listview example

iOS SDK Support

iOS SDK Support

  • Xcode cannot launch your app on a device for debugging after you install the iOS 3.x device debugging support component.
    Unplug and plug-in your device to your Mac, and ensure that you build your app for the armv6 architecture. 10538662

Editing Source Code

  • Xcode doesn’t show code-completion suggestions when there are mismatched braces.
    Turn on the “Automatically insert closing "}"” option in text editing preferences to reduce the number of mismatched braces. 10775381

Debugging

  • Some debugger commands and log expressions in breakpoints fail when using the LLDB debugger because Xcode uses the wrong frame when executing the debugger command or evaluating the log expression.
    If you know what thread the the debugger command or log expression must run relative to, add a breakpoint action that sets the current frame to the appropriate one before the breakpoint action with the problem. 10426977

Debugging: LLDB

  • The variables pane in the debug area does’t display correctly the child values of variables with dynamic types (Objective-C object pointers and virtual C++ pointers).
    Use the console pane in the debug area: enter the commands frame variable *self or frame variable *this to the values.10658091
  • LLDB cannot be used to debug apps on devices running iOS 3.x or iOS 4.x.
    Set GDB instead of LLDB as the debugger in the scheme that builds your app. 10776590

Performance Measurement and Analysis

  • When there are more than one Xcode releases installed on your Mac, Xcode 4.3 may not find your app’s symbols when displaying crash reports and the trace data for instruments.
    To enable Instruments to find your app’s symbols when displaying trace data:
    1. In Instruments, choose File > Re-symbolicate Document.
    2. Search for you app’s name, and locate it in your app’s build directory, such as ~/Library/Developer/Xcode/DerivedData/<MyApp>. 10552213
  • You cannot run System Time Profile from the Instruments icon in the Dock by Control-clicking the icon and choosing System Time Profile.
    Control-click the Instruments icon in the Dock, and select the Allow Tracing of Any Process option. 10755622

Source Control and Snapshots

When Xcode attempts to authenticate Subversion repositories that require approval of a server certificate, one or more svn processes hangs.
Authenticate the server in Terminal.

Xcode 4.3 Release Notes

Xcode 4.3 Release Notes

Resolved Issues

General

  • Xcode crashes when dragging tabs in full-screen mode. 9987358
  • Xcode crashes when opening multiple workspaces that contain the same folder reference (blue folder). 10079252

Installing

  • Installing Xcode on OS X v10.7.3 or later breaks the Xcode 4.3 Instruments app. 10619572

Editing User Interfaces

  • After enabling autolayout in a nib file, the wrong constraints are applied. 8201103
  • When resizing views that use autolayout, Xcode applies constraints to the descendants of the view being resized, but not to its siblings and ancestors. 9450655
  • Xcode doesn’t allow constraints with negative values. 9717632
  • When you create a user constraint, Xcode removes redundant constrains, which is not always desirable. 9794979
  • You cannot add width and height constraints to top-level views. 9877773

Building

  • Xcode imports incorrect header in projects containing targets that produce different header files with the same name. 8201103
  • A build may hang if Xcode encounters a build error and the “Continue building after errors” option in general preferences is turned on. 10642885

Known Issues

General

  • The App Store app cannot install Xcode in the /Applications directory because there are beta releases of Xcode in that directory.
    Do not install beta releases of Xcode in the /Applications directory. 10824869

Editing Core Data Models

Editing Core Data Models

  • MobileMe syncing support is deprecated. However, the syncable property is still set to YES by default in the User Info Dictionary for entities and properties, but the model editor doesn’t show this setting. 10787672
    To explicitly set syncable to NO for an entity or a property, add a key/value pair in your User Info Dictionary:
    1. Select the entity or property for which you want to turn off synching on a model file.
    2. In the User Info section in the Data Model inspector, add this key/value pair:

      key
      "com.apple.syncservices.Syncable"
      value
      "NO"

Localization

  • When you select the Use Base Internationalization option in the project editor, Xcode generates strings files for each your project’s user interface documents. 11462724
    To resynchronize your strings files with new content from your user interface documents, use the --generate-strings-file option of the ibtool command to produce new strings files. Then, manually merge the new files into your existing localized strings.

Debugging: LLDB

  • The po, print, and expression commands cannot access enumerators directly. You must use the name of the enumeration. 11485295
    For example, if your code contains enum MyEnum { e1, e2 };, LLDB emits an error if you type print e1. Instead type, print MyEnum::e1.

Autolayout: Runtime

  • At runtime, when adding subviews to a split view while loading both views from nib files, you may see log messages about unsatisfiable constraints because of autoresizing mask constraints on the split view panes. These are benign log messages because a split view automatically fixes the problem after adding the subview. 11614767
    In your code, before adding the subview to the split view, send setTranslatesAutoresizingMaskIntoConstraints:NO to the subview.

Xcode 4.4 Release Notes

Xcode 4.4 Release Notes


New Features

General

  • You can drag file, directory, and group icons from the jump bar to the project navigator, a Finder window, and other apps. 7452760
  • The Use Base Internationalization setting in the project editor works only on Mac products for deployment on OS X v.10.8 and later. Xcode must also be running on OS X v.10.8 or later. This setting is not supported on iOS projects. 11712855

Editing Source Code

  • The source editor can remove trailing whitespace at the end of a line after you have edited it. You control this behavior with the “Automatically trim trailing whitespace” option in Text Editing preferences. 2535591
  • When the “Automatically insert closing braces” option in Text Editing preference is turned on, as you type an opening parenthesis, brace, or quotation mark, the source editor adds the corresponding closing character. When the “Enable type-over completions” option is turned on, the editor adds the closing character in a state in which you can type over the character. This feature reduces the appearance of duplicate closing characters, such as when you type both the open and close characters quickly. 3780948
    Press Tab to jump over the closing character.

Compiling: ARM

  • LLVM integrated assembler for ARM. This new assembler improves compilation times for iOS products, and provides better user level diagnostics for ARM assembly code. This assembler uses only Unified Assembly Language (UAL) assembly code; therefore, you may need to update projects that use manually generated assembly code. 9136376
    Use the clang -no-integrated-as command-line option in projects with substantial Divided Syntax assembly code while transitioning to UAL.

Enhancements

Editing Source Code

  • During a code completion interaction, Xcode gives higher priority to completions you have used recently. 9790948

Editing Property Lists

  • You can view and modify the root object of a custom property list file. 8635494

Creating Projects

  • When creating a project, you can choose whether to add it to a workspace or create a standalone project. 8032086

Resolved Issues

Editing User Interfaces

  • When you hold down Option and place the pointer over views in the canvas, the distance values are not obscured by other elements, such as the resizing handles. 8204499

File System

  • You can rename a file just by changing the case of one of the letters in its filename, even on a case-insensitive file system. 7846036

New Issues


General

  • A failure to rebuild precompiled header (PCH) files causes syntax highlighting, code completion, and Command+click navigation to behave incorrectly. 11538640
    Delete the PCH index folder.
  • Xcode may not show any windows when it’s launched. This happens when you download Xcode from https://developer.apple.com and the “Close windows when quitting an application” preference in System Preferences is unselected. 11865559
    Switch to another app and relaunch Xcode.

Editing Source Code

  • Text and font rendering on OS X v10.8 is optimized for Retina display. On a non–Retina display running OS X v.10.8, some font configurations can appear blurry in Xcode. 11486875
    Switch back to non–Retina display optimized text and font appearance in Xcode by entering this command in Terminal:
    defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled -bool YES

Tuesday, October 22, 2013

API Overview

API Overview


Android 2.3.4 provides the same framework API to applications as Android 2.3.3 (API level 10). For a summary of the API, see the Android 2.3.3 version notes.

Open Accessory Library


Open Accessory is a new capability for integrating connected peripherals with applications running on the platform. The capability is based on a USB (Universal Serial Bus) stack built into the platform and an API exposed to applications. Peripherals that attach to Android-powered devices as accessories connect as USB hosts.
Open Accessory is introduced in Android 3.1 (API level 12), but is made available to devices running Android 2.3.4 by means of an optional external library, the Open Accessory Library. The library exposes a framework API that lets applications discover, communicate with, and manage a variety of device types connected over USB. It also provides the implementation of the API against parts of the Android platform that are not directly exposed to applications in Android 2.3.4.
The Open Accessory Library is optional on any given device. Device manufacturers may choose whether to include the Open Accessory Library in their products or exclude it. The library is forward-compatible with Android 3.1, so applications developed against Android 2.3.4 will run properly on devices running Android 3.1, if those devices support USB accessories.
The API provided by the Open Accessory Library is based on the Open Accessory API provided in Android 3.1. In most areas, you can use the same techniques and APIs. However, developing for the Open Accessory Library on Android 2.3.4 differs from the standard USB API in these ways:
  • Obtaining a UsbManager object — To obtain a UsbManager object when using the add-on library, use the helper method getInstance() rather than getSystemService() For example:
    UsbManager manager = UsbManager.getInstance(this);
  • Obtaining a UsbAccessory from a filtered intent — When you filter for a connected device or accessory with an intent filter, the UsbAccessory object is contained inside the intent that is passed to your application. If you are using the add-on library, you can get the UsbAccessory object in the following manner:
    UsbAccessory accessory = UsbManager.getAccessory(intent)
  • No USB host support — Android 2.3.4 and the Open Accessory Library do not support USB host mode (for example, through UsbDevice), although USB host mode is supported in Android 3.1. An Android-powered device running Android 2.3.4 can not function as a USB host. The library enables the Android-powered device to function as a peripheral only, with the connected accessory functioning as USB host (through UsbAccessory).
To develop apps using the Open Accessory Library, you need:
  • The latest version of the Android SDK tools
  • The latest version of the Google APIs add-on, which includes the library itself (for linking)
  • An actual hardware device running Android 2.3.4 (or Android 3.1) with USB accessories support, for runtime testing against connected devices
For a full discussion of how to develop applications that interact with USB accessories, please see the related developer documentation.
Additionally, developers can request filtering on Google Play, such that their applications are not available to users whose devices do not provide the appropriate accessory support. To request filtering, add the element below to the application manifest:
<uses-feature
  android:name="android.hardware.usb.accessory"
  android:required="true">

Android 2.3.4 APIs

Android 2.3.4 APIs

IN THIS DOCUMENT

  1. API Overview
  2. Open Accessory Library
  3. API Level

REFERENCE

  1. API Differences Report »
API Level: 10
Android 2.3.4 (GINGERBREAD_MR1) is a maintenance release that adds several bug fixes and patches to the Android 2.3 platform, without any API changes from Android 2.3.3. Additionally, Android 2.3.4 brings support for the Open Accessory API to mobile devices, through the optional Open Accessory Library.
For developers, the Android 2.3.4 platform is available as a downloadable component for the Android SDK. The downloadable platform includes an Android library and system image, as well as a set of emulator skins and more. To get started developing or testing against Android 2.3.4, use the Android SDK Manager to download the platform into your SDK.

Xcode 4.0 Developer Preview 6 Release Notes

Xcode 4.0 Developer Preview 6 Release Notes

New Features

Performance Measurement and Analysis

  • There is new command-line tool for measuring an application’s performance without launching the Instruments application: iprofiler. After making the measurements, you can analyze them with Instruments. A new framework, DTPerformanceSession (located in/Library/Developer/4.0/Instruments/Frameworks) allows your application to create performance measurements of itself or other applications. 7773305

Enhancements

General

  • In the Manage Schemes dialog you can specify whether to create schemes automatically with the “Autocreate schemes” option. You may want to turn off automatic scheme creation in a large workspace, where automatic scheme creation produces too many schemes. This setting is shared with all the users of the workspace.
    You can have Xcode create schemes with the Autocreate Schemes Now button. 7952053
  • You can add an Xcode archive file (.xcarchive) to the archives organizer by double-clicking it in the Finder. 8791305
  • You can use a workspace-relative location for derived data. 8242521

Task Information and Alerts

  • Enhancements to the execution of alert scripts:
    • The scripts can access the Xcode user environment variables.
    • The value of the PWD environment variable is a path to the directory that contains the current project or workspace.
    • The new XcodeAlertAffectedPaths environment variable contains a colon-separated list of full paths to the affected files. This variable replaces the IDEAlertAffectedURLs environment variable.

New Issues

New Issues

Editing Nib Files

  • Xcode disallows dragging objects in the Interface Builder canvas to the Object library. 8656363

Unit Testing

  • The unit-test command-line tools in /Developer/Tools are deprecated.
    To use unit testing in your Xcode 3 projects, set the Test After Build build setting to NO. 8803198

Known Issues

General

  • Interface Builder files with explicit Xcode 3 file types open in the source editor instead of in Interface Builder.
    Set the file type of the Interface Builder file in the Identity and Type inspector to “Default,” deselect it in the project navigator, and select it again. 8028406
  • The task log viewer is empty when you select the last build task of a project or workspace in the log navigator and the viewer is set to show only recent operations.
    Set the task log viewer to show all operations. 8350930

Editing Nib Files

  • Xcode cannot edit OS X–type Interface Builder documents comprised of objects from frameworks other than AppKit.
    You can compile and run these documents, however.