domingo, 23 de fevereiro de 2014

Android with Delphi for Javascript

POST #030 =======================================================================
Take the big picture: I want to access data over the web, using my android tablet thin client. But I would like to keep my server/service written in pascal. What I'm trying to do is write a small web application in Delphi which support REST protocol and JSON. I would like to share my customer table remotely through Android tablets, table has more than 10,000 customers. Of course, I need authentication, strong scheme to ensure that connection is secure. So, my server should send small data packets to client, and security is an issue, but I don't have the necessary muscules in my brain to do the client side in javascript. So I could try to convert Delphi to javascript, but I don't know if this is possible. Simple as...


Ok folks, I know that PHP, java could help me with this, but I would like I'm a GUI guy ;) Take a look at this video. I'm using Delphi as server side and Delphi for javascript as client side, and finally I've combined with Cordova to create an Android application. Everything using pascal, android .apk file size is 300kb!

So there you have it, two possibly great frameworks combined! Whether they really are that great.

Thanks for listening, if you like this video I'm warleyalex from the beautiful Seven lakes, Brazil. otherwise I don't know anything about it...


Tags: Remote paging datagrid; Smart Mobile Studio; Android with Delphi for Javascript; OP4JS.
 


quinta-feira, 30 de janeiro de 2014

Database Reverse engineering with Delphi mORMot

POST #029 =======================================================================
I would like to map DB to class dynamically depending on the database. Now, I just have to select some tables and my little mORMot can generate the class on the fly to be used in models. Something like this:

TSQLSampleDB = Class(TSQLRecord  
public    
  fAuthUser       : TSQLAuthUser; 
  fLogonName      : RawUTF8; 
  fPasswordPlain  : RawUTF8; 
  fPrice          : currency; 
  fDisplayName    : RawUTF8; 
  fGroupRights    : RawUTF8; 
  fData           : TSQLRawBlob; 

published 
  property AuthUser: TSQLAuthUser read fAuthUser write fAuthUser; 
  property LogonName: RawUTF8 index 20 read fLogonName write fLogonName; 
  property PasswordPlain: RawUTF8 index 10 read fPasswordPlain write fPasswordPlain; 
  property Price: currency read fPrice write fPrice; 
  property DisplayName: RawUTF8 index 50 read fDisplayName write fDisplayName; 
  property GroupRights: RawUTF8 index 15 read fGroupRights write fGroupRights; 
  property Data: TSQLRawBlob read fData write fData; 
end; 

It's a good practice to put all data definition into a stand-alone unit called model. This unit will be shared between client and server.

This is not a real class but something quite similar, it just has to inherits from TSQLRecord, and the published properties will be used for the Delphi mORMot framework, in ORM side, ready to use in client/server environment. Very handy, isn't it?

Tags: Convert table to class; DB reverse engineering; mORMot framework.
 


quarta-feira, 4 de dezembro de 2013

Smart Mobile Studio - DBGrid with some curves

POST #028 =======================================================================
Like it or not, Delphi is the best development tool for Win32/Win64 but Embarcadero seems to ignore the fact. Someone could say that the baby is being thrown out with the bathwater and after all, when they realize the error will be too late.

The fate of Delphi is increasingly linked to the acclaimed FireMonkey technology. Concerns about FireMonkey are concerns about Delphi. Embarcadero beyond thinking who owns the Pascal, persists in pushing your fancy half-assed multi-platform write-once run-anywhere, in reality, is that you can write once and then run it in any platforms each "supported". For example, you develop for Android "some " Androids.

This is my space for outburst. Now, talking about SMS. Smart Mobile Studio was created with Delphi. The tool lets you instantly convert Pascal "Delphi-like" javascript code to native code. The interesting part is that the generated code (pure javascript) is ready to run on smart phones. In order to demonstrate the functionality of this greate tool, I've created a DBGrid with pictures in SmartMS. Nice photos, ehm. doncha think?

Noteworthy is that you can call javascript event handlers using object pascal . Thus, you could make a sort of binding between components of a javascript library and the native components SmartMS thus being able to create more sophisticated apps. This is warleyalex from Seven Lakes, Brazil. Stay tuned on upcoming videos about SmartMS.

Tags: OP4JS; Smart Mobile Studio; SmartMS with DBGrid.
 


sábado, 30 de novembro de 2013

Smart Mobile Studio - DBGrid component

POST #027 =======================================================================
Smart Mobile Studio (aka Delphi for Javascript) instantly converts pascal Delphi-like code into high-speed javascript. The interesting part is that JS code generated is ready to run on smart phone or any HTML5 web-kit empowered device.

I would like to create a testapp more sophisticated with SmartMS, I realized that I could write a Pascal wrapper classes to mimic the structure of the JS library, with the intent of using it to call events from pascal. In this mini video, I'll demonstrate a DBGrid with SmartMS. Thank you very much, I'm warleyalex, and you take care. Stay tuned on upcoming videos about SMS.

Tags: OP4JS; Smart Mobile Studio; SmartMS with DBGrid.
 


domingo, 13 de outubro de 2013

Delphi mORMot - My Custom 404 error page

POST #026 =======================================================================
Welcome back. Delphi mORMot server will typically generate a error "Not Found" when you attempt to follow a dead link, this message indicates that the client was able to communicate with the server, but the server could not find what was requested.

I would like to display a customised 404 error page, including a more "friendly" message that work in no-script browsers. This is for browsers that do not understand JavaScript can be redirected to special pages that do not expect users to support JavaScript.

I'm using meta refresh tag <meta http-equiv="refresh" content="0; url=/root/">
to auto redirect page. Concerning absolute URIs in redirects, I don't know if this method is the best approach for redirection, but anyway, this is another story. So please stay tuned on upcoming videos. Thank you very much for listening, I'm warleyalex, and you take care.

Tags: Delphi mORMot URI redirection; Custom 404 error page; auto redirect page.
 

segunda-feira, 7 de outubro de 2013

Smart Mobile Studio (Delphi for Javascript) - calendar widget

POST #025 =======================================================================
Welcome back, everyone. This is warleyalex. Playing with SMS - Smart Mobile Studio (AKA Object Pascal for Javascript). SmartMS instantly convertes pascal Delphi-like language into pure JavaScript. The code generated is ready to run on your iPhone or any HTML5 web-kit device. The idea here, in this mini video was demonstrate some SmartMS built-in datetime functions. As you know, since delphi and javascript deal with dates quite differently, this probably is an issue. I’m having a hard time to add an animation feature in Smart, but this is for the next video. So please stay tuned on upcoming videos. Thank you very much for listening, I'm warleyalex, and you take care.

Tags: Delphi for javascript; Object Pascal for Javascript; Smart Mobile Studio with jQuery.