Author Archives: admin

.NET Interview Questions 2015

This series of articles will present you what you will be asked in your next .NET job interviews in 2015.

In general it gives an overview of the concepts of Object Oriented Programming which you WILL be asked:

1. Abstract class
– It is intended to be a base class.
– Cannot be instantiated.
– Can contain abstract methods and properties
o They don’t have implementation and must be implemented in the derived class, by overriding the method/property
o Methods are implicitly virtual
o Cannot use static or virtual modifiers with combination of abstract
– Can contain non abstract methods
2. Interface – express behavior that a class/struct may choose to support
– Cannot be instantiated
– Can contain methods, properties, events
– All of the methods are public and abstract
– One class can derive one base class and many interfaces
3. Method overriding and method overloading
– Method overriding is implementing base class method in the derived class
– Method overloading is having one method with different list of parameters.
4. Boxing/unboxing
– Boxing is converting a value type object to the type of object or to any interface implementing this value type. It wraps its value inside a System.Object and stores it in the managed heap. Unboxing extracts the value type from the object. Boxing is implicit, unboxing is explicit. This concept is used because of the C# unified type system, that any type can be treated as an object.
In general it is expensive process, because a new object must be allocated and constructed.
5. Static constructor
– A given class may define only a single static constructor. In other words, the static constructor cannot be overloaded.
– A static constructor does not take an access modifier and cannot take any parameters.
– A static constructor executes exactly one time, regardless of how many objects of the type are created. This is done before any other instance level constructors.
– It can be used to initialize static properties of the class
6. Generics
– Introduced in .NET version 2.0.
– Design classes and methods that rely on specific type.
– Allow code reuse, type safe, performance
– Mostly used for collections
– If not used generics, in order to have generalization, reference type are upcasted to Object and value types are boxed. This comes to a cost of decreased performance and additional memory used.
7. Stack memory, Stack overflow
– Keeps track of what is being called, functions. Every time a new function is called, it is positioned on top of the stack. Memory is allocated for its parameters. If they are value types they are copied, if they are reference type, pointers to them are copied. You can access only the last one e.g. the top one. After it finishes execution is removed and the function below goes on.
– Stack has limited memory, if overfilled overflow exception is thrown
– Value types are stored on the stack
– Stack automatically allocates and later deletes memory, needed for execution
– If a reference type is needed in a function, it is created on the heap and a pointer to it is stored in the stack.
– In multithreaded environment, every thread has its own stack, but all of them share the same heap.
8. Heap memory
– Keeping track of the objects – reference types are stored on the heap
– Anything can be accessed any time
– Objects left without references are cleaned by the Garbage Collector
– Heap memory can be extended
9. Memory cleaning
– GC runs and cleans objects from the managed heap, which don’t have references pointing to them
– Not managed resources (files, db connections, network connections). There is a finalization queue. Object’s finalizer is invoked, then it is garbage collected. However better practice is to explicitly clean/close these resources (IDisposable). The keyword using is relevant to this interface. When using it, after leaving the scope of the “using” block, dispose method is called.
– Weak reference – creates a reference to an object, but this object can be garbage collected at any time. That’s why this has to be checked if the reference IsAlive, before using it.
10. Object methods
– ToString() – returns string representation of the object
– Equals() – determines whether the specified object is equal to the current one
– GetHashCode() – A hash code is a numeric value that is used to identify an object during equality testing. It can also serve as an index for an object in a collection.
– GetType() – Gets the type of the current object
11. Serialization
12. Immutable
13. Events

14. Thread Pool – form of multithreading where, tasks are added to a queue and automatically started when threads are created
15. GAC – assemblies are added in order to be reused/shared between apps. They have to be signed and strongly named for security reasons. Allows you to have different versions of the same assembly. Use gacutil.exe in order to manipulate the GAC.
16. Multicast delegate – they let you invoke multiple methods.
17. .NET Remoting
a. Singleton call – gets one instance for all incoming request. Every variable used will be shared between all request.
b. Single call – every request will get a new instance of the defined type, it’s own memory and variables. Still can share static and global variables external resources etc.

Other
1. Web Farms / Load balancer – load balancer is used to spread the request between the servers in the web farm in order to prevent overloading of one server. When using this approach it’s important to define where Session is stored. Session can be stored in three places:

a. InProc (in the server’s memory) – if a user sends the first request to Server A, his session is created and stored in the memory of that server. However, if later user’s request is sent to Server B, his session won’t be available and big mess will happen. So if we want to use InProc session, we need to configure the load balancer to use Sticky Sessions. This means that all request for specific session are always sent to the same server. In general this is not a good approach.

b. SQLServer session – all session data is stored in one central place. However, all session data, saved in the DB, must be serialized. Better approach for heavy session data.

c. State Server – data is stored in a separate server in one central place. It will be handled by Windows Service (aspnet_state). All session data must be serialized.

d. machine.config – this file needs to be the same on all of the servers in the farm, because encryption (of the view state) is using the Machine Key value and it must be the same on all of the servers.

Stay tooned for next topic covered!

Microsoft System Center Extending Operations Manager Reporting free ebook

2476.9780735695788 thumb 038ACD84 Microsoft System Center Extending Operations Manager Reporting free ebookThe System Center Operations Manager data warehouse stores many objects, making it possible to report on performance, availability, configuration, and security. You can use data collected by Operations Manager for issue tracking, awareness, planning, and forecasting, all of which are important factors for maintaining and managing your environment. But understanding what to report on and how to do so is what actually contributes to the stability of your infrastructure. If you’re not using the data you collect about your environment, you’re simply wasting space. If you use Operations Manager to monitor your environment, whether your infrastructure or a public, private, or hybrid cloud, this book is a good resource to help you understand the basics of reporting and how to build queries and stored procedures for your reports. It can also help you understand the various elements of Operations Manager management packs that are used when you create reports.

This book assumes that you have a good understanding of Operations Manager and the management pack structure required to create custom reports. It also assumes that you have a good working knowledge of SQL Server and tools like Report Builder, Business Intelligence Development Suite, and SQL Server Data Tools.

Download from here.

.NET Technology Guide for Business Applications

3660.image 606EC3AF 245x300 .NET Technology Guide for Business Applications.NET Technology Guide for Business Applications, by Cesar de la Torre and David Carmona!

Download the ebook (6.02 MB PDF) here.

Here’s a little bit about the guide:

1. Key takeaways

Select your architecture approaches and development technology based on your specific application’s priorities and requirements.

A single architecture and approach won’t work for every type of application. The Microsoft development stack and .NET are extremely flexible and offer many possibilities, but it’s essential that you choose specific approaches and technologies based on the kind of application—or even subsystem—you build. Each application will have very different priorities and tradeoffs that must be taken on different paths.

Business application modernization goes further than simply building mobile apps. Mobile applications must rely on and extend your foundational business applications.

To be successful, mobile apps must be built with deep integration into your current foundational business applications. Mobile business apps should be part of the larger enterprise ecosystem and substantially extend foundational business applications, whether the foundational systems are established legacy applications or new, large, mission-critical applications built with innovative, scalable, and elastic services.

Positioning your application or subsystem within a global patterns segmentation will help you to choose the right approaches and technologies.

It is fundamental to position your application/subsystem in the right segmentation area. The right approaches and technologies for each of the following application types could potentially be very different:

  • Emerging application patterns
    – Devices and services
  • Established application patterns
    – Small and medium-sized business applications
    – Large, mission-critical business applications

2. Purpose of this guide

This guide will help you effectively select the right Microsoft development technologies and approaches for your .NET custom application development, depending on the priorities you have for your application and for your business domain.

This guidance does not cover Application Lifecycle Management (ALM) practices. For additional guidance on this topic, you can visit the Visual Studio ALM website at www.microsoft.com/visualstudio/alm.

Who should use this guide

This guide will be useful to decision makers, software architects, development leads, and developers who are involved in selecting the technologies to use for their applications and projects based on Microsoft development platforms.

Specifically, it covers custom enterprise application development, although ISVs might also find the information and recommendations useful.

This guide does not cover development solutions based on Microsoft business-market products, such as vertical solutions based on Dynamics CRM or Dynamics ERP.

How to use this guide

This guide covers a broad spectrum of software development options that focus on business applications. It is written as a reference document so that you can go directly to an area you’re interested in, such as Section 4, “Emerging application patterns,” or “Large, mission-critical business applications” within Section 5, “Established application patterns.”

We do recommend that you read Section 3, “Overview,” for context before you dive deeper into the individual sections.

