Introduction to WebOctave

Weboctave is a package that provides functionality to run Octave on a web server. It provides support for same functionality as we run Octave in terminal. It provides a text input box on a web page in which we can type our octave commands. There is a ‘Submit to octave’ button pressing which the command executes and the output is returned below the input box. It also supports plotting graphs as it computes on server and return the image of that output graph on HTML page.

I downloaded weboctave-0.1.0 from weboctave

Extract the weboctave-0.1.0.tar.bz2 and it contains the README file which says the basic requirements:

1) WWW server with PHP>=5 support (ex. Apache)
2) SQL server (ex. MySQL, may be remote)
3) Octave>=3.0.0

I had used octave 4.0.0 version.

INSTALLATION PROCEDURE:
1) Unpack weboctave archive to a directory available to be accessed by WWW server.

I had extracted it in my web document root i.e. /var/www/html/

a. You can change permissions of directories “data”
and “Logs” to be writeable by WWW server.

sudo chown root:www-data data/ -R
sudo chown root:www-data Logs/ -R

2) Create database to be used by WebOctave.

To go to MYSQL command line give this command in terminal:

mysql -u root -p

“Here p is for password”

I created a database called “weboct” from MySQL command line as:

create database weboct;
3) Set database entries. Use "setup/db.sql" script, but edit it first
   to supply the database name.
   USE weboct;
4) Copy "config/config.php.example" to "config/config.php".
5) Edit "config/config.php" and set your preferences. 
   You have to set database data.
Example:
define("DB_HOST", "localhost");

define("DB_USER","root");

define("DB_PASSWORD","***");

define("DB_DATABASE","weboct");
 6) Make sure, that user that WWW server runs under (ex. www-data,...) has
 rwx rights to directories "data" and "Logs". Now your WebOctave
 environment is ready to work and should be accessible by any web browser.

Go to Web Browser and type localhost/weboctave. “Here, weboctave is the name of folder that’s placed in the web document root.”

Struggles: 1. I installed apache2 on my system but later on got to know that it does not contain php having version >=5 that is why I was not able to see text box for input in the interface,  Then I installed lampp server furthur which is having php in it.

sudo apt-get install lamp-server^

Then I checked the version of php using command,

php -version

 

  1. As I am not at all familiar with php, so was not able to judge the error in index.php file.Though it was the simplest i.e to add php in beginning tag of Show content part.

<?php
// load content
$content->ShowContent();
?>

‘php’ written in red above was missing in that file and need to be written.

  1. Third problem which I faces was that when I press submit to octave button in interface of weboctave, its not showing the output i.e

yi

To solve the first error , type in terminal

locate octave-cli

Find its path and give permissions. Then, rename octave to octave-gui and octave-cli to octave, so that by default octave-cli gets opened.

I had done it using my command i.e Example

mv octave octave-gui

After  this one only ‘dispatch’ error is left.

  1. User-defined functions
Functions may be created and managed by Functions tag. User may change old functions by Show
Functions subtag or define new with Define Function subtag.  Remember
to end function with "endfunction" command, not just "end".
New functions can also be defined in Commands tag directly in Octave
commands textbox. After clicking Submit to Octave they will be created
and may be used in the computation immediately. 
'Below is the funtion written'
function varargout = dispatch (varargin)
  varargout = cell (nargout, 1);
  [ varargout{:} ] = __dispatch__ (varargin{:});
endfunction

varargout is an output variable in a function definition statement that allows the function to return any number of output arguments. Specify varargout using lowercase characters. When the function executes, varargout is a 1-by-N cell array, where N is the number of outputs requested after the explicitly declared outputs.

  This will result in beautiful plots on the browser.
yup

You can try with different commands like
a=[1,1;2,2;3,3];
 plot(a);
5. But still I was getting an error under this plotted graph i.e
warning: print.m: epstool binary is not available.
Some output formats are not available.
warning: print.m: fig2dev binary is not available.
Some output formats are not available.
To solve this I gave commands:
sudo apt-get install epstool
sudo apt-get install transfig

Transfig/xfig is a package which contains fig2dev in it.
Problem solved :) :)

 What is EPS?

Encapsulated Postscript Vector graphics EPS is a file extension for a graphics file format. EPS stands for Encapsulated PostScript. An EPS file can contain text as well as graphics.

In addition, XFig is a drawing tool and Transfig has Utilities for converting XFig figure files.

If you want to have a trial before all this, you may visit over here

Learn from your Mistakes

Well said that always ‘learn from your mistakes’ instead of cursing others and yourself.

A case happened with me regarding my training purpose where I was going to take a decision on which I will surely regret in coming future. But lucky me that I got it on time and stops myself from getting deviated from my path. Although I suffered a loss because of my wrong decision (May be its a right path for many but in my case I enjoy working my own and the path I was going to choose earlier is surely less effective path for me)

But a great quote is there that “Everything you loose is not a loss”. So may be I got it not that early but not that late also.  And one of my known person said that, ‘Every moment is a new hope’. So just live in the moment.

Some of these quotes had really feeded me with positive thoughts. 🙂

This case gave me a lesson instead and this will surely help me in future to take right decisions.

Now I am going to cross a new road of my life and will surely visit each and every spot coming in the way 🙂

Stay tuned 😉

 

How to play MUSIC from Terminal?

There are many audio players available like SOX etc. I had here used MOC

MOC (MUSIC ON CONSOLE): It is one of the simple console audio player. It supports OGG, WAV, MP3 and other formats.

Just run mocp, go to some directory using the menu it provides and press enter to start playing the file. The program will automatically play the rest of the files in the directory.

1.sudo apt-get install moc

This will install moc package in system.

  1. mocp

This will direct to moc space where you can go through each and every file of your system.

It has several flags used for different purposes. I am here just telling about some of them.

ENTER                  Start playing at this file or go to this directory
DOWN                  Move down in the menu
UP                         Move up in the menu
PAGE_DOWN     Move one page down
PAGE_UP            Move one page up
HOME                  Move to the first item in the menu
END                     Move to the last item in the menu
Q                          Quit
s                          Stop
n                         Play next file
b                         Play previous file
p                        Pause