Sunday, October 14, 2012

What is BCP?

Bulk Copy Program

The Bulk Copy Program (BCP) is a command-line utility that ships with Microsoft SQL Server. With BCP, you can import and export large amounts of data in and out of SQL Server databases quickly and easily. Any DBA who has utilized this functionality will agree that BCP is an essential tool.

Read More Articles/Tutorials

Game Development Tutorial


How to Make a Game
Fairly audacious heading, huh? There are a lot of books out there that are introductions to C++ or Direct3D, or discuss the construction of a real-time strategy game. What these books do not cover is which development methodologies you should employ in creating your game and how to be smart about outsourcing portions of it. This book is not a vague list of good ideas and suggestions; rather it gets down and dirty and discusses failed and successful project management techniques from my own experience as well as the experience of a multitude of other development studios.
First Have a Plan

Games that have a poor development methodology (or none at all) take much longer than they should, run over budget, and tend to be unreasonably buggy. The majority of commercial games fail to turn a profit. Figuring out what your game needs to do is called “requirements capture.” This book will show you how to use formalized methods such as the Unified Modeling Language’s use case diagrams to quickly collect your requirements and communicate them effectively to your team and other project stakeholders.
Even if you are working on a solo project, you must still take your game’s project planning seriously. A mere demo of your capabilities to show a prospective employer would be created with higher quality and with more speed if you follow the techniques presented here. These are just the earliest elements of an entire game project production methodology that is developed throughout this book.
Organize Your Team Effectively

Once you have a plan in hand, full game production commences. This is the most exciting time for a game project. Literally every day new features will come online, and on a healthy project,the team will feed itself with new energy to propel forward. This book discusses how to create task visibility so everyone knows what he or she needs to do and how far along the rest are in their tasks.
Controlling feature creep, reaching alpha, and freezing new features are critical to finishing your game. All of the mega-hits in our industry kept their feature sets narrow and the polish deep. I will point this out again: The mega-hits such as Doom, Warcraft, Myst, Gran Turismo, Mario64, and The Sims are not small games; rather their feature set is small but polished to a superior degree. This book will show you how to get a grip on your features.
If you think about it, teams with one developer must use their time even more effectively than a fat 30- person production. All the methods of creating achievable tasks, measuring progress, and controlling features are even more critical for very small teams.
Game Development Is Software Development

Game Development Is Software Development Games are certainly special; however, a point I will be making repeatedly throughout this book is that game development is software development. Games are software with art, audio, and gameplay. Financial planning software is software that is specialized for financial transactions and planning, expert systems are software with artificial intelligence, and cockpit instrumentation is software dedicated to flying an aircraft. Too often game developers hold themselves apart from formal software development and production methods with the false rationalization that games are an art, not a science. Game developers need to master their production methods so that they can produce their games in an organized, repeatable manner—a rigorous manner that creates great games on budget and on time.
Where to Turn for Outside Help

The game industry is maturing rapidly. With this growth, outside vendors that are experts in the fields of cinematics, character modeling, motion capture, sound effects, voice-over, language localization, quality assurance, marketing, and music composition have produced mature, cost-effective solutions for the largest to the smallest team.
Do you know how many moves you need to capture for your game or how much they will cost? Do you need to record in high fidelity 120 frames per second, or will buying a library of stock moves be the best solution? I will show you how to specify what you need and give you an idea of how the bid will break down in costs. Interviews by major vendors in these areas will highlight major gotchas where projects went afoul and explain how to avoid them.
How to Ship a Game

So you have finished your game, eh? You’ve coded it all up and played through it a bunch, and your friends like it, but how do you know when it is ready to ship? I will show you how to track bugs, prioritize your bugs effectively, task your bugs, and review your final candidates for readiness.
All game projects can benefit from beta testing. I will show you how to effectively solicit help from beta testers. Respect them and you will be repaid in help beyond measure. Let your beta testers lie fallow or fail to act meaningfully on their suggestions and your game will suffer. Beta testers are project stakeholders too; you must communicate with them effectively, explain to them your decisions, and show strength of leadership.
Post-Release

After a game ships you will often have a responsibility and an opportunity to support your game. This is especially true for the PC game market where it is possible to patch bugs, fine-tune the balance, and add new features or content. The new content can take the form of free downloads or larger packages that can be sold as expansions to your game. These are the straightforward tasks; true mega-hits transcend the status of just a game to play through and become a hobby. Enabling players to modify the game through the creation of new levels, new modules, new missions, or even total conversions keeps your game alive far beyond the life expectancy of a game without user-extensible elements.
Pioneered to great success, id Software’s Doom and Quake series coined the term level designer as an occupation. Arguably, the greatest strength of Chris Taylor’s Total Annihilation was its aggressive design for user modification. Chapter discusses the technical design, and it is here, in the earliest stages of architecture for your game, that you must plan for user modification. Waiting until the end of your project is not a valid method for adding user-extensibility to your game.
Fan communication is critical to long-term success; set up an Internet message board for your fans to trade ideas, tips, gripes, rants, stories, challenges, and new content.
Success and the Long Race

Success and the Long Race The deeper message I am presenting in this book is that successful game making is a long race rather than a sprint to fast cash. Any attempt to take a shortcut for poor motives will manifest itself in a sickly, failed game project. Take your time to figure out the context of your game project. Discover why you are making this game. What is the vision? What are your true profit goals? Are they reasonable? What should you accomplish in this game? Where this game you are making does fit into a chain of game projects?

Core Java Tutorial


AN INTRODUCTION TO JAVA

The first release of Java in 1996 generated an incredible amount of excitement, notjust in the computer press, but in mainstream media such as The New York Times, TheWashington Post, and Business Week. Java has the distinction of being the first and only programming language that had a ten-minute story on National Public Radio. A$100,000,000 venture capital fund was set up solely for products produced by use of aspecific computer language. It is rather amusing to revisit those heady times, and wegive you a brief history of Java in this section.
Java As a Programming Platform

