Delphi - Websockets and uniGUI - html

I am really a beginner in delphi, as the client request the project to be done in delphi, so I have to ask to get some help as possible as I can. This project will be involved in HTML5 and websockets as well, so there are some questions I need your advices.
Sorry let me explain more, this application have two parts mainly, one is HTML5 client web app (this app will be loaded from web server, and run locally in browser), and the other is its service located in server. The HTML5 web app is doing some product editing job, as well send its final output to server, during this process, there will be many communications between client app and service, and I planed to use Websockets.
I did plan this application in HTML5 and Node.js before, but as client send request to ask for the Delphi XE as primary development tool also it will be compiled to DLL (ISAPI, have to be) at last. For consistency of UI, I also was required to use uniGUI (http://www.unigui.com/demo)for Delphi. Now I have these questions:
Is there any other way to do this application with HTML5 as web front exclude uniGUI in Delphi?
What good libraries support Websockets in Delphi?
What book you can recommend me to read, as I don't know Delphi at all.
Thanks.

1: yes, make a "single page app" (static html + js) and communicate with server using xml or json.
At least with indy 10 it is quite straight forward to implement static file serving (response.contentstream := tfilestream.create(sfilename) or something like that)
2: yes, if you search for it on google you will find some :)
WebSocket server implementations for Delphi
btw, I'm busy with delphi socket.io implementation, which makes it easier to use websockets instead of plain low level tcp-like websockets itself

Is there any other way to do this application with HTML5 as web front exclude uniGUI in Delphi?
First concept : HTML5 applications are a bunch of HTML files and JS's wich can be processed by browsers.
Second concept : You need an application that can bind HTTP queries and return files from the first concept.
Third concept (paradigm) : With first two concepts, a third concept arises. Dynamic HTML. What is dynamic HTML? HTML that generates at runtime at the backend server and/or at frontend with JS.
Solution :
Yes, with Delphi as a backend server you can manipulate and return HTML5 views, if you know (MVC paradigmn for example) you can program an HTTPServer application that binds HTTP request from network and responses your HTMLs and JS.
What good libraries support Websockets in Delphi?
You need a multilayer library. The best library I know is mORMot. mORMot is like a swiss razor for Object Pascal.
You can create an HTTP server with websocket published interfaces. mORMot's Site
What book you can recommend me to read, as I don't know Delphi at all.
I have more than 10 years with Delphi and Free Pascal and I didn't read a book at all. But I read a lot from internet and a lot of computer architecture and another languages like C and C++.
If you like Delphi there are tons of documentation via Internet. I cannot recomend you a book because I will lie you.

Related

Java applet on website?

I have been assigned the task of creating a MySQL database which I will host on a server and create a website for a product my friend is selling. The database will store site information such as order information. I have little knowledge of HTML so my solution would be to use a website creater (weebly) and design it. There are then two routes I could take for accessing my database. I am limited to what I can do because all I know is java, c#, and c++. I figured I could create a java applet (which I could easily do) and embed the code of the code of the applet in an applet tag in my weeblys site. There is functionality to embed HTML code in the designer. Using the applet, with my java knowledge I figured I could easily access and insert/extract data from my hosted database. I know that java applets require the JRE and Java browser extension to run, this made me a little hesitant about doing this. Would that be a fine way to approach this project? I need my website to access my database, should I do this in java, or in php. What would be the correct thing for me to do?
What you're describing doesn't sound like a good idea.
First of all, Java Applets are an obsolete technology. The Java plugin isn't nearly as common now as it was in 1998, and security people have been advising that people disable it for years due to a long string of holes in its security model.
Second, it sounds like you're planning on giving the applet direct access to your database. This would require that you make your database externally accessible, which will make access control and data validation difficult.
The standard way to implement this sort of thing is to write a server-side web application (you can use PHP, any one of various server-side Java systems, ASPX, or one of many other platforms) that interacts with the database and generates web pages on demand. The database is hidden behind a firewall, the web application code handles access control and data validation, and the client doesn't need to run unsafe code.

application design: Scala + HTML5

I'd like to implement an application with Scala and HTML5. My idea was to create a "local" client-server architecture: Scala handles the calculations and generates HTML5 as a GUI.
To my mind there are two possibilities
Use a Java/Scala framework that allows embedded HTML5. SWT for example has a browser widget. JavaFX seems good, too.
Distribute the program with a server and run it in a browser on localhost.
It would probably be most convenient to require an internet connection and forget about the localhost. Unfortunately an offline mode is necessary.
Now I would like to know how to get this right:
The first option seems easier to implement but I wonder: How can I communicate with Javascript without the HTTP protocol ?
The second approach was just an idea. Have you ever done something like this ?
If you've got advice or know a good framework please go ahead.
UPDATE :
I've just had an interesting idea: Could I use nodejs to create something like a server-server architecture ?
Right now the communication between Scala and Coffescript seems like the most problematic part. I still wonder how I could initiate an update from the Scala side of the application. A HTTP Request is a nice way to exchange data. Sadly to my knowledge in "standard" Coffeescript there would be no event hook to listen to server-side HTTP messages.
I've thought about using nodejs to listen to the server-sent data. Is this a good idea ?
With regards to the second option, you may wish to investigate the Play! Framework or Lift. They automate a lot of the work required to make a web application in Scala, including handling AJAX requests.
Although I haven't tried packaging either for local use, there was an earlier Stack Exchange question about packaging Lift which might be relevant. It should be possible with Play! as well.

