Saturday, February 18, 2012

How to call Matlab functions from a Java program

Matlab is a very reputed piece of software specially among researchers and graduate students. It allows users to code complicated algorithms thanks to its rich libraries that implement many mathematical functions and statistical models. You may have ever used it to implement some classification processes that deals with heterogeneous data and you have got some interesting results and you wanted to show it to a client. He may not be interested in your statistical model nore in your charts and graphs. He is interested in a beautiful application with an ergonomic user interface with big shiny buttons that allow him to use you piece of program. He is interested in the usability of your program more than the academic process that allowed you to get your result.

So to make this happen, you need to implement a simple prototype that calls your Matlab functions and show resluts in a simple GUI. If you're a Java savvy, or you prefer java to make this happen you need to use the MatlabControl API. It's a simple Java API that allows you to call Matlab functions and execute eval, feval and other commands.


All you need to do is to download the jar file and add it to your classpath and use this code to open a Matlab session.



MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder()

.setHidden(true)
.setUsePreviouslyControlledSession(true)
.build();

MatlabProxyFactory factory = new MatlabProxyFactory(options);

MatlabProxy proxy = factory.getProxy();

After that you need to change your Matlab current path to your Matlab script path using CD command and then you can execute call your function:

proxy.eval("cd C:/Users/MyName/Desktop/MyScriptFolder");
proxy.eval("myFunction('"+param1+"','"+param2+"',intParam)");

If you need other details about variables and parameter you can use the API Walkthrough or check out the API Javadocs.


Monday, January 02, 2012

Writing Java code in blogger posts

I've been looking for a simple way to help me tweak my blog to show Java code.
This is what I've got after some changes in the blog template.

// Comment
public class Testing {
public Testing() {
}

public void Method() {
/* Another Comment
on multiple lines */
int x = 9;
}
}
All you have to do is changing your blog template and add some scripts so you can use the "SyntaxHighlighter" Library.
It works thanks to this post.

Tuesday, September 14, 2010

Web-Desktop Application for Network Monitoring and Alert Management.


Currently, computer networks are the backbone in the remote communication. Now they have become essential for the proper functioning of many domains and applications. Their rapid growth induces increased complexity of administration tasks and fault detection. Any problems or failure may have serious consequences forcing the use a system of monitoring and alert management.

The network monitoring has become therefore a major task not only the ensure the system retention and good functionality but also to have a global view on problems that may occur to prevent their appearance. As the task of the administrator is to ensure the smooth functioning of its network and manage heterogeneous devices, administrators were then forced in the past to work on a machine connected to the network which makes their task more difficult and may risk delaying critical tasks. Thanks to advances in technology and the evolution of the Web, this monitoring task has become more flexible.

In fact, the administrator is now able to monitor its network remotely via a web application that provides network monitoring and is capable of describing its condition and report alerts when this is necessary. Hence, it can remedy problems and resolve them as quickly as possible.

Indeed, this application starts with the automatic detection of network equipment (Routers, firewalls, terminal) which allows to draw the map showing equipment found to give the administrator a clear view on its network. The administrator can also predefine the annoying problems that which he judges to be important to be notified when they occur. Once one of these problems is encountered, an alert will reported to the administrator to inform him about the problem detected, its severity and its location so that he becomes able to correct it immediately.

The main objective of this project is to develop a web application for network monitoring and effective management of alerts. This application should be able to monitor services and network resources (routers, terminals). The following video is a demonstration of the project.
video



Monday, September 06, 2010

Introducing EXT JS

EXT JS is a javascript library which is build to offer web developers the ability to make interactive web applications using Ajax, DHTML and DOM scripting.

The new tendency in the last deacades in software development is the "rich Internet application". To be close to desktop application, you should have some advanced web

graphic tools and frameworks. Extjs has all the features to allow you to develop your rich Internet application.

