Friday, March 25, 2016

What is Windows Workflow Foundation?


.Net 3.0 introduced Window Work Flow Foundation. The main theme of WWF is separation of Business Process code and implementation.
A workflow model can be prepared in pure .Net, pure XAML, or mix of both.  A workflow model can be implemented in Windows, ASP.Net or Window Services. So workflow defined what is done and how it is done defined in traditional programming language.
Namespace System.Workflow contains all the necessary modules to develop Window Workflow.
Main characteristic of Workflow are:
1.       Visual Representation of Process.
2.       Easily modifiable at runtime
3.       It may be a long running process
Window workflows has two types.
1.       Sequential workflows : used for well-defined workflow, process workflow

2.       State Machine workflows: it is useful in a workflow where human interaction is required.

Friday, March 18, 2016

Cloud Computing

Cloud computing is also called on demand computing. Cloud computing enables companies to consume resources just like electricity. No need to build it in house just consume and pay for that.
What is 5-3-2 Rule?

#5:

There are five characteristic of cloud computing

1. On-Demand and Self Service. 2. Ubiquitous Network access (Exist everywhere). 3. Location transparent resource pooling. 4. Rapid Elasticity (Companies can increase or decrease use of resources as per demand). 5. Measured Service with pay per use. These characteristic were introduced by National Institute of Standards and Technology (NIST).

#3:

Three services of cloud computing are three delivery methods. 1. Software as a Service. 2. Platform as a Service 3. Infrastructure as a Service.


2#:

Two Deployment models are Private and Public Deployment model. While NIST lists down four deployment method but other two are derivation from first two, main deployment models are only two. As name indicate public computing means for public use and private computing means for private use.


5-3-2 is easily understandable, easy to use in common conversation.

What do you mean by SaaS?

SaaS stands for Software as a Service. Means no hardware required, no installation headach, you need only internet to use a software, you just login and use it. Gmail is the best example. Software will be hosted on internet, so user no need to buy or pay for maintenance.

Suppose you are going to start your own business for that you need an email. If start from scratch you need to develop or buy a software for mailing while the other way is you can use already build software gmail. For your mailing server you need to buy a server and need maintain that software and configure that too.

How SaaS Works?

SaaS works on the base of subscriptions you need to pay according to time and space if you are using for 1 hour daily and you have bought 1 GB space than you have to pay for that only if you use extra space or beyond your time limit than you have to pay more for that.

Example of SaaS:

Gmail, Salesforce, Bank, WebEx, Drop Box, Google Docs

What do you mean by PaaS?

Platform as a Service. PaaS means user can use platform as a service to develop his applications. He no need to worry about hardware required for that platform on which he wants to develop application. Google App Engine is the best example of PaaS?

Target Audience:

Developers

Benefits:

You no need to worry about hardware, maintenance of server, operating system and runtime to build the application. All the Services will provide by platform provider.


How PaaS Works?

Suppose you want to write a code but don’t want to take tension of IDE hardware required for that IDE so you go to a PaaS vendor.

Example:

Google App Engine,Heroku, IBM Bluemix, Red Hat’s OpenShift.


What do you mean by IaaS?

The lowest level of Cloud services is Iaas. You no need to worry to buy or maintain server infrastructure. You can get server from IaaS vendor. User can choose his own OS,own runtime and application code.

Example of IaaS : 

Amazon Web Services.

Target Audience: 

IT Admins

Benefits:

IaaS saves your time and headache that maintaining hardware infrastructure. You can get the servers from IaaS vendor.

How IaaS works?

IaaS works using virtual environments. IaaS vendor have data centers which have multiple servers. And every server have multiple virtual machine running which is allotted to customers. User can decide his OS and runtime. Although his is working on a virtual machine but he will never know that he is working on virtual machine.

Example:

AWS, HPCloud, CloudSigma

Graphical representation of SAAS, PAAS, IAAS.


Tuesday, March 15, 2016

Reflection

You can get type information, read manifest or read metadata from an assembly using reflection programmatically. Late binding also can achieve using reflection. Using reflection application can get the information about itself. Method can invoke using reflection. You can get the information about type, properties, methods and event object. We can create object of a class or use existing object using reflection.
System.Reflection namespace along with System.Type used in getting information from an assembly. System.Type is an abstract class, its represent a type in Common Type System.
System.Type represent type declaration such as class type, array type, interface type, value type, enumeration type , open or close constructed generic type.

You can get the type object using two ways.
1.       Using GetType() method of Type class

Type t = Type.GetType("Reflection.Car", false, true);
Console.WriteLine(t.FullName);

Where Reflection is namespace and Car is a class name.
Ouput
Reflection.Car
2.       Using typeof() operator.
/////////////////////////////////////////
 // Get the Type using typeof.
Type t = typeof(Car);
Console.WriteLine(t.FullName);
////////////////////////////////////
Ouput
Reflection.Car

Benefits

1.       Get the type of an object at runtime.
2.       Load an assembly at runtime and call meth\od dynamically at runtime. Basically useful for people who are working in an environment where configuration is changing at runtime.
3.       Get object information at runtime even call them
4.       Late binding
5.       Can create a class at runtime using Reflection.Emit
6.       Can create property and methods at runtime using PropertyBuilder and MethodBuilder.
7.       Activator.CreateInstance() method can be used to create object at runtime.
8.       Dynamic keyword introduced in .Net 4.0 uses reflection internally.


Practical Use of Reflection

1. Property window of visual studio is a live example of reflection where it reads the all properties of object and show them
2. In unit testing framework, you need to call method and properties dynamically.
3. Sometimes need to show all class information in a text file.


