Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Dr.Dobb's journal.2005.12

.PDF
Скачиваний:
25
Добавлен:
23.08.2013
Размер:
9.06 Mб
Скачать

#379 DECEMBER 2005

Dr.DobbsSOFTWARE TOOLS FOR THE

PROFESSIONAL

J O U R N A L PROGRAMMER

http://www.ddj.com

DATABASE DEVELOPMENT

Table Patterns & Matching Data

Java & ORM

Enterprise Application Logging

Automating Database Functions

Memory Management &

Embedded Databases

Summer of Code

Grids & Data Mining

XML-Binary

Optimized Packaging

Migrating a

Mac Text Editor to Intel

Wide-

Character

Format String

Vulnerabilities

Amazon Web

Services

Inside the

OCAP DVR

Spec

Ed Nisley

On the (Linux)

Road Again

Jerry

Pournelle

Windows

Vista: First

Impressions

NO PURCHASE NECESSARY. SPOTTING THE DIFFERENCES NOT REQUIRED TO ENTER. Void where prohibited. Must be U.S. resident age 18 or older to enter. Deadline for entry is 1/31/06. See complete rules at www.thedifferenceisobvious.com. © 2005 Microsoft Corporation. All rights reserved. Microsoft, Visual Studio, the Visual Studio logo, Windows, and “Your potential. Our passion.” are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

.2005 Studio Visual New

.obvious is difference The

Spot the difference? Once you start coding, you’ll see it immediately. The new Visual Studio® 2005 has over 400 new features, such as Web and Windows® controls that reduce tedious tasks and repetition.

So you can focus on creating great code. Spot the 10 differences above and play for cool prizes at msdn.microsoft.com/difference

Altova® MapForce® 2006 – The premier data integration and Web services implementation tool.

Streamline

Web services

Hook up with MapForce® 2006, and build

Web services without writing any code.

New in MapForce 2006:

Drag-and-drop Web services implementation Advanced flat file parsing and integration

Project-wide code generation

Embedding in your applications via OLE / ActiveX

Altova® MapForce, the tool awarded for easy integration of XML, database, text, and EDI file formats, now also lets you implement Web services in a visual way. Simply drag

connecting lines from information sources to targets and drop in data processing functions.

MapForce converts data on-the-fly and autogenerates data mapping code in XSLT 1.0/2.0, XQuery,

Java, C++, or C# for use in your data integration and

Web services applications. Give your data direction!

Download MapForce® 2006 today: www.altova.com

Also available in the Altova XML Suite.

C O N T E N T S

F E A T U R E S

DECEMBER 2005 VOLUME 30, ISSUE 12

Table Patterns & Changing Data 14

by Todd Schraml

Historical data doesn’t need to clutter your database and slow its performance.

Rapid Data Access Tier Implementation 24

by John Cheng, Abdul Akbari, and Hong Rong

DBAG is a tool for automating the creation of domain-specific classes.

Month-Text Ordering 30

by David Wincelberg

A month field-type can be a useful addition to your database toolbox.

Object-Relational Mapping in Java with SimpleORM 34

by Martin Snyder and Ted O’Connor

SimpleORM is a lightweight— yet powerful — object-relational mapping implementation.

Building Grid-Enabled Data-Mining Applications 41

by Alex Depoutovitch and Alex Wainstein

Computing grids let you use parallelization to tackle really big data-mining jobs.

The OCAP Digital Video Recorder Specification 49

by Linden deCarmo

The OCAP Digital Video Record specification defines an open API for building DVR applications.

XML-Binary Optimized Packaging 53

by Andrey Butov

XML-Binary Optimized Packaging provides a means for including binary data within XML documents.

A Mac Text Editor Migrates to Intel 56

by Tom Thompson

BBEdit, an industrial-strength Macintosh text editor, has been ported to the Intel platform. Here’s how.

Google’s Summer of Code: Part I 60

by DDJ Staff and Friends

Google’s Summer of Code resulted in thousands and thousands of lines of code. Here are some of the students who participated.

Wide-Character Format String Vulnerabilities 63

by Robert C. Seacord

Robert presents strategies for handling format string vulnerabilities in C.

Amazon Web Services 66

by Ashish Muni and Justin Hansen

ScanZoom lets you use mobile camera phones to launch services by taking photos of barcodes.

Enterprise Application Logging 68

F O R U M

EDITORIAL 8

by Jonathan Erickson

DR. ECCO’S

OMNIHEURIST CORNER 10

by Jim Mangione

