GDL2: the GNUstep Database Library
Listing 1. AppController.h
#include <AppKit/AppKit.h>
@interface AppController : NSObject
{
id window;
id tableView;
id items;
id editingContext;
}
- (void) update: (id)sender;
- (void) delete: (id)sender;
- (void) insert: (id)sender;
@end
Listing 2. AppController.m
#include <AppKit/AppKit.h>
#include "AppController.h"
#import <EOAccess/EOAccess.h>
#import <EOControl/EOControl.h>
@implementation AppController
- (id) init
{
self = [super init];
items = [[NSMutableArray alloc] init];
return self;
}
- (void) dealloc
{
[editingContext release];
[items release];
[super dealloc];
}
- (void) update: (id)sender
{
[items removeAllObjects];
[items addObjectsFromArray:
[editingContext objectsForEntityNamed:
@"Item"]];
[tableView reloadData];
}
- (void) delete: (id)sender
{
int row;
row = [tableView selectedRow];
if (row < 0 || row >= [items count])
{
NSBeep();
return;
}
[editingContext deleteObject:
[items objectAtIndex: row]];
[editingContext saveChanges];
[items removeObjectAtIndex: row];
[tableView reloadData];
}
- (void) insert: (id)sender
{
id aRecord;
aRecord = [[EOClassDescription
classDescriptionForEntityName:
@"Item"]
createInstanceWithEditingContext: nil
globalID: nil
zone: NULL];
[aRecord takeValue: @"<new item>"
forKey: @"name"];
[aRecord takeValue: [NSNumber numberWithInt: 0]
forKey: @"quantity"];
[aRecord takeValue: [NSCalendarDate date]
forKey: @"order_date"];
[editingContext insertObject: aRecord];
[editingContext saveChanges];
[items addObject: aRecord];
[tableView reloadData];
}
- (int) numberOfRowsInTableView: (id) aTableView
{
return [items count];
}
- (id) tableView: (id) aTableView
objectValueForTableColumn: (id) aTableColumn
row: (int) rowIndex
{
id aRecord;
aRecord = [items objectAtIndex: rowIndex];
return [aRecord valueForKey:
[aTableColumn identifier]];
}
- (void) tableView: (id) aTableView
setObjectValue: (id) anObject
forTableColumn: (id) aTableColumn
row: (int) rowIndex
{
id aRecord;
aRecord = [items objectAtIndex: rowIndex];
[aRecord takeValue: anObject
forKey: [aTableColumn identifier]];
[editingContext saveChanges];
}
- (void) applicationDidFinishLaunching: (id) not
{
EODatabaseContext *aDatabaseContext;
EOModelGroup *aModelGroup;
EODatabase *aDatabase;
EOModel *aModel;
aModelGroup = [[EOModelGroup alloc] init];
aModel = [aModelGroup
addModelWithFile:
@"tool/Inventory.eomodeld"];
[EOModelGroup setDefaultGroup: aModelGroup];
[aModelGroup autorelease];
aDatabase = [[EODatabase alloc] initWithModel:
aModel];
[aDatabase autorelease];
[[aDatabase adaptor] runLoginPanel];
aDatabaseContext = [[EODatabaseContext alloc]
initWithDatabase: aDatabase];
[[EOObjectStoreCoordinator defaultCoordinator]
addCooperatingObjectStore: aDatabaseContext];
[aDatabaseContext autorelease];
editingContext = [[EOEditingContext alloc]
init];
}
@end
int main(int argc, const char *argv[], char *env[])
{
[NSApplication sharedApplication];
NSApplicationMain(argc, argv);
return EXIT_SUCCESS;
}
Once the AppController files are modified, proceed with the creation of the GNUmakefile, used to compile our application, and the InventoryInfo.plist file, used to specify the application name, description and the name of the main Gorm file to load upon startup. Listings 3 and 4 show the content of those files.
Listing 3. GNUmakefile
include $(GNUSTEP_MAKEFILES)/common.make
include $(GNUSTEP_MAKEFILES)/Auxiliary/gdl2.make
APP_NAME = Inventory
Inventory_OBJC_FILES = AppController.m
Inventory_RESOURCE_FILES = MainMenu.gorm
ADDITIONAL_OBJCFLAGS = -Wall -Wno-import
include $(GNUSTEP_MAKEFILES)/application.make
Listing 4. InventoryInfo.plist
{
ApplicationName = "Inventory";
ApplicationDescription = "Inventory application.";
NSMainNibFile = "MainMenu";
}
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Nice article, thanks for the
7 hours 30 min ago - I once had a better way I
13 hours 16 min ago - Not only you I too assumed
13 hours 34 min ago - another very interesting
15 hours 27 min ago - Reply to comment | Linux Journal
17 hours 20 min ago - Reply to comment | Linux Journal
1 day 14 min ago - Reply to comment | Linux Journal
1 day 30 min ago - Favorite (and easily brute-forced) pw's
1 day 2 hours ago - Have you tried Boxen? It's a
1 day 8 hours ago - seo services in india
1 day 12 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
Re: GDL2: the GNUstep Database Library
Interesting article.
At this moment, this site at this link doesn't seem to exist:
And for the Python-inclined, there is a EOF-inspired Object-Relational database bridge called "Modeling" at: