Monday, December 3, 2007

1

C# 2005

Introduction


The C# programming language is a powerful, relatively new descendant of the earlier C, C++, and Java languages. Programming with it is a lot of fun, as you’re about to find out in this book.

Microsoft created C# as a major part of its .NET initiative. For what are proba­bly political reasons, Microsoft turned the specifications for the C# language over to the ECMA (pronounced ek-ma) international standards committee in the summer of 2000, long before .NET was a reality. In theory, any company can come up with its own version of C# written to run on any operating system, on any machine larger than a calculator.

When the first edition of this book came out, Microsoft’s C# compiler was the only game in town, and its Visual Studio .NET suite of tools offered the only way to program C# (other than at the Windows command line). Since then, however, Visual Studio has gone through two major revisions — Visual Studio 2003 and, very recently, Visual Studio 2005. And at least two other players have entered the C# game.

It’s now possible to write and compile C# programs on a variety of Unix-based machines using either the Mono or Portable .NET implementations of .NET and C#:

*. Mono (www.go-mono.com) is an open-source software project spon­sored by Novell Corporation. Version 1.1.8 came out in June 2005. While Mono lags Microsoft’s .NET, just now implementing the 1.1 version that Microsoft released a couple of years ago, it appears to be moving fast.

*. Portable .NET, under the banner of Southern Storm Software and DotGNU (www.dotgnu.org/pnet.html), is also open-source. Portable .NET is at version 0.7.0 as of this writing.

Both Mono and Portable .NET claim to run C# programs on Windows and a variety of Unix flavors, including Linux and Apple’s Macintosh operating system. At this writing, Portable .NET reaches the greater number of flavors, while Mono boasts a more complete .NET implementation. So choosing between them can be complicated, depending on your project, your platform, and your goals. (Books about programming for these platforms are becoming available already. Check www.amazon.com.)

Open-source software is written by collaborating groups of volunteer pro­grammers and is usually free to the world.Making C# and other .NET languages portable to other operating systems is far beyond the scope of this book. But you can expect that within a few years, the C# Windows programs you discover how to write in this book will run on all sorts of hardware under all sorts of operating systems — matching the claim of Sun Microsystems’ Java language to run on any machine. That’s undoubtedly a good thing, even for Microsoft. The road to that point is still under construction, so it’s no doubt riddled with potholes and obstacles to true universal portability for C#. But it’s no longer just Microsoft’s road.

For the moment, however, Microsoft’s Visual Studio has the most mature versions of C# and .NET and the most feature-filled toolset for programming with them. If all you need is C#, I’ve included a bonus chapter called “C# on the Cheap” on the CD that accompanies this book. That chapter tells you how you can write C# code virtually for free. (You’ll be missing lots of amenities, including the nice visual design tools that Visual Studio 2005 provides, but you can write Windows code without them, especially the kind of code in this book. Bonus Chapter 5 explains how.)

Note: Two authors wrote this book, but it seemed more economical to say “I” instead of “we,” so that’s what we (I?) do throughout.

What’s New in C# 2.0

While C# version 2.0 does have a number of small changes here and there, most of C# 2.0 is still virtually the same as the previous version. The big new additions that this book covers include the following:

*. Iterator blocks: An iterator is an object that lets you step through all the items in a collection of objects. That’s always been possible, but C# 2.0 makes it far simpler to implement. Bonus Chapter 3 on the CD helps you take advantage of the simplicity and flexibility of iterator blocks. Chapter 15 covers collections.

*. Generics: This is the big one! Generic features allow you to write highly general, more flexible code. It’s a powerhouse — a programmer’s dream. Chapter 15 shows you how to write far simpler and more type-safe code using generics.
Leaving aside a few of the more esoteric and advanced additions, we’ll men­tion a few smaller items here and there as appropriate. (Don’t worry if parts of this Introduction are Greek to you. You’ll get there.)

About This Book

The goal of this book is to explain C# to you, but to write actual programs you need a specific coding environment. We’re betting that most readers will be using Microsoft Visual Studio, although we do provide alternatives. In basing the book on Visual Studio, we’ve tried to keep the Visual Studio portions to a reasonable minimum. we could just tell you, “Run your program any way you want,” but instead we may say, “Execute your C# program from Visual Studio by pressing F5.” We want you to be able to focus on the C# language and not on the mechanics of getting simple things to work.

We realize that many, if not most, readers will want to use C# to write graphi­cal Windows applications. C# is a powerful tool for programming graphical Windows applications, but that’s only one area for using C#, and this book must focus on C# as a language. We touch briefly on graphical Windows pro­grams in Chapter 1, but you should get a good grasp of C# before seeking another source to understand Windows programming in full. We also realize that some power users will be using C# to build Web-ready, distributed appli­cations; however, publishing limitations require us to draw the line some­where. C# 2005 For Dummies does not tackle the challenges of distributed programming. The book does explain quite a bit of .NET, though, for the simple reason that much of C#’s power comes from the .NET Framework class libraries that it uses.

At a minimum, you need the Common Language Runtime (CLR) before yoi can even execute the programs generated by C#. Visual Studio 2005 copie: the CLR onto your machine for you as part of the installation procedure. Alternatively, you can download the entire .NET package, including the C# compiler and many other nice tools, from Microsoft’s Web site at http:// msdn.microsoft.com. Look for the .NET Software Development Toolkit (SDK). Bonus Chapter 5 on the CD explains how to get these items.

You can still create most of the programs in this book with Visual Studio 2003, if you need to. The exceptions are those that cover the new features available only with C# 2.0, primarily generics and iterator blocks. A less-costly C# Express 2005 version of Visual Studio 2005 is also available, and don’t overlook the cheap options covered in Bonus Chapter 5 on the CD.

What You Need to Use the BookHow to Use This Book

We’ve made this book as easy to use as possible. Figuring out a new language is hard enough. Why make it any more complicated than it needs to be? The book is divided into six parts. Part I introduces you to C# programming with Visual Studio. This part guides you step by step in the creation of two differ­ent types of programs. We strongly encourage you to start here and read these two chapters in order before branching out into the other parts of the book. Even if you’ve programmed before, the basic program framework created in Part I is reused throughout the book.

The chapters in Parts II through V stand alone. We have written these chapters so that you can open the book to any one of them and start reading. If you’re new to programming, however, you will have to read Part II before you can jump ahead. But when you return to refresh your memory on some particular topic, you should have no trouble flipping to a section without the need to restart 20 pages back. Of course, the Part of Tens finishes out the lineup, and there’s more on the CD that accompanies the book.
How This Book Is Organized

Here’s a brief rundown on what you’ll find in each part of the book.

Part I: Creating Your First C# Programs

This part shows you, step by step, how to write the smallest graphical Windows application possible using the Visual Studio 2005 interface. Part I also shows you how to create the basic nongraphical C# framework that’s used in the other parts of this book.

Part II: Basic C# Programming

At the most basic level, Shakespeare’s plays are just a series of words all strung together. By the same token, 90 percent of any C# program you ever write consists of creating variables, performing arithmetic operations, and controlling the execution path through a program. This part concentrates on these core operations.
Part III: Object-Based Programming

It’s one thing to declare variables here or there and to add them and subtract them. It’s quite another thing to write real programs for real people. Part III focuses on how to organize your data to make it easier to use in creating a program.
Part IV: Object-Oriented Programming

You can organize the parts of an airplane all you want, but until you make it do something, it’s nothing more than a collection of parts. It’s not until you fire up the engines and start the wings flapping that it’s going anywhere.

In like fashion, Part IV explains how to turn a collection of data into a real object — an object that has internal members, sure, but an object that can mimic the properties of a real-world item. This part presents the essence of object-oriented programming.
Part V: Beyond Basic Classes

After the airplane gets off the ground, it has to go somewhere. Figuring out classes and the fundamentals of object-oriented programming is only a start. Part V takes the next step, introducing structures, interfaces, and generics, your gateway to more advanced object-oriented concepts — and the wild blue yonder.

Part VI: The Part of Tens

C# is great at finding errors in your programs — at times, it seems a little too good at pointing out my shortcomings. However, believe it or not, C# is trying to do you a favor. Every problem it finds is another problem that you would otherwise have to find on your own.

Unfortunately, the error messages can be confusing. One chapter in this part presents the ten most common C# build error messages, what they mean, and how the heck to get rid of them. Many readers are coming to C# from another programming language. The second chapter in The Part of Tens describes the ten major differences between C# and its progenitor, C++.

Read Comments For More

Tuesday, November 27, 2007

7

Wiley Publishing - Wireless Networks

Author’s Acknowledgments


We’d like to offer special thanks to Pat O’Brien, who started this rolling. Peter worked as the technical editor for Pat on Hacking For Dummies. Thanks for passing on Melody’s name.
Thanks to Melody Layne, acquisitions editor, for pitching the book to the edi­torial committee and getting us a contract. Much appreciated.