Accurately gauging the health of IT assets across applications requires true enterprise-level logging.

E M B E D D E D S Y S T E M S P R O G R A M M I N G

Memory Management & Embedded Databases 72

by Andrei Gorine & Konstantin Knizhnik

Embedded and in-memory databases depend on the quality of their memory-management algorithms.

C O L U M N S

Programming Paradigms 76

Chaos Manor 82

by Michael Swaine

by Jerry Pournelle

Michael reminiscences about OOPSLA ’89 in New Orleans.

Jerry shares his first impressions of Windows Vista.

Embedded Space 79

Programmer’s Bookshelf 85

by Ed Nisley

by Gregory V. Wilson

Ed attends the 7th Annual Linux Symposium

Six books in seven paragraphs!

to find out what’s up with Linux.

Greg’s up to it.

by Dennis E. Shasha

NEWS & VIEWS 12 by DDJ Staff

PRAGMATIC EXCEPTIONS 18 by Benjamin Booth

OF INTEREST 87 by DDJ Staff

SWAINE’S FLAMES 88 by Michael Swaine

NEXT MONTH: Join us in January for DDJ’s 30th anniversary celebration. We also examine a bevy of programming languages.

http://www.ddj.com

Dr. Dobb’s Journal, December 2005

3

D R . D O B B ’ S O N L I N E

C

O

N

T

E

N

T

S

O n l i n e E x c l u s i v e s

 

 

 

 

 

 

T h e P e r l J o u r n a l

http://www.ddj.com/exclusives/

 

 

 

 

 

 

http://www.tpj.com/

Visual Basic 9.0: Looking Forward

 

 

 

 

 

 

Improving Template::Extract

Scott Swigart talks with Microsoft’s Visual Basic team about some of the changes coming in VB 9.0.

Tightening a few loose screws in a module with lots of potential.

Are Standards Enough for Web-Services Security?

The set of web-services standards seems to grow by the day. But if a web-services implementation supports all of these standards, is it necessarily secure?

T h e N e w s S h o w

http://thenewsshow.tv/

D o b b s c a s t A u d i o

http://www.ddj.com/podcast/

Software Builds: Where it all Comes Together

John Ousterhout, founder of Electric Cloud and creator of the Tcl scripting language, discusses the challenges in performing efficient software builds.

Windows in the Palm of Your Hands

Will smartphones take off as Microsoft and Palm hook up.

.NET Upgrade Metrics and the Migration Assessment Tool

The new .NET Migration Assessment Tool provides stats across multiple projects to help measure upgrade costs.

W i n d o w s / . N E T

http://devnet.developerpipeline.com/windows/

Getting Runtime Info from the CLR

You can update the Trace class to dump out some useful diagnostics about where the Trace object is being used

D o t n e t j u n k i e s

http://www.dotnetjunkies.com/

Microsoft Enterprise Library 2005

The Enterprise Library is a collection of Application Blocks released by the Patterns and Practices group within Microsoft.

B Y T E . c o m

http://www.byte.com/

Apache WSRF, Pubscribe, and Muse

Ian Springer explains how to use Apache’s toolkits for implementing web services based on WSRF, WSN, and WSDM.

T h e C / C + + U s e r s J o u r n a l

http://www.cuj.com

CUJ Experts Forum

Bjorn Karlsson continues his series on the Algorithms Library of the C++ Standard with a discussion of three related

algorithms search, search_n, and find_end.

R E S O U R C E

C E N T E R

As a service to our readers, source code, related files, and author guidelines are available at http://www.ddj.com/. Letters to the editor, article proposals and submissions, and inquiries should be sent to editors@ddj.com. For subscription questions, call 800-456-1215 (U.S. or Canada). For all other countries, call 902- 563-4753 or fax 902-563-4807. E-mail subscription questions to ddj@neodata.com, or write to Dr. Dobb’s Journal, P.O. Box 56188, Boulder, CO 80322-6188.

If you want to change the information you receive from CMP and others about products and services, go to http://www.cmp.com/ feedback/permission.html or contact Customer Service at Dr. Dobb’s Journal, P.O. Box 56188, Boulder, CO 80322-6188.

Back issues may be purchased prepaid for $9.00 per copy (which includes shipping and handling). For issue availability, send e-mail to orders@cmp.com, fax to 785-838-7566, or call 800-444-4881 (U.S. and Canada) or 785- 838-7500 (all other countries). Please send payment to Dr. Dobb’s Journal, 4601 West 6th Street, Suite B, Lawrence, KS 66049-4189. Digital versions of back issues and individual articles can be purchased electronically at http://www.ddj.com/.

