How to write a Remote DataModule to run on a linux server? - linux

i would like to know if there are any solution to do this. Does anyone?
The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service writen in pascal.
The 'not so' big picture: I´m trying to write a php to emulate a SOAP Midas packets to ClientDataSets in delphi, but i dont have the necessary muscules in my brain to do that. So i could try to convert dbexpress to FPC, but i don´t know if this is legal.
Ok folks, i know that PHP, java, c#/asp, python, ORM´s and things like that could help me with this, but i´m a GUI guy! Everyone who ever programmed 10000 lines report in cobol knows what i´m talking about. I just want to point my soap connection to some server in the net (i dont own the service providers) and make my customers happy. Simple as...

RemObjects SDK supports Free Pascal. And Free Pascal is a Delphi compatible Pascal compiler for, amongst others, Linux platforms.
http://wiki.remobjects.com/wiki/Introduction_to_Free_Pascal_support
If you are familiar with FPC and don't like to write many lines of code (as you pointed out), I think RemObjects SDK is really an interesting option.
A Delphi cross-platform edition is in the works. Hopefully with the next version of Delphi it is possible to build DataSnap servers for the Linux platform.

You can do this with Lazarus and the wst (web service toolkit). We use it for some client / server projects. In Lazarus you can use (almost) 100% compatible Delphi code and you can compile to native apps for Windows, Linux and OSX.
Only problem is the learning curve , which is rather seep.

The Delphi 2010 DataSnap support REST protocol and JSON as data packet. Perhaps this may helps if you want to design your solution to integrate your Delphi apps with non Delphi apps.

Related

Porting windows application to linux

I have an application which I need to port on Linux. I was thinking to use Free Pascal the problem is the application uses Windows API's to perform tasks such as serial port communication etc... Is there a msdn for linux users or a book covering how linux works internaly if there are apis.
I am very confused.
Well, it's sad to say but if your code in very Windows-dependend (not VCL depended!) then probably it'll be faster to write the application from the begining rather then porting it.
But if it's only serial port matter then give a try to multiplatform SynaSer library, find it here: http://synapse.ararat.cz.
hope this help :)
Robert Love has a book on Linux Systems Programming - that will cover this area and Love's books are generally good, so it is worth looking at.
It's not entirely clear from your question, but if your concern is that there are specific calls to hardware controlling functions in your Windows application that make it difficult to port I would suggest that is a misplaced fear. Both Windows and Linux operate on the principle that the application level programmer should be kept away from the hardware and that all that should be handled by the operating system kernel and only be accessible to applications via system calls. As the kernels of different operating systems face similar demands from users/applications, they tend to have system calls that do the same sorts of things. It is necessary to match the system calls to one another but I can see no reason why that should be impossible.
What may be more troublesome is that your Windows application may rely heavily on the Windows executive's windowing code/API. Again finding analogues for your code is not impossible but is likely to be a bit more complex e.g. in Linux this stuff is generally not handled in the kernel at all (unlike Windows).
But then again, your code may be written against a portable toolkit/library like Qt which would make things a lot easier.
Good luck in any case.
If the program contains GUI code you must use linux libraries like GTK/XLIB in order to create windows, forms, buttons, etc...
Windows specific functions (like EnterCriticalSection, WaitForSingleObject or _beginthreadex) must be replaced with equivalent linux api functions (a nice tutorial can be found here:
"www.ibm.com/developerworks/systems/library/es-MigratingWin32toLinux.html") or you can use libraries such as w2lpl or wine
A useful library for this kind of problems i've found at http://www.adontec.com/windows-to-linux-port-library.htm
I've had great experiences just using WINE. (https://www.winehq.org/)
You don't really port your app at all. You just make sure it doesnt violate some of the basc constraints of WINE and just run it as is. WINE (though is says it is not) is an emulator of the windows API's and will just do the translation for you. It's pretty complete in its coverage of the API's.

High-level language for developing applications on Linux

