Go to Post Sleep is for the weak in week 6! - JesseK [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 18-09-2014, 22:52
Dkt01's Avatar
Dkt01 Dkt01 is offline
Programming Mentor
AKA: David
FRC #1756 (Argos)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Peoria, Il
Posts: 145
Dkt01 will become famous soon enough
Re: The DevServer TCP-based data server

Do you have a gdb stack trace for the segfault? It's really difficult to debug the code without knowing where the program is actually failing.
  #17   Spotlight this post!  
Unread 19-09-2014, 17:41
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: The DevServer TCP-based data server

Quote:
Originally Posted by Dkt01 View Post
Do you have a gdb stack trace for the segfault? It's really difficult to debug the code without knowing where the program is actually failing.
I don't know how to use GDB from the terminal. I always use Qt Creator and use the built in Debugger, based off GDB and Valgrind. Sadly, I made a CMakeLists.txt and compiled the application on my pi using that.
I have come up with the conclusion that now seems like the best time to completely rewrite the server.
My previous version was really just me playing around in code and putting something together that works. It worked better than I expected, giving my as low as 4ms responses. However, there were many places where it lacked, like comments/documentation/etc., and had many holes/bugs/etc. Also, I had designed this solely for Google Chrome in mind, so as soon as you launch the web interface in a non-webkit browser such as IE/FireFox(IceWeasel), there are extremely annoying display bugs. Also, the transitions are only for chrome, so the changes are sudden.

Those web-interface bugs are the last on my list to fix. I will be using the same HTML code because it works beautifully, even supporting the ability to detect server/network failures.

Also, I am wondering whether to keep my RAMCache. The RAMCache makes it possible for me to get those 10ms load times for the actual web interface, but it makes it required to relaunch the server just to edit some HTML/JavaScript/CSS code. I think I might add some build configuration options, like the ability to turn on and off the RAMCache. I think I will also add a handler within the web server to recreate the file cache upon a certain action. Maybe I could add an HTML build script to send this signal to the server!
  #18   Spotlight this post!  
Unread 02-10-2014, 22:35
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: The DevServer TCP-based data server

Yesterday, I finished my new web interface, and consequently, the majority of the server project. I completely rewrote the web interface because the older one had a bit of a low performance and just didn't always work. I rewrote the entire server because there were a couple features I wanted to add that completely changed how to server booted and ran. Also, I was having some mutex problems that I fixed by changing the request handler. I also switched to using C++11 only features like std::timed_mutex, std::mutex, std::thread and std::unordered_map.

My program is written completely STL C++ (but not ANSI), so you should be able to compile code on any gcc compiler with a version of above 4.6 (C++0x+ support).

I have written an install script which just compiles the program and puts the build and required files in a location so the program should work right out of the box. The install script actually compiles the server so it should work for any platform.

The current installer should work in only Linux. I am going to soon start a Windows port, creating a Visual Studio 2013 Solution.

Changes:
-New GitHub repo so there is no mess with my having a hundred small programs in one repo
-User Program Capability (Must be enabled (enabled by default, with a sample program)). Put your code in userprgm.hxx.
-New web interface
--Poliished design, much easier to add features. The last version was me throwing together a bunch of stuff to create something that works
--More standardised JS (No longer 10 AJAX functions. Now only two generic ones (GET and POST)!)
--JavaScript, CSS and different modules in different files, put together by the browser via HTML, JS and AJAX calls
--You can now disable heartbeat, which sends responses every four seconds
--Heartbeat now sent to 4 seconds, not 1. Less network usage, but still works
--Standardised messagebox
-More AJAX
--Push form monitor integration now loaded via AJAX, so modding the push file means changing code in only one place
-CSS file in one place makes it much simpler to color interface to team standards
-Addding more web modules is now much easier. Just add another div in the top_menu, with a class of "top_menu_item", and with an onclick handler to load the module into content-content, and changing the title of content-title-content. Add the file to the server (I'll give a tutorial on request) and recompile to get access.
-You can now change servers on the fly without loading a different web interface. Open the menu and change the textbox to the new server location. The load server is what is loaded on launch


View repo at https://github.com/yash101/devserver. Note that the code for the installer is pulled from repo/linux/CMAKE/.

If you want to try out the server without doing much work, run the following command. the apt-get will only work on debian-based systems. If using something else, remove the apt-get install command and ensure you have git, cmake and build-essential (GCC, etc.) installed.

Code:
wget https://raw.githubusercontent.com/yash101/DevServer/master/devserver_installer.sh && chmod +x devserver_installer.sh && ./devserver_installer.sh
You can change server settings in config.hxx. Just make sure to recompile as they actually disable code compilation!

As usual, Good Luck!

REMEMBER: The server comes in demo mode. To fix, delete the build folder, enter the source folder and edit config.hxx. Enable/Disable anything you think is pointless.

I suggest that you disable:
-DEBUG_RNG
-DEBUG_WEBINF
-DETAILED_DEBUG
-ENABLE_CONSOLE

If you do not want to use the userprgm, get it out of the compile process by disabling:
-RUN_USERPRGM

If anyone would like to test the web debugger on my demo server, you may follow the link:
http://devyash.noip.me:2014
For an idea on how much CPU it is consuming, my RasPi (which is running this) is idling at 3% CPU usage. When it starts getting flooded with responses, it maxes out at about 30% CPU (tested using ab (Apache benchmark))!

Last edited by yash101 : 03-10-2014 at 01:10.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 19:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi