Leopard Technology Overview

June 18, 2008

Leopard is the sixth major version of Mac OS X and it will be the most advanced and powerful version yet. For users, it is full of new features and elegant user experience improvements that will make it a joy to use. For developers, things get even better. Leopard contains a cornucopia of cutting-edge new frameworks, streamlined developer tools, new application technologies, and strong system-level foundations. No matter what kind of developer we are, there’s something new in the system that will feel tailor made just for us.

An Operating System Designed for Innovation

The goal in adding so many new developer technologies into Leopard is to make it easier for us to create compelling, rich, and amazing new applications. Once upon a time, a great application was defined by the functionality it provided. Then, over time, the ease of use of an application became important—it wasn’t enough just to get the job done, it had to be easy to do so. In the last few years, the bar has been raised again. Now, a truly great application isn’t just defined by its features and how easy it is to use them, it’s also defined by how enjoyable it is to use.

By taking advantage of the technologies in Leopard, we can add that extra level of detail that makes our applications not just useful, but highly desirable. We can give them that “wow” factor that will bring our customers back to our application again and again.

Getting to Know the Leopard Technologies

These articles will take a deep look at Xcode, Objective-C 2.0, Core Animation, Image Kit, Instruments, and much more.

I’m starting the series with a broad overview of more than two dozen new and enhanced technologies, tools and APIs that are in Leopard.

Developer Tools

As a developer, the first thing we should do when we install Leopard is take a look at the new developer tools. We are in for a real treat. Apple has put a lot of time and effort into improving Xcode and Interface Builder so that it’s easier to create and maintain large projects. They didn’t stop there, however. In Leopard, Apple introduced the entirely new Instruments and Dashcode tools. Instruments will let us take a look at how our application runs like we’ve never been able to before. Dashcode lets us build Dashboard widgets in no time flat.

Xcode 3.0

Xcode is Apple’s Integrated Development Environment (IDE) for creating any code for Mac OS X. It’s the centerpiece application of our workday. Because it’s such an important part of the development process, Apple spent a lot of time making the latest version of Xcode streamlined and faster, in order to make us more productive. The first place we can notice Xcode’s improvements is in the text editor. Code folding, scope highlighting, and iChat-like message bubbles that clearly mark build warnings and errors as well as breakpoints, are some of the key editing enhancements.

8A36DC43-EBDA-4073-944E-E94DDCD47E30.jpg

To help us access documentation while we work, the new Research Assistant gives us a heads-up display of relevant information about symbols in our code in a convenient, small panel. If we need more information, we can simply click for more detail and the full documentation window will open. And, to help us experiment with our code, Project Snapshot lets us record the state of our project and snap back to that state at any point in the future. This lets us quickly try out an idea without having to check things back into our projects source code repository.

Interface Builder 3.0

Interface Builder is the intuitive, easy-to-use tool for creating and editing user interface resources files (nib files). These files represent a set of interface objects and their relationships, as well as their connections to our application’s logic. In Leopard, Interface Builder has been thoroughly modernized and updated, both to support the new interface technologies in Leopard as well as to make the applications we develop easier than ever to build.

0BFDC4E1-BC14-4E2E-84A5-CDF3A70824A2.jpg

In addition to laying out our user interface, Interface Builder now lets us add impressive Core Animation-based behaviors to our application, such as the iChat sliding list view or Keynote-style transitions, in a matter of minutes. And it even has features that improve the ability to see differences between versions of our interface. It also comes with a new Interface Builder Kit API for plug-in developers.

Instruments

Instruments is a brand-new, timeline-based performance visualization tool that gives us the ability to see how our application works like we’ve never been able to do before. It lets me watch CPU, disk I/O, memory usage, garbage collection, events, and more in the form of graphs tied to time.

For example, we can track UI events in real-time and see how they affect I/O activity and CPU load at the same time. And, once the data has been collected, we can scan back and forth through our application’s run and see exactly what occurred, and when.

