Month: April 2017

Interesting Ubuntu Commands

To find the file. Its alterantive is locate command.

find -iname <filename>

i means case-insensitive. It is an optional.

eog a.png

eog means eye of Gnome. It shows image.

pdftk in.pdf cat 1-endE output out.pd
sudo easy_install -U pip

To install pip.

libreoffice file.odt

To open odt file in libreoffice. We can also open docx file.

pandoc -f latex -t docx -o irc.docx irc.tex

It will convert tex file to docx. We can also convert tex file to odt. For it just replace docx with odt.

Testing Software- Selenium

Selenium is a software-testing framework for web-applications. It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including C#, Groovy, Java, Perl, PHP, Python, Ruby and Scala. The tests can then run against most modern web browsers. Selenium deploys on Windows, Linux, and OS X platforms.

It is a suite of software tools to automate web browsers. It is an open source and mainly used for functional testing and regression testing. It checks the functional(necessary) requirements of the web page.

Here, I am going to test the project “Certificate Generation System”. You can clone it from https://github.com/amisha2016/Certificates

Selenium Installation

For it, first install pip3 package.

pip3 install selenium

se1

The webdriver for Firefox is installed along with Selenium but if you want to test your applications on chrome then you need to download the chrome driver and ensure chrome is installed on your Linux distro.

sel.py file

#!/usr/bin/env python3
from selenium import webdriver
driver = webdriver.Chrome(“/home/amisha/Downloads/chromedriver”)
driver.get(“http://localhost/Certificate/CGS/index.php?cert=design4&#8221;)
assert “Academic Certificate” in driver.title
innn=driver.find_element_by_name(“in”)
innn.send_keys(“Selenium web test edit”)
asss=driver.find_element_by_name(“as”)
asss.send_keys(“Selenium web test edit”)
Submit=driver.find_element_by_value(“Submit”)
success=Submit.click()
assert “Institute Details Saved Succesfully!” in driver.h2

It is the python script which is used to test the page in the project. Similarly for your web-based project there would be a relevant script.

An assertion is a sanity(normal)-check that you can turn on or turn off when you are done with your testing of the program. If the result comes up false, an exception is raised.

Now, give the executable permissions to the python script

sudo chmod 755 sel.py

python3 sel.py

se7

se3se4se5

Correspondingly, you can do it for your own project.

Increase the Memory of Ubuntu Partition

Free/Unallocated Space

If you have not free space to extend the memory then shrink space from other partition. Below are the steps to do so.

  1. Open Gparted either from terminal or from dashboard.
  2. Right click on the partition you want to shrink.
  3. Click on Resize/Move and write the free space(in Mib) you want to unallocate.
  4. Click on Apply all operations (Tick button with a green color).

After this Start GParted in live Ubuntu session.

Also unmount (if they’re mounted) all the partitions that will be involved in the resize/move operation (by right clicking and selecting unmount from the context menu)

The partition you want to extend should be adjacent to the unallocated space. If not so, then we have move the in between partitions as was in my case.

gpar1.png

Here, I want to extend /dev/sda8 partition with 49.61 Gib unallocated space. But they are not adjacent to each other. So, I have to move the partition  /dev/sda6 to the left.

Right click on the partition /dev/sda6 and select move/Resize option. Drag the bar to the complete left.

(WARNING: moving /boot partition may cause boot failure!)

snapWarn

Click OK. You will able to see the progress. It might take an hour or more depending upon the number of operations and partition memory.

mov1

After the completion of a move the partitions was in the order as shown.

movv

Now, it’s time to extend the partition /dev/sda8 which was our main objective. So again right click and select Resize/Move option.

mov2

Extend the size of the window by expand it to left (in this case) and select Resize/Move.

In this case the partition will move to left as well grow.

mov5

mov6

Here, you can see the partition /dev/sda8 is increased by 49.61 Gib. Hope this blog would help you out.

For any queries or suggestions you may comment on this blog.

USB Bootable In Ubuntu

In my first blog, I explained how to bootable USB in windows through UUI. Today, I will discuss it in Ubuntu. Sounds interesting.;)

Search Start Up Disk Creater on dashboard and select it. It will pop up the window.

start.png

As shown in the figure you will be able to see the source disk image(.iso) or CD in your system. Select any one of them.

Then select the removable disk to be used to make it bootable.

Forward to click the option Make startup disk and you are done with it.

Format USB in Ubuntu

Format USB In Ubuntu

Search Disk on dashboard and select it. It will pop up the window.

Select the option of the disk you want to format.

Choose atleast 1 volume represented by it.

Select the gear(settings button popping for more actions) icon and click the option Format Partition.

format

You are done with it. Now you may safely eject your pendrive.:)