Category Archives: Blog

Selenium Webdriver For Beginners.

What is Selenium WebDriver?

Selenium WebDriver is open source software testing tool which supports many different browsers. It is also supporting many different software programming languages like Python, Ruby, C#, Java, PHP and Perl so that you can create your test cases using your preferred language. Currently, the most popular language Is Java to prepare your software application automation test cases with selenium webdriver.

How to download selenium and install Selenium Webdriver with Eclipse and Java Step By Step?

Downloading selenium webdriver and installing selenium webdriver is easy. You need to download selenium jar files. Then configure downloaded selenium jar files in eclipse. Actually there is nothing to install except JDK. Let me describe you step by step the process of download, installation and configuration of web driver software and other required components.

Steps To Set-up and configure Selenium Webdriver With Eclipse and Java

Step 1 : Download and install Java in your system

First of all you need to install JDK (Java development kit) software in your system.

Step 2 : Download and install Eclipse in your system

Download Eclipse for Java Developers and extract “save it” in any drive. It is totally free. You can run ‘eclipse.exe’ directly so you do not need to install Eclipse in your system.



Step 3 : Download WebDriver Jar Files.
Selenium webdriver supports many languages and each language has its own client driver. Here we are configuring selenium 2 software with java so we need ‘webdriver Java client driver’.
Click here to go on WebDriver Java client driver download page for webdriver download file. On that page, click on ‘Download’ link of java client driver as shown in below image.

Download and install Selenium Java Client Driver

(language-specific client driver’s version is changing time to time so it may be different version when you will visit download page. )

Downloaded ‘webDriver Java client driver’ will be in zip format. Extract and save it in your system at path D:\selenium-2.33.0. There will be ‘libs’ folder, 2 jar files and change log in unzipped folder as shown in below figure. We will use all these files for configuring webdriver in eclipse.

 

 

Java client driver for webdriver

Step 4 : Start Eclipse and configure it with selenium 2 (webdriver)

  • Select WorkSpace on eclipse start up

Double click on ‘eclipse.exe’ to start eclipse software application. First time when you start eclipse software application, it will ask you to select your workspace where your work will be stored as shown in below image. Create new folder in D: drive with name ‘Webdriverwork’ and select it as your workspace. You can change it later on from ‘Switch Workspace’ under ‘file’ menu of eclipse.

Selecting workspace in eclipse

After selecting workspace folder, Eclipse will be open.

  • Create new project

Create new java project from File > New > Project > Java Project and give your project name ‘testproject’ as shown in below given figures. Click on finish button.

Create new webdriver project in eclipse

Create new java project in eclipse

Now your new created project ‘testproject’ will display in eclipse project explorer as below.

Webdriver project on project explorer

Create new package

Right click on project name ‘testproject’ and select New > Package. Give your package name = ‘mytestpack’ and click on finish button. It will add new package with name ‘mytestpack’ under project name ‘testproject’.

Creating new package in eclipse

Create New Class

Right click on package ‘mytestpack’ and select New > Class and set class name = ‘mytestclass’ and click on Finish button. It will add new class ‘mytestclass’ under package ‘mytestpack’.

Creating new class for webdriver

Now your Eclipse window will looks like below.

webdriver configuration with eclipse

Add external jar file to java build path

Now you need to add selenium webdriver’s jar files into java build path.

  • Right click on project ‘testproject’ > Select Properties > Select Java build path > Navigate to Libraries tab

  • Click on add external JARs button > select both .jar files from D:\selenium-2.33.0.

  • Click on add external JARs button > select all .jar files from D:\selenium-2.33.0\libs

Now your testproject’s properties dialogue will looks like below.

Adding webdriver external jar files in eclipse

 


That’s all about configuration of WebDriver software with eclipse. Now you are ready to write your test in eclipse and run it in WebDriver.

Upcoming Post:

>> Create And Run First Webdriver Script With Eclipse.

How to store mysql data in different drive

Some time we require to store mysql data in different drive or folder instead of default on.

