Is it possible to auto-update native JavaFX apps? - javafx

I'd like to have a JavaFX application with native packaging (Windows as well as Linux) where the user can click a button to update to the latest version of the app (or have the update take place automatically). This functionality doesn't appear to be built in. Is there some way to do it?

There is a feature request RT-22211 to allow self-contained JavaFX applications to be updated automatically. This feature request is currently scheduled for implementation for Java 9. In the meantime, take a look at the comments on the feature request which discuss various alternate mechanisms for auto-updating JavaFX applications.

Related

Meteor mobile build vs having a phonegap browser

Why is the difference between using a simple phonegap browser app pointed at your site vs using meteor's mobile build options?
a simple phonegap browser app pointed at your site
Not sure exactly why you would be ready to use this option, compared to a simple shortcut / link to your site, or even an "installable" Web App.
Anyway, since you point at your site, it means you require an Internet connection whenever you open your app, and you are limited by what a website can access to on your device.
meteor's mobile build options
It becomes similar to a native app (it is actually called a "hybrid" app), so you can use it totally offline, and you can access more device functionalities (file system, notifications, etc.).
Nothing really specific to Meteor here, it is rather why using a hybrid app v.s. a shortcut.
In the end, you should base your decision on your requirements:
Do you need to access your app while offline?
Is your app primary functionality accessing "real time" content that makes no sense using your app while offline? (like news, forums, etc.)
Do you need to access specific device functionalities, that are not accessible by a normal website?
You should have plenty resources on that topic on the Internet.
Your question might rather be: what is the difference between a standard hybrid app (typically built through Cordova / Phonegap) and one built through Meteor?
In that case, you are asking what Meteor brings specifically? (as it uses Cordova under the hood to build the app)
First of all, you have all advantages of Meteor framework for normal website (minimongo, isomorphic methods, etc.)
You also have by default the Hot Code Push functionality. You can also set it up on your Cordova / Phonegap app, but you will have to configure it yourself, whereas Meteor does everything for you.
Finally, you might benefit from Meteor packages that bring Cordova plugin + client code + server code, something unique to Meteor as it is a full-stack framework.

How to create modeless dialog with electron?

I want to create a modeless dialog with electron, but I found nothing about this topic in the official documents. Can anybody help me?
As it says in its Quick Start guide:
Electron enables you to create desktop applications with pure JavaScript by providing a runtime with rich native (operating system) APIs. You could see it as a variant of the Node.js runtime that is focused on desktop applications instead of web servers.
This doesn't mean Electron is a JavaScript binding to graphical user interface (GUI) libraries. Instead, Electron uses web pages as its GUI, so you could also see it as a minimal Chromium browser, controlled by JavaScript.
So, just use HTML, CSS and javascript! By instance you can use the dialog native element or any other library like Bootstrap, Vex, Bootbox.js, etc.

Using Vaadin Push to push server changes

I want to use Vaadin Push in my application. I am using vaadin 7.1.2 which has vaadin push built in. I have 2 question:
How to push the changes from the database on change in data in the database? How can I listen to the database changes? Is there any listeners in vaadin push which can be use?
Since I have many modules in my application I want to add push functionality to only selected modules. Is it possible to add push to only selected modules?
Thanks
Abhilash
Abhilash, what kind of persistence layer you are using?
Common Vaadin Container implements PropertySetChangeListener listener so you can register to and receive event for every DB change. But it will work only if you will change DB via this Container.
Well, external changes won't be noticed and no event will be provided. For this case it is a much harder to get noticed about these DB changes. You should implement kind of "middleware", which will handle all DB changes and also it will notify all registered listener.
To second question, I'm not sure what you mean with modules? Could you provide more information with examples?
How to push the changes from the database on change in data in the database? How can I listen to the database changes? Is there any listeners in vaadin push which can be use?
No, no silver bullet there.
Databases do not generally have an event-notification system to alert external systems about changes to the stored data. You need to code such behavior yourself.
Postgres NOTIFY
The Postgres database offers an unusual feature of NOTIFY where a client connected to the database server can be prodded from server-side code such as PL/pgSQL. The server-side code can ship an optional “payload” string to the client. The client-side database-connection implementation must be coded to accept such notifications.
If you have such a client, then you could do something like have triggers that fire when saving changes to certain tables, then use NOTIFY to tickle the client into querying the table name passed as the payload.
This is nowhere near standard SQL, and is a Postgres-specific feature.
Vaadin events
If the only source of changes to the database is within your Vaadin app, you could set up some kind of alert system within your app.
The ServletContext is required by the Servlet spec to represent your web app at runtime. You can get/set “attributes” as a way for the various threads and user sessions to communicate with each other.
You would need a way to track all your user sessions, as discussed here.
Taking a Vaadin-centric approach may not be practical if there is any chance of other sources of changes to the database outside of your app.
For more info on messaging between current Vaadin users, see the Broadcasting to Other Users section in Vaadin docs, as mentioned in this Answer to a similar Question.
Polling
One common solution is polling. Spawn a background thread to query the database, report findings, then sleep. Lather, rinse, repeat. Set the sleep time for the amount of time your users are willing to be out-of-date.
This kind of work is made much easier with a ScheduledExecutorService built into Java SE. Alternatively, Java EE offers an #Schedule annotation as discussed here, but I am unfamiliar with its usage. Either way, you are scheduling a chunk of code to be run repeatedly. By the way, never use the Timer class in a Servlet-based app or Java EE app.
I have used the ScheduledExecutorService successfully in a Vaadin 7 app running in Tomcat 8.5. Learn about the ServletContextListener as a place in your app to launch and shutdown your executor service. See my slides for my talk on the subject.
And be sure to never access the Vaadin user-inteface layouts and widgets from a background thread. Instead, always interact with the UI by calling access or accessSynchronously on the UI class for user-interface related changes or VaadinSession for non-user-interface related changes. Read the Accessing UI from Another Thread section of the Server Push page in Vaadin doc.
Push technology updates
Push technology has been a rapidly evolving field.
As I recall, Vaadin 8 may be much more efficient with Push than Vaadin 7, though I do not recall details. At the very least, Vaadin 8 may be using more recent versions of the Atmosphere library that powers Vaadin Push features. So if possible, you may want to consider migrating to Vaadin 8. Keep in mind that Vaadin 8 has a compatibility layer feature to make it easier for you to bring over Vaadin 7 code.
Most crucial, be sure to use the latest versions of your web container such as Tomcat or Jetty. The support for WebSocket in particular has had significant improvements over the years.
While perhaps not yet ready in practice, the Servlet 4 spec has major implications for the future of Push technology. The spec includes support for HTTP/2 and Request/Response multiplexing to help with server-side push.
Vaadin Push scoped to UI
Since I have many modules in my application I want to add push functionality to only selected modules. Is it possible to add push to only selected modules?
Enabling Push significantly alters your deployment situation, and so you are wise to carefully consider its use.
Vaadin’s support for Push is scoped to your subclass of UI. Your Vaadin app by default has a single UI object for each user, from a single subclass of UI class. But your are free to instantiate additional UI objects within your user’s session. The instances may come from your same UI subclass, or from additional UI subclasses you have authored.
This is precisely how the multi-window/multi-tab support works in Vaadin 7 and Vaadin 8: You instantiate a new UI subclass object and install it into the new web browser window or tab.
I am not sure, but you may be able to swap out a Push-enabled UI object for an alternative non-Push-enabled UI object within the same web browser window/tab. But I have not tried doing so, and I do not know if this is supported or recommended. Personally, I would choose to keep the same UI object installed for the entire life of the window/tab.

