Tuesday, March 6, 2018

XSLT




XSLT is used to transform XML documents into other XML documents  and other formats such as HTML or plain text.

XML --> other XML formats
XML --> HTML
XML --> Plain Text

the converted files subsequently converted to other formats, such as PDFPostScript and PNG.

https://www.w3schools.com/xml/xsl_intro.asp








C# code:

public static string TransformXMLToHTML(string inputXml, string xsltString)
{
    XslCompiledTransform transform = new XslCompiledTransform();
    using(XmlReader reader = XmlReader.Create(new StringReader(xsltString))) {
        transform.Load(reader);
    }
    StringWriter results = new StringWriter();
    using(XmlReader reader = XmlReader.Create(new StringReader(inputXml))) {
        transform.Transform(reader, null, results);
    }
    return results.ToString();
}

ISTQB Automation Tester


BooK:
https://www.istqb.org/downloads/category/48-advanced-level-test-automation-engineer-documents.html

Question Papers:
https://www.istqb.org/downloads/category/49-advanced-level-test-automation-engineer-exam-documents.html


Monday, March 5, 2018

visual studio build event : prebuild and postbuild


https://msdn.microsoft.com/en-us/library/42x5kfw4(v=vs.120).aspx

http://www.c-sharpcorner.com/article/prepost-build-events-command-line-in-visual-studio/

Pre/Post build events are useful when we wish to perform some operations before/after a project is built. These operations are nothing but the Shell commands being used from the command line. 

copy "$(TargetDir)*$(TargetExt)"  "$(ProjectDir)..\library"

..\ means it goes one directory up and searches for folder library there.

Valid Statments

copy "D:\jenkins.war" $(SolutionDir)

copy "D:\jenkins.war" "$(SolutionDir)"

xcopy "D:\jenkins.war" "$(SolutionDir)"

copy "D:\jenkins.war" "D:\MagicPlus\Download\Video\"
copy "D:\jenkins.war" "D:\MagicPlus\Download\Video"

copy "$(TargetDir)*$(TargetExt)"  "$(ProjectDir)sum\library"



invalid
robocopy command don’t work: it gives error
robocopy "D:\jenkins.war" "$(SolutionDir)"

Fully Qualified vs. Relative Paths


https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#fully_qualified_vs._relative_paths

  • "..\tmp.txt" specifies a file named tmp.txt located in the parent of the current directory.
  • "..\..\tmp.txt" specifies a file that is two directories above the current directory.
  • "..\tempdir\tmp.txt" specifies a file named tmp.txt located in a directory named tempdir that is a peer directory to the current directory.

https://stackoverflow.com/questions/6424114/slash-vs-tilde-slash-in-style-sheet-path-in-asp-net


·         / - Site root
·         ~/ - Root directory of the application
The difference is that if you site is:
http://example.com
And you have an application myapp on:
http://example.com/mydir/myapp
/ will return the root of the site (http://example.com),
~/ will return the root of the application (http://example.com/mydir/).



Thursday, March 1, 2018

Database Normalization


Edgar F. Codd proposed the relational model in 1970 and also Normalization.

https://stackoverflow.com/questions/8337309/superkey-candidate-key-primary-key

Normalization:
Removing inconsistent dependency and redundancy within a database is called normalization.

Denormalization:
Normalization supports for efficient data storage but it increases the time to access the related values, as when querying dbms will look into multiple table for joining tables to return values.

Performance and tracking historical data

Rows = Tuples = Records
Columns = Attributes

Super Key: A super key is a set of columns that uniquely defines a row.

Name:     Not Unique
Id:            Unique
Address:  Not Unique
Phone    :  Unique

Here Id and Phone are Unique. All the below combinations are super keys. Super keys is a superset of candidate key. Any combination which uniquely defines a row is a superkey.

  • Id
  • Id, Name
  • Id, Address
  • Id, Phone
  • Phone
  • Phone, Name
  • Phone, Id
  • Phone, Address

Below examples are not Super Keys,
Name, Address

What is Composite Key?

Primary key consists of more than one attributes/Columns is called Composite Key.


Candidate Key:
A candidate key is a "minimal" superkey. So in the above example the minimal is 1. So, we have two canditate key Id and Phone.

Primary Key: There will be

Prime attributes:
The attributes/Columns which are the part of candidate key are called Prime attributes.

Functional Dependency: means relationship among the attributes.

Functional Dependency: X → Y means that the values of Y are determined by the values of X. Two tuples sharing the same values of X will necessarily have the same values of Y. 
enter image description here
Reference: https://www.youtube.com/watch?v=7-ka5ylK_DI
A à
functionally determines B

  Name
     ID
      Marks
Pradeep
    1
     62
Vinod
    2
     67
Ravi
    3
     78
Pradeep
    4
    78

In this example
IDà Name     (if you know ID, we can uniquely determine the name of the person, vice versa not holds good as same Name can be have by multiple persons. In this example there are 2 persons with name Pradeep)

IDà Marks   (With ID we can know the marks, but vice versa again not holds good). 

Normalization: Designing a relational database to minmize data redundancy
Introduced by Edgar codd
1NF, 2NF, 3NF and so on.

1NF:
  1. each table has only relevant columns
  2. each table has primary key
  3. each table has no repeating groups
  4. No multiple values in any coloumn of any row

2NF : No partial dependency should exist

To be in 2NF, the table has to be in 1NF and all non-prime attributes/coloumns has to be depend on the whole primary key, and not on a part of the primary key. 

Consider a Customer table with CustomerID and StoreID together making up the primary key. If we have an attribute StoreLocation, we can see that it depends only on StoreID, which is not the complete primary key. Hence its not in 2NF.

If the primary key is not composite Key,  Primary key is single attribute then the relation will be in 2NF
https://www.tutorialspoint.com/dbms_for_gate_exams/dbms_second_normal_form_2nf.asp


3NF:
https://beginnersbook.com/2015/05/normalization-in-dbms/



Chrome Developer tools



Reference:
Open Developers Tools : Shift + Ctrl + I    or   F12


docking postion options will be at top right corner with three vertical dots.


options on right click :


Mobile view:


strikeing means :
Styles: top is most specfic , bottom is general
you could see padding and border-bottom is strike-out, it means more specific is over-written the same properties.


we can select and deselect the properties as shown below


Computed shows only the applied property or styles


in the event listener, we can see the various events associated with the element:


Console is to write Javascript :
even in Elements tab , if we press Esc key a small Console window will get open, both options are same.


extra:


Network tab:
we can disable cache so every time the requests are made to the server.




if you click on Initiator , its shows the source code where the request has started.










JMeter Simple Controller

  Simple Controller is just a  container  for user request.