To change the data storage location of mysql we need to following changes.

Step1:- Stop Mysql service. you can use /etc/init.d/mysql stop.

Step2:-Create a new folder where you want to store the data. eg new_data_folder.

Step3:- Change the user and group of this folder. chown -R mysql:mysql new_data_folder

Step4:- Copy existing data in new folder from default location(/var/lib/mysql/)

Update the data location in my.cnf file

/etc/apparmor.d/local/usr.sbin.mysqld:

/data/ r,
/data/** rwk,
…and then reload the AppArmor profiles:

# service apparmor reload

Zoho : Migration of data from one account to another in zoho crm

Migrating data from one Zoho crm account to other zoho crm account:

Supported modules: These are the supported module that can migrate from one account to other

      1. Users 
      2. Leads 
      3. Accounts
      4. Contacts
      5. Potentials
      6. Products
      7. Events
      8. Attachments
      9. Notes
      10. Calls

Import Sequence:  This is the sequence for importing data from one account to another

Leads => Account => Vendor => Contact => Potential => Product => Quotes => Invoices => Task => Events => Calls => Notes => Attachment

Note:- Quotes and Invoices can not directly imported.

Prerequisites: Before migrating data into Zoho CRM, please go through the following details

1.  Add accountCreate two accounts in your Zoho CRM

2. File format – All the files to be imported should be in CSV format. Any other format is not supported.

3. Date and Time format – The Date in the import file must be in yyyy-MM-dd format.

4. Update Mandatory Fields – Import file, we must have data for all the mandatory fields in Zoho CRM

 

 

Migrate Data

Follow the steps given below which assist you in migrating your data

Step 1.  Log in to Zoho CRM with Administrator privileges

Step 2. Click Setup > Data Administration > Migrate from Other CRM.

Step 3. In the Data Migration Wizard page, select the module that you want to import

Capture

Note: You need to import the records in the same sequence as it is listed in the drop-down.

 

Step 4. Click Next.

Step 5. In the Migrate Users page, browse and select the import file.

Capture1

Step 6. Click Next

 

 

Capture2

Step 7. In the Map Fields section, make sure that you map all the mandatory fields.
The field names that you would mention in the CSV file should be available in the drop down lists.

 

Step 8. Click Create Custom Fields if you want to add new fields during the migration and add data to them

 

Step 9. In the Create Custom Fields pop-up, do the following:

Capture2

All the fields that are not available in Zoho CRM and not mapped for migration will be listed, along with the column numbers in the import file.

 

Select the Field Type from the drop-down list. Auto number and Formula will not be listed. You cannot create these fields during migration.

Click Create.

The field will be created and mapped to the columns in the import file.

Click Close to go to the migration page and continue the migration process.

&nbsp

;

Step 10. Click Next to Import records.

When the migration is complete an email is sent to the user (administrator) who imported the records.

In the same way we can migrate Account Data, Vendor Data, Contact data, Potential Data and Product data.

 

Important Note: While migrating quotes and invoices data from one account to other, we could not directly migrate. For this purpose we use some API to migrate quotes and invoices data from one account to other.

Migrate Quotes/Invoices data: We can migrate quotes/invoices data through API.

With  API(API written in any language) we can easily push or pull data into or from Zoho crm accounts and corresponding modules.

API allows you to:

Add record into Quotes in Zoho Crm

Modify record in the Quotes of  Zoho Crm

Challenges faced while migrating quotes/Invoices data from one account to other:

1. While migrating quotes/invoices data from one account to other the inline item field(i.e Product details) is blank

We handled this challenge with the help of API.

2. While migrating quotes/invoices data from one account to other, If API disconnected in the middle

We handled this challenge with the help of logging.

3. While migrating quotes/invoices data from one account to other, data doesn’t migrated from 1st account into 2nd.

We handled this challenge with the help of logging.

4. Notes/Comments/Activity data from one account to other

We handled this challenge with the help API and DataBase.

5. While migrating records of quotes/invoices module from one account to other in zoho crm Attachment in a quote is unavailable

This is handled by API and store old and new attachment id for error handling.

Python’s framework, a comparative view.

If we talk about frameworks of python, we will be discussing only three
frameworks.

  1. Pyramid
  2. Flask
  3. Django

Introduction to frameworks

Django have “Batteries
included” feature, “Batteries included means” this framework includes
all basic tools included within the framework.

Django has templating, forms, routing, authentication, basic
database administration and many more. Django’s first release was in
2006. Pyramid includes routing and authentication, but templating
and requires external libraries for database administration. Pyramid
is actually an enhancement of 
Pylon project, which
was introduced in 2005 and eventually it is named “
Pyramid“. Flask is
“micro framework” primarily aimed for the simpler applications.
Flask is the youngest framework of python, started in the middle of
2010.

 

Pyramid is best for:-

  • Developers
    working on API projects

  • Prototyping
    a concept
  • Developing
    large web applications, such as a CMS

Flask is best for:-

  • Developers
    who care about best practices

  • Developers
    who want to prototype something quickly
  • Developers
    who need a standalone app

 

Django is best for:-

  • Developers
    who aim to include all the batteries a web application will need.

  • Developers
    who wants to use ORM, templating, routing, authentication, database
    administration and bootstrapping on the go

Bootstrapping

Django and Pyramid both frameworks
have the bootstrapping tools, the bootstrapping tool means we don’t
need to write codes of views, models and controllers. Using
bootstrapping tools makes easier to generate the skeleton of the
project. 
Flask‘s
target audience is not trying to build large 
MVC application.
Pyramid uses “pcreate” to for bootstrapping and Django uses
“django-admin” for templating

ORM (Object
relational mapping)

According
to Wikipedia ORM, is programming technique to convert the
incompatible type system in 
object oriented
programming
 language.
Django and Pyramid both supports ORM, because of using ORM we don’t
need to fight with the queries to get the data as object in our
code. ORM is not supported by Flask.

Community

On stackoverflow there
are 85.6k questions asked in connection with 
Django and
12k followers
. 
If we talk about 
Pyramid the number
of questions asked are only 1.4k and 471 followers. If you talk
about Flask the number of question asked are 6.1k and 1.7k follower
of this framework. The number of questions and number of followers
shows the popularity of the framework and number of users who use
these frameworks.

Summary

According
to Ryan Brown one of the blogger says, after comparing these three
frameworks that “
Pyramid
is the most flexible of the three

it can be used for small application as well as for big applications
like 
Dropbox.
One of the most common complaints is that there are so many options
available with the pyramid to start a new project. Django is the
most popular framework of Python. List of sites that uses Django
is quite big like Pinterest, Instagram and Bit bucket. Flask is
great for Developers who want to develop small and very fast
development of websites on python platform.

Zoho Crm: How to convert a Lead into a Potential using Custom function

Lead To Potential Conversion

Objective is to convert Lead to Potential in Zoho CRM. Here our key module is Lead. A workflow must be created in order to convert a Lead to a Potential.

workflow

Login your account -> Setup -> Automation -> Workflow -> Create Rule

 

We should follow below steps for creating a Rule.

Step1:- Enter Basic Information

Module Field: We should choose Lead as an option here since we have to convert Lead to Potentials

Rule Name: User can type in any name of their choice

Status: Click “Is active” if you wish to activate the created rule

Description: Description of your choice.

Kindly refer to following visual.

Module Name

Leads

Rule Name

leadtopotentialconversion

Status

Active

Description

leads to potential conversion based on field action

Basic information

Step 2:- Rule Trigger

Rule Trigger option deals with the execution of workflow on following conditions.

  1. On Record action

  2. A Date field value

Rule trigger

On Record Action:- It has different options which are related to an action performed on the key module i.e. “Leads” in our case. Possible options are: execute the workflow when a new record is created, existing record is edited, record is deleted, field updated under LEADS Module. Below is the visual for the same

recordaction

A Date field value:-  This rule is triggered based on date field selected, which are present on the Lead form. Upon selecting a date field, it further provides options like date of execution, time of execution, execution cycle

datefieldvalue

choose condition in execute based on option

Execute to based on

On Record action

A Date field Value

Step 3:-Rule Criteria

This step specifies that rule will be executed on the specified date and time for those Leads that match the following rule criteria.

It has three columns i.e. Field, condition, text box

Field: It contains all the fields of Lead module

Condition: It contains conditions like is, isn’t, contains, doesn’t contain, contains user

Text Box: Whatever selected from first two columns, appropriate results will be populated in to this column. If not selected automatically, can be entered manually as well.

Here is the visual.

rulecrieteria

Field Name

Conditions

Field Value

 

Step 4:- Action

Action has different options under it.  In our case we’ve used custom function to map Lead fields to Potential fields using Delgue Script.

Following actions can be performed

Send Alert

Send Alert Message Through Email Template

Assign Task

Assign Task

Update Field

Action execute on particular fields are updated in corresponding module

Call Custom Function

We can call a custom function for a conversion and this function is written in Delgue Script

action

Time Based Action

It is applicable for time based actions only. User can create their own time based action

time

How to write Custom Function For Leads To Potentials Conversion?

Please follow these steps for writing a custom function which can be used to convert Leads to Potential

Call custom function(0)->Write your own

Step 1:- Write Function Name and click on EDIT for entering argument. Take lead Id as an argument.

Step 2:- Convert Lead Id into String using toString() function

Step 3:-Use searchRecordsByPDC function for searching leads using Lead Id

Step 4:-Create a map function and store it in a state variable

Step 5:-Use “foreach element as element loop”

Step 6:-Use Put key in Maplist to map Potential Fields with Lead Fields. Put key is used inside the loop

Step 7:-Use zoho.crm.create function to create a potential

functionpart1.1

function1.2

function 1.3

Advanced Analytics Synchronization with Zoho Reports

Zoho Reports is an excellent feature for individuals & businesses for generating reports on the views defined by them within Zoho CRM. Have you ever tried to synchronize any default module other than  Accounts, Activity, Contacts, Potentials, Leads, Users? Actually Zoho does not provide synchronization support for other default modules as of now but Zoho is planning to release the synchronization support for other modules like Quotes, Demos, etc very soon.

Question is how to get the data of remaining default modules to Zoho Reports?

We have only left with the option of manual operation of exporting the data from Zoho CRM and importing it into Zoho Reports. Additionally, you may create custom modules within Zoho CRM and synchronize the data with Zoho Reports.

Useful MySql Commands and Tricks

GROUP_CONCAT

This function returns a string result with the concatenated non-null values from a group. It returns null if there are no non-null values.

Some time we need comma separate values of a group. For example we need to show the details of a department and name of employees. In this case can simply use GROUP_CONCAT(“employee_name”) with “left join” and “group by department_id” query.

Sample Query:

select d.*, GROUP_CONCAT(“e.employee_name”) as employee_list from department as d left join employee as e on d.department_id = e.department_id group by d.department_id

CASE

The return type of a CASE expression is the compatible aggregated type of all return values, but also depends on the context in which it is used. If used in a string context, the result is returned as a string. If used in a numeric context, the result is returned as a decimal, real, or integer value

EXPLAIN

The EXPLAIN statement can be used to obtain information about how MySQL executes a statement. It is very user at the time of query optimization. EXPLAIN provides additional information and estimates the number of table rows that are filtered by the condition.

EXPLAIN select d.*, GROUP_CONCAT(“e.employee_name”) as employee_list from department as d left join employee as e on d.department_id = e.department_id group by d.department_id

Host A PHP website at Amazon web service using EC2

There are few basic steps to host your PHP(Dynamic) website using EC2.

Login on AWS Management Console.
Go to EC2 Tab and Launch a Instance and choose size according to you requirement.
After that you need to allocate a new Address under Elastic IP.
Associate this IP address with your instance.
Now you can access your server(instance) usng this IP from browser. You need to add a security rule under “Security Groups tab”
For this choose you security group and add a HTTP rule under Inbound Tab.
Now you can login at you server(Instance).
For login you need to create a key Pair and it will give you a .pem file. Using this file you can login at your server.Use following command to login “ssh -i filename.pem ec2-user@Public DNS address”
Now you can setup your server as a normal server. Install webserver and language any else according to your requirement.

Selecting the Right Mysql Engine

When You designing MySQL based applications, You should decide which engine to use for storing your data. If you don’t think about it during the design phase, you are likely to face complications later in the process.

MyISAM, InnoDB, BDB and HEAP are the most common and popular storage engines. All have some advantages and disadvantages. HEAP is an in-memory storage engine,so we will primarily focus on MyISAM, InnoDB and BDB storage engines.

  • Transactions and Concurrency:- If your application requires transactions and high read/write concurrency, InnoDB is probably your best bet. If your application only need moderate read/write concurrency then BDB might also work for you.
  • If your application depends upon accurate and fast row counts then you can use MyISAM. InnoDB have to count all the rows but MyISAM always knows exact count without re-counting.
  • Only MyISAM tables provide full text functionality.
  • If your tables primarily used for read operations then MyISAM is the most suitable choice. It works most efficiently in that scenario.
  • Locking in MyISAM tables is performed at the table level but InnoDB uses row-level locking in conjunction with a multi-versioning scheme. BDB tables use page level locaking on 8 KB pages. InnoDB uses row-level locking so it gives better performance for high number of insert/update queries. However if your table is generally used for read(select queries) then MyISAM works great as InnoDB’s row-level locking adds some extra overhead.
  • Non-MyISAM tables will generally use more CPU and disk space.
  • MyISAM tables may take a long time to check and repair while InnoDB tables generally recover quickly.
  • Only InnoDB provides foreign key constraints other storage engines do not provide this functionlity.
  • BLOB and TEXT columns in MyISAM table can be indexed. MyISAM tables have a limit of 500 bytes on each key, so the index uses only the first few hundred byte of BLOB or TEXT field. InnoDB also provides lightning fast results for queries that use primary key(s) for look-up.

What is the indexing?

What is mysql indexing? To understand this let’s take a very simple example from real life. A phone book has thousands of phone numbers, and we want to search John’s number. Then we simply go to the page where “J” is first character. After that we check the second character and third and so on. By this process the number can be found in short period. Now that if the number would not have been sorted, then every record/name was needed to be checked and then it will become an lengthy and time consuming process. Indexing also works on same principle.

Now the second point that comes in mind is that why we don’t index all the columns of a mysql table? There are two main reasons for this. First is, It will require extra space to store data of indexes. Second and very important reason is that, it will slow down the insert/update queries as every insert and update query will also need to update the indexes thus adds up extra overhead.

Indexes require a lot of space for performance. A phone book table having 2 billion rows in it, adding an index on name will require a lot of space. If the average name is 8 byte long, mysql need 16 GB space for indexes. Luckily mysql provides full control on indexes. We can index only first 4 byte instead of full index. This is called as partial indexing.

“Alter table phone_book add index(name(4))”

Mysql also provides multiple column indexes. It is very helpful when we can use two or more columns into same query. For example firstname and lastname for phonebook. Multiple column indexing are also referred as composite indexing or compound indexing. Why don’t use separate indexing on firstname and lastname? There is a very simple reason to this. Mysql will ever use only one index per table per query. So in case of separate indexing mysql either uses indexing of firstname or of lastname.

Mysql indexes aren’t always used to locate matching rows for query. We can also use them as constraints. For example unique indexes. Unique indexes ensure that each value of a column appears only once.

With MYISAM tables, the indexes are kept in a completely separate file that contains a list of primary key and a value that represents the byte offset for the record with clustered indexes the primary key and the records are all stored in primary key order. When your data is almost frequently searched via its primary key, clustered indexes make lookups incredibly fast.