Thursday, 7 May 2015

Tableau –Latest Data Visualization Tool

What is Tableau   ?
Tableau software is an American computer software company headquartered in Seattle, Washington   . It produces a family of interactive data visualization products focused on Business intelligence.

Tableau Products   :

  •                   Tableau Desktop

  •         Tableau Server

  •         Tableau Online

  •          Tableau Reader

  •          Tableau Public


Advantages of Learning Tableau

ü  Tableau was built to organize and store massive amounts of data.
ü  You can depict your information in more than one illustrations including
Graph ,tables , maps etc.
ü  Even a beginner to the software can create his first production as well as drawn   out result with acceptable visual appearance.
ü  The user interface is well organized so you can customize the view with a few clicks vs multiple menus .

Career Advantage

Latest Data Visualization Tool Tableau jobs are very high in number and companies
Are currently looking for  Tableau Consultants to large extent. The average salary
For tableau consultant is $102,000.

Call Now For Free Demo   : 404 900-9988


For More Details : www.quontrasolutions.com




Monday, 24 November 2014

Creating Hierarchy of Packages in Selenium

We can create packages at different hierarchy level (package and its sub-package etc). Lets create the packages at different hierarchy levels as shown below -
Lets implement this on Eclipse IDE -
1. Launch Eclipse IDE and create a Java Project ‘Project 41′ as shown below -
2. Now lets change the display mode of the package hierarchy by following the below steps.
3. Select the ‘view’ menu icon of the ‘Package Explorer’ tab as shown  below -
4. In ‘View Menu’ options change the Package Presentation option from Flat to Hierarchical as shown below -
Now with this step, the package display mode got changed to hierarchical mode. Lets create hierarchy of packages by following the below steps.
5. Create two packages ‘package1′ and ‘package2′ as shown below -
Now lets create the packages ‘packageA’ and ‘packageB’ as sub-packages under ‘package2′ by following the below steps.
6. Now right click on the ‘package2′ and select ‘New’ -> ‘Package’ from the right click options as shown below -
7. In New Package dialog, enter the package name as package2.packageA and click on ‘Finish’ button  as shown below -
8. Observe that the package ‘package2′ got changed to ‘package2.packageA’ as shown below -
When you create a single sub-package, the original package will get replaced with a single package ‘package.subpackage’. But when you create more than one sub-packages for a package, you can clearly see the hierarchy. Please follow the below steps to create another sub-package for ‘package2′.
9. Right click on the ‘package2.packageA’ package and select ‘New’ -> ‘Package’ from the right click options as shown below -
10. Ensure that the ‘New Java Package’ dialog is displayed with ‘package2.packageA’ in the name field as by default as shown below -
11. Change the packageA to packageB in the default displayed name and click on ‘Finish’ button as shown below -
12. Observe that the two sub-packages ‘packageA’  and ‘packageB’ are displayed under the ‘package2′ package as shown below -
This is how we create packages at different hierarchy levels and view them in the Hierarchical package display mode.
Now lets find out the package statements created in the Class files which are created under the package which is not having any sub-pakcage by following the below steps.
13. Create a Class ‘ClassOne’ under ‘package1′ page and observe that the package statement is displayed in the Class file as shown below -
Hence when you create a Class file under a package directly, the package statement syntax will be package packageName; 
Now lets create a Class file under a sub-package ‘packgeB’ of ‘package2′ package by following the below steps.
14. Create a Class ‘ClassX’ under ‘packageB’ of ‘package2′ and observe that the package statement is displayed in the Class file as shown below -
Hence when you create a Class file under a sub-package of any package, the package statement syntax will be package packageName.subPackageName; 
 Now lets change the package view from Hierarchical mode, back to the Flat mode by following the below steps.
15. Select ‘Flat’ option from the ‘View Menu’ options as shown below -
16. Observe that the hierarchical mode got changed to the Flat mode as shown below -
When you create a package in Eclipse IDE, a folder will be created in the workspace in your computer (i.e. Inside Eclipse IDE Workspace -> Project folder). Now lets view the workspace of this project to verify the same by following the below steps.
17. Right Click on the Project, select ‘Properties’ option and view the location of your project on your computer as shown below -
18. Navigate to the location on your computer and view the Project files as shown below -
19. Open the ‘src’ folder and observe that the Packages ‘package1′ and ‘package2′ are displayed as folder as shown below -
20. Open the ‘package2′ folder and observe that ‘packageA’ and ‘packageB’ sub folder for the sup-packages in Eclipse IDE are displayed as shown below -
21. Open the ‘packageB’ sub-folder and observe that ClassX created under the sub-package ‘packageB’ is displayed as shown below -

