Thursday, June 11, 2009

Command line for Quercus project - Php in Java

Quercus is a mature industry oriented platform for PHP/Java solutions. Well, it is around for a few years, has a rich PHP modules support, and is claimed to be faster then mod_php, because of compiled bytecode, cache management, etc.

Unfortunately that beast is primary targeted to support web applications only under Resin werbser. But with closer look, it turns out that not only the webserver presense is not required, but you can actually run it from command line. I have recently added this pet project - an ad hoc to support detached functionality of this nice PHP in Java implementaiton.

All the feedback is welcomed. Future plans are to do a lot of testing, properly mimic php-cli behaivor, implement CGI support.

PS

Alternative projects are ProjectZero and Faun. The last one is also my lovely pet ;)

Friday, June 5, 2009

cool flash photogallery software

Here it goes in action. And here is the website of the project. It is really cool, minimalistic, and I truly favor the mouse scroll. Would be tricky to do the same with AJAX ;-)

And the rotating effect by the guys behind
JW FLV Player (Open Source). This is the 'first" open source flash player and one of the most popular on the net. Well this rotator is also a nice gallery =) Here is the demo in "practice".

Wednesday, May 27, 2009

Lambda Templates

I have just putted this piece of code into the repository together with small wiki article.

LambdaTemplates
Building a very trivial tool for programmable templates support

Background

Template techniques are widely used in programming languages and, of course, the web. This small piece of code that I have "cleverly" called Lambda Templates is yet another string substitution tool (as I have found out later initially very similar to String Templates by Terrence Parr).

Usually, templates mechanism tries to follow procedural paradigm of text generation by simple replacing of a bunch of specially marked placeholders with passed values. For my needs, I wanted to have something very short at hand: to call a method and process the result further within the program code.

Examples

To set a constant string value to some variable, one calls $p->setVar('foo','bar');. Apparently, $p->getVar('foo'); will return the corresponding value.

Now the name Lambda featuring the title, comes from Lambda calculus by Alonzo Church, where one can observe a sort of substitution mechanism for resolution of specially build logical expression. Well, actually the resemblance ends at the point of using "/" that mimics lambda symbol in lambda expressions.

Once again, the idea behind a lambda template is actually as trivial as this: /fruit. this is a fruit - an example of parametrized template's value. Because it's inspired by lambda calculus, we don't give a name for this expression inside the value. The comma separated list of argument names between LAMBDA and DOT symbols, are actually names that will be reserved for substitution after DOT.

Grammar will be something like

expression := body | LAMBDA (argument COMMA)* DOT body;
body
:= CHAR*;

Further examples are:

$p = new LambdaTemplates();
$p
->setVar('x','10');
$p
->setVar('what is x','/x.is /x = x?');
echo $p
->processTemplate('question: %what is x%');

$p
= new LambdaTemplates();
$p
->setVar('titel','herr');
$p
->setVar('name','y.y.');
$p
->setVar('titelname','/titel,name.titel name');
echo $p
->processTemplate('question: %titelname%');

Global scope

Current implementation does not support a proper functional paradigm for templating with closure and application constructions (and maybe proper reduction). All parametrized names inside argument list are applied globally, that is extracted from the global scope of values and substituted to the expression.

Friday, May 22, 2009

light bot

Great game in Action Script. Maybe the simplest way to teach basic algorithm development skills ever.

Drag and drop actions (icons) into the sequence to create a small program.

Your goal is to light the lamp over special blue areas.

And "programming" of the game can go pretty sophisticated, that is functional (see the following picture):



Idea behind is pretty cool, although not new. There are a lot of cases where games exploit mechanical scenarios and achieve amazing resembles of certain automaton model with questionable equivalence to some Turing Machine.

Wednesday, May 13, 2009

meditation cite

Meditation brings wisdom; lack of meditation leaves ignorance. Know well what leads you forward and what holds you back, and choose the path that leads to wisdom.

Saturday, April 18, 2009

a hybrid : javascript inside a bat file

Truly nice mix! ;-)

Originally by this guy

// Jim Lawless
// jimbo@radiks.net
// http://www.radiks.net/~jimbo

Your.bat file:

rem ( /*
@echo off
cscript /nologo /e:javascript %0
goto end
*/ )

//
// main function is below

function rem() {
WScript.StdOut.WriteLine("Hello, world!");
}

/*
:end */

Wednesday, April 8, 2009

Today is a greatest day of spring!

"Путешествия позволяют получить точное представление о реальности, а не заполнять её воображаемым содержимым."

"Journeys allow to obtain the exact understanding of reality, without filling it with any imaginary content."

Great words of some guy =)