Skip to main content

Posts

installing perl dancer in ubuntu

For installing perl dancer you need curl utility for installing curl ,
sudo apt-get install curl

Now we can install Perl-Dancer by this command, type this command in terminal 

curl -L http://cpanmin.us | perl - --sudo Dancer2
Recent posts

creating first go program

for creating go program open your editor and paste this code, and save it as filename.go for example helloworld.go

package main import "fmt" func main() { fmt.Println("Hello, 世界") }
I will explain these codes in details for now , we will look how to run these code.

to run type go run helloworld.go  in terminal , we get


you can try golang online as well , golang

creating python django project

If you installed and configured python django you can create django project .

for that create a folder any where in you system and open you terminal navigate to that folder and type the django command django-admin startproject projectname  for example django-admin startproject firstdjangoproject


This command will create a folder firstdjangoproject        , navigate inside to the project folder . You can see file structure of django project

I will explain each of this files in detail for now lets run the application

for running the application need to type this command in your terminal

python manage.py runserver

Ignore the migration exception , we can see the application running at localhost port 8000, 8000 is the default port . Now open your web browser and type address http://127.0.0.1:8000 and you can see

if you see this your django application is up and running and you are good to go. press ctrl+c keys to stop the server.

python django installation on ubuntu

If you wish to install Django using the Ubuntu repositories, the process is very straight forward.
First, update your local package index with apt, and then install the python-django package: sudo apt-get update sudo apt-get install python-django You can test that the installation was successful by typing: django-admin --version If you wish to install the latest version of Django globally, a better option is to use pip, the Python package manager. First, we need to install the pip package manager. Refresh your apt package index: sudo apt-get update Now you can install pip. If you plan on using Python version 2, install using the following commands: sudo apt-get install python-pip Now that you have pip, we can easily install Django. If you are using Python 2, you can type: sudo pip install django
You can verify that the installation was successful by typing: django-admin --version 

xpath

It is very easy if you understood the funta behind XPATH . xpath is XML path , XPath is used to navigate through elements and attributes in an XML document . As i said earlier both HTML and XML follows DOM structure , so we can use xpath to navigate elements and attributes in an HTML.
<html> <body> <div class="1"> <div class="2"></div> <div class="1"></div> <div class="2"> <div class="1"> <a id="1">HI</a> <a id="2"> <h1>HI<h2> </a> </div> </div> <div class="3"></div> <div class="2"></div> </div> </body> </html>
we can visualize the above HTML code in DOM structure we get

In Document object Model (DOM) , document is the paren…

locating webelements using selenium

Record and playback is a Novice routine and I am not interested in it.
 Selenium provides several options to locate Web Elements such as (h1,p,div...) .

The attributes id,name,classname are used for identifying particular element inside html for example

<html> <body> <pid="para1">Hi</p> <inputtype=textareaname="text" > <pclass="para2">Hello</p> <pclass="para2">World</p> <aid="linkone">link1</a> </body> <html>
#para1 { color:blue; } .para2 { color:green; }
we are giving id to <p id="para1">  for identify the element in order to change the property of that element. if you are using css or javascript id cannot be repeated unlike class="para2" , class name can be repeated and name is the attribute of input . In selenium there are classes and methods to get these elements by passing this id,name and classname 

In…