Archive for the ‘Computing’ Category.

New theme

I’ve ported the good old theme from http://www.gimpster.com/ to work with PhpWiki, see GimpsterTheme.

Hack to stop warnings

I’ve found a way to stop the warnings that started to appear two weeks ago — see my post on the 18th. The problem was, that file_exists suddenly started to give a warning when you used it on a file that you didn’t have access to, because [PHP][] is running in ”Safe Mode”. This started when NetSite upgraded to PHP 4.2.3.

The fix was simple, I just added a @ infront of file_exists to suppress the warnings. [PhpWiki][] provides all the PEAR files is need, so things still work. Here comes the patched function:

function _search_path ($file) {
    foreach ($this->_path as $dir) {
        // ensure we use the same pathsep
        if ($this->_pathsep != '/') {
            $dir = $this->slashifyPath($dir);
            $file = $this->slashifyPath($file);
            if (file_exists($dir . $this->_pathsep . $file))
                return $dir;
        } elseif (@file_exists("$dir/$file"))
            return $dir;
    }
    return false;
}

Where exactly do you change this? (What file?)

I found it… pretty obvious since the path to the file is given in the errors… lib/FileFinder.php.

-LaForce

Stupid errors…

I’m sorry I haven’t updated the site lately — I’ve had other things on my mind, and then those stupid errors suddenly started to appear:

lib/FileFinder.php:161: Warning[2]: SAFE MODE Restriction in effect. The script whose uid is 1332 is not allowed to access /usr/local/lib/php owned by uid 0

I’ve sent a mail to the guys at NetSite (who host GimpsterDotCom) to hear if they can fix it. The errors started when they upgraded to [PHP][] 4.2.3, so my guess is, that they’ve accidently changed the permissions on /usr/local/lib/php as part of the upgrade.

We’ve finished the first third of our project

Although I thought this last week was surposed to be my autumn holiday, I’ve still managed to spend around 6 hours at DAIMI each day… I’ve been working together with Thomas Mølhave and Mikkel Krøigård on our dPaSS project. And now it’s finished and it works! We were surposed to design a framework that will be used to build a calendar system. But we’ve actually made a working program where you can create new appointments, invite people to appointments and cancel appointments.

Everything is documented in the biggest document I’ve ever been part of, written in [LaTeX][] of course, we’re at about 70 pages right now. But it’s only about 18 of those pages that has text on them, the rest is titlepages, table of contents, and then all the code typeset using the excellent listings package. The definition we’ve been using for the BETA language is

\lstdefinelanguage{BETA}{
  morekeywords={
    origin, include, body,
    enter, do, exit,
    if, then, else,
    for, repeat,
    leave, restart,
    inner,
    suspend,
    dopart, descriptor, mainpart, attributes,
    true, false, and, or, not,
    none, this},
  sensitive=false,
  morecomment=[s]{(*}{*)},
  morecomment=[s][\footnotesize]{(**}{*)},
  morestring=[b]‘,
  moredelim=*[s][\slshape]{<<}{>>},
  moredelim=*[s][\scshape]{-}{-},
  moredelim=[s][\ttfamily]{[}{]}
}

The comments started with (** is used for the CVS headings which tend to be fairly long. Using \footnotesize makes then small enough to fit into a single line. We’ve typeset all the code using a basicstyle of \small\sffamily using the Lucida Bright fonts from Y&Y which look fantastic. Unfortunately I cannot show you the report with the fonts, because of the license on these commercial fonts, which says that

Scope of Use. [...] If you need to publish material in electronic form that contains fonts or partial fonts, then you need to obtain an electronic publishing license.

And I don’t have such a license :-(

I’m sick :-(

The summer has gone and autumn has arrived — it’s terrible cold outside these days. And this has made me sick: I’ve got myself a bad throat.

I went to the University today at 8:00 in the morning as usual, but got back already at 10:00 because my head started to ache. So Thoooms and Termos had to handle our group assignment in dArkOS themselves — which they did without a problem, of course. I went home to lie down on my couch.

Some hours later, I started working on the [LaTeX][] code that will become our report for our project in dPaSS. I’ve made a pretty cool document already by teaching the listings package to highlight BETA code. I’ll post the code here at GimpsterDotCom when we’ve tested it some more.

We’re working on your mandatory project for a week now. The task is to program a calendar system using the rather strange programming language BETA. To give your a taste of how BETA looks like, take a look at this Hello World example:

Origin '~beta/basiclib/betaenv';
--- Program: Descriptor ---
(# do 'Hello World!' -> putLine; #)

That was an easy example: It declares a fragment that will be inserted into the Program slot in betaenv which is the top level in all BETA programs. BETA programs consist of a lot of fragments which are inserted into slots in other fragments.

We can complicate things a bit this way:

Origin '~beta/basiclib/betaenv';
Include '~beta/containers/list';
--- Program: Descriptor ---
(# a, b: ^Text;
   l: @List(# element:: Text #);
do 'Hello ' -> a[];
   ‘World!’ -> b[];
   a[] -> l.Append;
   b[] -> l.Append;
   l.Scan(# do current[] -> putText; #);
   newLine;
#)

This will also output Hello World! to the terminal, but this time it’s done by storing each word in a variable, putting the variables into a list, and then running through the list — of course this is only to demonstrate the way you can further-bind Scan in the List pattern. The code in (# do ... #) is executed once for each element in the list, and the current element is available in the current variable. The brackets [] indicate that we’re working with references instead of the actual objects, just like & is used in C.

Programming in BETA is a mixed blessing: there’s a lot of nice things in the language like the way you specify take a general List pattern above and makes a subtype that can only contain Text patterns, but there’s also a lot of stupid things that you have to deal with using various hacks.