Showing posts with label SPD - (210). Show all posts
Showing posts with label SPD - (210). Show all posts

Wednesday, March 16, 2011

Stepping to the next level of Perl Programming

From my previous post I told you how to start Perl programming on windows. After being familiar with the syntax of Perl, all what you need is a good IDE where you could write the programs, run and easily get the output while being in the same place.

One of the IDEs I found convenient to use is the 'Eclipse' IDE. It is originally developed for java development, but by downloading and installing the Perl extension for Eclipse, you can use it for Perl programming.The following video describes how to download the IDE and how to configure it for Perl.

To master Perl Programming, you can refer books written on Perl development, but my recommendation is Lynda 's Video tutorials series. You can download the Lynda.com Perl 5 Essentials video series free.

This is the link where I downloaded it from. If the link doesn't work, just search in google for 'Lynda.com Perl rapidshare, hotfile, megaupload'. There are plenty of download links available.

-Tharindu Edirisinghe-
-SLIIT 10'-

Wednesday, March 9, 2011

Starting Perl Programming on Windows

We learn Perl Programming for "Systems Programming and Design" subject. Since most of the students are using Windows as the main operating system and use Linux operating systems installed as virtual PCs on windows, I thought of writing this post and show you how to install Perl on windows and start Perl programming.

All the major Linux operating systems are coming with Perl installed but on windows, you have to manually install Perl. First go to the Command Prompt and check whether your Windows operating system is already having a Perl installation. To check that type 'perl -version' or 'perl -v' and press Enter. If Perl is already installed it will show information about the installation. If not it will give an error message.

You can download Perl from http://www.activestate.com/ website.The size of the setup file will be around 25 MB so don't worry. Download the correct setup according to your Windows operating system.
After that install it. When you are installing it will ask you whether to update the PATH variable. Tick that and continue installation so that you don't need to update the PATH manually to run your Perl programs.
Once you have installed, go to Command Prompt and check whether it is installed correctly. Type 'perl -v' and you will get the information about the version. Now we have successfully installed Perl.

How to start Perl Programming ?

To write your Perl programs, you need a text editor. You can use the Notepad but my opinion is it is not good when you wish to do some serious programming because it doesn't highlight the syntax. I recommend 'Notepad++' which is a free software. You can download it from http://notepad-plus-plus.org/download . Download it and install.

Then create a new file in Notepad++ and before writing your program, save it with .pl extension. For the file type, select 'Perl Source File (.pl.....)'. Now type your first program and save it.

printf("Hello world ! \n");
printf("This is my first Perl Program \n");

Open the command prompt and change your current directory to the location where your Perl program is saved. Now type 
'perl filename.pl' and you will get the output as below.

Hello world !
This is my first Perl Program

P.S - From my next post I'll tell you how to master Perl Programming on your own.

-Tharindu Edirisinghe-
-SLIIT 10'-

Monday, February 7, 2011

C++ inside a Shell Script !!!

From my previous post I told you that I was learning Shell Programming. Once I got familiar with Shell Scripting, I got to know that the commands we type in the terminal can also be executed from shell scripts if we include the command within the grave operators.
eg: In Terminal = date
     In shell script = echo `date`

Suddenly I got an idea. If I write a C++ program and give the run command from a shell script, when I execute the shell script, the C++ program also should work.

I took a new file (a.cpp) and wrote the C++ program in that. 
eg:  vi  a.cpp

 I compiled the C++ program and executed it.

 
Then I wrote my shell script in myscript.sh file
eg:  vi  myscript.sh
I gave the full path of my C++ program so that the location where the Shell Script is saved does not matter when executing the C++ program.

 
It really worked !!!

P.S - At the moment I have completed 120 pages from that ebook

-Tharindu Edirisinghe-
-SLIIT 10'-

Saturday, February 5, 2011

How to master Unix Shell Programming ?

For the 'Systems Programming and Design' subject at SLIIT, we have to learn Unix Shell Programming. Normally I like programming stuff, but from the beginning of this SPD subject I had no interest in learning that. Day by day the content I had to study increased. I had to find a solution to improve my interest towards learning this subject. 

What I realized was that I didn't like Shell Programming not because of anything, just because I was not familiar with Unix environment. Other than programming, it needs to have an understanding of the Unix platform and what its capabilities are. We use Fedora to do the shell programming so first thing I did was trying to find what these Unix, Linux and Shell Programming are. 