On Windows I've been using C#/.NET to develop both quick and simple CLI utilities as well as big WinForms/WPF applications. Visual studio played a big part in this choice but also the language and libraries allowed me to program wide range of applications without much hassle.
I'm now looking for a similar language, or more languages, on Linux. The best choice for GUI, multi-platform applications seems to be QT, usually with C++. For console utilities the best choice seems to be some scripting language like Python. However, C++ isn't a high-level language like C# and many tasks are unnecessarily more complicated (since usually I don't look for high performance in GUI applications) and scripting languages are slower and have a higher startup time.
So, what are your languages/libraries of choice when developing applications for Linux, both ten-minute utilities and large complex GUI systems.
After a 13 year rollercoaster ride through C, C++ and Ruby, I moved to Smalltalk (Squeak and Pharo) for all my development - web, scripting (just starting here), and desktop GUI apps.
Trust me, no one was more surprised than me, but Ruby got me hooked on dynamic languages, and combined with Smalltalk's live environment, I am high on OO Koolaid. If you've never experienced it, check out this screencast: http://www.pharocasts.com/2010/02/programming-with-live-objects.html
Warning - although the language is beautifully simple, it will take a while to wean off of many unnecessary and complicated, but cherished, distractions e.g. files, databases, compile cycles, etc. Luckily the community is very friendly and extremely helpful.
Also, Squeak/Pharo run on top of a VM which works in (at least) linux, windows, and Mac, so you can develop (and share) anywhere.
Have a look at Monodevelop, It is C# and offers similar functionality as the one you are used to. And above all: it comes from the same company behind C#.
As you mention: Qt is also a possibility and one I've been using extensively. Of course, you will need to develop in C++ then. The tool you want to look at is qt-assistent.
You might be interested in wxwidgets,
http://wxwidgets.org/
regards,
/t
I use python and gtk to develop GUI applications.
With glade as UI editor you can quickly setup your application.
Doing the same thing with python/Qt(or whatever Graphical library you want) should be easily doable as well.
See here : http://docs.python.org/faq/gui.html
Python can make linux system calls; use
import os
os.system("yourFavouriteSystemCall")
Additionally, PyQt4 gives you simple access to the GUI framework Qt4. This could be a good bet for your needs.
Another option is to use QT or Wx with Python or some other scripting language
You can either use QT with Python, or Mono since you already have experience on .NET.

Is there a Core Linux API analogous to Windows WINAPI, in particular for creating GUI applications?