W E B S I T E

A C C O U N T A C T I VAT I O N

Dr. Dobb’s Journal subscriptions include full access to the CMP Developer Network web sites. To activate your account, register at http://www.ddj.com/registration/ using the web ALL ACCESS subscriber code located on your mailing label.

DR. DOBB’S JOURNAL (ISSN 1044-789X) is published monthly by CMP Media LLC., 600 Harrison Street, San Francisco, CA 94017; 415-947-6000. Periodicals Postage Paid at San Francisco and at additional mailing offices. SUBSCRIPTION: $34.95 for 1 year; $69.90 for 2 years. International orders must be prepaid. Payment may be made via Mastercard, Visa, or American Express; or via U.S. funds drawn on a U.S. bank. Canada and Mexico: $45.00 per year. All other foreign: $70.00 per year. U.K. subscribers contact Jill Sutcliffe at Parkway Gordon 01-49-1875-386. POSTMASTER: Send address changes to Dr. Dobb’s Journal, P.O. Box 56188, Boulder, CO 80328-6188. Registered for GST as CMP Media LLC, GST #13288078, Customer #2116057, Agreement #40011901. INTERNATIONAL NEWSSTAND DISTRIBUTOR: Source Interlink International, 27500 Riverview Center Blvd., Suite 400, Bonita Springs, FL 34134, 239-949-4450. Entire contents © 2005 CMP Media LLC.

Dr. Dobb’s Journalis a registered trademark of CMP Media LLC. All rights reserved.

4

Dr. Dobb’s Journal, December 2005

http://www.ddj.com

The Power of UNIX/Linux on Windows!

32-bit and 64-bit applications

(Windows Server 2003, XP, Windows NT/2000, Millennium Edition)

MKS Toolkit provides tools for instant productivity in both 32 and 64-bit Windows environments with development, testing, or system administration tasks. With full support for multibyte/ Unicode character sets and 64-bit Windows systems, MKS provides support for the newest, most powerful systems all over the world. MKS Toolkit also includes VIW integrated with VisualStudio.NET, Secure Visual File Manipulation and more!

DEVELOPERS CAN EASILY:

Display, load, edit, search and otherwise manipulate files and data in non-ASCII formats with the new utilities and APIs that now support multibyte/Unicode character sets.

Become more productive with the new Visual Studio VIW Plug-in and Syntax highlighting features.

Drag and drop multiple files and directories, edit and manipulate permissions as well as copy large file sets securely, between remote UNIX, Linux and Windows systems with Secure Visual SFTP.

Tape and archive utilities for UNIX-compatible backups with more than 100 Windows specific commands for true interaction with Windows.

Port UNIX, C, C++ and Fortran applications to Windows easily, leveraging existing investments.

Control network devices with SNMP Services and Utilities.

Schedule utilities to perform automated tasks.

All MKS Licenses are bundled with a yearly Support and Update Agreement.

TO ORDER YOUR RISK-FREE TRIAL

CALL 800-637-8034 OR +1 703-803-3343 +44 (0) 1483-733922

OR VISIT US ON THE WEB AT

http://www.mkssoftware.com/

MKS Toolkit and Nutcracker are registered trademarks of MKS Inc. UNIX is a registered trademark in the U.S. and other countries, licensed exclusively through X/Open Company Limited. Windows, is a registered trademark of Microsoft Corporation in the U.S. and/or other countries.

Need to find something fast?

With c-tree Speed.

FairCom’s c-tree Plus® embedded database engine offers Superior Indexing Technology – the key to performance, data integrity, and concurrency. c-tree Plus offers direct record-oriented C and C++ APIs with an industry-standard SQL interface that allows use of any combination of APIs within the same application. Furthermore, we offer source code access for intimate programming control, unmatched

portability, and developer-to- developer technical support.

Migrate from other RecordOriented Databases!

Custom upgrade pricing is available for developers using any other recordoriented database. Btrieve®, VSAM®, C-ISAM, and CodeBase® developers can migrate to c-tree with minimal overhead! E-mail info@faircom.com for more information.

Go to www.faircom.com/go/index for a FREE evaluation of c-tree Plus!

Dr.DobbsSOFTWARE

TOOLS FOR THE

PROFESSIONAL

J O U

R N A L

 

PROGRAMMER

 

 

 

 

 

 

 

P U B L I S H E R