Initially, we had this to write about Java:
“As a computer language, Java’s hype is overdone: Java is certainly a good programming language. There is no doubt that it is one of the better languages available toserious programmers. We think it could potentially have been a great programming language, but it is probably too late for that. Once a language is out in the field, the uglyreality of compatibility with existing code sets in.”
Our editor got a lot of flack for this paragraph from someone very high up at Sun Microsystems who shall remain unnamed. But, in hindsight, our prognosis seems accurate. Java has a lot of nice language features.It has its share of warts, and newer additions to the language are not as elegant as the original ones because of the ugly reality of compatibility.
But, as we already said in the first edition, Java was never just a language. There are lotsof programming languages out there, and few of them make much of a splash. Java is awhole platform, with a huge library, containing lots of reusable code, and an execution environment that provides services such as security, portability across operating systems,and automatic garbage collection.
As a programmer, you will want a language with a pleasant syntax and compre hensible semantics (i.e., not C++). Java fits the bill, as do dozens of other fine languages. Some languages give you portability, garbage collection, and the like, but they don’t havemuch of a library, forcing you to roll your own if you want fancy graphics or networking or database access. Well, Java has everything—a good language, a high-quality execution environment, and a vast library. That combination is what makes Java anirresistible proposition to so many programmers.
The Java “White Paper” Buzzwords

The authors of Java have written an influential White Paper that explains their designgoals and accomplishments. They also published a shorter summary that is organizedalong the following 11 buzzwords:
Simple                                    Portable
Object Oriented                     Interpreted
Network-Savvy                      High Performance
Robust                                    Multithreaded
Secure                                    Dynamic
Architecture                           Neutral
In this section, we will
  • Summarize, with excerpts from the White Paper, what the Java designers say abouteach buzzword; and
  • Tell you what we think of each buzzword, based on our experiences with the currentversion of Java.
Simple
We wanted to build a system that could be programmed easily without a lot of esoteric training and which leveraged today’s standard practice. So even though wefound that C++ was unsuitable, we designed Java as closely to C++ as possible inorder to make the system more comprehensible. Java omits many rarely used, poorly understood, confusing features of C++ that, in our experience, bring more griefthan benefit.
The syntax for Java is, indeed, a cleaned-up version of the syntax for C++. There is noneed for header files, pointer arithmetic (or even a pointer syntax), structures, unions,operator overloading, virtual base classes, and so on. (See the C++ notes interspersed throughout the text for more on the differences between Java and C++.) The designersdid not, however, attempt to fix all of the clumsy features of C++. For example, the syntaxof the switch statement is unchanged in Java. If you know C++, you will find the transitionto the Java syntax easy.
If you are used to a visual programming environment (such as Visual Basic), you willnot find Java simple. There is much strange syntax (though it does not take long to getthe hang of it). More important, you must do a lot more programming in Java. Thebeauty of Visual Basic is that its visual design environment almost automatically providesa lot of the infrastructure for an application. The equivalent functionality must be programmed manually, usually with a fair bit of code, in Java. There are, however,third-party development environments that provide “drag-and-drop”-style program development.
Another aspect of being simple is being small. One of the goals of Java is to enablethe construction of software that can run stand-alone in small machines. The size ofthe basic interpreter and class support is about 40K bytes; adding the basic standardlibraries and thread support (essentially a self-contained microkernel) adds anadditional 175K.
This was a great achievement at the time. Of course, the library has since grown to hugeproportions. There is now a separate Java Micro Edition with a smaller library, suitablefor embedded devices.
Object Oriented
Simply stated, object-oriented design is a technique for programming that focuses on the data (= objects) and on the interfaces to that object. To make an analogy with carpentry, an “object-oriented” carpenter would be mostly concerned with the chairhe was building, and secondarily with the tools used to make it; a “non-objectoriented”carpenter would think primarily of his tools. The object-oriented facilities of Java are essentially those of C++.
Object orientation has proven its worth in the last 30 years, and it is inconceivable that amodern programming language would not use it. Indeed, the object-oriented features ofJava are comparable to those of C++. The major difference between Java and C++ lies in multiple inheritance, which Java has replaced with the simpler concept of interfaces, and in the Java metaclass model.
Network-Savvy
Java has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP. Java applications can open and access objects across the Net via URLs with the same ease as when accessing a local file system.
We have found the networking capabilities of Java to be both strong and easy to use. Anyone who has tried to do Internet programming using another language will revel in how simple Java makes onerous tasks like opening a socket connection. The remote method invocation mechanism enables communication between distributed objects.
Robust
Java is intended for writing programs that must be reliable in a variety of ways. Java puts a lot of emphasis on early checking for possible problems, later dynamic (runtime) checking, and eliminating situations that are error-prone. . . . The single biggest difference between Java and C/C++ is that Java has a pointer model that eliminates the possibility of overwriting memory and corrupting data.
This feature is also very useful. The Java compiler detects many problems that, in other languages, would show up only at runtime. As for the second point, anyone who has spent hours chasing memory corruption caused by a pointer bug will be very happy with this feature of Java.
If you are coming from a language like Visual Basic that doesn’t explicitly use pointers, you are probably wondering why this is so important. C programmers are not so lucky.They need pointers to access strings, arrays, objects, and even files. In Visual Basic, you do not use pointers for any of these entities, nor do you need to worry about memory allocation for them. On the other hand, many data structures are difficult to implement in a pointerless language. Java gives you the best of both worlds. You do not need pointers for everyday constructs like strings and arrays. You have the power of pointers if you need it, for example, for linked lists. And you always have complete safety, because you can never access a bad pointer, make memory allocation errors, or have to protect against memory leaking away.
Secure
Java is intended to be used in networked /distributed environments. Toward that end, a lot of emphasis has been placed on security. Java enables the construction of virus-free, tamper-free systems.
Not long after the first version of the Java Development Kit was shipped, a group of security experts at Princeton University found subtle bugs in the security features of Java 1.0. Sun Microsystems has encouraged research into Java security, making publicly available the specification and implementation of the virtual machine and the security libraries. They have fixed all known security bugs quickly. In any case, Java makes it extremely difficult to outwit its security mechanisms. The bugs found so far have been very technical and few in number.
From the beginning, Java was designed to make certain kinds of attacks impossible, among them:
  • Overrunning the runtime stack—a common attack of worms and viruses
  • Corrupting memory outside its own process space
  • Reading or writing files without permission
