Friday, September 25, 2009

New way to manage your account on supercomputer

Recently, I have been developing a web based system to manage account on supercomputer. Previously, user need to connect text terminal based system to create account and change password. To be able to do this, user need to install terminal emulator(Hummingbird - Host Explorer) on their Windows machine first and set it up correctly. The problem here is that a lot of our user are not familiar with these 'text terminal' based system and even the interface is not intuitive at all and user has to go through different authentication process for each systems.

So we have decided to develop a web based system with more intuitive user interface and simple/central authentication process. Once user log in this system, user can create account, change password, and check account balance all in one single place. Now, it is under beta testing.

1. Login to AMS(Account Management System)

1-Login to AMS

2. Centralized Authentication System

2-Centralized Authentication System

3. Account Summary

3-Account Summary

4. Profile

4-Profile

5. Change password

5-Change password

Wednesday, August 19, 2009

PHP class generator

Writing a PHP class file is a huge nightmare if it has 20 member variables or more. Why? Because you have to write set function and get function per each member variable. It's 40 functions. What if you have 30 member variables? hm...

PHP class generator is a solution for that kind of job. It takes the name of class and list of member variables as parameters, then generate PHP class source code automatically.

For example, if you want


class testClass
{
var $test1;
var $test2;

function __construct()
{
}
function setTest1($test1)
{
$this->test1 = $test1;
}
function getTest1()
{
return $this->test1;
}
function setTest2($test2)
{
$this->test2 = $test2;
}
function getTest2()
{
return $this->test2;
}
}
?>


For example, if you want just type

$php genClass.php testClass test1 test2 > testClass.php

then it generates source code you want. Stop writing get/set function manually from now. Here is source code. I hope you enjoy it.


/**
* File : genClass.php
*
* Generate PHP class file with given class name and list of member variables.
*
* @author : Brian @ Texas A&M University
*
* Usage : $php genClass.php className fieldName1 fieldName2 ... > filename
* Example : $php genClass.php testClass test1 test2 > testClass.php
* $cat testClass.php
class testClass
{
var $test1;
var $test2;

function __construct()
{
}
function setTest1($test1)
{
$this->test1 = $test1;
}
function getTest1()
{
return $this->test1;
}
function setTest2($test2)
{
$this->test2 = $test2;
}
function getTest2()
{
return $this->test2;
}
}
?>
*/

if ( $argc == 1 )
{
exit("Useage : genClass.php className fieldName1 fieldName2 ... > filename\n");
}

$name = $argv[1];
$max = $argc-1;

echo "echo "class $name\n";
echo "{\n";

for ( $i = 2 ; $i <= $max ; $i++ )
{
echo " var \$$argv[$i];\n";
}

echo "\n";
echo " function __construct()\n";
echo " {\n";
echo " }\n";
for ( $i = 2 ; $i <= $max ; $i++ )
{
$tmp = ucfirst($argv[$i]);
echo " function set$tmp(\$$argv[$i])\n";
echo " {\n";
echo " \$this->$argv[$i] = \$$argv[$i];\n";
echo " }\n";
echo " function get$tmp()\n";
echo " {\n";
echo " return \$this->$argv[$i];\n";
echo " }\n";

}
echo "}\n";

echo "?>\n";
?>

Monday, June 15, 2009

Rocks cluster 5.2 (beta) & Matlab R2008b on Linux x86_64

Introduction


You will face 3 problems when you install and run Matlab R2008b on Rocks cluster 5.2 (beta). Actually, these issues are not necessary caused by Rocks 5.2 cluster, but, it happened on Rocks on Linux x86_64. So, let's fix them!

1. Installation

It happens when you type 'install' after inserting Matlab DVD into your head node.

bash: /media/MATHWORKS_R2008B/install: /bin/sh: bad interpreter: Permission denied

Solution

The reason is that 'noexec' option is applied internally when it is mounted automatically. Simple fix is that just unmount DVD and mount it again "manually". Then, 'noexec' won't be used by default.

$unmount /cdrom
$mount -t iso9660 /dev/cdrom /cdrom

Reference

http://www.mathworks.com/support/solutions/en/data/1-184PH/

2. Running demo

After installing, you might want to test run demos provided with Matlab. And you would click 'Help/Demo' menu and eventually, will click 'Run this demo' link. But, what you get is not a fancy demo window, but a just frustrating error like this.

Solution

Matlab is not really smart enough to know that you are using Firefox. So we need to let Matlab know that we are using Firefox. How?

Edit this file;

MATLAB_INSTALL_DIR/toolbox/local/docopt.m

In line 52, change this line

doccmd = '';

to

doccmd = 'mozilla';

Reference

http://www.mathworks.com/support/solutions/en/data/1-25NUXQ/

3. Printing

When you click print within Matlab, you would get this error on Linux;

Caused by: java.lang.NullPointerException: null attribute
at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)
at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121)
at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263)
at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437)
at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195)
at sun.print.ServiceDialog.(ServiceDialog.java:124)
at javax.print.ServiceUI.printDialog(ServiceUI.java:188)
at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855)
at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)

Solution

It is caused by the bugs in Java printing function, which is used by Matlab to print output. There are several workarounds are suggested, but, in my opinion, the easiest and simples way is adding this line;

Option orientation-requested 3

to CUPS's configuration file;

/etc/cups/printers.conf

Reference

http://www.mathworks.com/support/solutions/en/data/1-747TRF/