E D I T O R - I N - C H I E F

Michael Goodman

 

Jonathan Erickson

E D I T O R I A L

MANAGING EDITOR

Deirdre Blake

SENIOR PRODUCTION EDITOR

Monica E. Berg

ASSOCIATE EDITOR

Della Wyser

COPY EDITOR

Amy Stephens

ART DIRECTOR

Margaret A. Anderson

SENIOR CONTRIBUTING EDITOR

Al Stevens

CONTRIBUTING EDITORS

Bruce Schneier, Ray Duncan, Jack Woehr, Jon Bentley,

Tim Kientzle, Gregory V. Wilson, Mark Nelson, Ed Nisley,

Jerry Pournelle, Dennis E. Shasha

EDITOR-AT-LARGE

Michael Swaine

PRODUCTION MANAGER

Stephanie Fung

I N T E R N E T O P E R A T I O N S

DIRECTOR

Michael Calderon

SENIOR WEB DEVELOPER

Steve Goyette

WEBMASTERS

Sean Coady, Joe Lucca

A U D I E N C E D E V E L O P M E N T

AUDIENCE DEVELOPMENT DIRECTOR

Kevin Regan

AUDIENCE DEVELOPMENT MANAGER

Karina Medina

AUDIENCE DEVELOPMENT ASSISTANT MANAGER

Shomari Hines

AUDIENCE DEVELOPMENT ASSISTANT

Melani Benedetto-Valente

M A R K E T I N G / A D V E R T I S I N G

ASSOCIATE PUBLISHER

Will Wise

SENIOR MANAGERS, MEDIA PROGRAMS see page 86

Pauline Beall, Michael Beasley, Cassandra Clark, Ron Cordek, Mike Kelleher, Andrew Mintz

MARKETING DIRECTOR

Jessica Marty

SENIOR ART DIRECTOR OF MARKETING

Carey Perez

DR. DOBB’S JOURNAL

2800 Campus Drive, San Mateo, CA 94403

650-513-4300. http://www.ddj.com/

CMP MEDIA LLC

Steve Weitzner President and CEO

John Day Executive Vice President and CFO

Jeff Patterson Executive Vice President, Corporate Sales & Marketing

Leah Landro Executive Vice President, Human Resources Mike Mikos Chief Information Officer

Bill Amstutz Senior Vice President, Operations

Sandra Grayson Senior Vice President and General Counsel Alexandra Raine Senior Vice President, Communications Kate Spellman Senior Vice President, Corporate Marketing Mike Azzara Vice President, Group Director of Internet Business

Robert Faletra President, Channel Group

Tony Keefe President, CMP Entertainment Media Vicki Masseria President, CMP Healthcare Media

Philip Chapnick Vice President, Group Publisher Applied Technologies

Paul Miller Vice President, Group Publisher Electronics Fritz Nelson Vice President, Group Publisher Network Computing Enterprise Architecture Group

Peter Westerman Vice President, Group Publisher Software Development Media

Joseph Braue Vice President, Director of Custom Integrated Marketing Solutions

Shannon Aronson Corporate Director, Audience Development Michael Zane Corporate Director, Audience Development Marie Myers Corporate Director, Publishing Services

www.faircom.com

 

Printed in the

 

 

USA • Europe • Japan • Brazil

 

USA

 

 

American Buisness Press

Other company and product names are registered trademarks or trademarks of their respective owners.

© 2005 FairCom Corporation

6

Dr. Dobb’s Journal, December 2005

http://www.ddj.com

by

With

an Load

This

DTS in

a

tasks

and

Advertisement

 

SQL

Since DTS packages will continue to

(SSIS) and

work with SQL Server 2005, it

. In this

suggests that DTS and SSIS will

a

comfortably co-exist for the

list):

foreseeable future. In this context

scoping

manual upgrades that embrace SSIS

of

can take place in a controlled manner

 

as business drivers dictate.

 

Allan Mitchell and Darren Green are

organizations

the boffins behind www.sqldts.com

DTS to

and www.sqlis.com

of

 

you don't

The full version of this article is

on

available at www.simple-talk.com,

 

an industry service provided by

 

Red Gate Software.

fine,

 

migrated

 

Wizard.

 

between

 

ssue of

 

New

 

 

product

 

release!

 

 

 

tasks

 

 

 

can go

 

packages

 

 

 

package

 

 

 

.com

today for your

 

 

 

-gate

 

 

 

.red

 

.

 

Visit

www

 

 

 

 

 

