Saturday, 7 April 2012

C Sharp Tutorials/Lesson 21 Lesson 21: Anonymous Methods


In Lesson 14: Introduction to Delegates, you learned a about delegates and how they enable you to connect handlers to events. For C# v2.0, there is a new language feature, called anonymous methods, that are similar to delegates, but require less code. While you learn about anonymous methods, we'll cover the following objectives:
  • Understand the benefits of anonymous methods
  • Learn how to implement an anonymous method
  • Implement anonymous methods that use delegate parameters

How Do Anonymous Methods Benefit Me?

An anonymous method is a method without a name - which is why it is called anonymous. You don't declare anonymous methods like regular methods. Instead they get hooked up directly to events. You'll see a code example shortly.
To see the benefit of anonymous methods, you need to look at how they improve your development experience over using delegates. Think about all of the moving pieces there are with using delegates: you declare the delegate, write a method with a signature defined by the delegate interface, delcare the event based on that delegate, and then write code to hook the handler method up to the delegate. With all this work to do, no wonder programmers, who are new to C# delegates, have to do a double-take to understand how they work.
Because you can hook an anonymous method up to an event directly, a couple of the steps of working with delegates can be removed. The next section shows you how this works.

Implementing an Anonymous Method

An anonymous method uses the keyword, delegate, instead of a method name. This is followed by the body of the method. Typical usage of an anonymous method is to assign it to an event. Listing 21-1 shows how this works.
Listing 21-1. Implementing an Anonymous Method
using System.Windows.Forms;

public partial class Form1 : Form
{
  public Form1()
  {
      Button btnHello = new Button();
      btnHello.Text = "Hello";

      btnHello.Click +=
          delegate
          {
              MessageBox.Show("Hello");
          };

      Controls.Add(btnHello);
  }
}
The code in Listing 21-1 is a Windows Forms application. It instantiates a Button control and sets its Text to "Hello". Notice the combine, +=, syntax being used to hook up the anonymous method. You can tell that it is an anonymous method because it uses thedelegate keyword, followed by the method body in curly braces. Remember to terminate anonymous methods with a semi-colon.
Essentially, you have defined a method inside of a method, but the body of the anonymous method doesn't execute with the rest of the code. Because you hook it up to the event, the anonymous method doesn't execute until the Click event is raised. When you run the program and click the Hello button, you'll see a message box that say's "Hello" - courtesy of the anonymous method.
Using Controls.Add, adds the new button control to the window. Otherwise the window wouldn't know anything about the Button and you wouldn't see the button when the program runs.

Using Delegate Parameters with Anonymous Methods

Many event handlers need to use the parameters of the delegate they are based on. The previous example didn't use those parameters, so it was more convenient to not declare them, which C# allows. Listing 21-2 shows you how to use parameters if you need to.
Listing 21-2. Using Parameters with Anonymous Methods
using System;
using System.Windows.Forms;

public partial class Form1 : Form
{
  public Form1()
  {
      Button btnHello = new Button();
      btnHello.Text = "Hello";

      btnHello.Click +=
          delegate
          {
              MessageBox.Show("Hello");
          };

        Button btnGoodBye = new Button();
      btnGoodBye.Text = "Goodbye";
      btnGoodBye.Left = btnHello.Width + 5;

      btnGoodBye.Click +=
          delegate(object sender, EventArgs e)
          {
              string message = (sender as Button).Text;
              MessageBox.Show(message);
          };

      Controls.Add(btnHello);
        Controls.Add(btnGoodBye);
  }
}
The bold parts of Listing 21-2 show another Button control added to the code from Listing 21-1. Besides changing the text, btnGoodBye is moved to the right of btnHello by setting it's Left property to 5 pixels beyond the right edge of btnHello. If we didn't do this,btnGoodBye would cover btnHello because both of thier Top and Left properties would default to 0.
Beyond implementation details, the real code for you to pay attention to is the implementation of the anonymous method. Notice that the delegate keyword now has a parameter list. this parameter list must match the delegate type of the event that the anonymous method is being hooked up to. The delegate type of the Click event isEventHandler, which has the following signature:
public delegate void EventHandler(object sender, EventArgs e);
Notice the EventHandler parameters. Now, here's how the Button control's Click event is defined:
public event EventHandler Click;
Notice that the delegate type of the Click event is EventHandler. This is why the anonymous method, assigned to btnGoodBye.Click in Listing 21-2, must have the same parameters as the EventHandler delegate.

C Sharp Tutorials/Lesson 22 Lesson 22: Topics on C# Type