Is it possible to create web application using Qt?

How to create web application using Qt?
This depends on what you mean by "web application". If you mean an application that can show parts of a web page in its interface as rendered HTML, like a browser can...yes. Qt incorporates something called QtWebKit:
http://doc.qt.io/qt-5/qtwebkit-index.html
(Note: Back in the olden days it was Microsoft--I think--who first made an embeddable Internet Explorer control so that you could fetch a URL into the midst of some MFC or VB application and run a browser in the midst of your otherwise-form-based application. The event hooks for Microsoft's solution sucked, Qt's are much better.)
Anyway, this is great if you want people to install your application on their machine, where it fetches web data but takes advantages of native features to be richer than a browser could. But be careful because these days native apps have to be really outstanding to surpass the advantage of something that runs in a browser they already have.
HOWEVER If you are trying to use QtCore to push server-side content out and fulfill web requests, that'll be an uphill battle. You might find some related examples if you look hard enough:
https://web.archive.org/web/20100922075100/http://labs.qt.nokia.com/2006/12/20/whats-this-cgi/
Very few people use C++ (much less Qt) to generate web pages server-side. Yet there are still some doing it, even in pretty cool ways:
http://www.webtoolkit.eu/wt
...regardless, QtCreator will be no help in that kind of pursuit.
The functionality you are asking for does not exist within Qt itself. However, there exists (at least) one third party library that allows some of the Qt code for a desktop app to be re-used to a certain extent for serving up a web app:
http://cutelyst.org/
However, this does not magically allow you to write a QML interface with QML Widgets and have a visual interface accessible via a web browser.
What do you mean by "web application"? Is it a desktop app with web features? If so, yes Qt in general is very good for that.
If you mean a kind of server that outputs HTML, then you should use something else because you would have to reinvent many wheels to make it work.
You'd require to run or embed web server. It would be more whise to turn to a Apache Web Server or Apache Tomcat based approach. Otherwhise you'd run somewhat against the odds.
Consider also using some HTTP server library like libonion or Wt. Wt is close in spirit to Qt. However, you won't use Qt itself. libonion is lower level (and you may want to use browser-side Web frameworks like e.g. JQuery or AngularJS with it).
If you already have some Web server, you could consider developing some FastCGI application in C++.
You surely need a good understanding of HTTP protocol and of HTML5 & AJAX.
Since this is 11 years old, I thought I'd come here to tell you that it does indeed seem possible now that qt supports webassembly. The newest version, 6.4 (newest version as of today jan 31 2023), now offers support for webassembly and their website has various examples of apps built with qt that run in the browser.
https://www.qt.io/qt-examples-for-webassembly

How to block user using older version of my App?

I'm developing an application using flex/AIR and right now it changes all the time due to its beta condition.
What could be the best way to block all older versions activity and force the user to update the application?
Thanks.
Edit: This must be achieved without any server side language help (ie: php, java)
I think your best shot is to add an autoupdater to your app, and run it when starting your application. Check the Adobe AIR autoupdate framework. You can implement your logic (blocking the application, asking to update, closing it) after you have compared the versions if doesn't match.
This article might also be helpful: Adding autoupdate features to your air application in 3 easy steps (Actually it is a 2 Steps now).
You could create an entry method that checks the applications local version against the remote version number via a service you expose. If the local version does not match your newest version, don't allow the application to proceed. Instead, offer the download link, or automate the downloading/installation process based on your needs.

Resources