A number of security features have been added to Java over time. Since version 1.1, Java has the notion of digitally signed classes (see Volume II). With a signed class, you can be sure who wrote it. Any time you trust the author of the class, the class can be allowed more privileges on your machine.
NOTE: A competing code delivery mechanism from Microsoft based on its ActiveX technology relies on digital signatures alone for security. Clearly this is not sufficient—as any user of Microsoft’s own products can confirm, programs from well-known vendors do crash and create damage. Java has a far stronger security model than that of ActiveX because it controls the application as it runs and stops it from wreaking havoc.
Architecture Neutral
The compiler generates an architecture-neutral object file format—the compiledcode is executable on many processors, given the presence of the Java runtime system.The Java compiler does this by generating bytecode instructions which have nothing to do with a particular computer architecture. Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on the fly.
This is not a new idea. More than 30 years ago, both Niklaus Wirth’s original implementation of Pascal and the UCSD Pascal system used the same technique.
Of course, interpreting byte codes is necessarily slower than running machine instructions at full speed, so it isn’t clear that this is even a good idea. However, virtual machines have the option of translating the most frequently executed byte code sequences into machine code, a process called just-in-time compilation. This strategy has proven so effective that even Microsoft’s .NET platform relies on a virtual machine.
The virtual machine has other advantages. It increases security because the virtual machine can check the behavior of instruction sequences. Some programs even produce bytecodes on the fly, dynamically enhancing the capabilities of a running program.
Portable
Unlike C and C++, there are no “implementation -dependent” aspects of the specification. The sizes of the primitive data types are specified, as is the behavior of arithmetic on them.
For example, an intin Java is always a 32-bit integer. In C/C++, intcan mean a 16-bitinteger, a 32-bit integer, or any other size that the compiler vendor likes. The only restriction is that the inttype must have at least as many bytes as a short intand cannot have more bytes than a long int. Having a fixed size for number types eliminates a major porting headache. Binary data is stored and transmitted in a fixed format, eliminating confusion about byte ordering. Strings are saved in a standard Unicode format.
The libraries that are a part of the system define portable interfaces. For example, there is an abstract Window class and implementations of it for UNIX, Windows, and the Macintosh.
As anyone who has ever tried knows, it is an effort of heroic proportions to write a program that looks good on Windows, the Macintosh, and ten flavors of UNIX. Java 1.0 made the heroic effort, delivering a simple toolkit that mapped common user interface elements to a number of platforms. Unfortunately, the result was a library that, with a lot of work, could give barely acceptable results on different systems. (And there were often different bugs on the different platform graphics implementations.) But it was a start. There are many applications in which portability is more important than user interface slickness, and these applications did benefit from early versions of Java. By now, the user interface toolkit has been completely rewritten so that it no longer relies on the host user interface. The result is far more consistent and, we think, more attractive than in earlier versions of Java.
Interpreted
The Java interpreter can execute Java bytecodes directly on any machine to which the interpreter has been ported. Since linking is a more incremental and lightweight process, the development process can be much more rapid and exploratory.
Incremental linking has advantages, but its benefit for the development process is clearly overstated. Early Java development tools were, in fact, quite slow. Today, the bytecodes are translated into machine code by the just-in-time compiler.
High Performance
While the performance of interpreted bytecodes is usually more than adequate, there are situations where higher performance is required. The bytecodes can be translated on the fly (at runtime) into machine code for the particular CPU the application is running on.
In the early years of Java, many users disagreed with the statement that the performance was “more than adequate.” Today, however, the just-in-time compilers have become so good that they are competitive with traditional compilers and, in some cases, even outperform them because they have more information available. For example, a just-in-time compiler can monitor which code is executed frequently and optimize just that code for speed. A more sophisticated optimization is the elimination (or “inlining”) of function calls. The just -in -time compiler knows which classes have been loaded. It can use inlining when, based upon the currently loaded collection of classes, a particular function is never overridden, and it can undo that optimization later if necessary.
Multithreaded
[The] benefits of multithreading are better interactive responsiveness and real-time behavior.
If you have ever tried to do multithreading in another language, you will be pleasantly surprised at how easy it is in Java. Threads in Java also can take advantage of multiprocessor systems if the base operating system does so. On the downside, thread implementations on the major platforms differ widely, and Java makes no effort to be platform independent in this regard. Only the code for calling multithreading remains the same across machines; Java offloads the implementation of multithreading to the underlying operating system or a thread library. Nonetheless, the ease of multithreading is one of the main reasons why Java is such an appealing language for server-side development.
Dynamic
In a number of ways, Java is a more dynamic language than C or C++. It was designed to adapt to an evolving environment. Libraries can freely add new methods and instance variables without any effect on their clients. In Java, finding out runtime type information is straightforward.
This is an important feature in those situations in which code needs to be added to a running program. A prime example is code that is downloaded from the Internet to run in a browser. In Java 1.0, finding out runtime type information was anything but straight forward, but current versions of Java give the programmer full insight into both the structure and behavior of its objects. This is extremely useful for systems that needto analyze objects at runtime, such as Java GUI builders, smart debuggers, pluggable components, and object databases.
NOTE: Shortly after the initial success of Java, Microsoft released a product called J++ with a programming language and virtual machine that was almost identical to Java. At this point, Microsoft is no longer supporting J++ and has instead introduced another language called C# that also has many similarities with Java but runs on a different virtual machine. There is even a J# for migrating J++ applications to the virtual machine used by C#.
Java Applets and the Internet

The idea here is simple: Users will download Java bytecodes from the Internet and run them on their own machines. Java programs that work on web pages are called applets. To use an applet, you only need a Java-enabled web browser, which will execute the bytecodes for you. You need not install any software. Because Sun licenses the Java source code and insists that there be no changes in the language and standard library, a Java applet should run on any browser that is advertised as Java-enabled. You get thelatest version of the program whenever you visit the web page containing the applet.
Most important, thanks to the security of the virtual machine, you need never worry about attacks from hostile code.
When the user downloads an applet, it works much like embedding an image in a webpage. The applet becomes a part of the page, and the text flows around the space usedfor the applet. The point is, the image is alive. It reacts to user commands, changes its appearance, and sends data between the computer presenting the applet and the computer serving it.
a good example of a dynamic web page that carries out sophisticated calculations. The Jmol applet displays molecular structures. By using the mouse, you can rotate and zoom each molecule to better understand its structure. This kind of direct manipulation is not achievable with static web pages, but applets make it possible.
The Jmol applet