1A8D413F-4EE1-400C-8A85-CB44C24BF7BD.jpg

Instruments builds on top of the open source DTrace utility. DTrace is a comprehensive command-line monitoring utility that can probe almost any aspect of system performance. It comes with a large set of tools that cover most general aspects of system performance, including both kernel and user code, with near-zero overhead. If there is an aspect of the system that we want to track that isn’t already supported, we can create our own tool using the D programming language.

Dashcode

Dashcode is Apple’s new Dashboard widget development environment. It offers a built-in debugger and all the text editing features of a professional IDE. We can set and view breakpoints as well as track our widget’s execution through its JavaScript source code.

AB40D5DB-DCDA-45B4-A527-08FA6EF83BF3.jpg
Dashcode is geared for all levels of widget developers. We can start out with a prebuilt template and modify it to our needs, or get deep into the JavaScript, CSS, and HTML that defines all the aspects of how a widget looks and works.

Application Technologies

Leopard brings a multitude of improvements and additions to the Cocoa application framework set. The most visible of these is the new Core Animation framework which makes creating compelling interfaces much easier. Not as obvious, but no less important is the addition of garbage collection to Objective-C, new graphical controls, and 64-bit capabilities up the entire Cocoa stack from the BSD core system up to graphics, sound and networking. In addition, Leopard brings a factor of ten increase in the performance of Core Data.

Core Animation

Core Animation is a Cocoa framework for creating animated, composited, and dynamic user interfaces with a simple and approachable programming model. The fluid animations it creates are enabled by Quartz, OpenGL, and Core Image, yet it exposes a familiar NSView-style hierarchy that mirrors that of the Application Kit view architecture. Many of the new user-level features in Leopard, such as Spaces and Time Machine, utilize Core Animation to perform their user interface transitions.

32D16ACC-E480-4A83-8166-53321CBDE3F5.jpg

Using Core Animation, our application can effortlessly provide a cinematic user experience to our users. We’ll be able to smoothly move user interface elements around the screen, fade them in and out, and add effects with just a few lines of code. In addition to Quartz and Core Image, we can also leverage Core Video and Quartz Composer to achieve a wide range of visual results. We can direct Core Animation from either code or by using Interface Builder.

Objective-C 2.0

Objective-C is an ANSI C compatible language with dynamic object-oriented extensions. It combines the power of Smalltalk-style message passing with the performance and native system-level access of C. From the start, the abilities of Obj-C have fueled the power of the Cocoa framework. Now in Leopard, the Objective-C runtime has been updated to include a thoroughly modern and high performance garbage collection system, making memory management a thing of the past.

Also new in Objective-C 2.0 are a set of syntax improvements, including property accessors and fast enumeration. These improvements bring the language up-to-date with the expectations of today’s programmers. And, since Objective-C 2.0 is compatible with existing Objective-C source, we can adopt it at our own pace.

iChat Integration

Instant messaging has become an essential tool for users to communicate and collaborate. In Leopard, the ability to collaborate has been taken to a new level. In an iChat session, users will be able to use iChat Theatre to present data from another application, such as iPhoto or Keynote, as part of a video conference. The applications we create will also be able to integrate with iChat in the same way using the Instant Messaging framework via the Core Video and Core Audio APIs. Once integrated, the Instant Messaging framework will automatically compress the content, using the H.264 codec, and send it across the network to the remote user’s display.

Another new feature in the Instant Messaging framework is the ability to manage presence. This means that our application can query the iChat status of the user, indicating whether they are available or busy and what their status message is, as well as manipulate it. As well, it will give access to the buddy list. If we are building an application which allows users to collaborate on content, we could use the APIs to notify users when their friends or co-workers were online.

Resolution Independence

