pradeepkumar.org on Facebook

Subscribe by Email

Enter your email address:

Delivered by FeedBurner

Installing WAMP (Windows, Apache, MySQL, PHP)

  1. Download WAMP from the following link. http://www.wampserver.com/en/ 
  2. It is an .exe file, simply double click it and give the path as C:/wamp or whatever directory you want,give it.
  3. Once installation is successful, an icon will be appearing at the bottom right task bar like this icon
  4. Click the icon, a menu will be opened, click “put online” (this is to enable access to apache to other machines), if your ip address is 192.167.3.4, then any other machine which is connected in your network will give this ip address to use wampserver
  5. Once you click the icon as specfied in Step 3, you will get the following menu wamo
  6. localhost –> to display the homepage of the wampserver
  7. phpMyAdmin –> it is to manage the MySQL through a GUI, you can create databases, tables within databases, update, insert, etc
  8. www directory is the place where you can put all your web application files. if your entire application is residing in a folder called as “pradeep”, then copy the pradeep/ to the www/ and the path to the pradeep/ is http://localhost/pradeep
  9. Apache – to configure apache (like change of port address, server path change, etc)
  10. PHP –> to configure PHP
  11. MySQL –> to configure and work with MySQL in command mode.
  12. http://localhost/ will display the following page
  13. wamp1
  14. http://localhost/moodle will display the following page
  15. MOODLE

E learning tools

There are various tools available for providing the lecture notes as content, video lectures, audio lectures, etc. Some of the tools are open source and some are paid tools. Its up to an individual to select the tool either as open source or paid source.

This post list some of the tools that are needed for Elearning:

Moodle 

Name: Modular Object Oriented Distributed Learning Environment

Software’s used: PHP, MySQL4.1

For deplolying moodle in any environment, need for a web server is mandatory. Better Apache server can be used.

There are packages like WAMP (windows, Apache, MySQL and PHP) – This is for windows

and LAMP (Linux, Apache, MySQL, PHP) for Linux Operating System.

Moodle can be configured for the following apps

Scalable upto 50000 students of a University

Online Quiz Examination (Objective as well Descriptive)

Students Attendance Management System

Course Management

Drupal

Drupal is the very efficient tool for Content Management System (CMS). Drupal is a general purpose Content Management System which can be configured as elearning package with the help of various modules provided by the drupal software

Versions: Drupal 5, Drupal 6 and Drupal 7 (alpha) – Drupal 6 is used widely.

Software’s used: PHP, MySQL

Again here also WAMP or LAMP may be used to install Drupal.

Drupal can be configured for the following apps

Lecture notes posting on a regular basis

Student Assignment Submission

Student Project Management

Wordpress

Wordpress is the famous blogging platform for providing lecture notes on a regular basis and posted under various titles (tags).

Wordpress is given as a software package of not more than 2.5 MB, which will be installed on a web server particularly apache (WAMP or LAMP)

Software’s used: PHP, MySQL

The lecture notes can be posted on a regular basis (daily or weekly) and even the administrator of a domain can invite other authors to register and post.

The learners can able to read the notes(posts) and if any doubts, they can able to post queries in the commenting section which is also provided as part of the wordpress software.

Wordpress can be configured for the following

Lecture notes posting

Solving doubts through Commenting Section

Easily post the Audio/Video lectures

and not only the above the list goes on and on.

(NB: All the softwares above are free and open source. you can cusotmize as per your use and redistribute it)

Inserting FLV Files (Flash Videos) in Wordpress

For people who host their blog using CMS such as Wordpress, you’ll need a plugin and a Flash Media Player, so that people can play videos within the blog post.A Plugin called wordtube is available as a plugin in wordpress
and it is the open source JW FLV Media player.

Step 1: Download the wordtube.zip from the link http://wordpress.org/extend/plugins/wordtube, uncompress the fi les on your computer, and you will receive a folder named ‘wordtube’. Do not rename it. Upload the wordtube folder into the plugins folder (/wp-content/plugins/) of your blog using an FTP program.

Step 2: Download mediaplayer.zip from http://www.longtailvideo.com/players/ jw-fl v-player/, uncompress it, rename the file player.swf to mediaplayer.swf and upload it into to the wordtube folder of your blog.

Step 3: Login to enter the admin area, activate the wordtube plugin from the list, and then go to Settings | Wordtube to configure the plugin. Go to Media | WordTube, and you’ll land on a page that says ‘Manage Media files’.
From here, upload a fl ash video.

Step 4: Now create a post or open an existing one if you want to use the video therein. Before previewing the post and video, enter a tag [ media id= ‘id’] in the content box and at the desired location inside the post. In this tag, replace ‘id’ with the number of the video reflecting in the Media Center. Also, add the playlist tag as listed therein. Finally, hit the ‘preview post’ button to see how the video plays, when published.

