components or post values to a JSP / ASP or any web page or any services which can be referred by URL.
Client-side validation just avoids the client from going "but I filled this all in and it didn't tell me anything!". It's not actually mandatory, and in reality, client-side validation is a very new thing (read: 5 years old or less). In practice, all it does is prevent your client (with JS enabled) to know whether the form is okay before reloading a page. If AJAX is in the game, it is different - it allows you to save bandwidth as well as to provide user with feedback before submission. Finally, if you're building strictly client-side, peer-to-peer exchange apps (think games), you'll want client-side validation to keep the clients from cheating.
What could a user do if you do not server-side validate? Anything, depending on how you use their data. You could be allowing users to drop entire databases (or worse, leak them), modify anything they like (or worse, read anything they like. Directory traversal flaws are extremely common entrance points for naughty people), and elevate their privileges at will. Do you want to run this risk? Not validating user input is like trusting people and not installing locks on your house.
What Is the difference between creating string with and without new operator?
The basic difference between them is memory allocation.
First option i.e
String s1 = "hello";
When you use this s1 is called as a string literal and memory for s1 is allocated at compile time.
But in 2nd case
String s2 = new String("hello");
In this case s2 is called as an object of String representing hello
When you tries to create two string literal using the first case, only one memory is referenced by those two literals. I mean String literals are working with a concept of string pool. when you create a 2nd string literal with same content, instead of allocating a new space compiler will return the same reference. Hence you will get true when you compare those two literals using == operator.
But in the 2nd case each time JVM will create a new object for each. and you have to compare their contents using equals() method but not with == operator.
If you want to create a new string object using 2nd case and also you don't want a new object, then you can use intern() method to get the same object.
String s = "hello";
String s1 = new String("hello").intern();
System.out.println(s == s1);
In this case instead of creating a new object, JVM will return the same reference s. So the output will be true
please see: https://goo.gl/6k8RTk
What is router-outlet directive in Angular 2?
The Angular Router ("the router") borrows from this model. It can interpret a browser URL as an instruction to navigate to a client-generated view and pass optional parameters along to the supporting view component to help it decide what specific content to present. We can bind the router to links on a page and it will navigate to the appropriate application view when the user clicks a link. We can navigate imperatively when the user clicks a button, selects from a drop box, or in response to some other stimulus from any source. And the router logs activity in the browser's history journal so the back and forward buttons work as well.
- Enter a URL in the address bar and the browser navigates to a corresponding page.
- Click links on the page and the browser navigates to a new page.
- Click the browser's back and forward buttons and the browser navigates backward and forward through the history of pages you've seen.
Common remote testing techniques used in User Experience ?
The commonly used user research methods are :
- Tree Testing
- Screenshot Click Testing
- Remote Usability Testing (RUT)
A Tree Test methodology, is one of the best usability test to validate the findability and navigability of the website. This method helps the researcher to measure the time and easy of use to locate the url / button to reach correct product / page.
Screenshot Click Testing:
Screenshot Click Test will helps the researcher to identify where users are clicking over time. This would be an ideal solution to evaluate and iterate design concepts and user navigation, at an early stage. It will save the time and money throughout the product life cycle. The common outcome is click maps, heat maps and dark maps. In this test, the first clicks are very important to understand the user pattern, whether they choose the right option or not.
Generally, UX designers can use this methodology on a prototype (No need for fully developed / designed page) before the UI implemented.
Remote Usability Testing (RUT)
In this test process, users will be asked to perform a particular task, like login process or any other key task. This test can be conducted on any web apps, prototypes, mock-ups, etc., The focus would be whether users can complete the given task successfully ?
In general, UX researchers conduct the test to evaluate the design with different user segments. This test can be conducted with multiple users located in multiple locations, which helps to try with geographically distributed user groups.
Some of the used common remote techniques are:
Remote Usability Testing:
This is usability testing but without the need to drag users into your laboratory environment. It was once complex and expensive but technology has moved on and now it’s fairly simple to set up and reasonable value for money too.
Screenshot Click Testing for Findability:
A screenshot click test is a simple and fast method to determine the findability of content. Screenshot Click Testing can be used to test early stage designs, prototypes, wireframes, and storyboards, as well as test snapshots of a live site. It can be used to uncover usability issues and provides quick feedback early in the design phase at a low cost.
Tree Testing (Reverse Card Sort)
Tree testing is a method for testing the information architecture of a site. The hierarchical organization of content into categories and subcategories is presented to users in the form of a navigation tree that can be expanded and collapsed. The other elements of a web page, such as the images and search bar, are removed.
Card sorting was originally a technique used in psychological research long before UXresearch was a “thing”. It’s a simple concept, you write words or phrases on cards, then you ask the user to categorize them. You might also ask them to label the categories. It’s a great way to determine whether your information achitecture (IA) is heading in the right direction or to examine IA for new products.
What is the Difference between Manual Testing and Automation Testing?
- Tests conducted by testers manually is called Manual Testing, wherein they compare the expected and actual functionality are in accordance with the test cases.
- Tests conducted by using software tool is called Automation Testing, wherein the expected results are fed into the tool to be compared with the actual output of software being tested.
- Refer link for more Q&A on Automation Testing. (Link to Automation Testing QA)
In manual testing more time is required as it is done by humans who can get tired by continuous working.
In Automation testing less time is required in comparison with manual testing because tools and computer don’t get exhausted by continuous working.
The quality of the result produced after manual testing is low in contrast to automated testing.
The results produced using automated testing has high quality as they are more accurate.
In order to perform manual testing there is no need to write long and lengthy code.
In automation testing there is always a need to write code.
The result obtained from manual testing are not much reliable there is always some chances of error occurrence.
Automated testing produces a more reliable result.
|Automation Testing||Manual Testing|
|Automation testing perform the same operation each time||Manual testing is not reliable. Using this method test execution is not accurate all the time.|
|Automation testing is very much helpful regressions in testing where code changes frequently.||To execute the test cases first time using manual testing will be very much useful. But it is not sure that it will catch the regression defects under frequently changing requirements.|
|Automation testing will be useful to execute the set of test cases frequently.||Manual testing will be useful when the test case only needs to run once or twice.|
|After making Automation test suites, fewer testers required to execute the test cases.||To execute the test cases every time tester requires the same amount of time.|
|Automation testing can also be done on different machine with different OS platform combination, concurrently.||Using manual testing,testing on different machine with different OS platform combination is not possible, concurrently. To execute such task different testers are required.|
|Using Automation testing, testers can test complicated application too.||It does not involve in programming task to fetch hidden information.|
|Automation runs test cases significantly faster than human resources.||Manual testing is slower than automation. Running tests manually can be very time consuming.|
|Some time it is not helpful in UI testing||It is very much helpful in UI testing|
|Automation testing is very useful for automating the Build Verification Testing (BVT) & it is not mundane and tiresome.||To execute the Build Verification Testing (BVT) is very mundane and tiresome in manual testing.|
|Initial cost of automation testing is more than manual testing but useful always.||Manual testing requires less cost than automation.|
Explain how you can move or copy Jenkins from one server to another?
Move a job from one installation of Jenkins to another by simply copying the corresponding job directory.
Make a copy of an existing job by making a clone of a job directory by a different name.
Rename an existing job by renaming a directory. Note that the if you change a job name you will need to change any other job that tries to call the renamed job.
Those operations can be done even when Jenkins is running. For changes like these to take effect, you have to click "reload config" to force Jenkins to reload configuration from the disk.
There are some Jenkins plugins out there that provide some job export options. Here are a couple...
This is what I used, which worked nicely for only the few jobs we had. If you have a large number of Jenkins jobs, you may consider the first aproach above.
First download the Jenkins CLI jar.
You can do this from your jenkin's CLI page within your installed Jenkins instance.
Next we can use the following command (pointing to the old server) to list the jobs
java -jar jenkins-cli.jar -s http://<YourBuildServer>:<YourBuildServerPort>/ list-jobs
Using one job from the list above, let's copy the xml of a job to the clipboard. (I'm using a Mac which is were pbcopy & pbpaste come from below)
java -jar jenkins-cli.jar -s http://<YourBuildServer>:<YourBuildServerPort>/ get-job "NAME_OF_JOB" | pbcopy
This uses the cli get-job "NAME_OF_JOB" command to print the job's xml to stdout, which we pipe to pbcopy on the Mac to load the configuration into the clipboard. You could of course pipe the output to a file like ... > job.xml
If the above command placed a job's XML into the clipboard, you can use the below command to add it to the new server.
pbpaste | java -jar jenkins-cli.jar -s http://<YourBuildServer>:<YourBuildServerPort> create-job "NAME_OF_JOB"
This uses pbpaste to take what is in the clipboard, send it to stdin and pipe it to the Jenkins cli's create-job "NAME_OF_JOB" command.
Hope this helps...
There are atleast three ways
- Copy jobs directory
- Use Import Plugin https://wiki.jenkins-ci.org/display/JENKINS/Job+Import+Plugin
- Use Jenkins CLI to list the jobs, get the job xml and then create a job on new server based on the xml
How to synchronise two vobs?
First, the ClearCase administrator at the site that has the needed data must create and export a synchronization packet to the site that needs that data. Here is an example of the command that does this action. Keep in mind that this command must be run on the VOB server that hosts the VOB, as the VOB owner, and the destination VOB replica must be known.
|/usr/atria/bin/multitool syncreplica –export –nc –fship |
This command will create a synchronization packet file in the outgoing shipping bay; by default, this directory is located here: /usr/atria/shipping/ms_ship/outgoing/. Then this synchronization packet will be shipped to the remote replica's VOB server, and then the packet file will be deleted.
Explain servlet life cycle.
A servlet life cycle can be defined as the entire process from its creation till the destruction. The following are the paths followed by a servlet.
- The servlet is initialized by calling the init () method.
- The servlet calls service() method to process a client's request.
- The servlet is terminated by calling the destroy() method.
- Finally, servlet is garbage collected by the garbage collector of the JVM.
The web container maintains the life cycle of a servlet instance. Let's see the life cycle of the servlet:
Servlet class is loaded.
Servlet instance is created.
init method is invoked.
service method is invoked.
destroy method is invoked
there are three states of a servlet: new, ready and end. The servlet is in new state if servlet instance is created. After invoking the init() method, Servlet comes in the ready state. In the ready state, servlet performs all the tasks. When the web container invokes the destroy() method, it shifts to the end state.
1) Servlet class is loaded The classloader is responsible to load the servlet class. The servlet class is loaded when the first request for the servlet is received by the web container.
2) Servlet instance is created The web container creates the instance of a servlet after loading the servlet class. The servlet instance is created only once in the servlet life cycle.
3) init method is invoked
The web container calls the init method only once after creating the servlet instance. The init method is used to initialize the servlet. It is the life cycle method of the javax.servlet.Servlet interface. Syntax of the init method is given below:
public void init(ServletConfig config) throws ServletException
4) service method is invoked The web container calls the service method each time when request for the servlet is received. If servlet is not initialized, it follows the first three steps as described above then calls the service method. If servlet is initialized, it calls the service method. Notice that servlet is initialized only once. The syntax of the service method of the Servlet interface is given below:
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
5) destroy method is invoked The web container calls the destroy method before removing the servlet instance from the service. It gives the servlet an opportunity to clean up any resource for example memory, thread etc. The syntax of the destroy method of the Servlet interface is given below:
public void destroy()
- Loading Servlet Class : A Servlet class is loaded when first request for the servlet is received by the Web Container.
- Servlet instance creation :After the Servlet class is loaded, Web Container creates the instance of it. Servlet instance is created only once in the life cycle.
- Call to the init() method : init() method is called by the Web Container on servlet instance to initialize the servlet.
Signature of init() method :
public void init(ServletConfig config) throws ServletException
- Call to the service() method : The containers call the service() method each time the request for servlet is received. The service() method will then call the doGet() or doPost() methos based ont eh type of the HTTP request, as explained in previous lessons.
Signature of service() method :
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
- Call to destroy() method: The Web Container call the destroy() method before removing servlet instance, giving it a chance for cleanup activity.
Select TOP 2 salary from employee table
SQL Queries in Oracle, select * from (select * from employee order by SALARY desc) where rownum < 3
SQL Queries in SQL Server, select top 2 * from employee order by salary desc
SQL Queries in MySQL, select * from employee order by salary desc limit 2
You can just run 2 queries as inner queries to return 2 columns:
select (SELECT MAX(Salary) FROM Employee) maxsalary, (SELECT MAX(Salary) FROM Employee WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee )) as [2nd_max_salary]
Is it possible to insert the same values at once (Mysql)?
INSERT INTO Example (column_name) VALUES ('Red'),('Black'),('Green');