The old assumption that displays are 72dpi has been rendered obsolete by advances in display technology. Macs now ship with displays that sport native resolutions of 100dpi or better. Furthermore, the number of pixels per inch will continue to increase dramatically over the next few years. This will make displays crisper and smoother, but it also means that interfaces that are pixel-based will shrink to the point of being unusable. The solution is to remove the 72dpi assumption that has been the norm. In Leopard, the system will be able to draw user interface elements using a scale factor. This will let the user interface maintain the same physical size while gaining resolution and crispness from high dpi displays.

The introduction of resolution independence may mean that there is work that we’ll need to do in order to make our application look as good as possible. For modern Cocoa applications, most of the work will center around raster-based resources. For older applications that use QuickDraw, more work will be required to replace QuickDraw-based calls with Quartz ones.

Calendar Store

The Calendar Store framework provides access to a user’s iCal calendar data. Using the framework, we can fetch calendars, events, and tasks from iCal’s data storage. This allows our application to work with the same data as iCal, Mail, and any other application that a manager uses to interact with their schedule and to-do items.

Graphics & Media

Each release of Mac OS X builds on and expands the capabilities of QuickTime, Quartz, OpenGL, and Core Audio, and Leopard is no exception. The Graphics & Media frameworks in Leopard enable all of the higher-level application technologies, and expand them in new and exciting ways.

Image Kit

Image Kit is a new and robust Cocoa-based framework powered by Core Image and Core Animation. It makes available powerful imaging services that can be easily incorporated into our application. It provides functionality for finding, browsing, and viewing images in a collection. We can rearrange images in a group view as well as rotate individual images. Image Kit also provides a gateway for browsing, previewing, and setting Core Image filters on an image.

OpenGL Improvements

OpenGL is the industry-standard API for developing portable, interactive 2D and 3D applications. Mac OS X has supported OpenGL from the outset and in Leopard it adds pixel buffer objects, color managed texture images in the sRGB color space, and improvements in the shader programming API.

Leopard also provides a dramatic increase in OpenGL performance by offloading CPU-based processing onto another thread which can then run on a separate CPU core feeding the GPU. This can increase, or in some cases, approach double the performance of OpenGL-based applications.

QuickTime Improvements

Working with video using QuickTime has long been a strength of Mac OS X. Now, it’s as easy to build video capture into our application as it is to work with pre-recorded video. By using the QTKit Capture API, we can capture video from an iSight, USB (VDC) and FireWire (IIDC) devices, and DV cameras. The API even lets us output to multiple outputs.

QuickTime’s plumbing has received significant upgrades in Leopard. There have been significant enhancements in handling the H.264 encoding. And QuickTime now supports 64-bit. Note that the functionality for 64-bit QuickTime is only provided via the QTKit framework. The C-based QuickTime API is supported in 32-bit mode.

Picture Taker Panel

Mac OS X has used images in many applications for a while. For example, when we first set up Mac OS X, it will take our picture if we have a camera built-in or attached. Leopard exposes the ability to take a user’s picture to any application using the Picture Taker Panel. It will handle all the details of whether a user has a camera built-in or plugged in as well as providing a flash. In short, we can open the Picture Taker Panel and, once the user is satisfied with their picture, our application will be handed a picture return value.

OS Foundations

The heart of Mac OS X, the Open Source Mach- and BSD-based UNIX layer known as Darwin, continues to see improvements in Leopard. The latest Mac hardware brings more processing power, more cores, and more memory than ever before. The kernel in Leopard has been updated to take advantage of this new hardware.

Leopard certainly won’t be UNIX in name only. Apple will submit Leopard and Leopard Server to The Open Group for certification against the UNIX ‘03 product standard.

64-bit Support in Leopard

First implemented at the UNIX level in Tiger, Leopard brings 64-bit support to the Mac OS X application level. We can create 64-bit applications that can address extremely large data sets, up to 128TB using the current Intel-based CPUs. The 64-bit model used in Mac OS X is known as LP64 and is the same model used by other 64-bit UNIX systems from Sun and SGI as well as 64-bit Linux.

