ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have an application written in C++ running on a Linux server. I would like to be able to connect a web browser to that server and have the web page display the status of the application and allow configuration settings to be displayed and modified.
The program will need to display counters which could be updated as often as every second. Drop down menus, progress bars and meters would also be nice.
What I'm looking to learn from this thread it where to start. I have some programming experience (mostly C) and have done some work with Qt4 and C++. What language should I learn next? What tool kit or library should I use?
I'm not no expert but one possibility is php, I'm not really sure how you would do what you want to do, but I'm pretty sure it is possible. Ruby and Python are also options. Depending on the complexity of what you want to do you could even write a CGI program in c++. In any event you will need to be familiar with HTML, and probably javascript.
I'm not really a web developer, but I hope that this is helpful to you.
Python has a built-in webserver. I have used it to implement a single-purpose function distantly related to what you seem to want. I implemented it as a single .py file of 72 lines, including white space and my custom functionality.
If you combine that with Django you have a pretty powerful tool that can get to about anything on your server system.
The main qn is, do you want it all in one ie have the C++ program have a web interface as part of its code, or will it write to files that a separate prog eg in PHP can read etc.?
Either is do-able.
When you mention counters and configuration settings, are the values behind these currently stored in text files, a SQL database, or something else?
Configuration settings are already in a plain text file and status values can be retrieved from the application through calls.
Assuming all of the information to be displayed is stored in an easily retrieved format (file or database), what tools could be used to write the web pages to display this information?
You will need to embed an HTTP server in your C++ application. Depending on your requirements, it may take as little as a hundred lines of code. However, the fast update rate suggests an AJAX application running on the browser client, and as I understand it, that implies producing XML on the server, as well as some storage of the javascript code on the server/application, so that adds some complexity. Embedded HTTP servers are becoming increasingly common, and last time I looked (not very recently), there were a number of open source packages targeting your type of application. It sounds like you want to export process variables from within the main part of your application, rather than data from files or databases, so I'm not sure how well most of the offerings will fit.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.