Interview Tips Interview Tips, Interview Questions and Answers

29Sep/110

Volatile Fields

Software built on the .NET framework is subject to many optimisations. Some optimisation is performed when compiling your program or library in Visual Studio or using the command-line compiler. Other optimisations are applied when executing the compiled intermediate language (IL) code. These vary according to the type of processor used to run the program. In many situations these optimisations lead to faster code or smaller programs without any noticeable side effects.

One optimisation that can have side effects relates to publicly visible fields in classes or structures. When you request the value of such a field the program normally performs a non-volatile read. This type of read can be optimised to improve the performance of the program. For example, the processor may choose to read the value from memory earlier than expected, and potentially in a different order than specified, in preparation for its later use. This may move the value to the processor's cache memory, where it can be accessed more quickly than from the main memory, or to its registers for yet faster performance. In single-threaded code these changes are unnoticeable.

When you are creating a multithreaded application or one that uses parallel programming code, non-volatile reads can present a problem. To illustrate this, consider the following program:

26Sep/110

Why not evolve JavaScript

Why not evolve JavaScript? Brandon Eich, the inventor of JavaScript, is clearly not happy about Dart, favouring evolution of the language via standards and committee. Personally I don’t think this is working at the moment for a couple of reasons. Firstly, HTML5 is upon us and gaining popularity fast, JavaScript desperately needs some attention, fast! Secondly, non-backward-compatible or breaking changes are not possible via evolution, there are features of JavaScript that really need to be broken in order to fix them.

What about jQuery and other popular libraries? If Dart is really going to fix JavaScript, I would imagine that existing JavaScript libraries will not work with it. The web developer community will probably find it hard to accept Dart without jQuery.

Will everyone adopt it? This is probably the most important question of all. It is clearly Google’s aim that everyone does adopt Dart, then they will pass it over to committee, just as JavaScript was passed over to ECMA. The problem is, what’s in it for the other browser manufacturers? How will they benefit by adopting Dart? To be honest, I can’t see any benefict for Mozilla, Microsoft or anyone else. Lars (Google Tech Lead) has promised to Lars to “sweet talk” the other browser vendors, which in acknowledges the issue they face, but since when has sweet talking been part of the browser wars?

14Oct/100

Simple Spark Expressions

At its core, Spark is a template engine that allows developer to quickly and cleanly express their intent inside of views. Two of the most common scenarios in view development are if/else conditionals and looping.

Spark provides a very easy-to-learn syntax for conditional statements. The syntax is so-self describing that HTML fluent designers can identify the intent while modifying HTML. In the following example, a Product is tested to see how much it is and the result will change upon the price of the product.

This is expensive.


This is not too bad.


This is a DEAL!

The snippet above illustrates that the if element construct is readable within the HTML, and the intent is easily discernible. There is no need to explain what is happening since the code is seamless with the surrounding HTML.

A similar syntax exists for conditional evaluation as well. The test element construct has the exact same functionality as the if element construct but with different syntax. The following is identical in functionality to the example above.

This is expensive.

This is not too bad.

This is a DEAL!

Note the enclosing test element and self-closing else elements.

A third and final method of conditional evaluation exists as an inline attribute. The functionality below renders the same output as above, but with inline if and elseif attributes.

This is expensive

This is not
too bad.

This is a DEAL!

Looping within Spark can take on many forms; however, the most commonly used method is to use the each attribute that can be decorated on any HTML element. The each attribute is used verbatim as shown below (so it must have the type, variable name, the “in” keyword and the collection).

class="alt?{productIndex % 2 == 0}">

Name: ${product.Name}

Price: ${product.Price}

5Jul/100

Aren’t XML, SGML, and HTML all the same thing

Not quite; SGML is the mother tongue, and has been used for describing
thousands of different document types in many fields of human activity,
from transcriptions of ancient Irish manuscripts to the technical
documentation for stealth bombers, and from patients’ clinical records
to musical notation. SGML is very large and complex, however, and
probably overkill for most common office desktop applications.

XML is an abbreviated version of SGML, to make it easier to use
over the Web, easier for you to define your own document types,
and easier for programmers to write programs to handle them. It
omits all the complex and less-used options of SGML in return for
the benefits of being easier to write applications for, easier to
understand, and more suited to delivery and interoperability over
the Web. But it is still SGML, and XML files may still be processed
in the same way as any other SGML file (see the question on XML
software).
HTML is just one of many SGML or XML applications—the one
most frequently used on the Web.
Technical readers may find it more useful to think of XML as being
SGML– rather than HTML++.

4Jul/100

Describe the differences between XML and HTML.