How to Rename the Packages in Hierarchy - QuontraSolutions

we can rename the packages which are not in hierarchy without any problems. But when you want to rename a package which has sub-packages under it, it is not possible to do it from Eclipse IDE. Instead we have to go to the Project location on your computer, rename the folder with package name outside Eclipse IDE and refresh the Project in Eclipse IDE.
Lets implement this on Eclipse IDE -
1. Launch Eclipse, Create a Java Project ‘Project 42′ as shown below -
Now lets create a package under Project 42 and rename it by following the below steps. 2. Create a Package ‘packageA’ as shown below -
3. Now Right click on the Package and select ‘Refactor’ -> ‘Rename’ option as shown below -
4. Observe that ‘Rename Package’ dialog is displayed with the ‘packageA’ name as shown below -
5. Now change the package name in the ‘New Name’ field from ‘packageA’ to ‘packageX’ and click on ‘OK’ button as shown below -
6. Observe that the package name got changed from ‘packageA’ to ‘packageX’ as shown below -
Now lets create sub-packages under the package ‘packageX’ and try to rename it by following the below steps. 7. Create two packages package1 & package2 under ‘packageX’ as sub-packages to it as shown below -
In Eclipse IDE, rename the package ‘packageX’ , which is having two sub-packages ‘package1′ and ‘package2′ by following the below steps. 8. Right click on the ‘packageX’ and select ‘Refactor’ -> ‘Rename’ option as shown below -
9. Observe that ‘Rename Pakcage’ dialog is displayed with ‘packageX’ name as shown below -
10. Change the package name displayed in the ‘New Name’ field from ‘packageX’ to ‘packageG’ and click on ‘OK’ button as shown below -
11. Observe that a new package ‘packageG’ got added instead of renaming the ‘packageX’ to ‘packageG’ as shown below -
Hence we are not able to rename the package having the sub-packages using Eclipse IDE. So renaming the packages having the sub-packages from Eclipse IDE is not possible. Now lets find out the project location and change the package folder name to change it by following the below steps. 12. Right click on the Project and select ‘Properties’ option as shown below -
13. In the ‘Properties for Project 42′ dialog, select ‘Resources’ option from the left and view the location of the project on your computer as shown below -
14. Go to the Project location on your computer and open the ‘src’ folder to view the package folder ‘packageX’ inside it as shown below -
15. Rename the ‘packageX’ folder manually to ‘packageM’ as shown below -
16. Observe that the package name is still not changed in the Eclipse IDE as shown below -
Package name wont be changed in Eclipse IDE until you refresh the Project. Refresh the project by following the below steps. 17. Right click on the Project in Eclipse IDE and select ‘Refresh’ option as shown below -
18. Observe that the package name got changed from ‘packageX’ to ‘packageM’ in Eclipse IDE as shown below -
Hence renaming the package having the sub-packages from Eclipse IDE is not possible. In order to rename, we have to change the name of the package folder from the Project location in our computer and refresh the Project in Eclipse IDE to see the changes. Can we rename any package having Class files under it from Eclipse IDE ?
Yes, we can rename the package name in Eclipse which has any Class files under it. But we cannot rename the package name in Eclipse IDE if it has any sub-packages under it.
Lets implement this on Eclipse IDE -
1. In Eclipse IDE, create two Class files ‘ClassOne’ & ‘ClassTwo’ under the package ‘packageG’ in the existing Java Project ‘Project 42′ as shown below -
2. Right click on the ‘packageG’ which is having two Classes ‘ClassOne’ & ‘ClassTwo’ and select ‘Refactor’ -> ‘Rename’ option as shown below -
3. Observe the ‘Rename Package’ dialog is displayed with ‘packageG’ name as shown below -
4. Change the name of the package in ‘New Name’ field from ‘packageG’ to ‘packageS’ and click on ‘OK’ button as shown below -
5. Observe that the package name got changed from packageG to packageS without any problems in Eclipse IDE as shown below -
Hence we can renaming the packages having Class under it from Eclipse IDE without any problems.