When applets first appeared, they created a huge amount of excitement. Many people believe that the lure of applets was responsible for the astonishing popularity of Java. However, the initial excitement soon turned into frustration. Various versions of Netscape and Internet Explorer ran different versions of Java, some of which were seriously outdated. This sorry situation made it increasingly difficult to develop applets that took advantage of the most current Java version. Today, most web pages simply use JavaScript or Flash when dynamic effects are desired in the browser. Java, on the other hand, has become the most popular language for developing the server-side applications that produce web pages and carry out the backend logic.
A Short History of Java

This section gives a short history of Java’s evolution. It is based on various published sources (most important, on an interview with Java’s creators in the July 1995 issue of SunWorld’s on-line magazine).
Java goes back to 1991, when a group of Sun engineers, led by Patrick Naughton and Sun Fellow (and all-around computer wizard) James Gosling, wanted to design a small computer language that could be used for consumer devices like cable TV switchboxes. Because these devices do not have a lot of power or memory, the language had to be small and generate very tight code. Also, because different manufacturers may choose different central processing units (CPUs), it was important that the language not be tied to any single architecture. The project was code-named “Green.”
The requirements for small, tight, and platform -neutral code led the team to resurrect the model that some Pascal implementations tried in the early days of PCs. Niklaus Wirth, the inventor of Pascal, had pioneered the design of a portable language that generated intermediate code for a hypothetical machine. (These are often called virtualmachines—hence, the Java virtual machine or JVM.) This intermediate code could then be used on any machine that had the correct interpreter. The Green project engineers used a virtual machine as well, so this solved their main problem.
The Sun people, however, come from a UNIX background, so they based their language on C++ rather than Pascal. In particular, they made the language object oriented rather than procedure oriented. But, as Gosling says in the interview, “All along, the language was a tool, not the end.” Gosling decided to call his language “Oak” (presumably because he liked the look of an oak tree that was right outside his window at Sun). Thepeople at Sun later realized that Oak was the name of an existing computer language, so they changed the name to Java. This turned out to be an inspired choice.
In 1992, the Green project delivered its first product, called “*7.” It was an extremely intelligent remote control. (It had the power of a SPARC station in a box that was 6 inches by 4 inches by 4 inches.) Unfortunately, no one was interested in producing thisat Sun, and the Green people had to find other ways to market their technology. However, none of the standard consumer electronics companies were interested. The group then bid on a project to design a cable TV box that could deal with new cable services such as video on demand. They did not get the contract. (Amusingly, the company that did was led by the same Jim Clark who started Netscape—a company that did much to make Java successful.)
The Green project (with a new name of “First Person, Inc.”) spent all of 1993 and half of 1994 looking for people to buy its technology—no one was found. (Patrick Naughton, one of the founders of the group and the person who ended up doing most of the marketing, claims to have accumulated 300,000 air miles in trying to sell the technology.) First Person was dissolved in 1994.
While all of this was going on at Sun, the World Wide Web part of the Internet was growing bigger and bigger. The key to the Web is the browser that translates the hypertext page to the screen. In 1994, most people were using Mosaic, a noncommercial web browser that came out of the supercomputing center at the University of Illinoisin 1993. (Mosaic was partially written by Marc Andreessen for $6.85 an hour asan undergraduate student on a work-study project. He moved on to fame and fortune as one of the cofounders and the chief of technology at Netscape.)
In the SunWorldinterview, Gosling says that in mid-1994, the language developers realized that “We could build a real cool browser. It was one of the few things in the client/ server mainstream that needed some of the weird things we’d done: architecture neutral, real-time, reliable, secure—issues that weren’t terribly important in the workstation world. So we built a browser.”
The actual browser was built by Patrick Naughton and Jonathan Payne and evolved into the HotJava browser. The HotJava browser was written in Java to show off the power of Java. But the builders also had in mind the power of what are now called applets, so they made the browser capable of executing code inside web pages. This “proof of technology” was shown at SunWorld ‘95 on May 23, 1995, and inspired the Java craze that continues today.
Sun released the first version of Java in early 1996. People quickly realized that Java 1.0 was not going to cut it for serious application development. Sure, you could use Java 1.0 to make a nervous text applet that moved text randomly around in a canvas. But you couldn’t even print in Java 1.0. To be blunt, Java 1.0 was not ready for prime time. Its successor, version 1.1, filled in the most obvious gaps, greatly improved the reflection capability, and added a new event model for GUI programming. It was still rather limited, though.
The big news of the 1998 JavaOne conference was the upcoming release of Java 1.2, which replaced the early toylike GUI and graphics toolkits with sophisticated and scalable versions that come a lot closer to the promise of “Write Once, Run Any where”™ than its predecessors. Three days after (!) its release in December 1998, Sun’s marketing department changed the name to the catchy Java 2 Standard Edition Software Development  Kit Version 1.2.
Besides the Standard Edition, two other editions were introduced: the Micro Edition for embedded devices such as cell phones, and the Enterprise Edition for server -side processing. Here wefocuses on the Standard Edition.
Versions 1.3 and 1.4 of the Standard Edition are incremental improvements over the initial Java 2 release, with an ever-growing standard library, increased performance, and, of course, quite a few bug fixes. During this time, much of the initial hype about Java applets and client-side applications abated, but Java became the platform of choice for server-side applications.
Version 5.0 is the first release since version 1.1 that updates the Java language in significant ways. (This version was originally numbered 1.5, but the version number jumped to 5.0 at the 2004 JavaOne conference.) After many years of research, generic types (which are roughly comparable to C++ templates) have been added—the challenge was to add this feature without requiring changes in the virtual machine. Several other usefullanguage features were inspired by C#: a “for each” loop, autoboxing, and metadata. Language changes are always a source of compatibility pain, but several of these new language features are so seductive that we think that programmers will embrace them eagerly.
Version 6 (without the .0 suffix) was released at the end of 2006. Again, there are no language changes but additional performance improvements and library enhancements.
The evolution of the Java language and library. As you can see, the size of the application programming interface (API) has grown tremendously.
Evolution of the Java Language
Common Misconceptions about Java