The ways HTML5 vs. Flash could change gaming on the internet

It was never expected that there would be a battle between Flash Player and HTML5 to become the primary multimedia platform amongst internet users. This was down to Flash appearing to be in an unassailably dominant position. However since Apple made the controversial announcement that it would not be supporting Flash Player on any of its mobile devices, the long working partnership between the two companies diminished leading to HTML5 closing the gap with the support of Apple.

So what does the fight between the two mean for the internet?

Well depending on which of the two platforms comes out on top in the end it could make a serious difference to gaming. HTML5 allows the media used in games such as video, animation and graphics to be supported within the site while Flash requires to be downloaded externally. At the moment Flash is still the most popular choice with gamers, but this is less to do with it being a superior platform and more to do with there currently being more Flash-compatible games available. This is not likely to remain the case forever, and with more and more online casino sites turning to HTML for their mobile casino options the latter could really begin to win gamers over.

Just as with mobile sites, HTML5 looks a better supported option for those who do not want to have to keep downloading tools to their computers. The simple fact that it allows media to be supported on the site itself, rather than requiring a plug-in, means that it tends to be more stable and less liable to crash. This is particularly significant for games and sites such as http://www.jackpotcity.co.uk. These type of sites require a lot of investment of time in order to play them successfully – because if the platform crashes during the course of a long game it can seriously damage your chances of winning.

E-Book Gallery for Microsoft Technologies

Download existing and new content for ASP.NET, Office, SQL Server, Windows Azure, and other Microsoft technologies in e-book formats. Reference, guide, and step-by-step information are all available. All the e-books are free. New books will be posted as they become available.

  • Deploying an ASP.NET Web Application to a Hosting Provider using Visual Studio
  • Getting Started with ASP.NET 4.5 Web Forms (Beta)
  • Intro to ASP.NET MVC 4 with Visual Studio (Beta)
  • Configure Kerberos Authentication for SharePoint 2010 Products
  • SQL Server Master Data Services Capacity Guidelines
  • Microsoft SQL Server AlwaysOn Solutions Guide for High Availability and Disaster Recovery
  • Microsoft SQL Server Analysis Services Multidimensional Performance and Operations Guide
  • QuickStart: Learn DAX Basics in 30 Minutes
  • SQL Server 2012 Transact-SQL DML Reference
  • Windows Azure Prescriptive Guidance
  • Windows Azure Service Bus Reference

All the books are available in EPUB, MOBI, PDF format!

Download all the books from here.

Introducing Microsoft SQL Server 2012

41rYAFQaxbL. BO2204203200 PIsitb sticker arrow clickTopRight35 76 AA278 PIkin4BottomRight 4322 AA300 SH20 OU01  Introducing Microsoft SQL Server 2012For tech guys here is a free Microsoft ebook. Its a 288 pages book that gets you into shape with latest SQL Server 2012.

Microsoft SQL Server 2012 is Microsoft’s first cloud-ready information platform. It gives organizations effective tools to protect, unlock, and scale the power of their data, and it works
across a variety of devices and data sources, from desktops, phones, and tablets, to datacenters and both private and public clouds. Our purpose in Introducing Microsoft SQL Server 2012 is to point out both the new and the improved capabilities as they apply to achieving mission-critical confidence, breakthrough insight, and using a cloud on your terms.

As you read this book, we think you will find that there are a lot of exciting enhancements and new capabilities engineered into SQL Server 2012 that allow you to greatly enhance performance and availability at a low total cost of ownership, unlock new insights with pervasive data discovery across the organization and create business solutions fast—on your terms.

Download from here.

You can get it for Kindle as well.

SQL Server 2012 Cheatsheet

Pinal Dave has released his latest cheatsheet regarding the latest SQL Server 2012. Whats in there:

  • SSMS Shortcuts
  • Columnstore Index
  • SQL Server 2012 Datetime Functions
  • SQL Server Ranking Functions
  • SQL Server 2012 Analytic functions

Download from here.

Validate asp.net multiline TextBox

Because it is rendered to TextArea the MaxLength property does not work. One way around this is to attach a regular expression validator to that control. What is important is to set the ValidationExpression to something like “^[\s\S]{0,255}$“. Where 255 is the maximum length allowed.

Hope this helps icon smile Validate asp.net multiline TextBox