Exception is an Object - Selenium

A Java exception is an object that describes an exceptional condition (i.e. error) that has occurred in the piece of code. When an exceptional condition arises, an object representing that condition is created and thrown.
What happens when we don’t handle that exception ?
The program execution will stop at the line of the code where the exceptional condition (i.e. error) got occurred.
How does the program execution stops when exceptional condition got occurred ?
As our program, don’t have any code to handle the occurred exceptional condition (i.e. error), JVM stops our program execution and prints what when wrong using the thrown exception (i.e object).
How to handle the exception ?
We have candle the exception using the try{ } catch{ } blocks.
What happens when we use the try{ } catch{ } blocks to handle the exceptions ?
When an exception occurs in try { } block,  instead of passing the exception (i.e. object) to JVM, the try{} block will pass it to its associated catch{ } block where we can write our code to handle the occurred exceptional condition. catch{ } block catches the exception (i.e. object) that describes the occurred exceptional condition in the program code of the try{ } block and executes the program code that is written in its block to handle the occurred exception condition (i.e. error).
Lets understand it using the below code -
try
{
    int a = 1/0;  //Gives Arithmetic exception
}
catch(Exception e)   //Here e is an object of Exception Class type which receives the exception (i.e. object) that is occurred in and passed by try block.
{
     System.out.println(” 1/0  is not a valid statement “);  //This statement will be printed and the program execution will continue
Lets understand the above code step by step -
1. int a = 1/0;  statement gives divide by zero error and hence throws an exception (i.e. object). But as we have provided the above statement in the try{ } block, instead of passing the exception (i.e. object) to the JVM and terminating the program, try{ } block will pass the exception (i.e. object) to its corresponding catch { } block where we have written the code to handle the exception (i.e. object) to overcome its exceptional condition (i.e. occurred error).
2. catch(Exception e) -> catch block catches the exception(i.e. object) passed by the try{ } block and assigns it to the Exception Class type object ‘e’. You can create Exception Class type object with any name. Lets say, If I want to give the object name as  ‘object1′ instead of ‘e’ , I can as -> catch(Exception object1). And also Exception is a Parent Class of all its Sub-Classes which handles different types of  Exceptions.
In this example, we are using Exception Class i.e parent class, as we know that arithmetic exception is thrown by the statement in the try{ } block, we can use the Class which can receive the exception directly instead of up-casting the received object to the Exception Parent Class and using it. So in order to deal with the exception (i.e. object) directly we can modify the statement as -> catch(ArithmeticException object1). I will explain the Exception Hierarchy in our upcoming posts to explain the parent classes and child classes which are used in catch{ } blocks to handle the exceptions.
3. No programmer will intentionally write the statement int a = 1/0; in his program code. I have intentionally used this statement to make the program throw an exception in this example. But in real time, when a User runs the program created by a programmer, where in the code, the programmer has specified the statement as int c = a/b; and while the User is executing the program created by the programmer, the User may be asked to input a value for a & b variables, and unknowing the User inputs the a variable as 1 and b variable as 0.
The exception will occur in the statement int a=b/c and the program created by the programmer may not be run properly at the User end. In order to avoid this kind of situations, the programmer will handle the exceptions in his code by printing the message ‘0 is not valid’ at User end. When User runs the properly handled code at his end, and in case he enter ‘0’ for b variable, the executing program asks the User not to enter the value ‘0’ for the variable b.

Wednesday, 27 August 2014

ASP.NET MVC3 Vs MVC4 Vs MVC5

ASP.NET MVC 3

  • New Project Templates having support for HTML 5 and CSS 3.
  • Improved Model validation.
  • Razor View Engine introduced with a bundle of new features.
  • Having support for Multiple View Engines i.e. Web Forms view engine, Razor or open source.
  • Controller improvements like ViewBag property and ActionResults Types etc.
  • Unobtrusive JavaScript approach.
  • Improved Dependency Injection with new IDependencyResolver.
  • Partial page output caching

ASP.NET MVC 4

  • ASP.NET Web API, a framework that simplifies the creation of HTTP services and serving a wide range of clients. Follow to create your first ASP.NET Web API service.
  • Adaptive rendering and other look-n-feel improvements to Default Project Templates.
  • A truly Empty Project Template.
  • Based on jQuery Mobile, new Mobile Project Template introduced.
  • Support for adding controller to other project folders also.
  • Task Support for Asynchronous Controllers.
  • Controlling Bundling and Minification through web.config.
  • Support for OAuth and OpenID logins using DotNetOpenAuth library.
  • Support for Windows Azure SDK 1.6 and new releases.

ASP.NET MVC 5

Creating your first ASP.NET MVC 5 Application in 4 simple steps
  • Bootstrap replaced the default MVC template.
  • ASP.NET Identity for authentication and identity management.
  • Authentication Filters for authenticating user by custom or third-party authentication provider.
  • With the help of Filter overrides, we can now override filters on a method or controller.
  • Attribute Routing is now integrated into MVC 5.

Passing data from Controller to View in ASP.NET MVC

ASP.NET MVC is a framework that facilitates building web applications based on MVC (Model-View-Controller) design pattern. Request coming from client reaches the Controller through URL Rewriting Module. Controller decides which model to use in order to fulfill the request. Further passing the Model data to View which then transforms the Model data and renders response to client as shown in following basic level request flow diagram.
ASP.NET MVC Request Flow
In this ASP.NET MVC Tutorial, we will discuss and implement different options to pass data from ASP.NET MVC Controller to View. Following are the available options to pass data from a Controller to View in ASP.NET MVC:
  • ViewBag
  • ViewData
  • TempData
If we want to maintain state between a Controller and corresponding View- ViewData and ViewBag are the available options but both of these options are limited to a single server call (meaning it’s value will be null if a redirect occurs). But if we need to maintain state from one Controller to another (redirect case), then TempData is the other available option.
It’s common that initially it might be a bit difficult for a ASP.NET WebForms developer to digest above flow and need for options to pass data from Controller to View. Because in WebForms approach, Controller and View are tightly coupled to each other.

ViewBag Example

As we discussed earlier that ViewBag and ViewData serves the same purpose but ViewBag is basically a dynamic property (a new C# 4.0 feature) having advantage that it doesn’t have typecasting and null checks.
So, In order to pass data from Controller to View using ViewBag, we will modify our EmployeeController code as follows:
 public class EmployeeController : Controller
 {
           // GET: /Employee/
          public ActionResult Index()
         {
                     ViewBag.EmployeeName = “Muhammad Hamza”;
                     ViewBag.Company = “Web Development Company”;
                     ViewBag.Address = “Dubai, United Arab Emirates”;                     
                     return View();
         }
  }
And to get Employee details passed from Controller using ViewBag, View code will be as follows:
  <body>
    <div>
          <h1>Employee (ViewBag Data Example)</h1>
          <div>
                       <b>Employee Name:</b> @ViewBag.EmployeeName<br />
                      <b>Company Name:</b> @ViewBag.Company<br />
                      <b>Address:</b> @ViewBag.Address<br />
          </div>
    </div>
  </body>
In order to see the above changes in action run the solution, we will find the following output.
ViewBag Example

ViewData Example

As compared to ViewBag, ViewData is a dictionary object which requires typecasting as well as null checks. Same above implementation using ViewData can be achieved as follows:
 public class EmployeeController : Controller
 {
           // GET: /Employee/
          public ActionResult Index()
         {
                     ViewData["EmployeeName"] = “Muhammad Hamza”;
                     ViewData["Company"] = “Web Development Company”;
                     ViewData["Address"] = “Dubai, United Arab Emirates”;                     
                     return View();
         }
  }
And to get Employee details passed from Controller using ViewBag, View code will be as follows:
  <body>
    <div>
          <h1>Employee (ViewBag Data Example)</h1>
          <div>
                       <b>Employee Name:</b> @ViewData["EmployeeName"]<br />
                      <b>Company Name:</b> @ViewData["Company"]<br />
                      <b>Address:</b> @ViewData["Address"]<br />
          </div>
    </div>
  </body>
Run the application to view the following output.
ViewData Example

Using TempData in ASP.NET MVC

TempData in ASP.NET MVC is basically a dictionary object derived from TempDataDictionary. TempData stays for a subsequent HTTP Request as opposed to other options (ViewBag and ViewData) those stay only for current request. So, TempdData can be used to maintain data between controller actions as well as redirects.
Note: Just like ViewData, typecasting and null checks required for TempData also in order to avoid errors.
Let’s see how we can use TempData in a practical scenario to pass data from one controller action to another.
   //Controller Action 1 (TemporaryEmployee)
   public ActionResult TemporaryEmployee()
  {
                  Employee employee = new Employee
                  {
                          EmpID = “121″,
                          EmpFirstName = “Imran”,
                          EmpLastName = “Ghani”
                  };                   
                  TempData["Employee"] = employee;
                  return RedirectToAction(“PermanentEmployee”);
  }   
 
   //Controller Action 2(PermanentEmployee)
   public ActionResult PermanentEmployee()
  {
                 Employee employee = TempData["Employee"] as Employee;
                 return View(employee);
   }
As in above example, we store an employee object in TempData in Controller Action 1 (i.e. TemporaryEmployee) and retrieve it in another Controller Action 2 (i.e. PermanentEmployee). But If we try to do the same using ViewBag or ViewData, we will get null in Controller Action 2 because only TempData object maintains data between controller actions.
An important thing about TempData is that it stores contents in Session object. Then one may raise a question that  “What’s the difference between TempData in ASP.NET MVC and Session?” or “Why we have TempData dictionary object?, Why can’t we use the Session object directly?

ASP.NET MVC TempData Vs Sessions

Although ASP.NET MVC TempData stores it’s content in Session state but it gets destroyed earlier than a session object. TempData gets destroyed immediately after it’s used in subsequent HTTP request, so no explicit action required. If we use a Session object for this purpose, we would have to destroy the object explicitly.
It’s best fit for scenarios when:
  • we need to preserve data from current to subsequent request.
  • passing error message to an error page.

7 jQuery Code Snippets every web developer must Know

jQuery extensively simplified web developer’s life and has become a leader in javascript available libraries. There are a lot of useful jQuery snippets available but here in this post I am going to share 7 basic and widely used code snippets that every front-end web developer must have. Even for those who are new to jQuery can easily understand and get benefit from these routinely used code snippets.

1. Print Page Option
Providing option to print a page is a common task for web developers. Following is the available code:

<!– jQuery: Print Page –>
$(‘a.printPage’).click(function(){
           window.print();
           return false;
}); 

<!– HTML: Print Page –>

<div>
<a  class=”printPage” href=”#”>Print</a>
</div>
2. Helping Input Field/Swap Input Field
In order to make an Input Text field helpful, we normally display some default text inside it (For Example “Company Name”) and when user click on it, text disappears and user can enter the value for it.
You can try it yourself by using the following code snippet.

<!– jQuery: Helping Input Field –>
$(‘input[type=text]‘).focus(function(){    
           var $this = $(this);
           var title = $this.attr(‘title’);
           if($this.val() == title)
           {
               $this.val(”);
           }
}).blur(function() {
           var $this = $(this);
           var title = $this.attr(‘title’);
           if($this.val() == ”)
           {
               $this.val(title);
           }
});

<!– HTML: Swap Input Field –>

<div>
       <input type=”text” 
name=”searchCompanyName”
value=”Company Name” 
title=”Company Name” />
</div>


3. Select/Deselect All options

Selecting or Deselecting all available checkbox options using a link on HTML page is common task.

<!– jQuery: Select/Deselect All –>
$(‘.SelectAll’).live(‘click’, function(){ $(this).closest(‘.divAll’).find(‘input[type=checkbox]‘).attr(‘checked’, true); return false; }); $(‘.DeselectAll’).live(‘click’, function(){ $(this).closest(‘.divAll’).find(‘input[type=checkbox]‘).attr(‘checked’, false); return false; });

<!– HTML: Select/Deselect All –>

<div class=”divAll”> <a href=”#” class=”SelectAll”>Select All</a>&nbsp; <a href=”#” class=”DeselectAll”>Deselect All</a> <br /> <input type=”checkbox” id=”Lahore” /><label for=”Lahore”>Lahore</label> <input type=”checkbox” id=”Karachi” /><label for=”Karachi”>Karachi</label> <input type=”checkbox” id=”Islamabad” /><label for=”Islamabad”>Islamabad</label> </div>


4. Disabling Right Click

For web developers, its common to disable right click on certain pages so following code will do the job.
 
<!– jQuery: Disabling Right Click –>
$(document).bind(“contextmenu”,function(e){
       e.preventDefault();


   });
 
 
5. Identify which key is pressed.
Sometimes, we need to validate the input value on a textbox. For example, for “First Name” we might need to avoid numeric values. So, we need to identify which key is pressed and then perform the action accordingly.
<!– jQuery: Which key is Pressed. –>
$(‘#txtFirstName’).keypress(function(event){
     alert(event.keyCode);
  });
 
<!– HTML: Which key is Pressed. –>
<asp:TextBox ID=”txtFirstName” runat=”server”></asp:TextBox>
 
 
6. Validating an email.
Validating an email address is very common task on HTML form.
 
<!– jQuery: Validating an email. –>
$(‘#txtEmail’).blur(function(e) {
            var sEmail = $(‘#txtEmail’).val();
            if ($.trim(sEmail).length == 0) {
                alert(‘Please enter valid email address’);
                e.preventDefault();
            }        
            var filter = /^([w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([w-]+.)+))([a-zA-Z]
                             {2,4}|[0-9]{1,3})(]?)$/;        
            if (filter.test(sEmail)) {
                alert(‘Valid Email’);
            }
            else {
                alert(‘Invalid Email’);
                e.preventDefault();
            }
        });
 
