Thread: [Cppcms-users] (no subject)
Brought to you by:
artyom-beilis
From: eric m. <mid...@gm...> - 2014-02-20 04:12:29
|
Hello, I am looking for a way to update parts of a webpage via events from the server. I downloaded the Ticker example from the blog but as I try to compile it (os = Ubuntu) I'm getting the following errors: g++ -std=c++0x -O2 -Wall -g ticker.cpp -o ticker -lcppcms -lbooster ticker.cpp: In member function 'void ticker::async_send(booster::shared_ptr<cppcms::http::context>)': ticker.cpp:83:39: error: capture of non-variable 'ticker::counter_' ticker.cpp:97:9: note: 'int ticker::counter_' declared here I also downloaded the Sse Ticker example from contrib and that does compile but when I run it and access the page from firefox (127.0.0.1:8080/ticker), I get a 404 Not Found and a popup with the following information: ------------------------------------------------------- ticker which is: text/event-stream from: http://127.0.0.1:8080 What should firefox do with this file? - Open with Browse - Save File -------------------------------------------------------- It doesn't display the tickers on the webpage. I have a camera that is shooting photographs and want a webpage to reflect what the camera is doing. So every time it shoots a photograph the webserver should send the filename and sequencenumber of that photograph to the webpage and the user must be able to inform the camera to stop taking pictures via pressing a button. So HTTP requests to control the camera and asynchronous status-updates to be displayed on the webpage. I hope someone can help me out by either getting one of the ticker examples working or providing another working example. Many thanks! Eric <http://www.lightandmagicphotography.com> |
From: Andrey <par...@gm...> - 2016-11-23 07:05:43
|
Hello, Al Why cppcms with single asynchronous application generates 20 threads after start? (e.g. examples/chat) |
From: Patrick W. <pat...@ra...> - 2017-01-05 14:32:16
|
Hi, I would like to know if anyone could give me some insight on how to configure cppcms with mod_fcgid. The fastcgi module is not anymore provided with centos, which is my server's distribution. I would be very grateful. Another more trivial question is anyone could get the syntaxhighlighter working? I downloaded version 3.0.83, added the content of the directory to /media/sh, enabled it in the config.js file ("syntax_highlighter" : "/media/sh",) and changed the main.cpp source code to match the names of the javascript and css files. But there is no syntaxhighlighting. I wrapped the source with the tag <pre> and </pre> in the publishing text area form. Thank you. -- Patrick Wolf |
From: Artyom B. <art...@gm...> - 2017-01-08 07:14:56
|
On Thu, Jan 5, 2017 at 4:32 PM, Patrick Wolf <pat...@ra...> wrote: > > Hi, > I would like to know if anyone could give me some insight on how to configure cppcms with mod_fcgid. First of all take a look on this: http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config >From what I remember mod_fcgid does not support multi-threaded application (and CppCMS works this way) http://stackoverflow.com/questions/15623422/mod-fcgid-multi-threaded-fastcgi-now-or-in-a-planned-future you probably should give a try to mod_proxy_fcgi but also note it can't start your process. I'd suggest just use SCGI (it is in general as efficient as fastcgi) Artyom > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Marcel H. <ke...@co...> - 2014-02-20 12:12:15
Attachments:
signature.asc
|
On 20.02.2014 05:12, eric middelkoop wrote: > Hello, > > I am looking for a way to update parts of a webpage via events from the > server. > > I downloaded the Ticker example from the blog but as I try to compile it > (os = Ubuntu) I'm getting the following errors: which version of gcc do you using? > g++ -std=c++0x -O2 -Wall -g ticker.cpp -o ticker -lcppcms -lbooster > ticker.cpp: In member function ‘void > ticker::async_send(booster::shared_ptr<cppcms::http::context>)’: > ticker.cpp:83:39: error: capture of non-variable ‘ticker::counter_’ > ticker.cpp:97:9: note: ‘int ticker::counter_’ declared here fun fact: ticker.cpp has only 76 lines :) Which version of the ticker are you using? The latest from svn trunk? > > I also downloaded the Sse Ticker example from contrib and that does > compile but when I run it and access the page from firefox > (127.0.0.1:8080/ticker <http://127.0.0.1:8080/ticker>), I get a 404 Not > Found and a popup with the following information: hmm. I think you mess up things. 404 really means nothing, but firefox has a file which will be presented to you. > > ------------------------------------------------------- > ticker > which is: text/event-stream > from: http://127.0.0.1:8080 > > What should firefox do with this file? > - Open with Browse > - Save File > -------------------------------------------------------- > > It doesn't display the tickers on the webpage. Yep, that's right, but that's what the ticker does. It does not have a page to display, but emits events the whole time to a stream. To view the content you can use this: > wget localhost:8080/ticker -qO - | cat > > I have a camera that is shooting photographs and want a webpage to > reflect what the camera is doing. So every time it shoots a photograph > the webserver should send the filename and sequencenumber of that > photograph to the webpage and the user must be able to inform the camera > to stop taking pictures via pressing a button. You need a webpage that does some magic javascript and a backend. That shouldn't be that hard. > So HTTP requests to > control the camera and asynchronous status-updates to be displayed on > the webpage. > > I hope someone can help me out by either getting one of the ticker > examples working or providing another working example. As I said. Everything works in the way that it should be. Maybe the chat example is more for you :) > > Many thanks! > > Eric > > Greetings Marcel |
From: eric m. <mid...@gm...> - 2014-02-20 18:25:18
|
Hi Marcel, Thank you for your reaction. I have well over 25 years experience with programming in c, c++, c# and Ruby, but have virtually no experience with web-development. I do understand the concepts but am struggling to get a working comet-example to use. See my comments underneath at the ### marks. Hope you can help me out here. Kind regards, Eric On Thu, Feb 20, 2014 at 1:12 PM, Marcel Hellwig <ke...@co...> wrote: > > > On 20.02.2014 05:12, eric middelkoop wrote: > > Hello, > > > > I am looking for a way to update parts of a webpage via events from the > > server. > > > > I downloaded the Ticker example from the blog but as I try to compile it > > (os = Ubuntu) I'm getting the following errors: > which version of gcc do you using? > ###4.7.3 > g++ -std=c++0x -O2 -Wall -g ticker.cpp -o ticker -lcppcms -lbooster > > ticker.cpp: In member function 'void > > ticker::async_send(booster::shared_ptr<cppcms::http::context>)': > > ticker.cpp:83:39: error: capture of non-variable 'ticker::counter_' > > ticker.cpp:97:9: note: 'int ticker::counter_' declared here > fun fact: ticker.cpp has only 76 lines :) > Which version of the ticker are you using? The latest from svn trunk? > ###The first one that gives the compiler error I got from here: http://cppcms.com/files/ticker/ ###The other one that does compile but reacts like described underneath I got from here ### https://svn.code.sf.net/p/cppcms/code/framework/trunk/contrib/server_side/sse/ > > > I also downloaded the Sse Ticker example from contrib and that does > > compile but when I run it and access the page from firefox > > (127.0.0.1:8080/ticker <http://127.0.0.1:8080/ticker>), I get a 404 Not > > Found and a popup with the following information: > hmm. I think you mess up things. 404 really means nothing, but firefox > has a file which will be presented to you. > > > > ------------------------------------------------------- > > ticker > > which is: text/event-stream > > from: http://127.0.0.1:8080 > > > > What should firefox do with this file? > > - Open with Browse > > - Save File > > -------------------------------------------------------- > > > > It doesn't display the tickers on the webpage. > Yep, that's right, but that's what the ticker does. It does not have a > page to display, but emits events the whole time to a stream. To view > the content you can use this: > > > wget localhost:8080/ticker -qO - | cat > ###Ok I understand this. But the page does contain the following: <p>Price:<span id="price"></span></p> so I had expect it to show something. If that's not doing it, how can I translate that stream into a field that is updated and displayed on every change? > > > > > I have a camera that is shooting photographs and want a webpage to > > reflect what the camera is doing. So every time it shoots a photograph > > the webserver should send the filename and sequencenumber of that > > photograph to the webpage and the user must be able to inform the camera > > to stop taking pictures via pressing a button. > You need a webpage that does some magic javascript and a backend. That > shouldn't be that hard. > > So HTTP requests to > > control the camera and asynchronous status-updates to be displayed on > > the webpage. > > > > I hope someone can help me out by either getting one of the ticker > > examples working or providing another working example. > > As I said. Everything works in the way that it should be. Maybe the chat > example is more for you :) > > > > Many thanks! > > > > Eric > > > > > Greetings > Marcel > > > > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > > http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > -- Groetjes, Eric http://www.lightandmagicphotography.nl http://www.lightandmagicphotography.com |
From: Marcel H. <ke...@co...> - 2014-02-20 22:29:27
Attachments:
signature.asc
|
> ###4.7.3 should be good enough ;) > ###The other one that does compile but reacts like described underneath > I got from here > ###https://svn.code.sf.net/p/cppcms/code/framework/trunk/contrib/server_side/sse/ that's the right one :) > ###Ok I understand this. But the page does contain the following: > <p>Price:<span id="price"></span></p> so I had expect it to show > something. If that's not doing it, how can I translate that stream into > a field that is updated and displayed on every change? Sorry, only used the stream itself. You're right. There is a frontend, namely the the_ticker.html which reacts like it should. In my browser (also firefox) the price is changing. Did you enabled javascript?! The thing you need is the javascript code in 'the_ticker.html' which opens a stream and put its content into the span field. If you have any further questions, feel free to mail them. Greetings Marcel |
From: eric m. <mid...@gm...> - 2014-02-21 06:58:44
|
Hi Marcel, Yes I checked. Javascript is enabled in Firefox. Do you have any idea what is going wrong here? Greetings, Eric On Thu, Feb 20, 2014 at 11:29 PM, Marcel Hellwig <ke...@co...> wrote: > > ###4.7.3 > > should be good enough ;) > > > ###The other one that does compile but reacts like described underneath > > I got from here > > ### > https://svn.code.sf.net/p/cppcms/code/framework/trunk/contrib/server_side/sse/ > > that's the right one :) > > > ###Ok I understand this. But the page does contain the following: > > <p>Price:<span id="price"></span></p> so I had expect it to show > > something. If that's not doing it, how can I translate that stream into > > a field that is updated and displayed on every change? > Sorry, only used the stream itself. You're right. There is a frontend, > namely the the_ticker.html which reacts like it should. In my browser > (also firefox) the price is changing. Did you enabled javascript?! > > The thing you need is the javascript code in 'the_ticker.html' which > opens a stream and put its content into the span field. > > If you have any further questions, feel free to mail them. > > Greetings > Marcel > > -- Groetjes, Eric http://www.lightandmagicphotography.nl http://www.lightandmagicphotography.com |
From: Marcel H. <ke...@co...> - 2014-02-21 08:46:27
Attachments:
signature.asc
|
On 21.02.2014 07:58, eric middelkoop wrote: > Hi Marcel, > > Yes I checked. Javascript is enabled in Firefox. Do you have any idea > what is going wrong here? Are you sure your application is running und reachable? Did you try the command I sent you? > wget localhost:8080/ticker -qO - | cat If that works the page should also work: http://localhost:8080/the_ticker.html if not. Try to update your cppcms version and after that I don't have any clue :D Greetings |
From: eric m. <mid...@gm...> - 2014-02-21 17:25:27
|
Hi, Yes when I start the ticker and run wget localhost:8080/ticker -qO - | cat from another terminal I get a steady stream of tickers updates. id:44 data:7.36238 id:45 data:7.73572 id:46 data:7.913 id:47 data:8.63035 id:48 data:9.47829 id:49 data:10.1078 id:50 data:10.9298 When instead I start Firefox and go to localhost it asks me to save the data as a file. I downloaded the latest version of cppcms only last week. Does it work with you? And if yes what browser and os are you using? I just don't get it... Best regards, Eric On Fri, Feb 21, 2014 at 9:46 AM, Marcel Hellwig <ke...@co...> wrote: > > > On 21.02.2014 07:58, eric middelkoop wrote: > > Hi Marcel, > > > > Yes I checked. Javascript is enabled in Firefox. Do you have any idea > > what is going wrong here? > > Are you sure your application is running und reachable? > Did you try the command I sent you? > > > wget localhost:8080/ticker -qO - | cat > > If that works the page should also work: > > http://localhost:8080/the_ticker.html > > if not. Try to update your cppcms version and after that I don't have > any clue :D > > Greetings > > -- Groetjes, Eric http://www.lightandmagicphotography.nl http://www.lightandmagicphotography.com |
From: eric m. <mid...@gm...> - 2014-02-21 17:35:32
|
I tried Chrome instead of Firefox and that reacts differently. Its reading the stream but doesn't show anything until I stop the server. Then it displays the same as when connected via the terminal. So it does work in the end (no idea why Firefox behaves differently). Any idea how to make the browser refresh the page after every change from the server? On Fri, Feb 21, 2014 at 6:25 PM, eric middelkoop <mid...@gm...>wrote: > Hi, > > Yes when I start the ticker and run wget localhost:8080/ticker -qO - | cat > from another terminal I get a steady stream of tickers updates. > id:44 > data:7.36238 > > id:45 > data:7.73572 > > id:46 > data:7.913 > > id:47 > data:8.63035 > > id:48 > data:9.47829 > > id:49 > data:10.1078 > > id:50 > data:10.9298 > > > When instead I start Firefox and go to localhost it asks me to save the > data as a file. I downloaded the latest version of cppcms only last week. > > Does it work with you? And if yes what browser and os are you using? > > I just don't get it... > > Best regards, > Eric > > > > On Fri, Feb 21, 2014 at 9:46 AM, Marcel Hellwig <ke...@co...>wrote: > >> >> >> On 21.02.2014 07:58, eric middelkoop wrote: >> > Hi Marcel, >> > >> > Yes I checked. Javascript is enabled in Firefox. Do you have any idea >> > what is going wrong here? >> >> Are you sure your application is running und reachable? >> Did you try the command I sent you? >> >> > wget localhost:8080/ticker -qO - | cat >> >> If that works the page should also work: >> >> http://localhost:8080/the_ticker.html >> >> if not. Try to update your cppcms version and after that I don't have >> any clue :D >> >> Greetings >> >> > > > -- > Groetjes, > Eric > > http://www.lightandmagicphotography.nl > http://www.lightandmagicphotography.com > -- Groetjes, Eric http://www.lightandmagicphotography.nl http://www.lightandmagicphotography.com |
From: eric m. <mid...@gm...> - 2014-02-21 17:51:17
|
Sorry... Have found it. It does actually work. I was wondering why chat was updating and ticker didn't. While adapting the code of ticker towards chat to see where the problem is, I reread your emails and found the cause of the problem. I was using http://localhost:8080/ticker instead of http://localhost:8080/the_ticker.html Thanks for your support. On Fri, Feb 21, 2014 at 6:35 PM, eric middelkoop <mid...@gm...>wrote: > I tried Chrome instead of Firefox and that reacts differently. Its reading > the stream but doesn't show anything until I stop the server. Then it > displays the same as when connected via the terminal. So it does work in > the end (no idea why Firefox behaves differently). Any idea how to make the > browser refresh the page after every change from the server? > > > On Fri, Feb 21, 2014 at 6:25 PM, eric middelkoop < > mid...@gm...> wrote: > >> Hi, >> >> Yes when I start the ticker and run wget localhost:8080/ticker -qO - | >> cat from another terminal I get a steady stream of tickers updates. >> id:44 >> data:7.36238 >> >> id:45 >> data:7.73572 >> >> id:46 >> data:7.913 >> >> id:47 >> data:8.63035 >> >> id:48 >> data:9.47829 >> >> id:49 >> data:10.1078 >> >> id:50 >> data:10.9298 >> >> >> When instead I start Firefox and go to localhost it asks me to save the >> data as a file. I downloaded the latest version of cppcms only last week. >> >> Does it work with you? And if yes what browser and os are you using? >> >> I just don't get it... >> >> Best regards, >> Eric >> >> >> >> On Fri, Feb 21, 2014 at 9:46 AM, Marcel Hellwig <ke...@co...>wrote: >> >>> >>> >>> On 21.02.2014 07:58, eric middelkoop wrote: >>> > Hi Marcel, >>> > >>> > Yes I checked. Javascript is enabled in Firefox. Do you have any idea >>> > what is going wrong here? >>> >>> Are you sure your application is running und reachable? >>> Did you try the command I sent you? >>> >>> > wget localhost:8080/ticker -qO - | cat >>> >>> If that works the page should also work: >>> >>> http://localhost:8080/the_ticker.html >>> >>> if not. Try to update your cppcms version and after that I don't have >>> any clue :D >>> >>> Greetings >>> >>> >> >> >> -- >> Groetjes, >> Eric >> >> http://www.lightandmagicphotography.nl >> http://www.lightandmagicphotography.com >> > > > > -- > Groetjes, > Eric > > http://www.lightandmagicphotography.nl > http://www.lightandmagicphotography.com > -- Groetjes, Eric http://www.lightandmagicphotography.nl http://www.lightandmagicphotography.com |