Source: December 2009, Chip Magazine

Protected: RTS Marks – (Password Protected)

This post is password protected. To view it please enter your password below:


How to write a Makefile

Assume there are more number of source files to be compiled using a set of commands everytime is a tedious process. So there is a facility to compile everything at a stretch is by the use of a Makefile.

The makefile can be named as either “Makefile” or “makefile”.

Let me define four files for my simple application, create a new directory and store all the files given below

  • main.c  (which contains the main program)
  • sum.c (summing function is defined)
  • hello.c (print hello world)
  • function.h (function prototypes are declared)

You can download all the files here

//function.h

int sum(int,int);
void print_hello();

//hello.c

#include <stdio.h>
#include “function.h”
void print_hello()
{
printf(“Hello World \n”);
}

//sum.c

#include “function.h”
int sum(int a, int b)
{
int c;
c=a+b;
return c;
}

//main.c

#include <stdio.h>
#include “function.h”
int main()
{
int a=10,b=20,c;
print_hello();
c=sum(a,b);
printf(“The sum of two numbers is %d “,c);
return 0;
}

There are different methods of compiling this file

Method 1: (gcc command based)

gcc main.c sum.c hello.c –o pradeep

once you execute the above command, an executable named pradeep is created and you can see the output by typing ./pradeep

Method 2: using Makefile

The basic makefile is composed of:

This syntax applied to example would look like:

target: dependencies

[tab] system command

all:

gcc main.c sum.c hello.c –o pradeep

to run this make file(the file name should be Makefile or makefile), execute the command

make

Method 3: using Makefile with dependencies

There may be a chance of using different targets in your makefile, this is because if you modify a single file in your project, you don’t have to recompile everything, only what you modified.
Here is an example

all: pradeep

hello: main.o sum.o hello.o
gcc main.o sum.o hello.o -o hello

main.o: main.c
gcc –c main.c

sum.o: sum.c
gcc –c sum.c

hello.o: hello.c
gcc –c hello.c

Method 4: using variables

CC=gcc
CFLAGS=-c -Wall

all: hello

hello: main.o sum.o hello.o
$(CC) main.o sum.o hello.o -o hello

main.o: main.c
$(CC) $(CFLAGS) main.c

sum.o: sum.c
$(CC) $(CFLAGS) sum.c

hello.o: hello.c
$(CC) $(CFLAGS) hello.c

Method 5:

With this brief introduction to Makefiles, you can create some very sophisticated mechanism for compiling your projects.

CC=gcc
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=main.c hello.c sum.c
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello

all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@

.c.o:
$(CC) $(CFLAGS) $< -o $@

If you understand this last example, you could adapt it to your own personal projects changing only 2 lines, no matter how many additional files you have !!!.

Thanks to:http://mrbook.org/tutorials/make/

The above examples is tested only on linux and Windows also supports make utility (through nmake utility), the readers are advised to work on their own in Windows. the following link will show you the way to nmake utility

http://msdn.microsoft.com/en-us/library/dd9y37ha(VS.71).aspx

Workshop on Effective E-learning tools and Techniques

The School of Computing Science and Engineering (SCSE) of VIT University is planning  to conduct a workshop on “Effective E-learning Tools and Techniques” on 20th March 2010.

click the link for further details: E-LEARNING WORKSHOP

TCS Presentation Files

Module 1 – Software Development Process

Installing OMNET ++ in Fedora 10

Download Omnetpp from the following website

http://www.omnetpp.org/omnetpp/doc_details/2198-omnet-40p1-source–ide-tgz

untar it using the command

tar zxvf omnetXXXX.tgz (I have installed in /home/pradeepkumar/)

open terminal -> go to the folder using –> cd /home/pradeepkumar/omnet-xxx/

Execute the following commands

./configure (if any errors, then install the required packages)

it may ask for tcl/tk developement package

yum install tcl-devel tk-devel

if installed, then execute

make (thats it!!!)

(NB: you need to have Java installed on your machine for installing Omnet++)

Save Tiger – Save Mankind (there are just 1411 tigers)

save-tigers

Saving the tiger means saving mankind..
Not only is tiger a beautiful animal but it is also the indicator of the forest’s health. Saving the tiger means we save the forest since tiger cannot live in places where trees have vanished and in turn secure food and water for all.
If we make sure tigers live, we have to make sure that deer, antelope and all other animals that the tiger eats (its prey base) live. To make sure that these herbivores live, we must make sure that all the trees, grass and other plants that these prey animals need for food are protected. In this way, the whole forest gets saved! Saving the tiger means saving its entire forest kingdom with all the other animals in it.
Also forests catch and help store rainwater and protect soils. In this way we protect our rivers and recharge groundwater sources. Areas with less trees lead to floods, killing people and destroying homes. It takes away the precious soil, leaving behind a wasteland. The soil jams up our lakes and dams, reducing their ability to store water. By destroying the tiger’s home, we not only harm tigers, but also ourselves.
The tiger thus becomes the symbol for the protection of all species on our earth since it is at the top of the foodchain. This is why we sometimes call the tiger, an apex predator, an indicator of our ecosystem’s health

