Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone, what would be the best language for a simple control panel (start/stop a process)?
I've seen most of the people use PHP and Perl, but I tough about doing a RPC Json server in C++ using this library: https://github.com/cinemast/libjson-rpc-cpp[^]

Would that be a good idea?
Posted

1 solution

Knowing more about the requirements would help a lot in deciding what to use as a server side and client side language + web server if you want a web app. The possible solutions to put together a webserver+webapp+clientside_code is endless, each solution having its own advantages and disadvantages. If the current requirement is basically only a button to start/stop a process on server side then its no matter what you use just get the job done.

Until putting a lot of effort to implement a lot of functionality into your server you can decide to change the whole architecture if you find out that your future plans fit another solution better. Any future plans?

Just my pure opinion: If you want to learn a nice crossplatform general purpose scripting language then python is a better choice than Perl or PHP.
 
Share this answer
 
Comments
ProDavy 10-Oct-13 14:53pm    
In the future I plan to add functionality like: Move server file across different nodes, automate everything, create a auto restart function if server crashes.
pasztorpisti 11-Oct-13 4:27am    
These are relatively simple functions you can implement in any of web development frameworks. Even without frameworks depending on how sophisticated solution you want. For example without dynamic content generation and without dhtml you can do the stuff in pure html and you can implement the server side request handler logic as a set of cgi scripts, each cgi script can be written in ANY language (including C/C++). All you need is a web server that can server your static html files and can start your cgi scripts when the user requests something from a specific path of the server (like /commands/restart_server?id=5). This is solution #0. If you want to generate the content of your html files dynamically on server side then you can do that as well by writing your main page as a cgi script. This is solution #1. To be honest I think getting to know cgi scripts would be one of the most useful things you could learn as a first step! cgi can be combined with any frameworks and cgi alone is enough to perform everything you need. It doesn't have fancy features like some other frameworks like putting together fancy user interfaces with a few lines because cgi is just a simple stupid protocol/technology but you should start learning from the basics. And again, in my opinion cgi is ONE OF THE MOST USEFUL THINGS in web development!!! To write a cgi script just use your favorite language. How cgi works in 30 minutes: You set up your web server to execute your cgi script when a request comes that matches some criteria, for example its path is /command/restart_server. Then the web server executes your script and passes the parameters of the request in environment variables to your script. Then your script interprets the request parameters and outputs the generated response to the stdout that is captured by the server. Thats it. Find a simple stupid web server that has cgi support and read a basic cgi tutorial becuase it is as simple as I described.
ProDavy 11-Oct-13 4:38am    
Thank you, that was really helpful.
pasztorpisti 11-Oct-13 4:50am    
You are welcome! What you should learn besides cgi is the HTTP protocol at least on a basic level. In your framework there will be probably some buttons on the webpages along with some input fields (basically a form). A typical pattern you will use: when the user presses the button on a form then the browser sends the field values of the http form to the page/location your defined for the form as a POST request. Then your cgi executes and typcially you want to return a 303 (== See Other) status code to this post. But go and learn a bit more about HTTP, its simple on an intermediate level. To implement a basic control panel just go with cgi and with C++ if you like that the most. There are some helper libraries for cgi for any language (even for c/c++) that can parse the incoming parameters for you (because that is a boring thing if you write a lot of cgi scripts). And again, learning cgi and http is not a wasted time, it is useful knowledge even if you later learn a few frameworks on top of this. And besides this knowledge isnt as volatile as knowing some frameworks that morph into something totally different in 6 months. cgi and http ares the same as they were 10 years ago.

With cgi you can implement even dynamically generated websites, you can use cgi for any requests even for those that retrieve your html pages not only for those that process form posts. After html and cgi if you want more fancy stuff then learn client side programming (javascript) and maybe ajax if you want dhtml but this is optional if all you want is a basic control panel.
ProDavy 11-Oct-13 5:11am    
I am using CodeIgniter as my framework for the front end. As far as HTML goes I know it on a decent level, same with AJAX / JavaScript. I will create the cgi scripts in C++ I found a lib for that already. I wasn't sure what language to use, coz there is so many of them I even tough about using Erlang. I will stick to your guidelines and hopefully it will come out great.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900