The predefined tools such us grid, forms, panels and menus are rendered client-side.You don't have to wonder about compatibility. It's designed to work perfectly on any common browser.

Coding and editing Ext js scripts is fun. Since there are many examples with the downloaded package of the library and it has a very helpful community. These are some Screeshots of what this library is capable of:


Monday, March 16, 2009

How to make vi colorful on xubuntu

Hi...
We started to study shell programming in school and we use VI to code some scripts. I noticed that all my colleagues using vi on ubuntu are very irritated and seem to envy their friends who use VI on Fedora 10 because it's very easy to use and colorful, it helps to detect syntax errors. Some of my friends started to regret installing Ubuntu instead of Fedora and even blamed me for recommending it. As an Ubuntu fan I looked for a solution for this tiny problem. I won't accept any lame remark about Ubuntu !! you need a colorful VI ? Here you are !


1- You have to install VIM which is "vi Improved" just tape this code in your console:

sudo apt-get install vim

2- After installing it you have to edit a file () and uncomment a parameter. To do so first you have to turn into root so type su and enter your root password:

su
then change this file mode for writing (so you can change its content)

chmod +w /etc/vim/vimrc

no open this file using vi if you want and uncomment syntax on. i.e erase the (") before syntax on in line 20.
vi /etc/vim/vimrc
After doing that save changes and exit using :wq
try writing something, save it and re-open it and you will find your beautiful colorful script. ENJOY !!

Xubuntu and low performance machines : The perfect match !


When the machine gets old and becomes useless. You get short on options. You can't sell it because you are so emotionally attached to it and it doesn't worth that much and you can't run new applications on it because it can't afford them. But you can turn it into a beautiful workstation. Able to open your pdf documents, play your music and videos and does your office tasks... You need just a light operating system that doesn't consume much hardware resources.

I'm talking about a Linux system of course so you won't spend any dime on proprietary software and you can avoid the headaches of the anti-viruses and etc...
The choice was : xubuntu .

I installed xubuntu 8.04 on my Compaq Armada notebook. This notebook is really a disaster running with WinXP but not bad with Windows 2000 and this is its configuration :
Intel Pentium III 750 MHz
64 MB Ram
20 Go hard disk

Pathetic isn't it ? But it was all I had when I needed a Linux system for my SHELL programming courses. I downloaded the Xubuntu which is an ubuntu distribution designed for low performance machines and it was just perfect. The graphics were nice and simple. Most of the applications run properly. The execution of the system in the start up doesn't take much time.
You can see down here the "system monitor" and how xubuntu is using the ressources of the machine.

Wednesday, December 31, 2008

Torvalds' gift for the Linux community... The new Kernel 2.6.28

Actually, it was on the 25th of december. Linus Torvalds plays Santa clause and released a gift for all Linux users. It's the New Kernel.

Ext4 :
The most important thing in this relase is EXT4 the new Filesystem of Linux which will be :

  • Compatible with the old EXT3 : you can have and ext4 partition as if you have a ext3 one.
  • Larger filesystem : The capacity of this FS was extended to be able to support 1 Exbibyte and files of 16 TiB ( about 16 000 Gigabytes). The number of possible used directories was extended to 64000.
  • Journal Checksums : The Journal (a file containing the changes of a hard disk) will be using a new technique which will improve the reliability of the disk by cheking the occurence of anyy error during the processing of saving data.
You can check this link fo further informations

Graphic performances :
The release of the new GEM (Graphics Execution Mananger). This piece of software will take care of the graphic chipset ressources and how to exploit them for different multimedia applications. This GEM will improve the graphic performance of you graphic card.
Some improvments were made to KVM. It's the part of the kernel that take care about virtualisation for some architectures like intel-V and AMD-V. It will allow the machine the possibility to seperate several systems without restarting and the possibility to use some pieces of software that don't exist on the HOST system.

Drivers:
Many improved drivers specially for USB and Wirless devices. The tree of these drivers was considered as stable.

As a conclusion, the new Linux has many new features. Will they be adopted by the different distributions ?


References :
Site du zero news article.
Kernel.org changelog

Friday, December 26, 2008

The status of the engineer in Tunisia

In order to find out the status of the engineer in Tunisia we will try to answer these questions:

Who`s he ? What does he do?

How much does he earn ?

What is his image in society?

What does he suffer from ?

What are the potentials of this career in Tunisia ?

Definition

An engineer is a person professionally engaged in a field of engineering. Engineers are concerned with developing economical and safe solutions to practical problems, by applying mathematics and scientific knowledge while considering technical constraints. As such, the work of engineers is the link between perceived needs of society and commercial applications. Some consider this profession to be the link between art and science.
wikipedia definition


Problems

joblessness and overexploitation :

Some statistics of a study made on 4763 young graduated students in 2005 after 18 months from their graduation

Financial status

  • For newly graduated engineers with no experience the wage is from 800TD to 1200TD.
  • After 5 to 10 years of experience the wage can touch the 1500TD to 2000TD.
  • Earnings mainly depends on years of experience, certifications and of course the engineer himself. Once he proves to his boss his skills and abilities, he can renegotiate his salary.


The gap between Tunisia and Europe in wages

  • In France, the salary of a newly graduated engineer is from 2000€ to 2800€ ( 3600TD to 5000TD).
  • In the end of his career, a well experienced engineer can touch 6000 € (10800 TD).
  • The standard of life is very different. The daily needs are expensive in Europe compared to what is available inTunisia but still an engineer in Europe is better remunerated.
  • The evolution of the engineer in Europe and USA is faster. In fact, occidental companies evaluate talent and take it into consideration.
  • The competition between these companies to have the best members in their crew make the salary negotiation more simple and efficient.
  • In conclusion, Tunisian engineers won`t skip the chance to travel and work abroad . Consequently, Tunisia lose many skilled engineers and this is just a sample of a wider phenomenon called `Brain Brand`.



Social status

57,2% of higher education students are female (www.universites.tn)

30% of working engineers are female(2004 statistics INS)

  • conclusion : The society consider engineering as a masculine job




To proceed in explaining the social status of the engineer Tunisia we will use a study made by Raoudha Ben Othmen a professor in the university of Tunis:

Subjects:

  • 180 secondary school students aged 15-16
  • 180 primary school pupils

Tools :

  1. Questionnaire
  2. Draw me an engineer test
  3. Teacher led class discussions

N=140 Questionnaires (45% boys and 55%girls)


Drawings

  • No major difference between children and teenagers’ drawings.
  • None of the drawings contained a picture of a woman.
  • Most drawn engineers have glasses, are middle-aged, look scruffy wear a lab coat and hold some kind of tool.
  • Some pictures contained a working bench


Class discussions

  • Teachers seem to have naive ideas about engineers and engineering.
  • Teachers did not give the children the name of a famous modern engineer. Most of the examples are old (Graham Bell)
  • In leading the class discussions about future careers, teachers allocated more turns to boys than to girls
  • In leading class discussions about studying engineering, teachers seemed to allocate turns equally between girls and boys

Tests conclusions

  • Students and teachers hold naive conceptions of engineering
  • The necessity to enhance the image of engineers and specifically of the working environment
  • Both male and female students are determined to choose other lucrative careers than engineering

Potentials

  • Many foreign companies choose to invest in Tunisia due to the low taxation and labor cost.
  • The Tunisian government aims to attain 7000 engineers in 2011-2012.
  • Many Mega projects are scheduled in Tunisia as ` The Mediterranean gate` which will host hundreds of companies.

Conclusion

All the figures are showing the fact of the promising future of engineering as a profession in Tunisia. However, many laws and interventions have to be made in order to protect the engineer`s rights and ameliorate his status and his image is society.




Diapositive 1