Thanks to Becky Huehls, who started us out on this project as editor but wisely got herself re-assigned. Thanks to Kelly Ewing for picking up the ball and running with it after Becky. Unfortunately, Kelly fumbled it, but Colleen Totz was able to struggle with it over the goal line.
Dan DiNicolo, technical editor, is commended for his diligence in reviewing the material. Thanks, Dan.

Peter would like to thank Kevin Beaver, Ken Cutler, Gerry Grindler, Ronnie Holland, Carl Jackson, Ray Kaplan, Kevin Kobelsky, Carrie Liddie, Dexter Mills Jr., and Larry Simon for responding to a request for wireless informa­tion. Thanks for answering the call for help. The provided information shows in this book.

Barry would like to thank his co-author Peter. Always a pleasure, sir. He would also like to acknowledge Craig McGuffin and John Tannahill who are always there for him, as friends and business associates , and never fail to lend a helping hand.

Introduction

Recently, a very knowledgeable speaker at a presentation for a wireless vendor talked about wireless as ubiquitous. We would have to disagree. Wireless is widespread, but it is not everywhere. But it is rapidly becoming ubiquitous.

In about 1990, cell phone users carried around a phone that looked and felt like a World War II walkie-talkie. You didn’t casually whip that baby out and start a conversation. At that time, you either had a deep wallet, a big ego, or a compelling need to talk to your mother. Now, depending on where you live in the world, the cell phone provides better quality at a lower cost — and in a much smaller form factor.

In about 1994, Wireless Local Area Network (WLAN) equipment manufacturers sold gear that was comparable to the wireless phone market. The devices were large and very expensive and provided poor bandwidth. You had to have a compelling reason to spend the money on the low bandwidth. But that has changed. In 2004, you can buy a reasonably priced laptop with onboard sup­port for 802.11b and Bluetooth. You can add a fairly inexpensive 802.11a and g PC Card and easily connect wirelessly and, if you have a Centrino-based system or Microsoft Windows XP, somewhat seamlessly. The WLAN market of today is analogous to the Ethernet market of the mid 1980s. In those years, solutions were proprietary, and standards were being approved. Companies were jockeying for position. Now, you would have difficulty finding a desktop or laptop computer that does not come with Ethernet support. When we look back from the future, we will see some parallels between 802.3 and 802.11 development.

Telephone companies have wrestled with the issue of the “last mile” for a while. But forget the last mile; Bluetooth and IrDA provide the last foot. Mice, keyboards, phones, PDAs, and other devices support Bluetooth for wire replacement. When you have a Bluetooth-enabled printer, you no longer need to hook up to the network to print one page or a contact.

Vendors are trying to get along with each other to develop standards so that one day we can walk around with a phone, PDA, or laptop and connect to any network, anywhere, anytime. We wrote this book for those of you who want to release your company f its bondage. If you want to unfetter your clients so that they can access t e-mail before getting on the red-eye to New York or Toronto, this book is you. If your desktop looks like spaghetti junction and you want to rid you of all those wires, this book is for you. If you want to provide up-to-the-m stock quotes to the Chair of your company while she sits in the boardroo this book is for you. If you have a small to medium enterprise (SME) or b ness (SMB) or a small office/home office (SOHO) and don’t want to rewir (or pay someone to rewire) your office, this book is for you. If you have w less at home and want to learn about features that you can expect for ho gear, this book is for you.

About This Book

Mark Twain once wrote, “Writing is easy. All you have to do is cross out the wrong words.” So we have done the easy part for you. We crossed ou all the wrong words and came up with this book. What are left are the wo that will help you plan for, install, acquire, protect, manage, and administ wireless networks from personal area to wide area.

We have started your journey by providing information on

*.Differentiating WPAN, WLAN, WMAN, and WWAN
*. Planning your wireless network
*.Doing a site survey
*.Using IrDA for transferring files
*.Using Bluetooth for wire replacement
*. Securing IrDA and Bluetooth
*. Acquiring the right equipment
*.Installing and configuring an access point
*.Acquiring and installing client hardware
*.Installing and configuring client software
*. Building a network to allow roaming
*.Connecting while on the go
*. Securing your WLAN
*. Understanding WEP, WPA, and RSN
*. Understanding EAP
*.Setting up a VPN using PPTP
*. Troubleshooting your network
*. Evaluating and fixing network performance
*. Using administrator software and utilities