-functional 14 day trial

 

 

 

 

 

 

free, fully

 

 

ingeniously simple tools

E D I T O R I A L

Winners and

Losers

Google’s Summer of Code was the cat’s pajamas. Not only did it generate thousands of lines of open-source code in a variety of programming languages for a bunch of operating systems, but it paid well, too. Student developers who were selected to participate — and there were more than

400 of them — received $4500 each for coding to their heart’s delight over the summer.

But money wasn’t the only motivation, at least from Google’s perspective. According to promotions the company ran last spring, the goal was “to get the brightest minds on campus contributing code to open-source initiatives and inventing new open-source programs.” Still, no one turned down the loose change. After all, when it comes to summer jobs, buying coffee at Starbucks is a lot better than serving it.

Led by Chris DiBona, Google’s open-source programs manager, and Greg Stein, a Google engineering manager, the Summer of Code team proceeded to ally student programmers with mentors (DDJ contributing editor Greg Wilson was one mentor) and mentoring organizations. The mentors and mentoring organizations came up with project ideas, acted as sounding boards, and monitored student progress. The mentoring organization also played a part in determining the platform (come on, you really didn’t think that, say, FreeBSD.org would sponsor a Windows or Mac OS X project) and licensing scheme for the source code (as one of the mentoring organizations, Google required BSD, LGPL, or GPL). The choice of programming language was left to the student. Mentoring organizations included the Apache Software Foundation, Blender, Drupal, FreeBSD, The Gnome Foundation, Internet2, the Jabber Software Foundation, KDE, the Mono Project, NetBSD, OpenOffice.org, the Perl Foundation, Portland State University, the Python Software Foundation, the Subversion Project, XWiki, and Google, among others.

To acknowledge the efforts and contributions of students who participated in the Summer of Code, we will be presenting over the coming months profiles of many of the participants and their projects. We start off this month with a brief interview with Chris DiBona, who provides some background on the Summer of Code, then let the students tell you about their projects in their own words (see page 60). One thing you’ll notice right away is that the Summer of Code was truly an international effort.

This month’s students, for instance, attend schools in Sri Lanka, New York City, Croatia, and Missouri. Please join me in congratulating the students for their fine work and Google for sponsoring the

initiative. From what I can tell, the Summer of Code was an all-around winner — the mentoring organizations got a lot of great code to support their projects, the programming community was reminded about the importance of creativity and cooperation, and the students can now afford something other than Ramen noodles for dinner.

Okay, that takes care of the winners. Now for the losers.

Several years ago, DDJ published an article about the baggage system at the Denver International Airport (see “Simulating the Denver Airport Automated Baggage System,” by John Swartz, DDJ, January 1997). It didn’t take a massively parallel grid computer and army of consultants to figure out whether the $200 million 17-mile-long Rube Goldberg system of tracks and carts would work. (In fact, all it took was a run-of-the-mill PC and XLisp, David Betz’s freely available Lisp implementation.) What John Swartz’s simulation confirmed was that the automated baggage system wasn’t feasible. Nearly a decade and millions of dollars later, it’s official — the automated baggage system won’t work and has been abandoned. United Airlines, the only airline still using the system, finally just said “no” to automation, opting for human baggage handlers and saving $1 million a month in maintenance costs in the process.

The system, designed by BAE Automated Systems (which closed its doors years ago), was a paragon to technology. It originally called for 300 OS/2-based 486 PCs distributed in eight control rooms, databases running on fault-tolerant servers, high-speed fiberoptic Ethernet, 14 million feet of wiring, 56 laser arrays, 400 frequency readers, 22 miles of track, six miles of conveyor belts, 3100 standard carts, 450 oversized carts, 10,000 motors, and 92 PLCs to control motors and track switches. And, as Daniel Stearns of California Polytechnic State University notes, the system accurately illustrated the principle of object-oriented design by sending “messages to objects [the carts], which respond by returning other objects [baggage and empty carts] to the sender.” But it didn’t work.

Granted, offering advice at this point is like closing the barn door after the baggage cart has escaped. Still, you have to wonder whether a cadre of creative, energetic, and dedicated students looking to avoid a summer of saying, “Would you like fries with that?” could have done at least as good a job as those losers who planned (and profited from) the Denver Airport fiasco. Google and its Summer of Code just may be on to something, and I’m already looking forward to the Summer of Code 2006.

Jonathan Erickson editor-in-chief jerickson@ddj.com

8

Dr. Dobb’s Journal, December 2005

http://www.ddj.com