Web Interfaces for C++ Introspection?
Milo_Mindbender asks: "For a C++ application I'm working on I want to be able to pop up an interface to a class that will display all the 'tunable' parameters of the class and let me inspect/modify them, while the program is running. The catch is that I'm running on a minimal embedded OS with Open GL but no GUI library. Rather than porting a widget set or writing my own, I was thinking about having the application talk to a web browser, and then use the browser to display the GUI, take user input, and finally push the data back to the app. The classes have metadata that describes the public data locations/types so they can be accessed, but not being a web-wizard I'm not sure of the best way of generating the information I need to create the UI. My first thought is to generate HTML and push that to the browser, but it seems like there must be a better way than this, maybe someone has written a library specifically for doing this sort of thing? Any help/suggestions would be appreciated!"
Well, I'm a junior in college and a computer science major, studying things across the spectrum from kernels to compilers to recursive descent parsers to Turing machines and much of the stuff in between. I've had several jobs dealing with web or Intranet applications and embedded development. And I've never written a web server. I've never even considered it. I've written some pretty low-level CGI bits for C/C++ applications (parsing query strings and POSTs) and I've written some TCP/IP network communication bits, and I'm sure I could write a web server if I had to but... why should I ever need to? I've got Apache, I can look at other web servers like Tux, even IIS... and I have well-defined interfaces to these like CGI, and mod_perl, and things like JSPs for Resin. Write a web server "like everybody else?" I sincerely doubt that even one in fifty programmers have written them- and I'll even let you choose the definition of "programmers". Of all the nifty applications you could possibly imagine to write, why would you choose a web server?
The World Wide Web is dying. Soon, we shall have only the Internet.
You might consider a very minimal XML interface on top of a very very very simple HTTP server. Your UI could live on a completely different device on a completely different server... or on the same server in a different application stack. You could run your service on port 8080 or something if you didn't want to run it on 80 to prevent
You could display your state as a single XML document that is gotten at a single URL. Each setting could be manipulated by posting to a URL specified in the XML document. These sets of documents and post URLs could become a simple CGI set of interfaces you could describe for anything from webservers, application servers, or other web-aware C++ programs to hook into.
[signature]
The guy clearly knows C++ and is able to develop on an embedded OS which isn't an easy thing to do but yet can't write himself a simple web-server
Sorry, you've just given yourself away as an amateur. Every professional with two brain cells to rub together quickly realises that writing everything yourself is a non-starter, and that decent libraries can make you more productive than dozens of programmers who choose to write everything themselves.
I'm studying for a CS masters and a UNIX-based web server is the final project of our "Systems programming in C" course. It's an optional course though. Oh and BTW, fork() and the unix process model sucks as a parallellism primitive. I love Win32 threads and io completion ports :/
Have you looked at GLUI?
Powered by Web3.5 RC 2
Out of the 20 or so programmers I've known rather well over my life so far, about half have resorting to building their own web server (even in languages like Perl). They've done it for kicks (because, seriously, HTTP 1.0 is *easy*) or for practical reasons (like for the sort of problem you're having). Servers like Apache and IIS are for heavy loads and high reliability - but HTTP itself is a really simple protocol. Writing your own server should not only be reasonably trivial for someone such as yourself (from the sounds of it), but also an eye opener into a whole new way of approaching your problems. You said yourself that you never even considered it. Now consider asking yourself why not?
Hexy - a strategy game for iPhone/iPod Touch
Use Qt and declare your tunable parameters as properties. Writing a minimal server using Qt is trivial.