We close this chapter with a list of some common misconceptions about Java, along with commentary.
Java is an extension of HTML.
Java is a programming language; HTML is a way to describe the structure of a web page. They have nothing in common except that there are HTML extensions for placing Java applets on a web page.
I use XML, so I don’t need Java.
Java is a programming language; XML is a way to describe data. You can process XMLdata with any programming language, but the Java APIcontains excellent support for XML processing. In addition, many important third-party XML tools are implemented in Java.
Java is an easy programming language to learn.
No programming language as powerful as Java is easy. You always have to distinguish between how easy it is to write toy programs and how hard it is to do serious work.
Java will become a universal programming language for all platforms.
This is possible, in theory, and it is certainly the case that every vendor but Microsoft seems to want this to happen. However, many applications, already working perfectly well on desktops, would not work well on other devices or inside a browser. Also, these applications have been written to take advantage of the speed of the processor and the native user interface library and have been ported to all the important platforms anyway. Among these kinds of applications are word processors, photo editors, and web browsers. They are typically written in C or C++, and we see no benefit to the end user in rewriting them in Java.
Java is just another programming language.
Java is a nice programming language; most programmers prefer it over C, C++, or C#. But there have been hundreds of nice programming languages that never gained widespreadpopularity, whereas languages with obvious flaws, such as C++ and VisualBasic, have been wildly successful.
Why? The success of a programming language is determined far more by the utility of the support system surrounding it than by the elegance of its syntax. Are there useful, convenient, and standard libraries for the features that you need to implement? Are there tool vendors that build great programming and debugging environments? Doesthe language and the toolset integrate with the rest of the computing infrastructure? Java is successful because its class libraries let you easily do things that were hard before, such as networking and multithreading. The fact that Java reduces pointer errors is a bonus and so programmers seem to be more productive with Java, but these factors are not the source of its success.
Now that C# is available, Java is obsolete.
C# took many good ideas from Java, such as a clean programming language, a virtual machine, and garbage collection. But for whatever reasons, C# also left some good stuff behind, in particular security and platform independence. If you are tied to Windows, C# makes a lot of sense. But judging by the job ads, Java is still the language of choice for a majority of developers.
Java is proprietary, and it should therefore be avoided.
Sun Microsystems licenses Java to distributors and end users. Although Sun has ultimate control over Java through the “Java Community Process,” they have involved many other companies in the development of language revisions and the design of newlibraries. Source code for the virtual machine and the libraries has always been freelyavailable, but only for inspection, not for modification and redistribution. Up to this point, Java has been “closed source, but playing nice.”
This situation changed dramatically in 2007, when Sun announced that future versions of Java will be available under the General Public License, the same open source license that is used by Linux. It remains to be seen how Sun will manage the governance of Java in the future, but there is no question that the open sourcing of Java has been a very courageous move that will extend the life of Java by many years.
Java is interpreted, so it is too slow for serious applications.
In the early days of Java, the language was interpreted. Nowadays, except on “micro” platforms such as cell phones, the Java virtual machine uses a just -in -time compiler. The “hot spots” of your code will run just as fast in Java as they would in C++, and in somecases, they will run faster.
Java does have some additional overhead over C++. Virtual machine startup time is slow, and Java GUIs are slower than their native counterparts because they are painted in a platform-independent manner.
People have complained for years that Java applications are too slow. However, today’s computers are much faster than they were when these complaints started. A slow Java program will still run quite a bit better than those blazingly fast C++ programs did a few years ago. At this point, these complaints sound like sour grapes, and some detractors have instead started to complain that Java user interfaces are ugly rather than slow.
All Java programs run inside a web page.
All Java applets run inside a web browser. That is the definition of an applet—a Java program running inside a browser. But most Java programs are stand-alone applications that run outside of a web browser. In fact, many Java programs run on web servers and produce the code for web pages.
Most of the programs here are stand-alone programs. Sure, applets can be fun. But stand-alone Java programs are more important and more useful in practice.
Java programs are a major security risk.
In the early days of Java, there were some well -publicized reports of failures in the Java security system. Most failures were in the implementation of Java in a specific browser. Researchers viewed it as a challenge to try to find chinks in the Java armor and to defy the strength and sophistication of the applet security model. The technical failures that they found have all been quickly corrected, and to our knowledge, no actual systems were ever compromised. To keep this in perspective, consider the literally millions of virus attacks in Windows executable files and Word macros that cause real grief but surprisingly little criticism of the weaknesses of the attacked platform. Also, the ActiveX mechanism in Internet Explorer would be a fertile ground for abuse, but it is so boringly obvious how to circumvent it that few researchers have bothered to publicize their findings.
Some system administrators have even deactivated Java in company browsers, while continuing to permit their users to download executable files, ActiveX controls, and Word documents. That is pretty ridiculous—currently, the risk of being attacked by hostile Java applets is perhaps comparable to the risk of dying from a plane crash; the risk of being infected by opening Word documents is comparable to the risk of dying while crossing a busy freeway on foot.
JavaScript is a simpler version of Java.
JavaScript, a scripting language that can be used inside web pages, was invented by Netscape and originally called LiveScript. JavaScript has a syntax that is reminiscent of Java, but otherwise there are no relationships (except for the name, of course). A subset of JavaScript is standardized as ECMA-262. JavaScript is more tightly integrated with browsers than Java applets are. In particular, a JavaScript program can modify the document that is being displayed, whereas an applet can only control the appearance of a limited area.
With Java, I can replace my computer with a $500 “Internet appliance.”
When Java was first released, some people bet big that this was going to happen. Ever since the first edition of this book, we have believed it is absurd to think that home users are going to give up a powerful and convenient desktop for a limited machine with nolocal storage. We found the Java-powered network computer a plausible option for a“zero administration initiative” to cut the costs of computer ownership in a business, but even that has not happened in a big way.
On the other hand, Java has become widely distributed on cell phones. We must confess that we haven’t yet seen a must-have Java application running on cell phones, but the usual fare of games and screen savers seems to be selling well in many markets.

SQL Views - Advantages and Disadvantages

Advantages