I'm moving from windows programming (By windows programming I mean using Windows API) to Linux Programming.
For programming Windows, the option we have is Win32API (MFC is just a C++ wrapper for the same).
I want to know if there is something like Linux API (equivalent to WINAPI) that is exposed directly to the programmer? Where can I find the reference?
With my little knowledge of POSIX library I see that it wraps around part of Linux API. But what about creating GUI applications? POSIX doesn't offer that. I know there are tons of 3rd party Widget toolkits like gtk, Qt etc. But I don't want to use the libraries that encapsulates Linux API. I want to learn using the "Core Linux API".
If there are somethings that I should know, please inform. Any programmer who is familiar with both Windows & Linux programming, please map the terminologies of Linux world so that I can quickly move on.
Any resources (books,tutorials,references) are highly appreciated.
I think you're looking for something that doesn't exactly exist. Unlike the Win32 API, there is no "Linux API" for doing GUI applications. The closest you can get is the X protocol itself, which is a pretty low level way of doing GUI (it's much more detailed and archaic than Win32 GDI, for example). This is why there exist wrappers such as GTK and Qt that hide the details of the X protocol.
The X protocol is available to C programs using XLib.
What you must understand is that Linux is very bare as to what is contained within it. The "Core" Linux API is POSIX and glibc. Linux is NOT graphical by default, so there is no core graphics library. Really, Windows could be stripped down to not have graphics also and thus not have parts of the win32 API like GDI. This you must understand. Linux is very lightweight compared to Windows.
For Linux there are two main graphical toolkits, GTK and Qt. I myself prefer GTK, but I'd research both. Also note that GTK and Qt exist for Windows to, because they are just wrappers. If you go take a look at the X protocol code for say xterm, you'll see why no one tries to actually creating graphical applications on top of it.
Oh, also SDL is pretty nice, it is pretty bare, but it is nice if your just needing a framebuffer for a window. It is portable between Linux and Windows and very easy to learn. But it will only stretch so far..
Linux and win aren't quite as different as it looks.
On both systems there exists a kernel that is not graphical.
It's just that Microsoft doesn't document this kernel and publishes an API that references various different components.
On Unix, it's more transparent. There really is a (non-GUI) kernel API and it is published. Then, there are services that run on top of this, optionally, and their interfaces are published without an attempt to merge them into an imaginary layer that doesn't really exist.
So, the lowest GUI level is a the X Window System and it has a lowest level library called Xlib. There are various libraries that run on top of this one, as you have noted.
I would highly recommended looking at the QT/C++ UI framework, it's arguably the most comprehensive UI toolkit for any platform.
We're using it at work developing cross platform apps that run on windows, osx and linux.
It also runs on Nokia's smart phone Operating System Maemo which has recently been merged with Intel's Moblin Linux OS, now called MeeGo.
This is going to sound insane since you're asking about "serious" stuff like C++ and C (and the "core linux API"), but you might want to consider building in something else. For instance:
Java Swing (many people love it! Others hate it and call it obsolete)
Mono GTK# (C# or VisualBasic or whatever you want, lots of people say it's pretty cool, but they're not not that many people)
Adobe AIR (ActionScript, you might hate it)
Titanium (totally new and unproven, but getting a lot of buzz in the iPhone world, at least)
And many other possibilities, some of which let you work on multiple platforms at once.
Sorry if this answer is not at all what you're looking for. The "real" answers on Linux are "pick a toolkit," which is also no answer at all :)
Have a look at Cairo. This something roughly similar to GDI+ and is under the hood of some of of the few usable GUI programs for Linux i.e. Firefox or Eclipse (SWT). It wraps most the natsy and ancient Linux stuff for you into a nice API that runs on most Linux installations without locking you into a entire subsystems like GTK or QT.
There is also the docs for the two different desktop platforms: Gnome and KDE that might help you down that road.

J2ME development and native API

Is it possible to write a mobile application with J2ME and whenever we want to implement a functionality not offered by J2ME call native mobile API ? (kind of like what is done with .NET, whenever you need something not provided, you just call the Win32 API from the .NET platform).
While JNI is not officially supported in J2ME, the Symbian implementation of J2ME obviously uses something very similar.
Since most J2ME APIs have a corresponding Symbian OS C++ API, what Symbian did (a lot) is develop adaptation layers between the 2.
Between that and the new modular architecture of the IBM J9 virtual machine (from Series60 3rd edition feature pack 2 onward), it is technically possible to add a new API to the virtual machine without actually needing to recompile most of a handset firmware.
However, third party developers simply are not allowed to do it without a lot of help from the handset manufacturer.
A loopback socket connection is the solution that people have tipically implemented to transfer data accross the language barrier. Large-scale deployment is not the easiest task, though, as you technically need to install 2 applications on the device. Once you understand the threading model of the Symbian J2ME implementation, you also realize how ugly and inefficient a hack it is.
When you reach that kind of issue, it's time to learn Symbian OS C++ and do it right.
No. That's not possible with Java ME.
Only sort of. Actually it is possible but not directly. You can write a native server that listens on a local socket and send requests to it from your Java MIDlet. Someone even released a framework to do this called MIDP-JNI (as opposed to real JNI). Obviously the form of the solution imposes some limitations on what you can do with it but it isn't actually impossible.
Be aware that using this approach can make your application much more complex to debug.
If you are specifically looking out for Nokia/Symbian, then APIBridge http://wiki.forum.nokia.com/index.php/J2ME_API_Bridge_Interface could be a solution. Typically it is the 'official' version of 'native server on local socket' kind of thing. The APIBridge is 'extensible' & you can write your own 'plugins' for your suitable 'low-level' task.

Does anyone have information about Linux Support in the upcoming version of Delphi?

I need this info to decide on what I am going to do about my platform support of my systems in the coming year, but can't find any real info on that. Maybe someone has some just released information.
Thanks in advance.
There are four projects on the Delphi roadmap:
Delphi Weaver (Firebird support, enhanced RTTI, Windows 7 API)
Delphi X (Cross-platform)
Delphi Chromium (Quality)
Delphi Commodore (64-bit compiler, better multi-threading support)
You are looking for Delphi X, but it is unknown when it will come out. Delphi Weaver will be the next Delphi version.
This is as much as there is publicly available. Marco usually is well informed. But there are no release dates for the version.
Project Weaver
Focused on User Experience (new IDE Insight, Touch support),
Connectivity, improved Documentation,
Team Productivity, DataSnap with HTTP,
REST server, .NET Proxies for
DataSnap, Callbacks supported,
dbExpress with native Firebird
support, Aspect Oriented Programming
support, Subversion integration,
Windows 7 and Direct2D support, SOAP
1.2 clients, enhanced RTTI
Project Delphi “X”
Cross-platform support for MacOS and Linux, server and clients on Linux
and Mac
Project Chromium
All about developer productivity, Pascal code formatter,
documentation for the ToolsAPI, new
Databinding model, integrated DB tools
Project Commodore
64-bit Windows, compiler + RTL + VCL, multicore support, parallel RTL
Future (far)
Cloud computing, Web 3.0++, beyond RIA, Devices, sw appliances,
secutiry, compliance
Beyond the Beyond
Functional programming, declarative programming, natural
input, more platforms…
Nothing official from Embarcadero, but I think around 2010-2011 based on:
Embarcadero's CEO Wayne Williams said in interview with The Register:
Williams says cross-platform is now a
higher priority than a 64-bit
compiler, though both are planned, and
that we will see the first
cross-platform release next year.
Beside Robert Love commented at his blog which was about next Delphi versions:
Nothing was set in stone. These are
current plans and they may change.
Time frames where avoided, but one
comment was made in Q & A... They did
not see anything on this list taking
longer than 2011. So 2-3 years may be
practical since time frames were
really avoided, I would not plan on
anything right now.
We at twinforms provide support for Mac and Linux development using the current Delphi versions (for Linux and Mac, you need to compile the source using FreePascal). Have a look at the screencast that shows how to develop a cross platform application using Delphi and FreePascal - http://twinforms.com/products/wxformsdelphi/screencasts.php
A few things to keep in mind about Delphi forcasting:
At DelphiLive! Nick announced that they changed the way they are doing development now. Previously everyone was working on the next release. This made it harder to get bigger changes done in time and done well. So there would be one "code named" version they were working on, and that was it.
Now there are multiple code named projects that are not necessarily attached to a specific release. So for example the list of code named projects that everyone provided here isn't necessarily each a different release of Delphi. They will take whichever projects are "ready" when they have a release coming and include those.
If you want more information about the road map, you can check out a series of videos I shot at DelphiLive! or the DelphiLive! Recap and Product address.
As far as when we might expect the next Delphi release, I wrote a blog post about that based on information provided at DelphiLive! as well.
If you are going to use this information to plan your Delphi purchases, and you don't currently have Delphi 2009 then buy Delphi 2009 now (at least by Aug 24th). They have a great promotion going on, and you can get software assurance and then you will get whatever new versions come out in the next year.
Delphi 2009 is a fantastic release and you will want to come up to speed on generics and Unicode now so you can take better advantage of them in the next releases.
In Stack Overflow Podcast #61, Miguel de Icaza talks a lot about his work on Mono and briefly mentions Delphi, so one might speculate that any cross platform support is going to be built around Mono.
They tried this before with Kylix. Let's hope history doesn't repeat itself here.
The last thing we need is more proprietary development applications.

Resources