So I browsed internet and found that the movie 'Revolution OS' was something related to Unix and Linux. So I downloaded the movie and watched it. Since it was a documentary movie on the development of the Operating System Linux, I found it boring. Somehow I watched the whole movie and it gave me an understanding of Unix and its capabilities and usage. 

Then I tried to find a way to learn Shell Programming. I downloaded the Shell Scripting learning videos (Sinhala medium) from Kuppiya
After watching those video tutorials, I got a basic knowledge in Shell Programming and I understood that more than Programming, I should learn about the Unix Environment. Then I went to the library at SLIIT and found a book which is really helpful to understand Unix and Shell Programming. That is 'Unix Shell Programming by Yashavant P. Kanetkar'. 
After putting some effort, I could download the ebook also from the internet. For the last two days I was reading this book and doing the practicals. At the moment I write this post, I'm doing the exercises in the 95th page of this book. This book is really amazing. This is the first time I'm going to read a book completely and learn it. The author has clearly described the environment, giving simple to complex examples. Now I have gained the confidence and I have improved my interest towards SPD subject. I hope to get good results  for this subject from the upcoming Mid exams at SLIIT.

P.S - Nothing is impossible to learn. All what you have to do is to improve your interest towards what you are going to learn.

-Tharindu Edirisinghe-
-SLIIT 10'-

Friday, January 28, 2011

How in install Fedora on Windows, using Virtual Box

If you have not yet installed Virtual Box, first install it. You can download it from Oracle website free.

Run the virtual box and you will get the above window. Click on 'New'. Then you'll get the following window.
Click 'Next'.

Give a name for your virtual machine and select the operating system type and version. Then press 'Next'. 
Allocate memory according to your RAM. It is best if you can allocate more than 500 MB to support the GUI. Then press 'Next'.
select 'Create new hard disk' and tick 'Boot Hard Disk' Then press 'Next'.
Again press 'Next'.
Select an option according to your requirements. I select 'Dynamically expanding storage' so that if the initial capacity of the virtual hard disk exceeds by the time, it will expand the storage. Then press 'Next'.
Give the the location to be stored and the size of the virtual hard disk. It is best to allocate more than 5 GB. Then press 'Next'. 
Press 'Finish' in the next window.
Press 'Finish' again.

Click on 'Settings' when the virtual machine details window opens. Then you get the following window.
Select 'Storage' and click on the 'CD/DVD' icon. Then in the right hand side, select the CD/DVD drive. If you are installing Fedora using a CD or DVD, select that drive. If you have a .iso image you can mount it to a virtual CD/DVD drive using an image manipulating software like Power ISO . You can also browse and give the path to the Fedora image. Then press 'OK'. 

If you are going to browse and give the path to the Fedora image, you will get the following window. Press 'Add' button.
Browse and give the path. Then press 'Select'.

Then the settings window appears again. Now select the Fedora image in 'CD/DVD Device'. Then press 'OK'.

Now your virtual machine starts.
Now the installation process will begin. Select 'Install system with basic video driver' and press 'Enter'.
Select 'OK' and press 'Enter' in the next window.
Select 'Test' and press Enter.
Then the media checking will begin and verify the installation media.
Select 'OK' and press Enter.
Select 'Continue' and press Enter in the next window.
Then the GUI of Fedora will appear. Press 'Next'.
Select language to be used during the installation process and press 'Next'.
Select the language for the key board and click on 'Next'.
If a warning appears, click on 'Re-initialize drive'.
Give a name for your computer and press 'Next'.
Select your time zone and press 'Next'.
Give the password for root and press 'Next'.
Click on 'Next' again.
If it gives a warning, click on 'Write changes to disk'.
Tick the options as the below image shows and press 'Next'.
Then it will begin installing the packages.
After all the packages are installed, the below window appears. Press 'Reboot'.
Now if it again starts the installation process, that means it is booted using the CD/DVD drive. Turn the virtual machine off and remove the CD/DVD. If you mounted the image, unmount it. If you browsed and gave the path to image, clear the path. Then turn on the virtual machine. Now it will start booting from the virtual hard disk. 

Select 'Forward' in the next two windows.
Create the user profile and press 'Forward'.
 Set the date and time and press 'Forward'.
 Then it will show the hardware profile. Select 'Do not send profile' and press 'Finish'.
 If a message box appears, click on 'No, do not send'.
 Login using your user profile password. 
Now you have successfully installed Fedora.
Use Right 'Ctrl' button to take the mouse pointer out of the virtual machine when you want to. 

-Tharindu Edirisinghe-
-SLIIT 10'-