Throughout this tutorial, you've seen many different types, including those that are part of C# and custom designed types. If you've taken the samples and worked on them yourself, extending and writing your own programs, you are likely to have experienced errors associated with type. For example, you can't assign a double to an int without using a cast operator to perform the conversion. Another feature of C# concerns the semantic differences between reference and value types. Such problems should make you wonder why this is so and that's what this lesson is for. Here are the objectives for this lesson:
  • Understand the need for type safety
  • See how to convert one type to another
  • Learn about reference types
  • Learn about value types
  • Comprehend the semantic differences between reference and value types

Why Type Safety?

In untyped languages, such as scripting languages, you can assign one variable to another and the compiler/interpreter will use an intelligent algorithm to figure out how the assignment should be done. If the assignment is between two variables of the same type, all is good. However, if the assignment is between different types, you could have serious problems.
For example, if you assigned an int value to a float variable it would convert okay because the fractional part of the new float would just be zero. However, if you went the other way and assigned a float value to an int variable, that would most likely be a problem. You would lose all of the precision of the original float value. Consider the damage that could be caused if the float value represented a chemical ingredient, an engineering measurement, or a financial value. Finding such an error would be difficult and particularly expensive, especially if the error didn't show up until your application was in production (already being used by customers).

Using the Cast Operator for Conversions

In Lesson 02: Operators, Types, and Variables, you learned about C# types and operators. It explained the size and precision of the various types and there is a list of available operators. The cast operator, (x), is listed first as a primary operator in Table 2-4. When you must convert a type that doesn't fit, it must be done via what is called an explicit conversion, which uses the cast operator. Listing 22-1 has an example of an implicit conversion, which doesn't require the cast operator, and an explicit conversion.
Listing 22-1. Cast Operators
using System;

