I've started working with delphi quite some while ago but I would say I'm still a newbie in all this.
So basically I tried creating REST Server, which can validate license keys. I got in working with Indy, but one thing bothers me. The GUI. The Server shouldn't have any kind of gui so it can work on any OS (Win, Linux, etc). Is there a way to make a REST Server without any GUI/FMX/VCL?
BTW: Working in Delphi 10.2.3 Professional.
Any advice is appreciated.
EDIT: I forgot to mention one thing: the server is supposed to run on an independent Data Center away from any user.
You can create the WebServer as a Windows Service.
You can use DelphiMVCFramework or any other Framework to create it.
With DMVC you can create console application, Windows Service, Linux daemon, Apache module (Windows and Linux) and IIS ISAPI (Windows).
With Intraweb you can also create Services.
Take a look at our mORMot Open Source REST framework, which works on Delphi but also on FPC/Lazarus.
FPC support ensures that you can target Linux with this free compiler. No need to upgrade to a newer version of Delphi Architect, which supports Linux, and is very pricey - and less stable (to my knowledge) since Linux support is quite new.
As you requested, the mORMot REST server has no UI part. You define your services as interface and class - like you do e.g. with DotNet - and you will have full JSON/REST support generated.
mORMot is used on production since years for very high performance and stability, hosted on both Windows and Linux. A version 2 is on its way, which would be even easier to use for new projects.
And you can create a Windows service or Linux daemon without using any third party framework. Delphi include everything you need. However, it is possible that third party framework will facilitate your programming. Don't forget you'll have to learn those third party framework.
Creating a Linux daemon service in Delphi
Creating a Windows Service in Delphi
In both cases, you can use the sample code you've found that make use of TIdTCPServer.
Related
currently I'm looking for an open source project that gives me the opportunity to install software easily. I prefer direct calls or access with a REST interface.
I thought that CloudFoundry would fits my needs but it is'nt so.
AppFog (https://www.appfog.com/product/) comes much closer to my goal. It allows me to install Drupal, Wordpress, PhpMyAdmin, NodeJS Apps and so on.
The conclusion is that I'm looking for an project that...
is open source.
gives that possibility to install, configure and
uninstall software
is extendable when a specific software not
available
is accessible with an interface like REST.
is "hostable" on my own linux server
I would be happy for all kind of hints and tips :)
Cheers Tobias
Docker is seems to be the next big thing in the PaaS world. There are dozens new projects that build on top of docker or supporting it. For example OpenShift and Apache Stratos support docker. So if you look at solutions based on docker you can find a solution for you needs.
Right now I'm using docker for hosting couple of Drupal websites with simple bash scripts to manage them. Nginx is used for web traffic routing
Docker is open source
Gives you ability to prepare and install apps
You can build what you need on top of it
It has REST interface
It is running on nearly all major Linux distros
Its relatively easy to learn and use
Has great community
Tobias,
Suggest you look at Apache Stratos:
100% open source
Easy to Get Up and Running
Highly extensible, flexible, expandable
Uses REST APIs
Runs on Linux (Ubuntu or SUSE)
Mature (version 4)
See:
Intro article -- "Why Apache Stratos is the Preferred Choice in the PaaS Space"
http://wso2.com/library/articles/2014/05/why-apache-stratos-is-the-preferred-choice-in-the-paas-space/
Apache Stratos Project site -- which notes that "Stratos PaaS is easy to get it up and running in quick time. A developer will be able to run and test PaaS framework on a single machine to try out."
http://stratos.apache.org/
Cheers,
Michael
OpenShift is what you looking for :
it is open source and free for 3 gears for ever.
gives that possibility to install, configure and uninstall software in openshift.redhat.com or in rhc client tools.
it is extendable when a specific software not available is accessible throw DIY(Do it yourself)
with an REST interface
is "hostable" on Fedora or CentOS .
It is really easy to setup throw Eclipse.
I had this thought experiment of installing an OS on a php server over http.
So, what I am asking: Would it be possible to build a VM player (using the server's resources) from a server language like perl, php, or python? Or is my understanding of servers and security lacking in a way that would show this to be impossible?
It's not as outlandish as you might think.
UeberHacker Fabrice Bellard (the guy who created QEMU, among many other notable achievements) recently did precisely that. He created a VM in Javascript. That runs a virtual Linux system in your Web browser:
http://linuxhelp.blogspot.com/2011/05/pc-emulator-in-javascript-run-linux-in.html
I have written a program in PowerShell that loops and checks stuff.
I would like to convert this into a Windows service.
I've created a Windows service (in Admin->Services) but I can't start it.
I'm pretty sure I'm missing the proper interface that the system needs to call into in order to start/stop/pause/etc the service.
I can find plenty of examples when it comes to doing it in VB/C#/MS-lang but nothing about how to do it using PowerShell. Is there any documentation (or preferably code examples) out there to help with this?
There are a few items at issue here:
Are you sure that you really need a service? I agree with the comments about using the scheduler for running periodic tasks. The scheduler can start tasks as Administrator.
Services call a special set of APIs to communicate with the Service Control Manager, so an ordinary program can't be used directly.
The Service Control Manager uses CreateProcessAsUser to start the service process, so you need to point the SCM to an executable binary, as opposed to a script.
If you can't use the scheduler (though I strongly encourage you to try), I suppose that you could write an executable binary that acts as a service. It would then execute PowerShell and your script on your behalf. I'm thinking something like the srvany program that used to be included with the Windows Server 2003 Resource Kit could bootstrap the service for you.
If you absolutly want to execute your PowerShell code into a service, I think you can write a C# service wrapper for PowerShell code.
You found examples of how to create a service with C#, and it's simple to call Powershell from C#. So I'am surprised that as small SrvAny oriented PowerShell does not exists yet.
My advice here, you better rewrite your code in C# as a service.
You can use the Compile Script into Service option of PowerGUI: http://documents.software.dell.com/DOC144271
I think what you are looking for is SrvAny.exe from Microsoft (I don't know that they support it any longer, but it has been around in the Windows 2000 Resource Kit for years. It will essentially turn just about any executable (.exe, .cmd, etc...) into a service. I have VBScripts running as quasi-services using Srvany.exe and it works on Windows 2003 and Windows 2008 (even 64 bit). It is a little limited in that it does not provide 100% service functionality (stopping a running script may be difficult) but if you now a bit about programming and the Windows environment you can adapt it to work pretty well (i.e. it will launch the program after server Restart/Startup as you would likely need from a service. There is some documentation with SrvAny.exe (although it can be a little obtuse and difficult to find). It is however Free and built for Windows so it should work for you.
I agree for simplicity that the Scheduled Task idea is worth thinking about as it is even more simplistic that srvany.exe
http://www.firedaemon.com/
Will allows you start littery anything as a service. There are also free alternatives to this application, that does the same.
I'm developing an iPad app that needs read-only access to an Oracle database.
Is there any way to do this? As far as I can see, the only options are using OCI, which requires a prebuilt binary in the form of the instant client (and not built for ARM), or OJDBC drivers. Both of these seem to be out of the question.
In my research I have discovered that libmysqlclient compiles for arm with minimal tuning. This is a stretch, but is there any possible way to use this to my advantage?
I have seen this product providing odbc connectivity through the use of a Windows gateway machine using the ODBC client libraries, but this solution really isn't an option for me at the present time.
Any ideas?
At the very bottom, there are only two libraries for accessing Oracle:
The OCI binary library.
The Java OJDBC Jar file.
All other libraries (such as ODBC, ADO.NET) build upon one of these libraries (usually on OCI).
There's no OCI library for the iPhone (or any ARM architecture as far as I know) and there's no Java VM to use OJDBC. So you cannot directly connect from the iPhone to an Oracle database.
So whatever your solution will be, it'll require an intermediate server (or gateway).
While I did end up using an intermediary server... I have since realized that this isn't strictly necessary. Direct access should be obtainable by using the OJDBC drivers directly on iOS using gcj to compile them for ARM. Since Objective-C is a superset of C, you could use JNI for communication to and from. Hope this helps anyone who comes here :)
Direct access to an Oracle database from iOS is not possible as of this moment. Exchanging data with an Oracle database by means of web services is fairly simple. You can use APEX for this, lean and mean.
I have project that I'm working on that is going to require a webserver. The webserver will be used to remotely control a presentation using a mobile device.
I see there are quite a few options out there and I'm wondering if someone could provide some recommendations.
My criteria include:
Portable, fits on a USB key
Easy to
run. A user can just click on an
icon, or ideally it would include an
autorun command.
Open Source. I would prefer something licensed under the GPL or similar.
Runs a dynamic server-side language. I see that most have PHP which works perfectly, but I'm open to other languages.
Cross platform if possible.
Right now I'm leaning towards XAMPP, but I would love to hear some suggestions.
XAMPP is perfect for this.
I recommend XAMPP, so I think you are on the right track.
Have not used this, but it looks like it would be right up your alley:
http://www.blackdot.be/?inc=apache/httpserveronusb
Supports perl + php by default.
From the page:
If you are a web developer I'm sure you have had that moment where you went:
"If only I had a web server handy right now!"
Then HTTP Server On USB is something for you! HTTP Server On USB is a fully configured web server that runs from your USB-Key. Plug it in and off you go!
It can be use to show of a website to a costumer, share files with your friends (both ways thanks to DAV) or simply impress people but acting all geeky!
Are you special and do you depend on exotic 3rd party module?
Just drop them in the module folder and edit the configuration file!
Features:
Management Application
Apache 2.2.11
mod_deflate
mod_ssl
mod_security
mod_perl
PHP 5.2.8
ActiveState Perl 5.10
Requirements:
Windows 2000, Windows XP or Windows 2003
256mb USB-key
I have had no luck with XAMPP Lite or USBWebserver. What is currently working really well is Server2Go. I could never get XAMPP to run and USBWebserver would not allow me to install Drupal or Wordpress.
With Server2Go, I was able to install Drupal 7 on the USB Flash Drive, however, only with SQLite. I did need to go to the php folder and copy and rename the production-php.ini file to php.ini. There is a php.ini setting that needs to be set for the MySQL DB to be recognized. It is running well with SQLite for Development purposes though.
LAMPPIX - looks like not up to date, but should do the job.
I would suggest Apache, pretty lightweight and has everything you'll need (PHP).