Data is stored in SWX files, that is read natively by Flash Player as "objects".
Can the client request the server to update/modify SWX files, much like a MySQL database? How? SWX-PHP?
You would have to read SWX files on the server side. This would propably be quite hard to do, and not very practical.
You might consider storing your data in a database instead (for instance MySQL) and access it using for instance SWX-PHP services.
No.
Technically, data isn't stored in SWX files; SWX files are SWF files that follow a certain specification. There are some good definitions on the official web site. In SWX-RPC, the SWX file is the implementation of the Remote Procedure Call protocol involved, and the protocol is usable via an SWX service wrapper, which shouldn't need to be modified by client code - if you need to modify it, why?
What's stored in the SWX file is the actual code, in the Flash Player native format, for example (in SWX-RPC) to handle the interaction with the underlying service gateway.
What you probably want to do instead of modifying SWX files is have a method for producing the SWX files you need for your interaction with the service gateway. Usually, a new SWX will only be necessary when the service interface changes. If you want SWX files some other reason than service interaction, feel free to comment.
For SWX-RPC via PHP, the SWX-PHP site has good Getting Started examples.
Related
I'm building a streaming app similar to pandora. However right now I'm storing all my files on http and accessing them with urls. Is there an alernative to this because all the files are in the public html folder? For example how does apps like pandora or spotify pull files off their servers. I'm new to web severs and not sure where to ask this question. I have a centos server on vps hosting with apache, MySQL, http, ftp.
You just need to provide the content as a bit stream rather than a file download. The source of that data to send as a stream can be stored as binary data in a BLOB column in a database or as a regular file on a non-public part of the file system. It really does not mater which one you use.
Storing them in the database gives your app a bit easier access and makes the app more portable since it is not restricted the file system level permissions.
The fact you currently have the files in a public folder is not really that critical of an issue since you are making them available for download. You would just need to make sure you have an authentication requirement if you want to restrict who can access them.
What is the best way to create forms (textfields, checkboxes, radio buttons, ...) and handle the data after the user's input?
Just use web components as dart's web ui?
http://www.dartlang.org/articles/web-ui/
http://www.dartlang.org/docs/tutorials/web-ui/
edit: Lets imagine the following example application: I would like to create an online quiz/test.
First the user has to register
Data will be stored in a textfile or in a database
User can log in and play an online quiz or do an online test.
For that quiz/test i need to evaluate the input with the predefined correct answers
Here's a high-level answer to your question.
To handle data on the server side you can use the HttpServer class to start a web server. See this article.
To store data in a flat file you'll need to use the dart:io package to open a file and write to it. See the documentation for File.openWrite().
To store data in a database there are packages available on pub for mysql and postgresql.
There are two different ways to implement the client side. The traditional way is to use templating to generate html with the data in input elements within a form tag, and then handle the form submission in your webserver.
The modern way, that is the focus within the Dart community, is to write a single page app, which uses HttpRequest to read data from and send data to the server (usually using json).
On the client side, you could retrieve data from server (e.g. as JSON) and use that to build a form. This seems like a good fit for a web component as elements can be dynamically added based on received data.
The component would be bound to the model so you can serialize the model object to JSON on submit and send it to server on submit or just send it as standard HTML form.
The server side of the story is less clear, there are no production quality web server libraries that I am aware of, but you could take a look at DartExpress as an example, or Stream, and there are others, more or less complete. Anyway, you would have to extract the POST payload from HttpRequest (if sent as JSON) or use the form data which is also accessible via queryParameters property - please note that this is Dart:io.HttpRequest class, not Dart:html.HttpRequest, and it is available only on server side.
The mentioned server frameworks simplify this part a bit.
Using Web-UI would be a good choice. The todomvc application illustrates nicely how to dynamically capture the input from a user. Processing on the server side is wide open as far as choices go. Dart does have server side capabilities, and you could use some of the existing libraries to accomplish what you want.
Another way that you can process the information server side is to comunicate with the DB directly using a REST based web service like CouchDB. Cloudant offers such a service and allows you to communicate directly to the DB from the client, providing you can overcome the Same-Origin-Policy. There are 2 ways to do this. Enable CORS on the CouchDB instance, or host your application on the server that has the DB, which is also possible with CouchDB.
Dart serverside also supports websockets, so you can easily deliver the user provided data to the server with web sockets, and then do whatever processing you like on the serverside.
One other option I can think of would be to have the information processed and saved in the local browser. You can access the local DB or local browser file system from the Dart client, and keep everything local. For statistics, you can have the client update a web service of your choice.
i need to upload files from a FTP location into marklogic. please guide me on this
MarkLogic doesn't allow accessing external FTP locations from XQuery, like it allows HTTP calls. Nor does it provide FTP servers, like it provides WebDAV servers.
You can however easily put a mediator in between that accesses the FTP instead, and use other means to upload the document into MarkLogic. The latter can be done through a WebDAV App Server that you can create using the Admin interface, through the built-in REST api in MarkLogic 6 ( http://docs.marklogic.com/REST ), or through custom code like Corona ( http://developer.marklogic.com/code/corona ).
If you write the mediator in Java, you can also use the Java API ( see Java API tab at http://docs.marklogic.com/ ).
HTH!
We have a app that needs documents from a shared folder that we running an etl on to get into marklogic. You can do this a number of ways. If you are able to I'd amount the drive on the marklogic box and then read from there. IF that doesnt work see if you can make those files viewable from an http-get requested. IF that doest work then you might want to make a web services.
I personally would avoid WebDav unless you absolutely need it.
Is this a one-off, batch , or continous job ?
If one-off or batch then I would suggest using a script to FTP the files to a local disk then using mlcp or RecordLoader or xmlsh to push them to MarkLogic.
If this is a continuous job then a custom Java app is probably the way to go.
Do realize that FTP is a horribly sensitive protocol .. it can fail in so many ways and takes special port openings etc. It was designed in the 80's before firewalls, NAT and such.
Getting FTP to work reliably irregardless of MarkLogic is a black magic art in itself.
If its possible to use another protocol then FTP that would be ideal.
Say scp or rsync or http.
My application generates a complex calendar at runtime, so any user has tasks for a specific date/time and every task has a description + some properties.
I have been requested to "publish" this calendar as webCal. I have no knowledge about webcal, anyway I wonder if anyone of you has already tried for it and can write his comments or suggestions.
One issue is "how to identify a user"? Since I have a multiuser calendar, how do I publish individual calendars for every user?
I think to a kind of Delphi service application that runs continuously, publishing the calendar.
It depends on whether your users need write access to their calendar.
I once wrote a simple (command-line) utility that exports a single (.ics) calendar file. If changed, it uploads the exported .ics file to a web server, where it can be picked up by calendar clients (e.g. Google Calendar, iCalendar, Sunbird, Outlook). Publishing for different users can easily be done by uploading the .ics file to a different folder for each user.
Next, I scheduled this utility to run regularly. Of course, you could have your Delphi service do this regularly.
Many calendar clients understand http:// URLs as well as webdav:// URLs. Authentication can be arranged by using one of the regular HTTP authentication schemes. Of course, you’ll want to use SSL to secure things.
The only limitation of this is approach is that the resulting calendar is, in effect, read-only.
If you wanted to provide write access, you’ll need a real webcal server. A real webcal implementation would mean supporting the webdav protocol (which itself is an extension of the HTTP protocol) on the server, and picking up the changes from your Delphi service. Either that, or writing a WebDav/CalDav server in Delphi (e.g. using the Indy TIdWebdav component by extending the TIdHTTPServer component, since Indy doesn’t sport a TIdWebdavServer component).
You’d have to process all the webdav-specific commands yourself (using the OnCommandOther event), according to the WebDAV specs. This question about writing a WebDAV server may provide some pointers...
Alternatively, you could use a 3rd-party webdav server, and pick up any changes from your Delphi service.
Simple. I created a LINQ-TO-SQL Entity model, created a website, added a Data Service (*.svc) to this site and made sure it works by writing a simple .NET console application. The service works fine and cannot be modified.
Now I'm going to write a Delphi application (2007) for WIN32 which will have to call this data service. And while Delphi has no major problems importing a SOAP service, it can't import this service since it provides no WSDL...
So, two options. I could figure out how to generate a WSDL based on this data service or I'll have to find another way to consume this service. (Or just give up, but I hate to quit this challenge.) So, any advise?
ADO.NET Data Services are REST services. They are not SOAP WebServices and I don't think REST uses WSDL. You can call REST services from Delphi using HTTP GET/PUT/POST/DELETE. You could use Indy's TIdHTTPClient. See http://msdn.microsoft.com/en-us/library/cc668786.aspx for url examples. The results are in the Atom format, which is a XML format. You could parse it with TXMLDocument. They can also return JSON.
Maybe you can use the project Jedi "url grabber" components to consume the service. I have managed to get live share data using these in the past. I do not know exactly how your setup works, but maybe these can be helpful.
http://www.delphi-jedi.org/
You should also look at synapse, a small easy to use library which works well with REST. The latest version, which can be downloaded via SVN, works well in Delphi 2009.