Tuesday, 24 December 2019
Types of automation Testing
Types of Automation Testing
- Code drive testing
- UI testing
- Integration Testing
- API level testing
Automation Testing
Automation testing is used to simplify testing and involves steps to create scripts for testing. One of the advantage of automation testing is re-executing same test case in different environment so it saves time.
There are many tools available to prepare automation test cases some of them are
Selenium
IBM Rational
Test Case Studio
What are requirements companies look in Software Testing Engineer
9. Knowledge of best practices on automation.
Thursday, 19 December 2019
Javascript for pushing only unique values in array
JavaScript to give error on pushing a duplicate value in an array
if(!fileArray.includes(file1)){
fileArray.push(val)
}else{
alert("can't contain duplicate value");
}
}
Tips for writing a good blog
Tips for writing a good blog
1. USE SEO tips (Use Search terms for title, hyperlinks etc.,)
2. Use Google keywords people often search.
3. Be consistent
4. Check messages and emails on your blogs.
5. Make content sharable.
6. Improve your content repeatedly.
7. Be clear about your each blog.
8. Suggest user's related topic
9. Use images, pdf's presentation links.
10. Make content clickable.
11. Know your audience before starting any blog post or any blog.
12. Show your content to friends/relatives etc before posting if you have fear.
13. See other blogs of same category and write down 5 things which you are doing and others are not.
14. Go to google keyword planner to see no. of hits and suggestions for particular keyword.
15. Ask people for comments on your blog.
16. Link different set of information for your viewers.
17. Embed your blog with your website, quora, social networking sites also post your answers on sites like linkedin etc.
Integrating sql developer with Microsoft sql server
- Download jtds 1.3.1 driver for sql server and sybase
- Go to tools ->preference->db->3rd party driver and import this jar jtds 1.3.1.
- Click ok
- Restart sql developer now you will see a connection tab for microsoft sql developer and connect to your sql server db.
Wednesday, 18 December 2019
Javascript to change Label dynamically
<html>
<script>
function Test(){
var x=document.getElementById("Test");
if((x.innerHTML).includes("*")){
x.innerHTML=x.innerHTML.slice(0, -1);
}
else{
x.innerHTML=x.innerHTML+"*";
}
}
</script>
<body>
<label id="Test" for="new">My First JavaScript*</label>
<button type="button"
onclick="Test()" id="new" name="new">New
</button>
<p id="demo"></p>
</body>
</html>
Tuesday, 17 December 2019
Sunday, 15 December 2019
Steps to backup Sql server database
- Ensure application server is stopped.
- Login to Dev Server and launch SQL Server Management Studio
- Expand the Databases node in Object Explorer.
- Right-click on the database, hover over Tasks, and select Back up
Select the path and click ok to begin backup
- Ensure application server is stopped
- Login to server and launch SQL studio.
- Right click on database and click on restore.
- Select the .bak file to restore
List of Companies in India working on Maximo
- IBM
- Wipro
- TCS
- Infosys
- Accenture
- PWC
- Capegimini
- Tech Mahindra
- HCL
- Mphasis
- L&T
- ABS
- Ontracks
- Interloc
- Cybage
- Ford
- ValueD
- Mindtree
- Volkswagon
- Cognizant
- Cisco
- GE
- Atos
- Syntel
- Adobe
- Schlumberger
How can I delete or post multiple records in rest api
JavaScript functional expresion
Thursday, 12 December 2019
Javascript One button is calling another / Javascript One button is calling another submit
JavaScript event propogation
Inorder to resolve this issue you should be event.stoppropogation and event.preventdefault.
This issue occurs when in a form we have one submit and multiple button so default behaviour cause events propogation.
Tuesday, 10 December 2019
Jquery to make field required based on other Field
<html>
<head>
<title>Try jQuery Online</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("em").addClass("selected");
$("#myid").addClass("highlight");
$('#text1').change(function() {
var x = document.getElementById("label2");
if (x.innerHTML === "Last Name") {
x.innerHTML = "Last Name*";
} else {
x.innerHTML = "Last Name";
}
if ($('#text2').attr('required')) {
$('#text2').removeAttr('required');
}
else {
$('#text2').attr('required','required');
}
});
});
</script>
<style>
.selected {
color:red;
}
.highlight {
background:yellow;
}
</style>
</head>
<body>
<form>
<label for="text1" id="label1"> first name</label>
<p><input type="textbox" id="text1"/> Check Me to make the Text Box a Required Field</p>
<b>
</b>
<label for="tex2" id="label2">Last Name</label>
<input type="text" id="text2" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Monday, 28 October 2019
Command For Taking out PDF of All software installed from registry
Tuesday, 1 October 2019
SQL Server connection refused error
1. Go to server configuration manager.
2. Enable TCP/IP protocol and in IP address go to IP/ALL and set dynamic value to blank and TCP/IP port to 1433 (default)
Getting started with Apache Derby
Install derby and start using bat file startnetwork.bat.
C:\Users\AnilBalwani\Downloads\db-derby-10.12.1.1-bin\db-derby-10.12.1.1-bin\lib>java -jar derbyrun.jar ij
ij version 10.12
ij> connect 'jdbc:derby:booksdb;create=true';
ij> CREATE TABLE book (book_id int primary key, title varchar(64));
0 rows inserted/updated/deleted
ij> INSERT INTO book VALUES (1, 'New Test'), (2, 'Testing'), (3, 'Correct');
3 rows inserted/updated/deleted
ij> select * from book;
3 rows will get selected
Friday, 27 September 2019
Citi Corp Java Interview Questions
1. Variable used in Threading (say t1 works on Map, t2 should work after t1 finishes)
2. Circular Linked List. how to check if a list is circular?
3. What is Hashing, what's a bucket in hashing?
4. authentication in Web Servies
5. Get Nth employee salary in Oracle.
6. Explain all the guarantees about the use of volatile keyword in the Java language from version 1.5
7. Sort a array in such a way that the duplicates are also in
for ex
2 arrays
0 1 3 5
1 2 3 4
output should be
01123345
9. spring we use Initialization Bean interface
10, Discuss method overriding in Java?
11. Discuss internals of a Hashmap? What is Role of equals() and hashcode() method in Object class? What will be behavior if we override hashcode() method to always return 1?
Solution discussed here
What is difference between Future and Callable interface in Java?
When should I use StringBuilder class in a program?
Tell me about your understanding of Executor Framework. How is it different from Fork Join Framework?
What is a Immutable Class? How does it help in writing scalable applications?
What is thread safety? How do you achieve it?
How will you handle ConcurrentModificationException?
What is difference between poll() and remove() method of an Queue?
What is difference between fail-fast and fail-safe iterators?
How are Concurrent Collections different from Synchronized collections?
What is difference between Vector and ArrayList?
What is difference between HasSet and Hashmap?
What is CopyOnWriteArrayList, how it is different than ArrayList and Vector?
When to use serialization vs externalizable interface?
Design Problems
How do you pass a job from Thread 1 to Thread 2 to Thread 3?
How will you implement a Queue in Java?
Discuss Singleton and Decorator Design Pattern. Discuss the practical usage of these design patterns. How to make singleton class thread safe?
How will you implement pagination in a web application? What is difference between Factory and Abstract Factory Design Pattern?
You have array of n size having numbers between 1 to 100. you need to provide algorithm for sorting array with BigO(n) iteration.
How will you implement your own Binary Tree in Java?
There is a very big text file containing words? How would you read & process it to print the below output.
Print the top ten ranked distinct words.
Print the occurrence of the each alphabet in this file consider that the file can not fit into main memory of computer.
How will you design your custom Connection Pool in Java?
Explain Types of db indexes.
What is LRU Cache
What methods you override in java.lang.Object class
What is Hashing how to implement custom hashing?
Thursday, 26 September 2019
Accenture interview questions for 4 year experience
What is polymorphism
Explain system.out.println
How JVM works
How to manage outofmemoryerror
How to handle error in Java
What's is xMS and xmx in Java in case of 2 GB RAM
What is default heap size
Why segregation is there in error code of webservices
Which are required to handle
Difference between abstraction and interface
Why to use abs where to use Interface
What is DI
What is connection between di and interface
@autowired
How to connect to multiple database in hibernate
What is threadsafe in hibernate
How to handle exception
Try with resources closing
Where to use finally
How to map custom exception
What is index
Which Algo index uses
How does it works
Differ between primary key and unique key
How to check db performance
What is DI
How to configure Jenkins
Retrospective call in agile
How to manage a team
Project deployment cycle
Monday, 23 September 2019
Sunday, 22 September 2019
404 error accessing tomcat
what option you can use here is
Solution
Go to server configuration
Go to Server location and select
"Use Tomcat Installation" This should resolve you error.
Friday, 20 September 2019
SAS PUNE JAVA INTERVIEW QUESTIONS
2. What is aggregation, Inheritance and Composition give example?
3. What do you know about OOAD, SAS Analysis and BI tools?
4. What is a servlet?
5. What is Hibernate?
6. What is Spring?
7. Tell us about Spring Workflow?
Thursday, 19 September 2019
Integrating Java Web application with Maximo using Rest API Jersey
- Setup Jersey.
- Create an HTML page with workorder fields.
- Create a Submit button and call rest servlet.
- Pass those values collection from workorder fileds to servlet.
- Post the data to Maximo Rest Service.
Maximo Automation Script with Ldap
Steps:-
1. Define Ldap Attributes
2. Create a hashtable and put those attributes
3. Create a Context
4. Create a Search Control
5. Search using Context and Search Control
6. Loop through results and get required ldap attribute using criteria defined.
***************************************************************************
from javax.naming import *
from java.util import *
from javax.naming.directory import *
from psdi.mbo import SqlFormat
//Step 1
print "Starting Ldap querying from Maximo"
ldapurl="ldap:serverurl:port"
ldapuser="XXXX"
ldappassword="XXXX"
ldapbasedn="DC=something,DC=com"
//Step 2
ldaptable=Hashtable()
ldaptable.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory")
ldaptable.put(Context.PROVIDER_URL, ldapurl)
ldaptable.put(Context.SECURITY_AUTHENTICATION, "simple")
ldaptable.put(Context.SECURITY_PRINCIPAL,ldapuser)
ldaptable.put(Context.SECURITY_CREDENTIALS,ldappassword)
//Step 3
ctx =InitialDirContext(ldaptable) //Step4srch =SearchControls()
srch.setSearchScope(SearchControls.SUBTREE_SCOPE) //Step 6//To get email id of a person with person id Adam results=ctx.search(ldapbasedn,"Adam",srch) allattributes=results.getattributes() emailed=allattributes.get("emailed")
Tuesday, 17 September 2019
One Automation Script with Multiple Launch Point
1. For doing this create a autoscript and define a lauch point.
2. Create a new launchpoint and instead of new script use existing script.
Tips for automation scripts
2. Write script in some editor or ide like eclipse to notepad++.
3. Use preferred language as Jython.
4. Put print statement or alert while developing to see result.
export data using automation script
server=MXSERVER.getMXSERVER();
userinfo=mbo.getthisMboSet().getUserInfo();
Sunday, 15 September 2019
Saturday, 14 September 2019
Unix Script to check if the file exist or not in folder
{
count=`ls \home\myfolder | wc -l`
echo "count is "
echo "$count"
if test count -eq 0
then
echo "Folder is empty"
set err_msg = " FOLDER is empty..."
echo $err_msg
set sys_errs = "Y"
exit 1
else
echo "source folder is not empty folder"
fi
}
#**********************************************************************#
#** MAIN PROGRAM ******
#**********************************************************************
check_empty()
Sending Email via Unix Script
Friday, 13 September 2019
Getting Started with Spring JDBC
Getting Started with Spring Boot
Spring Framework Interview Questions
- What is Spring Framework?
- How Spring Framework inject Dependency?
- Why to inject dependency?
- What is IOC?
- What is difference between Bean factory container and ApplicationContext ?
- How to setup Spring Framework?
What is IOC Container
So all this happens in IOC Container.
Important IOC Container is ApplicationContext whose you we saw in Hello World Spring Framework Application.
Spring IOC container is very important as it will create object and configure them.
Types : 1. Bean Factory
2. Application Context Container
What is Spring Framework
Spring is an open source framework and inversion of control for Java Application.
Example
consider we have a pizza process for creating pizza
Class Pizza{
Pizza(){
……………….Steps for Making Pizza
}
}
Lets say we have OnlineRestaurantService{
CookService cs=new CookService(Pizza)
}
Here we are passing pizza dependency to CookService in OnlineRestuarantService class.
In future we can pass Hotdog service also in place of Pizza.
So this all can be done by Spring Framework.
How can we let CookService know to inject pizza as dependency or Hotdog as dependency.
Well using annotations
2 popular annotations are @component and @Autwired
@component tells manage OnlineRestuarantService dependency and @autowired tells you need to look for Pizza dependency for Cook Service.
We will see all annotations in our Annotation Library blog for Spring framework.
Spring Error Spring cannot find bean xml configuration file org.springframework.beans.factory.BeanDefinitionStoreException
Well what you could do is put your bean xml file outside your package since frameword is looking it inside package.
path
ApplicationContext context = new ClassPathXmlApplicationContext("src/main/resources/beans.xml");
Else give path inside package example
Thursday, 12 September 2019
Getting Started with Spring Framework
1. Spring framework.
2. Spring MVC
3. Spring Boot
Before beginning to what is Spring Framework we will learn what's the library to get all help from.
http://Spring.io it is a library where u can find all help documents, extensions related to spring.
What is Spring Framework?
Spring is an open source framework and inversion of control for Java Application.
Spring is dependency injection framework.
In an enterprise application many classes depend on many classes where we can take leverage using this framework by injecting this dependency.
How to setup Eclipse for Spring
1. Download Jdk 7 or 8.
2. Download Eclipse.
3. Download CommsApache jar https://commons.apache.org/logging/
4. Download Spring jars https://repo.spring.io/release/org/springframework/spring/5.0.0.RELEASE/
(download dist.zip)
5. Create a new Java Project and add CommsApache.jar and Spring jars.
Create Structure like below
Main class
package com.it.Hellow;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MainClass {
public static void main(String[] args) {
ApplicationContext apc=new ClassPathXmlApplicationContext("Bean.xml");
HelloWorld hellow=(HelloWorld)apc.getBean("hellowToWorld");
hellow.getMessage();
}
}
Hellow Class
package com.it.Hellow;
public class HelloWorld {
private String message;
public String getMessage() {
System.out.println(message);
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
Bean.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns = "http://www.springframework.org/schema/beans"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id = "hellowToWorld" class = "com.it.Hellow.HelloWorld">
<property name = "message" value = "Hello World by Anil"/>
</bean>
</beans>
Output on Running Main class as java application
What is happening here is your are creating a application context and passing it your bean xml name.
Then using that context your are telling what class to refer in that bean.xml using the ID defined in HellowWorld object. When Main class is loaded it pics up bean and supply message property with value Hello World by Anil and therefore prints o/p "hellow Wold by Anil".
What is bean
We can say its an object manage by Spring Framework.
What is Inversion of Control
It means we are giving control from class which needs dependency to Spring Framework.
Friday, 6 September 2019
Unix interview questions
2. What is kernet?
3. how to check logs?
4. What are shells?
5. What you can do if you lost root user's password?
Unix Script for Practice
2. Write a script to pass server details and folder structure and schedule it run daily and send data over FTP it should be generic and reusable.
3. Write a script to monitor cron table in Unix and update it at run time.
Unix Crontask every 5 minutes Unix crontask run every 30 Minutes Unix crontasak Every day
For Scheduling unix Crontask to run every 5 minutes
*/5 * * * *
For 3 Minutes
*/30 * * * *
Format
Minute Hour Day of Month Month Year
/ per
* is every
- is range of value
so
* * * * * Is every minute
For 12 Hour 5 minutes in August (12:05)
5 0 * 8 *
For
At 10:00 on every day-of-week from Monday through Saturday.
0 10 * * 1-6
Thursday, 5 September 2019
Checking logs in Linux
Linux logs can be viewed /VAR/LOG directory this contains plain text text files.
You can view logs using ls command.
You can also view logs via dmesg, which prints the kernel ring buffer. It prints everything and sends you to the end of the file. From there, you can use the command dmesg | less to scroll through the output.
Linux checking users information
The /etc/passwd file contains a list of all the system user accounts, along with some basic configuration information about each user.
Anil:Test@123:501:501:Anil Kumar:/home/anil:/bin/bash
Each entry has seven data fields, with each field separated by a colon. These fields are:
The username
The user's password
The user's system user ID number
The user's system group ID number
The user's full name
The user's default home directory
The user's default shell program
Tuesday, 3 September 2019
Hibernate error Initial SessionFactory creation failed.org.hibernate.HibernateException:
Initial SessionFactory creation failed.org.hibernate.HibernateException the issue is you are using an old way to configure the file and hibernate can't determine the dialect what you can do is use new way to resolve this.
Friday, 30 August 2019
Thursday, 29 August 2019
Copying file from One directory to Another in Unix
for file in \MyDrive\MyFolder\
do
echo $file
FILESIZE=$(stat -c%s $file)
echo "filesize " $FILESIZE
if [[ "$FILESIZE" -eq 0 ]]
then
echo "$file is empty.Hence not sending it.Can't Execute further"
exit 1
else
echo "$FILE has data."
fi
echo "Copying File "
cp $file $Other_Directory
}
#************Starting Copy File String#
copy_file
Find list of file names containing particular text
To find list of file names containing a particular text
FTP using Unix Shell Scripting
send_viaftp(){
ftp -ni $destination
verbose
user $username $password
cd $destinationfolder
ascii
put $myfile
}
#Copying file to server2
send_viaftp
Thursday, 22 August 2019
Getting started with Unix
this is the command used to make file executable
To execute File
./test.sh
Date used to get date
date
Creat a file
vi hello.sh
inser code
esc + I
Save code and quit
esc + :wq
if file is readonly use
:wq!
Give access to execute
chmod +x hello.sh or chmod 755 hello.sh
Execute Script
./Hello.sh
See what is the content of this file
cat Hello.sh
Exporting values in Unix for Variables
I have a script
echo " VAR VALUE IS $VAR1"
$VAR1="hello"
echo"NEW VAR VALUE IS $VAR1"
output
run using ./hello.sh
Var value is
New var value is hello
if you define $VAR in command prompt before running
$VAR = OLDHELLOW
It wont recognize this running ./hello and out put will be same
To make it global we need to export this value using
export VAR
To know your current location use
pwd
command.
Location for Java on Unix is
/usr/local/<java_Install>
To remove file preds.jar
rm preds.jar
To view Contents of Jar file
jar tvf Name_Of_JarFile