Difference Between Reflection and dynamic
1.       Using dynamic only public members can invoke while using reflection both can be invoke.
2.       Using dynamic only instance member can invoke while using reflection static members also cab invoke.
3.       Dynamic is a keyword introduce in .Net 4.0 while reflection is a mechanism to inspect the meta data of an object at runtime. Dynamic cannot inspect the metadata about an object.

Friday, March 11, 2016

HTML5

HTML5- The latest version of HTML is HTML5, it comes in 2011. HTML5 come with multimedia support. Some previously used tags are deprecated in HTML5. Before HTML5 you need plugin to run some media file in HTML but now HTML5 introduces object tag. To make HTML to HTML5 you need to use following declaration

HTML5 required that HTML should be well-formed.
Benefits:
1.     Audio-Video Support: - In old used need to use Adobe Flash player to run a video but HTML5 has built in support for that.
Ex.



2.     Offline Caching: HTML5 supports offline caching, If user has already visited the website that he load the website without internet connection.
HTML5 webmaster define which file will be saved on client machine. For offline caching you need to use manifest attribute like this



...

...


3.  Good Page Ranking: If page is not well structured than it will be difficult to read by any search engine. On the other hand a well-structured page is easy to read henceforth get a good rank.
4.  Game Development: HTML5 provide support for game development. It has canvas tag for that
5.  Geo Location Support:- HTML support GeoLocation, you can directly find out using new HTML5 GeoLocation API.
1. navigator.geolocation.getCurrentPosition(GetPosition);
2. function GetPosition (pos)
3. {
4. $('#lbllocation').html("Your Latitude: " + pos.coords.latitude + "
5.
6. Your Longitude: " + pos.coords.longitude );
7. }
 Mobile Optimization:- Good for mobile websites and applications. .     Make Markup that is easily readable by human.
Understandable by various devices like computer mobile etc
 ‘Required’ attribute.
 Autofocus attribute
 Case insensitive
 Web Workers: Web workers works same as daemon services that background worker in .Net. It runs in background of web browser instance. It does not affect the performance the web pages.
 Figure Element:- HTML5 provide a way to tag together image and its caption like figure and figcatption element.
DataList:- HTML5 provide a new element named datalist it work same as a editable combo box. It depict a predefined list of input elements.
   
   
   
   
   
 
If some type C in input box than list shows the all options starting with C.
Path Finder providing the turn by turn Navigation
Support for Regular Expression for input field

  
Support drag and drop with the help of following attributes

Draggable=”true”,ondragstart(On the element from where drag start)
Ondrop (On the element where the data is dropped)
The element to be dragged:
 
ondragstart="drag(evt)" width="300" height="50">
Container to which the dragged data will be dropped:




Thursday, March 10, 2016

Extract Line Number from Exception


Get the line number from Exception Class. Following code will give you Line number where exception is raised.

         private static int GetLineNum(Exception mexcption)
        {
            // Get stack trace for the exception with source file information
            var trace = new StackTrace(mexcption, true);

            // Get the very first stack frame
            var frame = trace.GetFrame(0);

            // Extract the line no from frame
            var line = frame.GetFileLineNumber();
            return line;
        }

You need to put pdb file along with exe.
You can use it like that

 private void ProceeEachFile()
        {           
            try
            {
               /* Some Code */
                throw new Exception("Some Error");
              /*Some Code */
             
            }
            catch (Exception ex)
            {
                var LineNum = GetLineNum(ex)
                throw new Exception(ex.Message + " Line Num -" + LineNum +"-->");
            }
        }

           In final method 
private void ByWorksheet(object ob)
        {         
           
            try
            {
              ProceeEachFile();
            }
           
            catch (Exception ex)
            {
                var line = GetLineNum(ex);
                String sLogData += ex.Message + " Line Num "+ line +"\n";
                MessageBox.Show(sLogData);
            }
           
        }


Tuesday, March 8, 2016

Relation and differences between SGML, XML, HTML and XHTML What is Markup Language:

What is Markup Language? Markup language designed for processing and presentation of Text. Markup Language is human readable in comparison of other languages which have special syntax.


As ML indicates XML and HTML are markup languages.XML is generic while HTML is specific there are some specified tag and attributes that can be used in HTML  but XML can use any USER defined tag or attribute. HTML is suitable for web designing.
SGML is super set while all three (HTML, XML, XHTML) are subset with their own limitations. You can well-formed HTML is XHTL.
SGML: SGML stands for Standard Generalized Markup Language. There is no restriction at all. Any tag can open anywhere without closing of previous tag. Empty opening and closing tags are allowed. You can only attribute value without its name.
XML: A well-formed SGML with proper closing and ending of tags is called XML. Some declaration that were allowed in SGML but not allowed in XML.
1.       DATATAG
2.       OMITTAG
3.       RANK
4.       LINK…etc

HTML : HTML contains some specified tags. Well formed is not mandatory.
XHTML: will contains specified HTML tags and attributes but well form ness is mandatory.

Purpose
Xml is used to pass data from one system other. Or we used it as a database to store the data.
HTML is used to display content on web pages.
HTML may be well formed or not. But some browser need a well formed HTML to display the content. That’s why XHTML required. A website is use don many devices now like Mobile, Tab Computer and HTML has some complexity so a more strict HTML was required to reduce the overhead to read un well -formed HTML.
XHTML Rules
1.       Tag name and attributes name should be in small case.
2.       Attribute value should be properly quoted.
3.       Well-formed

4.       Non empty tag should have closing tag.

Followers

Link