spread_the_word_banner

Implementing a new system call in Kernel version 2.6.32

A system call is used by application or user programs to request service from the operating systems. Since the user programs does not have direct access to the kernel whereas the OS has the direct access. OS can access the hardware through system calls only.

The following files has to be modified for implementing a system call

  1. /usr/src/linux-2.6.32.5/arch/x86/kernel/syscall_table_32.S
  2. /usr/src/linux-2.6.32.5/arch/x86/include/asm/unistd_32.h
  3. /usr/src/linux-2.6.32.5/include/linux/syscalls.h
  4. /usr/src/linux-2.6.32.5/Makefile

New set of files to be created

  1. Create a new directory newcall/ inside the path “/usr/src/linux-2.6.32.5/
  2. Create new files Makefile, newcall.c and put them in the /usr/src/linux-2.6.32.5/newcall/ folder
  3. Create new user files (in any folder of Linux) to test the system call
    testnewcall.c, testnewcall.h (created in /home/pradeepkumar)

syscall_table_32.S

Find the file /usr/src/linux-2.6.32.5/arch/x86/kernel/syscall_table_32.S and add the following line at the end
".long sys_newcall"  (add without double quotes, but the preceding . should)

unistd_32.h
open the file /usr/src/linux-2.6.32.5/arch/x86/include/asm/unistd_32.h
(all the system calls will be defined in this file using #define macro)

This file contains the system call number that is passed to the kernel through the register (EAX) when a system call is invoked.

Add "#define __NR_mycall <Last_System_Call_Num + 1>" at the end of the list.
If the last system call defined here is:
"#define __NR_vmsplice   336", then add:
"#define __NR_newcall   337" at the end of the list. (337 is the new system call number)

two

Increment the "NR_syscalls" by 1. So, if NR_syscalls is defined as:
"#define NR_syscalls 337", then change it to:
"#define NR_syscalls 338"  (Since we added a new kernel, so the total number of system calls should be incremented)

one

syscalls.h
open the file /usr/src/linux-2.6.32.5/include/linux/syscalls.h
Add the following line at the end of the file:
"asmlinkage long sys_newcall(int i);"  (without double quotes)

Makefile
Full path of the file – /usr/src/linux-2.6.32.5/Makefile
Create a new directory newcall/ under the folder /usr/src/linux-2.6.32.5
and include that path to /usr/src/linux-2.6.32.5/Makefile

open the /usr/src/linux-2.6.32.5/Makefile
and find the "core-y += " and append newcall/ to the path (please see the image below)

three

newcall.c
Create a new file called newcall.c with full path: /usr/src/linux-2.6.32.5/newcall/newcall.c
/*—Start of newcall.c—-*/
#include <linux/linkage.h>
asmlinkage long sys_newcall(int i)
{
return i*10; //the value passed from the user program will be multiplied by 10
}
/*—End of newcall.c——*/

Makefile
Create a new file called Makefile with full path: /usr/src/linux-2.6.32.5/newcall/Makefile
and paste the following line
obj-y := newcall.o

Create userspace files to test the system call
create two files testnewcall.c and testnewcall.h and the full path of the files are
/home/pradeepkumar/testnewcall.c
/home/pradeepkumar/testnewcall.h

testnewcall.c

#include <stdio.h>
#include "testnewcall.h"
int main(void)
{
printf("%d\n", newcall(15)); // since 15 is passed, the output should be 15*10=150
return 0;
}

testnewcall.h

#include<linux/unistd.h>
#define __NR_newcall 337

long newcall(int i)
{
return syscall(__NR_newcall,i);
}

Note: "_syscall1(long, mycall, int, i)" this can be added instead of

long newcall(int i)
{
return syscall(__NR_newcall,i);
}

Macro _syscall1()

_syscall1(long, newcall, int, i)
the importance of the above syscall is

  • The name of the system call is newcall.
  • It takes one argument.
  • The argument is an int named number.
  • It returns an long.

Testing the new system call
Step 1: Recompile and install the new kernel so that our system call becomes available to the operating system. go to the kernel folder and give command make

Step 2: Reboot the system

Step 3: Compile and execute the user space C file (testnewcall.c) that we created above. (gcc testnewcall.c and then execute ./a.out)

RESULT: You should see the output as 150. This has been tested on kernel 2.6.32.5.

Source: http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/ (The above link uses kernel version 2.6.17 and it uses different set of files)

My post uses a recent kernel 2.6.32.5 and it modifies different set of files.

Any doubts, please query through the comments….