And there’s more: the 64-bit support in Mac OS X maintains the ability to run current 32-bit applications. On Intel processors, 64-bit applications have an increased number of CPU registers available in 64-bit mode, and they may run faster than their 32-bit counterparts.

Information Technology

Mac OS X and Mac OS X Server provide a rich set of features and enable a rich set of solutions. Each version of Mac OS X Server has made impressive leaps in functionality while offering easy to use management tools. Leopard provides the most powerful version of Server, built on a host of open source products and tools that make it a server for anyone from sysadmins to IT managers to developers maintaining a lab of test and development Macs.

Best of all, Leopard Server is a superset of Leopard. That means it uses the same kernel and supports the same 64-bit capabilities. Building on top of Leopard’s 64-bit frameworks, all of the services in Leopard Server are 64-bit enabled. This means that they will be able to take advantage of massive amounts of memory as well as enjoy performance increases on Intel-based 64-bit processors.

Open Directory 4

Leopard Server ships with an updated version of Open Directory that supports LDAP proxying, cross-domain authorization, cascading replication, and replica sets. It even supports RADIUS authentication for AirPort base stations deployed across our office or campus.

Calendaring Server

The Darwin Calendar Server allows users to collaboratively share calendars across an organization. It provides a shared location to store their schedules and sync them between machines. It also allows users to send each other invitations to events. Implemented using the CalDAV protocol, it supports multiple calendaring clients, including Leopard’s iCal, Mozilla’s Sunbird, OSAF’s Chandler, and Microsoft Outlook.

Ruby on Rails

Leopard Server features a built-in installation of the powerful and productive Ruby on Rails web application framework. Ruby on Rails is a full stack framework optimized for sustainable productivity. Leopard Server will ship with Mongrel for simplified development and deployment of web-based applications.


Pretty Basic Mac Stuff

January 20, 2008

If you have ever looked at your Mac’s root directory and wondered what some of those other directories are for, you’re probably not alone. Mac OS got a whole lot more complex with the advent of OS X, adapting a unix file structure that is largely unfamiliar to Mac OS 9 and Windows users. So just what is /System, /Library, /usr, and all the others for anyway? Here’s a brief explanation of each directory as found in Mac OS X.

By default, if you look in the root of your Mac’s hard disk you’ll see some unfamiliar sounding directories. From the command line, you will see even more if you type ls /. Explained in no particular order:- Directory followed by the Description

/Applications Self explanatory, this is where your Mac’s applications are kept
/Developer The Developer directory appears only if you have installed Apple’s Developer Tools, and no surprise, contains developer related tools, documentation, and files.
/Library Shared libraries, files necessary for the operating system to function properly, including settings, preferences, and other necessities (note: you also have a Libraries folder in your home directory, which holds files specific to that user).
/Network largely self explanatory, network related devices, servers, libraries, etc
/System System related files, libraries, preferences, critical for the proper function of Mac OS X
/Users All user accounts on the machine and their accompanying unique files, settings, etc. Much like /home in Linux
/Volumes Mounted devices and volumes, either virtual or real, such as hard disks, CD’s, DVD’s, DMG mounts, etc
/ Root directory, present on virtually all UNIX based file systems. Parent directory of all other files
/bin Essential common binaries, holds files and programs needed to boot the operating system and run properly
/etc Machine local system configuration, holds administrative, configuration, and other system files
/dev Device files, all files that represent peripheral devices including keyboards, mice, trackpads, etc
/usr Second major hierarchy, includes subdirectories that contain information, configuration files, and other essentials used by the operating system
/sbin Essential system binaries, contains utilities for system administration
/tmp Temporary files, caches, etc
/var Variable data, contains files whose contents change as the operating system runs

Blogged with Flock

Tags:


A new approach to classifying bugs

January 20, 2008

Got an interesting mail so thought Id share it with eone.

