Why us?

New Code Gear announcements: Delphi 2007 for Win32 and Delphi for PHP

February 22, 2007

Code Gear just announced two new products: Delphi 2007 for Win32 and Delphi for PHP.

A quick rundown on each:

  • Delphi 2007 for Win32 is the latest release of good old Delphi with improved Vista and AJAX support (in the form of VCL for AJAX).
  • Delphi for PHP is a RAD IDE and component set for PHP developers. This may be a BIG hit: it packs a powerful IDE with an architecture/component framework called VCL for PHP and adds on top of that professional debugging support and deployment wizardry. I will definitely have more first-hand news about this baby in the coming weeks.

It should be noted that Delphi for PHP is not strictly a CodeGear/Borland internal project, it is originated from qadram’s qstudio, but now it is developed together by the two companies. VCL for PHP used to be called WCL and as far as I see will remain open source.

You can read more here (a very good blog, BTW).

If you seem a little bewildered by all the Delphi for Xxxx (e.g. Delphi for PHP has nothing to do with Object Pascal) and VCL for Yyyy tags, don’t feel lost! It is just POBC (plain old brand capitalization) .

While I am at it PasWiki seems to be interesting, too: it is a simple Wiki engine written in “Modern Pascal”. The angle I am keen to learn more about is its performance claims, an important subject and an area where Morfik should shine.

Morfik Tip: Pretty up the ‘Loading…’ message

February 14, 2007

Loading hackI got bored with the ugly ‘Loading…’ message in the upper left corner while my users are patiently (?) waiting for my app to launch, so I dug a little into the Framework source code and came up with the following.

In SystemServerDocForm, in the Browser code, in TFormServer.GenerateMainHTMLPage, replace line 595 with the following:

// !PI! Added a little style to the "Loading" message
Response.WritelnString('    <div id="__LoadingText" '+
 'style="left:40%;top:50%;position:absolute;font-weight:bold;'+
 'text-align:center;font-size:12px;font-family:verdana,serif;'+
 'background-color:#f0f0f0;padding:10px 14px 10px 14px;'+
 'border:1px dotted gray;color:red;">');

This is valid for 0.9.16.1 — if you have a different version, your mileage may vary somewhat.

This is a quickie, and I suppose will be outdated pretty soon, as Morfik will do something better about it (e.g. put a class on this DIV, and make it possible to have an external stylesheet to customize), but for the time being it is a good fix. Of course, you may want to adjust the settings to your liking. Can also add some logo, change the text itself, etc.

Morfik Tip: How to return the value of any class member field as a string

We are building a generic framework to do data transfers/data binding efficiently (and some other wonders;) in Morfik and we had this issue today that we wanted to get a field’s value when we knew the field’s name.

So we cooked up the following little Pascal function that will return the string equivalent of the value of filed ‘v’ of class ‘c’. This is a first cut, some tests should be done (and will be for our production lib) but it is a good start, if you happen to stumble upon the same problem.

function GetValue(c:Pointer; v:String):String; JavaScript; (*!
{
  return c[v];
}*)

Among other things this demonstrates how you can call JavaScript code from within the Pascal code without using external .js files. This is a relatively new syntax (from around the 0.9.1x.x branch AFAIS) but is way cool.

If you happen to have to drop to JavaScript, some of my advices:

  • do NOT do that, unless you know what you are doing — if you are new to JavaScript, it will be an interesting experience;
  • in Project / Project Options / Compiler, switch off “Obfuscate JavaScript” (and “Optimize JavaScript”, for that matter) to make your life easier when you are debugging;
  • install the Microsoft Script debugger as described in Appendix ‘G’ (if I recall correctly).

Happy sailing!

Chat example full of Morfik insight

February 7, 2007

Chat exampleYours truly has done it again! Instead of finally getting to writing about Analog Clock I created another Morfik Labs sample application, a simple chat thingy.

You can take a look at the application here and download the source code in the Morfik Labs.

Telling the truth, I created the original chat app almost a year ago (February, 2006) and now due to interest in the Morfik forums I dusted it off and updated to the latest version of Morfik WebOS AppsBuilder (0.9.16.1). I thought originally it would be a two-three hours exercise, and man I was wrong! It took me two days to tidy up a few hundred lines of code :-) The reason was that the original version used subforms for displaying the messages, but that was tooo sloooow, so I decided to wander a little bit into the wonderland of DOM programming.

So some details (shamelessly copied form the readme.txt): the Basic Chat example application is the innermost prototypical core of a chat engine and still it can provide some insight into areas of Morfik programming. A few examples:

- using web methods
- using inline JavaScript functions with parameters
- using critical sections in server logic to accommodate concurrency
- using in-memory caching on the server (the chat session is stored in server memory)
- using visual effects for highlighting UI changes
- no security measures: a very good example for many types of web application security attacks, especially injections :-)

PLEASE NOTE: this version of the chat engine is NOT secured, there are gaping holes and can be mistreated quite easily, so DO NOT use it for production purposes. It is very basic as well, you cannot set up chat rooms, or schedule events, authenticate users, there is no smiley handling, there are no application specific extensions, etc. Please also note that at the moment there are some open issues related to resource consumption in the Morfik framework that do affect the performance of the chat app. It has not been overly optimized either so substantial performance improvements can still be achieved.

If you need a production quality, secure chat engine, please contact me ;-).