Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit.

  • Loading branch information...
commit 6a7f7e9d3c512f8536e33438b20ff90e1d9bf6db 0 parents
@timburks authored
294 28_WebServices/AmaZone/AmaZone.xcodeproj/project.pbxproj
@@ -0,0 +1,294 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 224C59530DE759DA00DBA60E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 224C59520DE759DA00DBA60E /* main.m */; };
+ 2274D9600DE7386B003F744C /* Nu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2274D95F0DE7386B003F744C /* Nu.framework */; };
+ 2274D96A0DE73916003F744C /* main.nu in Resources */ = {isa = PBXBuildFile; fileRef = 2274D95E0DE73840003F744C /* main.nu */; };
+ 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
+ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
+ 224C59520DE759DA00DBA60E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 2274D95E0DE73840003F744C /* main.nu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.nu; path = nu/main.nu; sourceTree = "<group>"; };
+ 2274D95F0DE7386B003F744C /* Nu.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nu.framework; path = /Library/Frameworks/Nu.framework; sourceTree = "<absolute>"; };
+ 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+ 32CA4F630368D1EE00C91783 /* AmaZone_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AmaZone_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+ 8D1107320486CEB800E47090 /* AmaZone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmaZone.app; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D11072E0486CEB800E47090 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+ 2274D9600DE7386B003F744C /* Nu.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
+ );
+ name = "Linked Frameworks";
+ sourceTree = "<group>";
+ };
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
+ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107320486CEB800E47090 /* AmaZone.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 2274D95D0DE73833003F744C /* Nu */ = {
+ isa = PBXGroup;
+ children = (
+ 2274D95E0DE73840003F744C /* main.nu */,
+ );
+ name = Nu;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* AmaZone */ = {
+ isa = PBXGroup;
+ children = (
+ 2274D95D0DE73833003F744C /* Nu */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = AmaZone;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 224C59520DE759DA00DBA60E /* main.m */,
+ 32CA4F630368D1EE00C91783 /* AmaZone_Prefix.pch */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
+ 29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 2274D95F0DE7386B003F744C /* Nu.framework */,
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D1107260486CEB800E47090 /* AmaZone */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 93775B110CD0FF8E002E5E9E /* Build configuration list for PBXNativeTarget "AmaZone" */;
+ buildPhases = (
+ 8D1107290486CEB800E47090 /* Resources */,
+ 8D11072C0486CEB800E47090 /* Sources */,
+ 8D11072E0486CEB800E47090 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = AmaZone;
+ productInstallPath = "$(HOME)/Applications";
+ productName = AmaZone;
+ productReference = 8D1107320486CEB800E47090 /* AmaZone.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 93775B100CD0FF8E002E5E9E /* Build configuration list for PBXProject "AmaZone" */;
+ compatibilityVersion = "Xcode 2.4";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* AmaZone */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D1107260486CEB800E47090 /* AmaZone */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D1107290486CEB800E47090 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2274D96A0DE73916003F744C /* main.nu in Resources */,
+ 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
+ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D11072C0486CEB800E47090 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 224C59530DE759DA00DBA60E /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C165DFE840E0CC02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 29B97319FDCFA39411CA2CEA /* English */,
+ );
+ name = MainMenu.nib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 93775B0A0CD0FF8E002E5E9E /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ };
+ name = Development;
+ };
+ 93775B0B0CD0FF8E002E5E9E /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ };
+ name = Deployment;
+ };
+ 93775B0C0CD0FF8E002E5E9E /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ };
+ name = Default;
+ };
+ 93775B0D0CD0FF8E002E5E9E /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = AmaZone_Prefix.pch;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = AmaZone;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Development;
+ };
+ 93775B0E0CD0FF8E002E5E9E /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = AmaZone_Prefix.pch;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = AmaZone;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Deployment;
+ };
+ 93775B0F0CD0FF8E002E5E9E /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = AmaZone_Prefix.pch;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = AmaZone;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Default;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 93775B100CD0FF8E002E5E9E /* Build configuration list for PBXProject "AmaZone" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 93775B0A0CD0FF8E002E5E9E /* Development */,
+ 93775B0B0CD0FF8E002E5E9E /* Deployment */,
+ 93775B0C0CD0FF8E002E5E9E /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+ 93775B110CD0FF8E002E5E9E /* Build configuration list for PBXNativeTarget "AmaZone" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 93775B0D0CD0FF8E002E5E9E /* Development */,
+ 93775B0E0CD0FF8E002E5E9E /* Deployment */,
+ 93775B0F0CD0FF8E002E5E9E /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
7 28_WebServices/AmaZone/AmaZone_Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'AmaZone' target in the 'AmaZone' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
BIN  28_WebServices/AmaZone/English.lproj/InfoPlist.strings
Binary file not shown
41 28_WebServices/AmaZone/English.lproj/MainMenu.nib/classes.nib
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>FirstResponder</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>fetchBooks</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>AppController</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>progress</key>
+ <string>NSProgressIndicator</string>
+ <key>searchField</key>
+ <string>NSTextField</string>
+ <key>tableView</key>
+ <string>NSTableView</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
20 28_WebServices/AmaZone/English.lproj/MainMenu.nib/info.nib
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBFramework Version</key>
+ <string>629</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>../../AmaZone.xcodeproj</string>
+ <key>IBOldestOS</key>
+ <integer>5</integer>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>2</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9B18</string>
+ <key>targetFramework</key>
+ <string>IBCocoaFramework</string>
+</dict>
+</plist>
BIN  28_WebServices/AmaZone/English.lproj/MainMenu.nib/keyedobjects.nib
Binary file not shown
26 28_WebServices/AmaZone/Info.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>AmaZone</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.myCocoaApplication</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
14 28_WebServices/AmaZone/Nukefile
@@ -0,0 +1,14 @@
+;; Nukefile for AmaZone
+
+;; source files
+(set @nu_files (filelist "nu/.*\.nu$"))
+(set @resources (filelist "^English\.lproj/Infoplist.strings$"))
+(set @nib_files (filelist "^English\.lproj/[^/]*\.nib$"))
+
+;; application description
+(set @application "AmaZone")
+(set @application_identifier "nu.programming.amazone")
+
+;; build tasks
+(application-tasks)
+(task "default" => "application")
22 28_WebServices/AmaZone/main.m
@@ -0,0 +1,22 @@
+/*!
+ @file main.m
+ @copyright Copyright (c) 2007 Neon Design Technology, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+int NuMain(int argc, const char *argv[]);
+
+int main(int argc, const char *argv[])
+{
+ return NuMain(argc, argv);
+}
132 28_WebServices/AmaZone/nu/main.nu
@@ -0,0 +1,132 @@
+;; file main.nu
+;; discussion Entry point for a Nu program.
+;;
+;; copyright Copyright (c) 2008 Tim Burks, Neon Design Technology, Inc.
+
+(import Cocoa) ;; bridgesupport
+(load "console") ;; interactive console
+
+(set AWS_ID "1CKE6MZ6S27EFQ458402")
+
+(function stringForKind (k)
+ (case k
+ (NSXMLDocumentKind "Document")
+ (NSXMLElementKind "Element")
+ (NSXMLTextKind "Text")
+ (else (k stringValue))))
+
+;; To see the output of this function, look at the Nu console (command-L).
+(function ShowTree (node level)
+ (set kind (node kind))
+ (set kindString (stringForKind kind))
+ (level times:(do (i) (print " ")))
+ (if (eq kind NSXMLTextKind)
+ (then (puts (+ kindString ": " (node stringValue))))
+ (else (puts (+ kindString ": " (node name)))))
+ ((node children) each:
+ (do (child)
+ (ShowTree child (+ 1 level)))))
+
+(class AppController is NSObject
+ (ivar (id) progress (id) searchField (id) tableView (id) doc (id) itemNodes)
+ (ivar-accessors)
+
+ (- (void)awakeFromNib is
+ (@tableView setDoubleAction:"openItem:")
+ (@tableView setTarget:self))
+
+ (- (void)fetchBooks:(id)sender is
+ ;; Show the user that something is going on
+ (@progress startAnimation:nil)
+
+ ;; Put together the request
+ ;; See http://www.amazon.com/gp/aws/landing.html
+
+ ;; Get the string and percent-escape for insertion into URL
+ (set searchString ((@searchField stringValue) stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding))
+ (NSLog "searchString = #{searchString}")
+
+ ;; Create the URL
+ (set urlString "http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Operation=ItemSearch&SubscriptionId=#{AWS_ID}&SearchIndex=Books&Keywords=#{searchString}")
+ (set url (NSURL URLWithString:urlString))
+ (set urlRequest (NSURLRequest requestWithURL:url
+ cachePolicy:NSURLRequestReturnCacheDataElseLoad
+ timeoutInterval:30))
+
+ ;; Fetch the XML response
+ (set urlData (NSURLConnection sendSynchronousRequest:urlRequest
+ returningResponse:(set responsep (NuReference new))
+ error:(set errorp (NuReference new))))
+ (unless urlData
+ (NSRunAlertPanel "Error loading" ((errorp value) localizedDescription) nil nil nil)
+ (return))
+
+ ;; Parse the XML response
+ (set @doc ((NSXMLDocument alloc) initWithData:urlData
+ options:0
+ error:errorp))
+ (NSLog "doc = #{@doc}")
+
+ (ShowTree @doc 0)
+
+ (unless @doc
+ (set alert (NSAlert alertWithError:(errorp value)))
+ (alert runModal)
+ (return))
+
+ (set @itemNodes (@doc nodesForXPath:@"ItemSearchResponse/Items/Item" error:errorp))
+ (unless @itemNodes
+ (set alert (NSAlert alertWithError:(errorp value)))
+ (alert runModal)
+ (return))
+
+ ;; Update the interface
+ (@tableView reloadData)
+ (@progress stopAnimation:nil))
+
+ (- (void)openItem:(id)sender is
+ (set row (@tableView clickedRow))
+ (if (eq row -1) (return))
+ (set clickedItem (@itemNodes row))
+ (set urlString (self stringForPath:"DetailPageURL" ofNode:clickedItem))
+ (set url (NSURL URLWithString:urlString))
+ ((NSWorkspace sharedWorkspace) openURL:url))
+
+ (- (id)stringForPath:(id)xp ofNode:(id)n is
+ (set nodes (n nodesForXPath:xp error:(set perror (NuReference new))))
+ (cond ((eq nodes nil)
+ (set alert (NSAlert alertWithError (perror value)))
+ (alert runModal))
+ ((eq (nodes count) 0)
+ nil)
+ (else ((nodes objectAtIndex:0) stringValue))))
+
+ (- (int)numberOfRowsInTableView:(id) tv is
+ (@itemNodes count))
+
+ (- (id)tableView:(id)tv objectValueForTableColumn:(id)tableColumn row:(int)row is
+ (set itemNode (@itemNodes objectAtIndex:row))
+ (set xPath (tableColumn identifier))
+ (self stringForPath:xPath ofNode:itemNode)))
+
+(set SHOW_CONSOLE_AT_STARTUP nil)
+
+;; @class ApplicationDelegate
+;; @discussion Methods of this class perform general-purpose tasks that are not appropriate methods of any other classes.
+(class ApplicationDelegate is NSObject
+
+ ;; This method is called after Cocoa has finished its basic application setup.
+ ;; It instantiates application-specific components.
+ ;; In this case, it constructs an interactive Nu console that can be activated from the application's Window menu.
+ (- (void) applicationDidFinishLaunching:(id) sender is
+ (set $console ((NuConsoleWindowController alloc) init))
+ (if SHOW_CONSOLE_AT_STARTUP ($console toggleConsole:self))))
+
+;; install the delegate and keep a reference to it since the application won't retain it.
+((NSApplication sharedApplication) setDelegate:(set $delegate ((ApplicationDelegate alloc) init)))
+
+;; this makes the application window take focus when we've started it from the terminal (or with nuke)
+((NSApplication sharedApplication) activateIgnoringOtherApps:YES)
+
+;; run the main Cocoa event loop
+(NSApplicationMain 0 nil)
15 README
@@ -0,0 +1,15 @@
+
+Cocoa Programming with Nu
+
+This project contains selected examples from the new Third Edition
+of Aaron Hillegass' Cocoa Programming for Mac OS X:
+
+ http://www.amazon.com/gp/product/0321503619/ref=neontologycom-20
+
+Individual directories contain both Xcode projects and Nukefiles.
+All examples require Nu (http://programming.nu).
+
+Contributors, please follow the style used in 28_WebServices/AmaZone.
+
+Tim Burks
+tim@neontology.com
Please sign in to comment.
Something went wrong with that request. Please try again.