class Program
{
  static void Main()
  {
      float lengthFloat = 7.35f;

      // lose precision - explicit conversion
      int lengthInt = (int)lengthFloat;

      // no problem - implicit conversion
      double lengthDouble = lengthInt;

      Console.WriteLine("lengthInt =
          " + lengthInt);
      Console.WriteLine("lengthDouble
          = " + lengthDouble);
      Console.ReadKey();
  }
}
Here's the output:
lengthInt = 7
lengthDouble = 7
Since a float, lengthFloat, has a fractional part but an int, lengthInt, doesn't; the types aren't compatible. Because of type safety, C# won't allow you to assign lengthFloat directly to lengthInt, which would be dangerous. For your protection, you must use a cast operator,(int), to force the explicit conversion of lengthFloat to lengthInt. In the output, you can see that lengthInt is 7, showing that it lost the fractional part of the 7.35f value fromlengthFloat.
The assignment from lengthInt to lengthDouble is safe because a double is 64-bit and an int is 32-bit, meaning that you won't lose information. Therefore, the conversion is implicit, meaning that you can perform the assignment without the cast operator.

Understanding Reference Types

Reference type variables are named appropriately (reference) because the variable holds a reference to an object. In C and C++, you have something similar that is called a pointer, which points to an object. While you can modify a pointer, you can't modify the value of a reference - it simply points at the object in memory.
An important fact you need to understand is that when you are assigning one reference type variable to another, only the reference is copied, not the object. The variable holds the reference and that is what is being copied. Listing 22-2 shows how this works.
Listing 22-2. Reference Type Assignment
using System;

class Employee
{
  private string m_name;

  public string Name
  {
      get { return m_name; }
      set { m_name = value; }
  }
}

class Program
{
  static void Main()
  {
      Employee joe = new Employee();
      joe.Name = "Joe";

      Employee bob = new Employee();
      bob.Name = "Bob";

      Console.WriteLine("Original Employee Values:");
      Console.WriteLine("joe = " + joe.Name);
      Console.WriteLine("bob = " + bob.Name);

      // assign joe reference to bob variable
      bob = joe;

      Console.WriteLine();
      Console.WriteLine("Values After Reference Assignment:");
      Console.WriteLine("joe = " + joe.Name);
      Console.WriteLine("bob = " + bob.Name);

      joe.Name = "Bobbi Jo";

      Console.WriteLine();
      Console.WriteLine("Values After Changing One Instance:");
      Console.WriteLine("joe = " + joe.Name);
      Console.WriteLine("bob = " + bob.Name);

      Console.ReadKey();
  }
}
Here's the output:
Original Employee Values:
joe = Joe
bob = Bob

Values After Reference Assignment:
joe = Joe
bob = Joe

Values After Changing One Instance:
joe = Bobbi Jo
bob = Bobbi Jo
In Listing 22-2, I created two Employee instances, joe and bob. You can see in the output that the Name properties of both Employee instances each show their assigned values from when the objects were first created. After assigning joe to bob, the value of the Nameproperties of both instances are the same. This is what you might expect to see.
What might surprise you is the values that occur after assigning a value to the Employeeinstance variable named joe. If you look at the code closely, you'll notice that it doesn't change bob - only Joe. However, the results from the output show that the Name property in bob is the same as the Name property in joe. This demonstrates that after assigning joeto bob, both variables held references to the joe object. Only the reference was copied - not the object. This is why you see the results of printing Name in both joe and bob are the same because the change was on the object that they both refer to.
The following types are reference types:
  • arrays
  • class'
  • delegates
  • interfaces

Understanding Value Types

Value type variables, as their name (value) suggests, hold the object value. A value type variable holds its own copy of an object and when you perform assignment from one value type variable to another, both the left-hand-side and right-hand-side of the assignment hold two separate copies of that value. Listing 22-3 shows how value type assignment works.
Listing 22-3. Value Type Assignment
using System;

struct Height
{
  private int m_inches;

  public int Inches
  {
      get { return m_inches; }
      set { m_inches = value; }
  }
}

class Program
{
  static void Main()
  {
      Height joe = new Height();
      joe.Inches = 71;

      Height bob = new Height();
      bob.Inches = 59;

      Console.WriteLine("Original Height
          Values:");
      Console.WriteLine("joe = " + joe.Inches);
      Console.WriteLine("bob = " + bob.Inches);

      // assign joe reference to bob variable
      bob = joe;

      Console.WriteLine();
      Console.WriteLine("Values After
          Value Assignment:");
      Console.WriteLine("joe = " + joe.Inches);
      Console.WriteLine("bob = " + bob.Inches);

      joe.Inches = 65;

      Console.WriteLine();
      Console.WriteLine("Values After
          Changing One Instance:");
      Console.WriteLine("joe = " + joe.Inches);
      Console.WriteLine("bob = " + bob.Inches);

      Console.ReadKey();
  }
}
Here's the output:
Original Height Values:
joe = 71
bob = 59

Values After Value Assignment:
joe = 71
bob = 71

Values After Changing One Instance:
joe = 65
bob = 71
In Listing 22-3, you can see that the Inches property of bob and joe are initially set to different values. After assigning joe to bob, a value copy occurs, where both of the variables have the same value, but are two separate copies. To demonstrate value assignment results, notice what happens after setting joe to 65; The output shows thatbob did not change, which demonstrates that value types hold distinct copies of their objects.
The following types are value types:
  • enum
  • struct

Reference Type and Value Type Differences

From the previous paragraphs, you might already see that there is a difference reference type and value type assignment. Reference types copy a reference to an object and value types copy the object. If you don't know this, then the effects can be surprising in your code when performing tasks such as making assignments and passing arguments to methods.

C Sharp Tutorials/Lesson 23 Lesson 23: Working with Nullable Types


Lesson 23: Working with Nullable Types

Working with value types and data can sometimes be challenging because a value type doesn't normally hold a null value. This lesson show you how to overcome this limitation with C# nullable types. Here's what you'll learn.
  • Understand the problem that nullable types solve
  • See how to declare a nullable type
  • Learn how to use nullable types

Understanding the Problem with Value Types and Null Values

As explained in Lesson 12: Structs, the default value of a struct (value type) is some form of 0. This is another difference between reference types and value types, in addition to what was described in Lesson 22: Topics on C# Type. The default value of a reference type is null. If you're just writing C# code and managing your own data source, such as a file that holds data for your application, the default values for structs works fine.
In reality, most applications work with databases, which have their own type systems. The implications of working with database type systems is that you don't have a one-to-one mapping between C# and database types. One glaring difference is that database types can be set to null. A database has no knowledge of reference and value types, which are C# language (.NET Platform) concepts. This means that C# value type equivalents in the database, such as int, decimal, and DateTime, can be set to null.
Since a type in the database can be null, but your C# value type can't be null, you have to find some way to provide a translation in your C# code to account for null values. Effectively, the scheme you use will often be inconsistent from one program to another; something you often don't have a choice about. For example, what if you wanted to handle a null DateTime from SQL Server as the minimum DateTime value in C#. After that project, your next task would be to read data from a legacy Foxpro database, whose minimumDateTime value is different from SQL Server. Because of this lack of constency and potential confusion, C# 2.0 added nullable types, which are more elegant and natural for working with null data.

Declaring Nullable Types

To declare a value type as nullable, append a question mark, ?, to the type name. Here's how to declare a DateTime variable as a nullable type:
    DateTime? startDate;
A DateTime can't normally hold a null value, but the declaration above enables startDate to hold null, as well as any legal DateTime value. The proper terminology is to refer to the type of startDate as a nullable DateTime.
You can assign a normal value to startDate like this:
    startDate = DateTime.Now;
or you can assign null, like this:
    startDate = null;
Here's another example that declares and initializes a nullable int:
    int? unitsInStock = 5;
The unitsInStock in the example above can be assigned a value of null also.

Working with Nullable Types

When you have nullable types, you'll want to check them to see if they're null. Here's an example that shows how you can check for a null value:
     bool isNull = startDate == null;

  Console.WriteLine("isNull: " + isNull);
The example above shows that you only need to use the equals operator to check for null. You could also make the equality check as part of an if statement, like this:
     int availableUnits;

  if (unitsInStock == null)
  {
      availableUnits = 0;
  }
  else
  {
      availableUnits = (int)unitsInStock;
  }
Note: Notice the cast operator in the else clause above. An explicit conversion is required when assigning from nullable to non-nullable types.
That's several lines of code for something that appears to be such a common operation. Fortunately, there's a better way to perform the same task, using the coalesce operator,??, shown below:
    int availableUnits = unitsInStock ?? 0;
The coalesce operator works like this: if the first value (left hand side) is null, then C# evaluates the second expression (right hand side).

Saturday, 31 March 2012

IT jobs will grow 22% through 2020, says U.S.


WASHINGTON -- U.S. officials on Thursday said thatoffshoring will hurt the growth of U.S. programming jobs in this decade, though expansion of healthcare IT and mobile networks will in turn increase demand for software developers, support technicians and systems analysts.
By 2020, employment in all computer occupations is expected to increase by 22%, but some IT fields will fare better than others, according to the U.S. Bureau of Labor Statistics (BLS) biennial update of employment projections.

Comparative growth rates

Projected 10-year growthCompared to other categories
Increase 29% or moreMuch faster than average
Increase 20% to 28%Faster than average
Increase 10% to 19%About average
Increase 3% to 9%More slowly than average
Decrease 2% to increase 2%Little or no change
Decrease 3% to 9%Decline slowly or moderately
Decrease 10% or moreDecline rapidly
Source: U.S. Bureau of Labor Statistics
Demand for software developers will be the strongest in this period, with increases ranging from 28% to 32%, depending on the type of software development.
The BLS update imagines what IT employment will look like through 2020.
The agency's forecasts, particularly for technology-related jobs, are often controversial because they can't account for rapid market changes and tech disruptions. But its estimates are often cited in various policy debates on issues ranging from education to immigration.
The IT employment growth rate projected by the BLS was characterized as "anemic" by Victor Janulaitis, CEO of Janco Associates, a research firm that analyzes IT wage and employment trends.
"When you consider the overall demand for systems and applications in high-growth markets like China and India, [the BLS projections] mean the U.S. will be doing a diminishing portion of the development and implementation work," said Janulaitis. "If that's the case, the U.S. will no longer be the leader in IT.
"The BLS projections are a bad sign for the U.S. IT graduates from universities. Those numbers do not cover the net growth necessary to give all of the graduates jobs," Janulaitis added.
The outlook varies from occupation to occupation. Here's a look at the BLS projections for various tech jobs.

Database administrators

Demand for database administrators is expected to increase by 31%, with 33,900 jobs being added this decade as enterprises endeavor to cull valuable information from an ever-growing mountain of data.
The field employed 110,800 people in 2010 at a median salary of $73,490.

IT managers

For IT managers, employment is projected to increase by 55,800 jobs, or 18%, to 363,700 jobs by 2020.
The BLS said growth in the healthcare industry and the need for more IT security may spur an increase in the number IT management jobs, but the agency added that "cloud computing may shift some IT services to computer systems design and related services firms, concentrating jobs in that industry."
The median pay for IT managers in 2010 was $115,780.

Job growth forecast

Job titleMay 2010 employment2020 jobs forecastJob growth forecastPct job growth forecastExpected growth rate thru 2020May 2010 median wage
Software developers, systems software392,300519,400127,10032%Much faster than average$ 94,180
Database administrators110,800144,80034,00031%Much faster than average$ 73,490
Network & computer system admins347,300443,80096,50028%Faster than average$ 69,160
Software developers, applications520,800664,500143,70028%Faster than average$ 87,790
Computer systems analyst544,400664,800120,40022%Faster than average$ 77,740
Information Security Analysts, Web Developers, and Computer Network Architects302,300367,90065,60022%Faster than average$ 75,660
Computer & information systems managers307,900363,70055,80018%About average$115,780
Computer support specialists607,100717,100110,00018%About average$ 46,260
Computer programmers363,100406,80043,70012%Average$ 71,380
Source: U.S. Bureau of Labor Statistics Occupational Outlook Handbook

Assembly Language for Intel-Based Computers (4th Edition) By Kip R. Irvine

Description:
Designed for students and professionals interested in learning the basics of operating systems and architecture in the context of a microprocessor. Irvine shows how to approach programming problems with a machine-level mindset. Readers will benefit most if they have already learned a high-level language such as C, Delphi, or Java.

Software: Includes a full professional version of Mcft Assembler 6.11 (MASM). Also supplied are a large link library of console I/O routines, and a custom-designed programming editor from which you can assemble, link, and debug programs.

Examples: Over 50 complete example programs are supplied, including protected-mode subroutines that link to Mcft Visual C and Borland C.

Topics: Binary and hexadecimal tutorials, hardware and software architecture, instruction set fundamentals, procedures and interrupts, stack parameters, conditional processing, logic structures, integer arithmetic, structures and macros, numeric conversions and libraries, strings and arrays, disk storage, finite state machines, low-level disk I/O, hardware port I/O, linking to C programs, memory-resident programs, and floating-point instructions.–This text refers to an out of print or unavailable edition of this title.

From the Back Cover:
This text is designed for students and professionals interested in learning the basics of operating systems, architecture, and programming in the context of a microprocessor. In his eagerly anticipated fourth edition, Kip Irvine concentrates on the combined Windows/MS-DOS operating system and thoroughly covers 32-bit assembly language applications for Intel-based computers.
Focusing on how to approach programming problems with a machine-level mindset, Assembly Language for Intel(r)-Based Computers includes the following features:
Detailed tutorials on numbering systems and data storage fundamentals.
All programs tested with the Mcft(r) MASM 6.15(tm) assembler.
Inline assembly code, as well as linking assembly language to C/C in both Real and Protected modes.
Extensive instruction set reference that includes instruction formats and CPU flag usage.
Interrupt vectoring and device I/O.

CD-ROM that includes the full professional version of the Mcft(r) MASM 6.15(tm) Assembly Language Development System, a programmer’s editor, a macro library, and the book’s source code.

New to the fourth edition:
  1. Win32 programming, including the console API and a graphical application.
  2. Expanded coverage of procedures, recursion, stack parameters, structures, and unions.
  3. Boolean expressions, truth tables, and flowcharts.
  4. Basic string handling, sorting and searching algorithms.
  5. Bit-mapped graphics in both Real and Protected modes.
  6. IEEE floating-point binary representation.
  7. Virtual machine architecture; IA-32 Protected mode segmentation and paging.
  8. Introductory explanations of the instruction execution cycle, memory I/O, multitasking, pipelining, and superscalar architecture.
  9. Disk fundamentals, including disk geometry, FAT32 and NTFS file structures.


Download Link :
For book:
http://rapidshare.com/files/50941060/5A35E5B4-4E82-40BB-A1FD-C03AC9CF40DA.rar
Password: books_for_all

For CD:
http://rapidshare.com/files/51578843/C74BFA11-004E-4b5f-8B5C-70AC3F624C52.rar
Password: books_for_all

Digital Logic And Computer Design by M. Morris Mano + Solution Manual


Digital Logic and Computer Design

The book presents the basic concepts used in the design and analysis of digital systems and introduces the principles of digital computer organization and design. It provides various methods and techniques suitable for a variety of digital system design applications and covers all aspects of digital systems from the electronic gate circuits to the complex structure of a microcomputer system. It also includes applications of the read only memory (ROM) and programmable logic array (PLA).


Download Book
Download Solution

Electronics Workbench Multisim v.10 Retail Edition


http://myegyptsun.com/forum/attachment.php?attachmentid=638&stc=1&d=1211641988


The National Instruments Electronics Workbench Group (formerly Electronics Workbench) equips the professional PCB designer with world-class tools for schematic capture, interactive simulation, board layout, and integrated test.

Download:

Easy Share Links:
http://w13.easy-share.com/13789211.html
http://w13.easy-share.com/13789181.html
http://w13.easy-share.com/13789221.html

[read the crack procedure in the extracted rar file]


Torrent Link:
http://www.mininova.org/get/846945