Developers always have an issue with QA classifying bugs – The general trend has been to classify an issue based on how much of functionality a particular bug blocks/prevents the user from accessing. But consider this new approach – Though it made us go nuts initially with almost all minor bugs suddenly getting promoted to blockers, I feel it’s a very interesting approach – Let me know what you think.

Trivial – Not likely to Business/Power user bump into it, because it requires some prior and rather technical configuration or high level technical background. So in general until now, if a particular key combination(keyboard short cut) crashed the app, QA would consider it a blocker. But with this approach the QA would need to look at what is the probability of someone using that key combination, and if it is rare it would only be a trivial issue!

Minor – Not likely to Business/Power user bump into it, because it requires medium technical background.

Major – Business/Power user with little technical background might bump into it after several hours of interacting with the tool.

Critical – Business/Power user with no technical background at all, might bump into it after a few hours session with the tool.

Blocker – Very likely that Business/Power user with no technical background at all, will bump into it in the first couple of hours with the tool. So, until now you might consider a ’spelling mistake’ on the front page to be a minor issue, but with this approach it becomes a blocker!!!!

A complete turn around – but for the marketing team it means they can sell the product better! What do you think?

Blogged with Flock

Tags:


Locking the Screen on a Mac

January 20, 2008

Applications–> Utilities–>Keychain Access

Preferences–>General

Check – Show Status in Menu Bar

The Lock icon shows up on the system menu bar.

Blogged with Flock

Tags:


How to check if a directory is bundle

January 20, 2008

http://developer.apple.com/technotes/tn2002/tn2078.html

OSStatus LSIsApplication( const FSRef *inRef, Boolean *outIsApplication,
Boolean *outIsBundled )
{
LSItemInfoRecord info;
OSStatus err = LSCopyItemInfoForRef( inRef, kLSRequestBasicFlagsOnly,
&info );

if ( err == noErr )
{
*outIsApplication = ( kLSItemInfoIsApplication &info.flags ) != 0;
*outIsBundled = ( kLSItemInfoIsPackage &info.flags ) != 0;
}
return( err );
}

Blogged with Flock

Tags:


sha-bang in Scripts

January 20, 2008