<!– HTML: Validating an email–>
<asp:TextBox id=”txtEmail” runat=”server” />
 
 
7. Limiting MaxLength for TextArea
Lastly, it usual to put a textarea on a form and validate maximum number of characters on it.
 
<!– jQuery: Limiting MaLength for TextArea –>
   var MaxLength = 500;
       $(‘#txtDescription’).keypress(function(e)
       {
          if ($(this).val().length >= MaxLength) {
          e.preventDefault();}
       });
 
<!– HTML: Limiting MaLength for TextArea–>
<asp:TextBox ID=”txtDescription” runat=”server” 
                         TextMode=”MultiLine” Columns=”50″ Rows=”5″></asp:TextBox>

Tuesday, 5 August 2014

Manual and Automated Testing

There are mainly two broad types of software testing – Manual Testing and Automated Testing.
Manual Testing
Manual Testing involves testing the software without any automation script or any tool. Testers check the application or software by taking up the role of an end user. They try to find out if there is any unexpected behavior or failure in the application. Test Management can be taken care of by using test plans and test cases.

Automation testing

Automation testing process involves testing with the help of automation scripts and executing the scripts to run the application with the help of some automation tool. Once the script is ready then these tests can run quickly and efficiently.
Since the cost of automated testing is in the form of efforts and time required to create the scripts, not all tests can be converted to automated test. There should be a valid reason to pay that cost.
Reasons for Automation
1. Regression testing to confirm that new changes have not affected the application adversely. It considers already existing test cases for execution. This is an efficient process when we need to provide feedback to the developer immediately.
2. The test cases need to be iterated multiple number of times often with varying datasets to cover multiple workflow paths.
3. When we require support for agile methodologies.
4. Customized reports are required for monitoring.

Getting Started with Automated Testing

Once the need for automated testing has been established, it involves creation of relevant test scripts. Test script creation can be done only by a skilled testers having knowledge of testing, the suite of tools as well functionality under development. Such resources are costly and their time is a premium. Considering this fact, it is often not possible to budget the automation of all tests. Some of the major decision points while identifying cases for testing automation are
1. System modules where requirements do not change frequently
2. Ample time is at hand to describe a test via scripts
3. The application/software module is critical enough to justify the upfront cost of automation
4. After functional testing we want to do performance testing with multiple virtual users using the same test script.
With the scope of automation decided, next step is to pick the testing tool. The following checklist can help with the selection.
1. The tool should be able to easy to work with. It should execute test cases in unattended manner. It should provide interface to write scripts, efficient IDE and ease of test execution.
2. The tool should provide support to various technologies. It should support testing using different browsers, languages, and types of applications.
3. It should integrate with a software that does Application Lifecycle Management so that it can be used for running automated Build Verification Tests as well as the reports can be integrated with other reports created by ALM software