Views are used for several different reasons:
  1. To hide data complexity. Instead of forcing your users to learn the T-SQL JOIN syntax you might wish to provide a view that runs a commonly requested SQL statement.
     
  2. To protect the data. If you have a table containing sensitive data in certain columns, you might wish to hide those columns from certain groups of users. For instance, customer names, addresses and their social security numbers might all be stored in the same table; however, for lower level employees like shipping clerks, you can create a view that only displays customer name and address. You can grant permissions to a view without allowing users to query the underlying tables. There are a couple of ways you might want to secure your data:
    1. Create a view to allow reading of only certain columns from a table. A common example of this would be the salary column in the employee table. You might not want all personnel to be able to read manager's or each other's salary. This is referred to as partitioning a table vertically and is accomplished by specifying only the appropriate columns in the CREATE VIEW statement.
       
    2. Create a view to allow reading only certain rows from a table. For instance, you might have a view for department managers. This way, each manager can provide raises only to the employees of his or her department. This is referred to as horizontal partitioning and is accomplished by providing a WHERE clause in the SELECT statement that creates a view.
       
Enforcing some simple business rules. For example, if you wish to generate a list of customers that need to receive the fall catalog, you can create a view of customers that have previously bought your shirts during the fall.
 


Data exports with BCP. If you are using BCP to export your SQL Server data into text files, you can format the data through views since BCP's formatting ability is quite limited.
 
Customizing data. If you wish to display some computed values or column names formatted differently than the base table columns, you can do so by creating views.

Disadvantages

Even though views can be a great tool for securing and customizing data, they can be slow. Indeed, they are not any faster than the query that defines them. With SQL Server 2000, indexed views (also referred to as "materialized" views) are supported to overcome this limitation.

Views can especially degrade the performance if they are based on other views. Therefore, it is recommended NOT to create views based on other views. All views should be created against base tables. 

SQL CREATE VIEW Syntax

CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

SQL CREATE VIEW Examples

CREATE VIEW [Current Product List] AS
SELECT ProductID,ProductName
FROM Products
WHERE Discontinued=No

SQL Updating a View

You can update a view by using the following syntax:

SQL CREATE OR REPLACE VIEW Syntax

CREATE OR REPLACE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
Now we want to add the "Category" column to the "Current Product List" view. We will update the view with the following SQL:
CREATE VIEW [Current Product List] AS
SELECT ProductID,ProductName,Category
FROM Products
WHERE Discontinued=No
SQL Dropping a View

SQL DROP VIEW Syntax

DROP VIEW view_name


Difference between Stored Procedure and Function


  • Procedure can return zero or n values whereas function can return one value which is mandatory.
  • Procedures can have input/output parameters for it whereas functions can have only input parameters.
  • Procedure allows select as well as DML statement in it whereas function allows only select statement in it.
  • Functions can be called from procedure whereas procedures cannot be called from function.
  • Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in afunction.
  • We can go for transaction management in procedure whereas we can't go in function.
  • Procedures can not be utilized in a select statement whereas function can be embedded in a select statement.
  • UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Storedprocedures cannot be.
  • UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
  • Inline UDF's can be though of as views that take parameters and can be used in JOINs and other Rowsetoperations.

JavaScript Tutorial


What Is JavaScript?

When JavaScript first appeared in 1995, its main purpose was to handle some of the input validation that had previously been left to server-side languages such as Perl. Prior to that time, a round trip to the server was needed to determine if a required field had been left blank or an entered value was invalid. Netscape Navigator sought to change that with the introduction of JavaScript.The capability to handle some basic validation on the client was an exciting new feature at a time when use of telephone modems (operating at 28.8 kbps) was widespread. Such slow speeds turned every trip to the server into an exercise in patience.
Since that time, JavaScript has grown into an important feature of every major Web browser on the market. No longer bound to simple data validation,JavaScript now interacts with nearly all aspects of the browser window and its contents.Even Microsoft,with its own client-side scripting language called VBScript,ended up including its own JavaScript implementation in Internet Explorer from its very earliest version.
A Short History of Java Script

Around 1992, a company called Nombas began developing an embedded scripting language called C-minus-minus (Cmm for short).The idea behind Cmm was simple: a scripting language powerful enough to replace macros, but still similar enough to C (and C++) that developers could learn it quickly.This scripting language was packaged in a shareware product called CEnvi,which first exposed the power of such languages to developers. Nombas eventually changed the name Cmm to ScriptEase because the latter sounded “too negative” and the letter C “frightened people” .ScriptEase is now the driving force behind Nombas products. When the popularity of Netscape Navigator started peaking, Nombas developed a version of CEnvi that could be embedded into Web pages.These early experiments were called Espresso Pages, and they represented the first client-side scripting language used on the World Wide Web.Little did Nombas know that its ideas would become an important foundation for the Internet.
As Web surfing gained popularity,a gradual demand for client-side scripting languages developed.At the time, most Internet users were connecting over a 28.8 kbps modem even though Web pages were growing in size and complexity. Adding to users’ pain was the large number of round-trips to the server required for simple form validation. Imagine filling out a form,clicking the Submit button, waiting 30 seconds for processing,and then being met with a message telling you that you forgot to complete a required field. Netscape,at that time on the cutting edge of technological innovation, began seriously considering the development of a client-side scripting language to handle simple processing.
Brendan Eich,who worked for Netscape at the time,began developing a scripting language called LiveScript for the upcoming release of Netscape Navigator 2.0 in 1995, with the intention of using it both in the browser and on the server (where it was to be called LiveWire).Netscape entered into a development alliance with Sun Microsystems to complete the implementation of LiveScript in time for release.Just before Netscape Navigator 2.0 was officially released, Netscape changed the name to JavaScript in order to capitalize on Java as a new Internet buzzword.Netscape’s gamble paid off and JavaScript became a must-have from that point on.
Because JavaScript 1.0 was such a hit, Netscape released version 1.1 in Netscape Navigator 3.0. Right around that time, Microsoft decided to throw its hat into the ring and released Internet Explorer 3.0 with a JavaScript-clone called JScript (so-called in order to avoid any possible licensing issues with Netscape).This major step for Microsoft into the realm of Web browsers is now a date that lives in infamy for Netscape, but it also represented a major step in the development of JavaScript as a language.
After Microsoft threw its hat into the ring, three different JavaScript versions were floating around:JavaScript in Netscape Navigator, JScript in Internet Explorer, and CEnvi in ScriptEase. Unlike C and many other programming languages,JavaScript had no standards governing its syntax or features, and the three different versions only highlighted this problem. With industry fears mounting,it was decided that the language must be standardized.
 In 1997,JavaScript 1.1 was submitted to the European Computer Manufacturers Association (ECMA) as a proposal. Technical Committee #39 (TC39) was assigned to “standardize the syntax and semantics of a general purpose, cross-platform, vendor-neutral scripting language” .Made up of programmers from Netscape, Sun, Microsoft, Borland, and other companies with interest in the future of scripting, TC39 met for months to hammer out ECMA-262,a standard defining a new scripting language named ECMAScript.