The sha-bang ( #!) at the head of a script tells your system that this file is a set of commands to be fed to the command interpreter indicated. The #! is actually a two-byte [1] magic number, a special marker that designates a file type, or in this case an executable shell script (type man magic for more details on this fascinating topic). Immediately following the sha-bang is a path name. This is the path to the program that interprets the commands in the script, whether it be a shell, a programming language, or a utility. This command interpreter then executes the commands in the script, starting at the top (line following the sha-bang line), ignoring comments. [2]

#!/bin/sh
#!/bin/bash
#!/usr/bin/perl
#!/usr/bin/tcl
#!/bin/sed -f
#!/usr/awk -f

Each of the above script header lines calls a different command interpreter, be it /bin/sh, the default shell (bash in a Linux system) or otherwise. [3] Using #!/bin/sh, the default Bourne shell in most commercial variants of UNIX, makes the script portable to non-Linux machines, though you sacrifice Bash-specific features. The script will, however, conform to the POSIX [4] sh standard.

Note that the path given at the “sha-bang” must be correct, otherwise an error message — usually “Command not found” — will be the only result of running the script.

#! can be omitted if the script consists only of a set of generic system commands, using no internal shell directives. The second example, above, requires the initial #!, since the variable assignment line, lines=50, uses a shell-specific construct. [5] Note again that #!/bin/sh invokes the default shell interpreter, which defaults to /bin/bash on a Linux machine.

Blogged with Flock

Tags:


Subversion installation script

January 20, 2008

echo

echo Sample Subversion installation program for Mac OS X

echo by JanakiRam, October 11th, 2007

echo

echo Download source files:

cd ~/Desktop

curl -O http://subversion.tigris.org/downloads/subversion-1.4.5.tar.gz

echo Extract the zip archive:

tar xvfz subversion-1.4.5.tar.gz

cd subversion-1.4.5

echo Compile the source code:

./configure –prefix=/usr/local \

–mandir=/usr/local/share/man –with-ssl \

–with-apxs=/usr/local/apache2/bin/apxs –with-zlib \

–enable-swig-bindings=no –without-berkeley-db \

–with-apr=/usr/local/apache2 \

–with-apr-util=/usr/local/apache2

echo Run the make command, and then run the sudo make install command:

make

sudo make install

echo Add the /usr/local/bin path to your profile:

cd ~

echo ‘export PATH=”$PATH:/usr/local/bin”‘ >> .bash_profile

echo All done — Subversion installation successfully completed!

Blogged with Flock

Tags:


Installing Fink

October 2, 2007

Today i’ve installed fink in my Mac OS X  Tiger (10.4.9).

I’ve installed XCode 2.4.1 as a prerequisite.

Installation Procedure:

New to Fink? These quick start instructions are here to get you up to speed with the binary release.

  1. Download the installer disk image:
    Fink 0.8.1 Binary Installer (PowerPC) – 17930 KB
    Fink 0.8.1 Binary Installer (Intel) – 17510 KB

  2. Double-click “Fink-0.8.1-XYZ-Installer.dmg” (where XYZ is either PowerPC or Intel) to mount the disk image, then double-click the “Fink 0.8.1 XYZ Installer.pkg” package inside. Follow the instructions on screen.

  3. At the end of the installation, the pathsetup utility will be launched. You will be asked for permission before your shell’s configuration files are edited. When the utility has finished, you are set to go!

  4. If anything goes wrong during this process, you can try again by launching the pathsetup application which appears on the installer disk, or by running (from the command line in a Terminal.app window)

    /sw/bin/pathsetup.sh

    (This step should also be repeated by any other users on your system: each user must run pathsetup in his or her own account.)

  5. Open a new Terminal.app window and run the following: “fink scanpackages; fink index“.

  6. Once those two commands are finished you should update the fink package, in case there have been significant changes since the last point release. After you do this you can install other packages.

    • Use apt-get. Apt-get will fetch and install binary packages for you, saving compiling time. To update fink open a Terminal.app window and type sudo apt-get update ; sudo apt-get install fink

      Once you’ve updated fink, you can install other packages, using the same syntax, e.g sudo apt-get install gimp to install the Gimp. Note, however, that not all fink packages are in binary form.

        Thats it , fink is now installed in your Mac OS X Tiger.

Blogged with Flock

Tags: ,


Getting a Useful Crash Log in Windows XP

September 26, 2007

Windows XP does not automatically log crashes like OS X, but it does include Dr. Watson, an easy to set up tool that can be configured to log them.


* A dialog box will appear informing you that Dr. Watson has been installed as the default debugger. Press OK.

*Crash information will now be logged to the drwtsn32.log and user.dmp files in C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson\.

* All crashes you experience on Windows XP are logged to drwtsn32.log. Dr. Watson will also create a user.dmp file that contains a dump of the memory Your Application was using when it crashed. This is generally more useful for debugging a crash than the crash log, but be careful as it is overwritten with every crash.

* Running drwtsn32 without any options or switches will bring up a window that allows you to change various setting such as moving the log folder to a more easily accessible location or throwing a visual alert letting you know it caught the crash.

Blogged with Flock


Display/Hide Hidden Files Finder

September 26, 2007

We need to set the AppleShowAllFiles preference for the Finder to show/hide the Hidden Files.

Execute the following statement in Terminal to display the hidden files in Finder

defaults write com.apple.finder AppleShowAllFiles TRUE&&killall Finder &

Execute the following statement in Terminal to hide the hidden files in Finder

defaults write com.apple.finder AppleShowAllFiles FALSE&&killall Finder &

Blogged with Flock