Web Application Framework - HTML5 with mobile devices JavaScript support

I searched for Java based web application frameworks the last few days. I have to build a Java EE backend and a HTML5/CSS3/JavaScript frontend which can be accessed with multi-touch capable devices. So I will need modern JavaScript frameworks like Sencha Touch.
My backend should be built upon with Java EE, Hibernate and MySQL. I have two kinds of data transfer: AJAX / JSON so the page does not need to be reloaded and pages and normal pages which reload the page by sending a form with POST (or do you think to have more the feeling as a application I should do all stuff with AJAX/JSON?).
I found several web application frameworks:
JavaSever Faces
Apache Wicket
Spring MVC
handle it only with jar files for JSON (and REST)
Google Web Toolkit
What do you think will fit best? Perhaps you can exclude one of them, that would also be great, so I can take a closer look at the remaining technologies.
Best Regards, Tim.
Interesting question.
Concerning exclusion: If you use a JS framework like Sencha Touch in the frontend I don't see the sense in using something like GWT which is for frontend-code generation.
I would probably stick with a more lightweight framework like http://www.playframework.org/.
You get your data from the backend and then hand it via JSON over to your frontend code i.e. sencha, sproutcore, cappuccino, gwt or what you choose to use.
Let me know what you choose :-)

fastest public web app framework for quick DB apps?

I'd like to pick up a new tech for my toolbox - something for rapid prototyping of web apps. Brief requirements:
public access (not hosted on my machine) - like Google's appengine, etc
no tricky configuration necessary to build a simple web app host
DB access (small storage provided) including some kind of SQLish query language
easy front end HTML templating
ability to access as a JSON service
C# or Java,PHP or Python - or a fun new language to learn is OK
free!
An example app, very simple: render an AJAXy editable (add/delete/edit/drag) list of rich-data list items via some template language, so I can quickly mock up a UI for a client. ie. I can do most of the work client-side, but need convenient back end to handle the permanent storage. (In fact I suppose it doesn't even need HTML templating if I can directly access a DB via AJAX calls.)
I realize this is a bit vague but am wondering if anyone has recommendations. A Rails host might be best for this (but probably not free) or maybe App Engine, or some other choice I'm not aware of? I've been doing everything with heavyweight servers (ASP.NET etc) for so long that I'm just not up on the latest...
Thanks - I'll follow up on comments if this isn't clear enough :)
C# or Java,PHP or Python - or a fun new language to learn is OK
How 'bout Javascript? This place hosts server-side Javascript ticking most of your other boxes. So you can use the same language for client- and server-side stuff (which I find very handy). [Caveat: I only played with their service; seemed cool though. I use Javascript on the server-side on IIS and on Tomcat (via Rhino).]
For something bleeding edge - A new version of spring roo was released recently. With it you can create a great web app in 10 minutes. Supports GAE and GWT...
http://www.springsource.org/roo
xataface is a quick way to make a front end for a MySQL database.
It makes it easy to start an app quickly with dynamically created views and then you can change it to something very customized to your needs.
It simply needs a server service with MySQL and PHP.

Are There Any Other Web Programming Languages That Can Be Used Without A Framework Aside From PHP?

Python needs a framework, so does Java (for the web). I don't know much about Ruby or Coldfusion. But is there another language out there for the web that can stand alone as it is without a need for a framework or without strict adherence to a design pattern (MVC and the likes) aside from PHP? BTW, the statement that Python and Java needs a framework to work with the web came purely from my readings on articles and books; I might be mistaken.
EDIT : by frameworks I mean those like Django, Pylon, Spring, JSF, RoR etc
I don't think any of those languages "need" a framework. My understanding is that as long as the webserver has a way to talk to the language interpreter you are in business. Hence all the apache modules for the various languages. The framework is just to make common web development tasks (like accessing a database) easier.
You could just as easily write without a framework in any language you can connect with a webserver.
Simplified, a web server is like a function:
HttpResponse ProcessRequest(HttpRequest request);
And since request and responses both are strings, it's more like:
string ProcessRequest(string request);
So, any language that can take a string as an argument and return another string should be fully capable of acting as a server side language ;)
Perl does not need one : mod_perl
Python does not need one - mod_python.
Neither does ruby - mod_ruby.
Check this.
very unconventional..
C++ Server Pages
Python with WSGI (mod_wsgi) and Ruby with Rack (mod_rack) can be used to write web apps, with only a small stub needed to catch the request from the web server.
The last production C program I ever wrote was a cgi app. If you can write web apps in C, you can write them in anything.