The following year, the International Organization for Standardization and International Electrotechnical Commission (ISO/IEC) also adopted ECMAScript as a standard (ISO/IEC-16262).Since that time, Web browsers have tried, with varying degrees of success and failure, to use ECMAScript as a basis for their JavaScript implementations.
JavaScript Implementations

Although ECMA Script is an important standard, it is not the only part of JavaScript,and certainly not the only part that has been standardized. Indeed,a complete JavaScript implementation is made up of three distinct parts
  • The Core (ECMAScript)
  • The Document Object Model (DOM)
  • The Browser Object Model (BOM)
ECMAScript
ECMAScriptdoesn’t have ties to any browser in particular and, actually,has no methods for user input or output to speak of.(It is not unlike languages such as C,which rely on external libraries to accomplish such tasks.) So what is ECMAScript?
“ECMAScript can provide core scripting capabilities for a variety of host environments,and therefore the core scripting language is specified...apart from any particular host environment.”
AWeb browser is considered a host environment for ECMAScript,but it is not the only host environment.Indeed,numerous other environments (such as Nombas’s ScriptEase and Macromedia’s ActionScript, used in both Flash and Director MX) can host ECMAScript implementations.So what does ECMAScript specify outside of a browser? To put it simply,ECMAScript describes the following:
  • Syntax
  • Types
  • Statements
  • Keywords
  • Reserved Words
  • Operators
  • Objects
ECMAScript is simply a description,defining all the properties, methods,and objects of a scripting language.Other languages implement ECMAScript,as JavaScript does,as the baseline for functionality.
Each browser has its own implementation of the ECMAScript interface, which is then extended to contain the DOM and BOM There are other languages that also implement and extend ECMAScript such as Windows Scripting Host (WSH), ActionScript in Macromedia Flash and Director,and Nombas ScriptEase.
ECMAScript editions
ECMAScript is separated into editions rather than versions because it is defined in a standard called ECMA-262. Like any standard, ECMA-262 can be edited and updated. When a major update occurs, a new edition of the standard is published. The most recent edition of ECMA-262 is edition 3, released in December of 1999.The first edition of ECMA-262 was essentially the same as Netscape’s JavaScript 1.1 with all browser-specific code removed, but with a few changes.First, ECMA-262 required support for the Unicode Standard (to support multiple languages).Second, it required that objects be platformindependent (Netscape’s JavaScript 1.1 actually had different implementations of objects, such as the Date object, depending on the platform).This was a major reason why JavaScript 1.1 and 1.2 did not conform to the first edition of ECMA-262.
The second edition of ECMA-262 was largely editorial in nature.The standard was updated in order to get into strict agreement with ISO/IEC-16262 and didn’t feature any additions,changes,or omissions.ECMAScript implementations typically don’t use the second edition as a measure of conformance.
The third edition of ECMA-262 was the first real update to the standard. It provides updates to string handling,the definition of errors, and numeric outputs.It also adds support for regular expressions, new control statements, try...catch exception handling,and small changes to better prepare the standard for internationalization. To many, this marked the arrival of ECMAScript as a true programming language.
What does ECMAScript conformance mean?
In ECMA-262, the definition of ECMAScript conformance is laid out. A scripting language must subscribe to four basic tenets:
  • A conforming implementation must support all “types, values, objects, properties, functions, and program syntax and semantics” (ECMA-262, p. 1) as they are described in ECMA-262.<
  • A conforming implementation must support the Unicode Character Standard.
  • A conforming implementation may add “additional types, values, objects, properties, and functions” that are not specified in ECMA-262. ECMA-262 describes these additions as primarily new objects or new properties of objects not given in the specification.
  • A conforming implementation may support “program and regular expression syntax” that are not defined in ECMA-262 (meaning that the built-in regular expression support is allowed to be altered and extended).
All implementations of ECMAScript must be in agreement with these criteria.
ECMAScript support in Web browsers
Netscape Navigator 3.0 shipped with JavaScript 1.1 in 1996.That same JavaScript 1.1 specification was then submitted to the ECMA as a proposal for a new standard.With JavaScript’s explosive popularity, Netscape was very happy to start developing version 1.2.One problem: ECMA hadn’t yet accepted Netscape’s proposal.
A little after Netscape Navigator 3.0 was released, Microsoft introduced Internet Explorer 3.0. This version of IE shipped with JScript 1.0 (Microsoft’s name for its JavaScript implementation), which was supposed to be equivalent to JavaScript 1.1. However, because of undocumented and improperly replicated features, JScript 1.0 fell far short of JavaScript 1.1.
Netscape Navigator 4.0 was shipped in 1997 with JavaScript 1.2 before the first edition of ECMA-262 was finalized;ECMA-262 was accepted and standardized later that year. As a result, JavaScript 1.2 is not compliant to the first edition of ECMAScript, even though ECMAScript was supposed to be based on JavaScript 1.1.
The next update to JScript occurred in Internet Explorer 4.0 with version JScript 3.0(version 2.0 was released in Microsoft’s Internet Information Server version 3.0 but was never included in a browser).Microsoft put out a press release touting JScript 3.0 as the first truly ECMA-compliant scripting language in the world. At that time, ECMA-262 hadn’t yet been finalized, so JScript 3.0 suffered the same fate as JavaScript 1.2: It did not comply with the final ECMAScript standard.
Netscape opted to update its JavaScript implementation in Netscape Navigator 4.06. JavaScript 1.3 brought Netscape into full compliance with ECMAScript Edition 1.Netscape added support for the Unicode standard and made all objects platform-independent while keeping the features that were introduced in JavaScript 1.2.
When Netscape released its source code to the public as the Mozilla project,it was anticipated that JavaScript 1.4 would be shipped with Netscape Navigator 5.0. However, a radical decision to completely redesign the Netscape code from the bottom up threw a monkey wrench into the works. JavaScript 1.4 was only released as a server-side language for the Netscape Enterprise Server and never made it into a Web browser.
Today, all popular Web browsers comply with the third edition of ECMA-262. The following table lists ECMAScript support in the most popular Wed browsers:

The Document Object Model (DOM)
The Document Object Model (DOM) is an application programming interface (API) for HTML as well as XML. The DOM maps out an entire page as a document composed of a hierarchy of nodes. Each part of an HTML or XML page is a derivative of a node. Consider the following HTML page:
<html>
<head>
<title>Sample  Page</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
This code can be diagrammed into a hierarchy of nodes using the DOM .
By creating a tree to represent a document, the DOM allows developers an unprecedented level of control over its content and structure. Nodes can easily be removed, added, and replaced by using the DOM API.
Why the DOM is necessary
With Internet Explorer 4.0 and Netscape Navigator 4.0 each supporting different forms of Dynamic HTML (DHTML),developers for the first time could alter the appearance and content of a Web page without reloading it.This represented a tremendous step forward in Web technology,but also a huge problem.Netscape and Microsoft each went its own way in developing DHTML,thus ending the period when Web developers could write a single HTML page that could be accessed by any Web browser.
It wasdecided that something had to be done to preserve the cross-platform nature of the Web.The fear was that,if someone didn’t rein in Netscape and Microsoft,the Web would develop into two distinct factions that were exclusive to targeted browsers.It was then that the World Wide Web Consortium (W3C),the body charged with creating standards for Web communication,began working on the DOM.
DOM levels
DOM Level 1 became a W3C recommendation in October of 1998.It consisted of two modules:the DOM Core,which provided a way to map the structure of an XML-based document to allow for easy access to and manipulation of any part of a document, and the DOM HTML,which extended the DOM Core by adding HTML-specific objects and methods.
Whereas DOM Level 1’s only goal was to map out the structure of a document,DOM Level 2’s aims were much broader. This extension to the original DOM added support for mouse and user interface events (long supported by DHTML),ranges, traversals (methods to iterate over a DOM document),and support for Cascading Style Sheets (CSS) through object interfaces.The original DOM Core introduced in Level 1 was also extended to include support for XML namespaces.
DOM Level 2 introduced several new modules of the DOM to deal with new types of interfaces:
  • DOM Views — describes interfaces to keep track of the various views of a document (that is, the document before CSS styling and the document after CSS styling)
  • DOM Events — describes interfaces for events
  • DOM Style — describes interfaces to deal with CSS-based styles
  • DOM Traversal and Range — describes interfaces to traverse and manipulate a document tree DOM Level 3 further extends the DOM with the introduction of methods to load and save documents in a uniform way (contained in a new module called DOM Load and Save) as well as methods to validate a document (DOM Validation). In Level 3, the DOM Core is extended to support all of XML 1.0, including XML Infoset, XPath, and XML Base.
Other DOMs
Aside from the DOM Core and DOM HTML interfaces,several other languages have had their own DOM standards published.The languages are XML-based and each DOM adds methods and interfaces unique to that language:
  • Scalable Vector Graphics (SVG) 1.0
  • Mathematical Markup Language (MathML) 1.0
  • Synchronized Multimedia Integration Language (SMIL)
Additionally,other languages have developed their own DOM implementations,such as Mozilla’s XML User Interface Language (XUL).However,only the languages in the preceding list are standard recommendations from W3C.
DOM support in Web browsers
The DOM was already a standard for some time before Web browsers started implementing it.Internet Explorer took first stab in version 5.0,but it actually didn’t have any realistic DOM support until version 5.5, when it implemented most of DOM Level 1.Internet Explorer hasn’t introduced new DOM functionality since that time.
For Netscape,no DOM support existed until Netscape 6 (Mozilla 0.6.0) was introduced.To date, Mozilla has the best support for the DOM, implementing all of Level 1,nearly all of Level 2, and some parts of Level 3.(The goal of the Mozilla development team was to build a 100% standards-compliant browser,and their work paid off.)
Latecomers such as Opera,which didn’t add DOM support until version 7.0,and Safari, which has implemented most of DOM Level 1,are mostly on par with Internet Explorer 5.5; and in some cases,they exceed it.However,all the browsers are still a distant second to Mozilla as far as DOM support goes.The following fidure shows DOM support for popular browsers:
The Browser Object Model (BOM)
The Internet Explorer 3.0 and Netscape Navigator 3.0 browsers feature a Browser Object Model (BOM) that allows access and manipulation of the browser window. Using the BOM,developers can move the window, change text in the status bar, and perform other actions that do not directly relate to the page content. What makes the BOM truly unique, and often problematic, is that it is the only part of a JavaScript implementation that has no related standard.
Primarily, the BOM deals with the browser window and frames, but generally any browser-specific extension to JavaScript is considered to be a part of the BOM. Such things include:
  • The capability to pop up new browser windows.
  • The capability to move,resize,and close browser windows.
  • The navigator object,which provides detailed information about the Web browser.
  • The location object,which gives detailed information about the page loaded in the browser.
  • The screen object,which gives detailed information about the user’s screen resolution.
  • Support for cookies.
  • Internet Explorer extends the BOM to include the ActiveXObject class, which can be used to instantiate ActiveX objects through JavaScript.
Because no standards exist for the BOM, each browser has its own implementation.There are some defacto standards,such as having a window object and a navigator object,but each browser defines its ownproperties and methods for these and other objects.


Differences between Asp.net 2.0 and 3.5

SNoFeatureAsp.net 2.0   Asp.net 3.5
1.New FeaturesAsp.net 2.0 includes the following new features
1)    Master Pages
2)    Profiles
3)    Girdivew Control
  Asp.net 3.5 includes the following         new features
1)    Listview Control
2)    DataPager Control
3)    Nested Master Pages
4)    Linq DataSource
2.Multi TargetingAsp.net 2.0 does not support multi-targeting environmentAsp.net 3.5 supports multi –    targeting What is multi – targeting? Check below description
3.Ajax SupportThere is no built-in support for AJAX in asp.net 2.0 , it has to be installed and downloadedIn Asp.net 3.5, Ajax is integrated in .NET framework, thereby making the process of building intuitive cool user interfaces easier
4.Silverlight SupportIt does not support for silverlightIt support for silverlight
5.JavaScript DebuggingIt does not support for JavaScript debuggingIt support for JavaScript debugging
6.LINQ SupportIt doesn’t support LINQIt supports LINQ


Read More Articles/ Tutorials