It’s amazing how many developers claim to be proficient programming
with XML, yet do not understand the basic differences between XML
and HTML. Anyone with a fundamental grasp of XML should be able
describe some of the main differences outlined in the table below.

XML
User definable tags

Content driven
End tags required for well formed documents
Quotes required around attributes values
Slash required in empty tags

HTML
Defined set of tags designed for web display

Format driven
End tags not required
Quotes not required
Slash not required

2Jul/100

Flash Control for ASP.NET

Features

Works with .NET framework 2.0, 3.0 and 3.5

FlashControl supports all Flash properties :

Width, Height, Src, FlashVars, PluginsPage, Loop, Menu, Scale, BgColor, SwLiveConnect, Quality, Play, Base, Align, SAlign, WMode, AllowScriptAccess, AllowNetworking, SeamlessTabbing, Devicefont.
Ready for ASP.NET AJAX!
FlashControl fully works with ASP.NET AJAX UpdatePanel.

Supports communication between Flash and JavaScript.

FlashControl works with ASP.NET 2.0 Theme service and Skin files !
Full Visual Studio 2005 and 2008 Designer support :

Smart Tag!
Custom Designer
Custom Editors
Custom template
Web Resources
FlashControl provide a XHTML compliance mode ! The rendered code validates XHTML 1.0 strict in compliance with W3C web standards.

With FlashControl you can target specific HTML output : Internet Explorer Windows ( tag) and/or Netscape/Mozilla, IE MAC ( tag) or use Automatic browser detection (FlashControl will automatically choose to render tag or tag depending on browser capabilities).

1Jul/100

Where should I use XML

Its goal is to enable generic SGML to be served, received, and
processed on the Web in the way that is now possible with HTML.
XML has been designed for ease of implementation and for interoperability
with both SGML and HTML.
Despite early attempts, browsers never allowed other SGML, only
HTML (although there were plugins), and they allowed it (even encouraged
it) to be corrupted or broken, which held development back for over
a decade by making it impossible to program for it reliably. XML
fixes that by making it compulsory to stick to the rules, and by
making the rules much simpler than SGML.

But XML is not just for Web pages: in fact it’s very rarely used
for Web pages on its own because browsers still don’t provide reliable
support for formatting and transforming it. Common uses for XML
include:
Information identification because you can define your own markup,
you can define meaningful names for all your information items.
Information storage because XML is portable and non-proprietary,
it can be used to store textual information across any platform.
Because it is backed by an international standard, it will remain
accessible and processable as a data format. Information structure

XML can therefore be used to store and identify any kind of (hierarchical)
information structure, especially for long, deep, or complex document
sets or data sources, making it ideal for an information-management
back-end to serving the Web. This is its most common Web application,
with a transformation system to serve it as HTML until such time
as browsers are able to handle XML consistently. Publishing the
original goal of XML as defined in the quotation at the start of
this section. Combining the three previous topics (identity, storage,
structure) means it is possible to get all the benefits of robust
document management and control (with XML) and publish to the Web
(as HTML) as well as to paper (as PDF) and to other formats (eg
Braille, Audio, etc) from a single source document by using the
appropriate stylesheets. Messaging and data transfer XML is also
very heavily used for enclosing or encapsulating information in
order to pass it between different computing systems which would
otherwise be unable to communicate. By providing a lingua franca
for data identity and structure, it provides a common envelope for
inter-process communication (messaging). Web services Building on
all of these, as well as its use in browsers, machine-processable
data can be exchanged between consenting systems, where before it
was only comprehensible by humans (HTML). Weather services, e-commerce
sites, blog newsfeeds, AJaX sites, and thousands of other data-exchange
services use XML for data management and transmission, and the web
browser for display and interaction.

30Jun/100

What is XML

1. What is XML?

XML is the Extensible Markup Language. It improves the functionality
of the Web by letting you identify your information in a more accurate,
flexible, and adaptable way. It is extensible because it is not
a fixed format like HTML (which is a single, predefined markup language).
Instead, XML is actually a meta language.(a language for describing
other languages)which lets you design your own markup languages
for limitless different types of documents. XML can do this because
it’s written in SGML, the international standard meta language for
text document markup (ISO 8879).

2. What is a markup language?

A markup language is a set of words and symbols for describing
the identity of pieces of a document (for example ‘this is
a paragraph’, ‘this is a heading’, ‘this
is a list’, ‘this is the caption of this figure’,
etc). Programs can use this with a style sheet to create output
for screen, print, audio, video, Braille, etc.

Some markup languages (eg those used in word processors) only describe
appearances (’this is italics’, ‘this is bold’),
but this method can only be used for display, and is not normally
re-usable for anything else.