How to Use This Book

You don’t have to start reading this book at the beginning — each chapter stands on its own, as does each and every part. In fact, if you are new to wireless networking but not new to networking, you may want to start with the radio frequency (RF) primer in Appendix C. It’s an exploration of radio frequency. We do suggest, however, that you consider starting at the begin­ning and reading to the end.

We encourage you to use the white space and the margins of this book. Mark it up and make it your own. Look up the links that we provideto find a wealth of information. You’ll want to write in the book because it will become an irre­placeable reference when you cross out words and add others yourself.

How This Book Is Organized

We grouped the chapters of this book into manageable chunks, called parts. Each part has a theme. For instance, the first part is like a handshake. We help you get started through planning and acquiring hardware and software. In between, we have some management parts. And the last part is an exchange of data.

Part I: Planning and Acquiring Your Network

Part I is the foundation required for the world of wireless networks. Chapter 1 breaks down the various types of wireless networks and provides examples of each type. If you’re trying to sell wireless within your organization, you will see some benefits of wireless you might want to use. Chapter 2 introduces the necessary planning for a successful implementation. You will see how to do a site survey. Chapter 3 sorts out more terminology and explains the differences between an ad hoc and an infrastructure network. You get the scoop on differ­entiating between BSS, IBSS, and ESS.

Part II: Implementing Your Wireless Network

Part II starts at 10 meters and moves to 100 meters and then beyond. Chapter 4 gives you an overview of IrDA and Bluetooth and security measures for both. You will understand how to use these technologies to replace wires in your office or on your body. Chapters 5 and 6 move on to wireless local area net­working. In Chapter 5, you see how to set up an access point. Chapter 6 talks about connecting Windows 2000, Windows XP, tablet PC, Linux, and Mac OS clients as well as Centrino-based systems. Chapter 7 moves you a little beyond your office through the use of bridges and switches. When you want to roam about your offices, you need to set your system up correctly. You can read how to do this in Chapter 7. Chapter 8 deals with accessing wireless wide area net­works. You will find a discussion about hot spots. But more important, you see how to get your e-mail wirelessly while on the road.

Part III: Using Your Network Securely

In Chapter 9, we introduce you to the additional risks of wireless networks — additional because you have all the risks of a wired network plus those specific to wireless. For instance, signal jamming is not a real risk in wired networks, but it is in wireless networks.

It wouldn’t be fair to just enumerate risks without providing some help. Chapter 10 provides a security architecture for your wireless network. You probably have a healthy paranoia when it comes to wireless and its security. Hopefully, Chapter 11 can allay some of your fears — and add some new ones. Chapter 12 helps you set up a secure channel because, quite frankly, who cares if WEP can be broken when you protect your data at a higher level?

Part IV: Keeping Your Network on the Air — Administration and Troubleshooting

Availability is an integral part of a network. So is administration. After we develop a network that is reliable, available, and secure, we must administer it. This includes documenting components. Chapter 13 highlights known wireless problems and practiced solutions. For instance, when you have a near/far condition, move one of the workstations closer. You’ll find pithy advice like this in Chapter 13. Chapter 14 discusses bridges and bridging technology. When you have a network, you have people complaining about connectivity

and performance. Chapter 15 provides some commonsense solutions to typi­cal wireless problems. Finally, Chapter 16 provides guidance for trying to wrap your hands (and heads) around your network. Whether you have an authorized wireless network or not, you won’t want to miss this chapter.

Part V: The Part of Tens

The Part of Tens provides top-ten that lists authors think are interesting. Our Part of Tens is no different. We provide a look at ten indispensable tools for network administrators and tinkerers alike (Chapter 17); ten ways to secure your WLAN (Chapter 18); and ten ways to use wireless in your busi­ness (Chapter 19).

Part VI: Appendixes

We also provide some valuable reference material in the Appendixes. Appendix A lists trade associations and user groups for wireless. You can find out whether there is a WUG (wireless user group) in your neighborhood. If you don’t have one, start one and send us the information. Appendix B pro­vides information on the 802 standards that you need to know for the wireless market. Appendix C, as mentioned earlier, provides the minimum necessary information that you need to set up a wireless network. If you want more infor­mation, refer to Appendixes A and B.
Read Comments for more

Would you like to get my updates directly to your mailbox? Click below to Enter your mail address

Subscribe to Books Tube


AddThis Feed Button 
Page copy protected against web site content infringement by Copyscape