cppcms-users Mailing List for CppCMS C++ Web Framework (Page 100)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
| 2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
| 2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
| 2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
| 2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
| 2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
| 2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
| 2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
| 2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
| 2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: kpeo <sla...@ya...> - 2012-01-02 09:35:35
|
Hello, Template framework for foreach block has an iterators: <% foreach s rowid i in some %> See: http://cppcms.sourceforge.net/wikipp/en/page/cppcms_1x_templates_flow#Foreach.block 02.01.2012, 12:43, "Sergey" <dan...@gm...>: > data/ > std::vector<some_class *> some; > > apps/ > data::some_content c; > c.success.push_back(&some); > > tmpl/ > <% foreach s in some %> > <% item %><%= s.key() %><% end %> > <% end %> > > Of course i need like that <%= s[i].key() %> > Anyway it does not work > > Anybody have solution? > > ------------------------------------------------------------------------------ > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex > infrastructure or vast IT resources to deliver seamless, secure access to > virtual desktops. With this all-in-one solution, easily deploy virtual > desktops for less than the cost of PCs and save 60% on VDI infrastructure > costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Sergey <dan...@gm...> - 2012-01-02 09:32:12
|
Solution is: <%= s->key() %> |
|
From: Sergey <dan...@gm...> - 2012-01-02 08:45:18
|
data/ std::vector<some_class *> some; apps/ data::some_content c; c.success.push_back(&some); tmpl/ <% foreach s in some %> <% item %><%= s.key() %><% end %> <% end %> Of course i need like that <%= s[i].key() %> Anyway it does not work Anybody have solution? |
|
From: Artyom B. <art...@ya...> - 2011-12-28 14:18:30
|
> I do not understand the exact scope of the anonymous namespace. > the anonymous namespace in json namespace,the json namespace in cppcms namespace . > ... > can you explain that why in json namespace can invoke the > method in a the anonymous namespace that define in json namespace? Read: http://stackoverflow.com/questions/154469/unnamed-anonymous-namespaces-vs-static-functions > is the parse_stream just belong json.cpp ? Exactly. Artyom |
|
From: 4. <440...@qq...> - 2011-12-28 12:17:55
|
I do not understand the exact scope of the anonymous namespace . the anonymous namespace in json namespace,the json namespace in cppcms namespace .
bool value::load(std::istream &in,bool full,int *line_number)
{
int err_line;
value v;
if(!parse_stream(in,*this,full,err_line)) {
if(line_number)
*line_number=err_line;
return false;
}
return true;
} in json namespace
can you explain that why in json namespace can invoke the method in a the anonymous namespace that define in json namespace ? is the parse_stream just belong json.cpp ?
------------------ Original ------------------
From: "Marcel Hellwig"<ke...@co...>;
Date: Wed, Dec 28, 2011 08:05 PM
To: "cppcms-users"<cpp...@li...>;
Subject: Re: [Cppcms-users] In json.cpp and json.h I did not seethedeclareof the parse_stream function but you use it onjson.cpp in 1051line.why /?
Why don't you crawl through the sourcecode?
Line 41 + 42 namespace cppcms {
namespace json {
Line 559 namespace { (anonymous namespace
If you go through the json.h you see, that there isn't any method parse_stream, that means it is a function in a way that is only declared in the anonymous namespace from line 559 to 1046 and not a class method.
Am 28.12.2011 12:54, schrieb 44073786: I do not know whether my idea is right ? is the bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line) in the default global scope?
------------------ Original ------------------
From: "44073786"<440...@qq...>;
Date: Wed, Dec 28, 2011 07:52 PM
To: "cppcms-users"<cpp...@li...>;
Subject: Re: [Cppcms-users] In json.cpp and json.h I did not see thedeclareof the parse_stream function but you use it onjson.cpp in 1051 line.why /?
I konw it in 836,but I think it should bool value::parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line),but not bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line) ? I don not now why.?
------------------ Original ------------------
From: "Marcel Hellwig"<ke...@co...>;
Date: Wed, Dec 28, 2011 07:44 PM
To: "cppcms-users"<cpp...@li...>;
Subject: Re: [Cppcms-users] In json.cpp and json.h I did not see the declareof the parse_stream function but you use it on json.cpp in 1051 line.why /?
grep -Hirn "parse_stream" cppcms/src
cppcms/src/json.cpp:836: bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line)
cppcms/src/json.cpp:1051: if(!parse_stream(in,*this,full,err_line)) {
cppcms/src/json.cpp:1063: if(!parse_stream(in,v,false,line_no))
as you can see it's a method declared in line 836.
Did you use Strg+F?
Am 28.12.2011 12:21, schrieb 44073786: Hello:
when I read the source code. In json.cpp and json.h I did not see the declare of the parse_stream function but you use it on json.cpp in 1051 line.why /?
I don not know why? please help me .thank you very much!
------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev
_______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users
------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev
_______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Marcel H. <ke...@co...> - 2011-12-28 12:05:16
|
Why don't you crawl through the sourcecode?
Line 41 + 42 namespace cppcms {
namespace json {
Line 559 namespace { (anonymous namespace
If you go through the json.h you see, that there isn't any method
parse_stream, that means it is a function in a way that is only declared
in the anonymous namespace from line 559 to 1046 and not a class method.
Am 28.12.2011 12:54, schrieb 44073786:
> I do not know whether my idea is right ? is the bool
> parse_stream(std::istream &in,value &out,bool force_eof,int
> &error_at_line) in the default global scope?
> ------------------ Original ------------------
> *From: * "44073786"<440...@qq...>;
> *Date: * Wed, Dec 28, 2011 07:52 PM
> *To: * "cppcms-users"<cpp...@li...>;
> *Subject: * Re: [Cppcms-users] In json.cpp and json.h I did not see
> thedeclareof the parse_stream function but you use it onjson.cpp in
> 1051 line.why /?
> I konw it in 836,but I think it should bool
> value::parse_stream(std::istream &in,value &out,bool force_eof,int
> &error_at_line),but not bool parse_stream(std::istream &in,value
> &out,bool force_eof,int &error_at_line) ? I don not now why.?
> ------------------ Original ------------------
> *From: * "Marcel Hellwig"<ke...@co...>;
> *Date: * Wed, Dec 28, 2011 07:44 PM
> *To: * "cppcms-users"<cpp...@li...>;
> *Subject: * Re: [Cppcms-users] In json.cpp and json.h I did not see
> the declareof the parse_stream function but you use it on json.cpp in
> 1051 line.why /?
> grep -Hirn "parse_stream" cppcms/src
> cppcms/src/json.cpp:836: bool parse_stream(std::istream
> &in,value &out,bool force_eof,int &error_at_line)
> cppcms/src/json.cpp:1051:
> if(!parse_stream(in,*this,full,err_line)) {
> cppcms/src/json.cpp:1063: if(!parse_stream(in,v,false,line_no))
>
> as you can see it's a method declared in line 836.
> Did you use Strg+F?
>
>
> Am 28.12.2011 12:21, schrieb 44073786:
>> Hello:
>> when I read the source code. In json.cpp and json.h I did not see the
>> declare of the parse_stream function but you use it on json.cpp in
>> 1051 line.why /?
>> I don not know why? please help me .thank you very much!
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Write once. Port to many.
>> Get the SDK and tools to simplify cross-platform app development. Create
>> new or port existing apps to sell to consumers worldwide. Explore the
>> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
>> http://p.sf.net/sfu/intel-appdev
>>
>>
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
>
>
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
|
|
From: 4. <440...@qq...> - 2011-12-28 11:55:07
|
I do not know whether my idea is right ? is the bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line) in the default global scope?
------------------ Original ------------------
From: "44073786"<440...@qq...>;
Date: Wed, Dec 28, 2011 07:52 PM
To: "cppcms-users"<cpp...@li...>;
Subject: Re: [Cppcms-users] In json.cpp and json.h I did not see thedeclareof the parse_stream function but you use it onjson.cpp in 1051 line.why /?
I konw it in 836,but I think it should bool value::parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line),but not bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line) ? I don not now why.?
------------------ Original ------------------
From: "Marcel Hellwig"<ke...@co...>;
Date: Wed, Dec 28, 2011 07:44 PM
To: "cppcms-users"<cpp...@li...>;
Subject: Re: [Cppcms-users] In json.cpp and json.h I did not see the declareof the parse_stream function but you use it on json.cpp in 1051 line.why /?
grep -Hirn "parse_stream" cppcms/src
cppcms/src/json.cpp:836: bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line)
cppcms/src/json.cpp:1051: if(!parse_stream(in,*this,full,err_line)) {
cppcms/src/json.cpp:1063: if(!parse_stream(in,v,false,line_no))
as you can see it's a method declared in line 836.
Did you use Strg+F?
Am 28.12.2011 12:21, schrieb 44073786: Hello:
when I read the source code. In json.cpp and json.h I did not see the declare of the parse_stream function but you use it on json.cpp in 1051 line.why /?
I don not know why? please help me .thank you very much!
------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev
_______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: 4. <440...@qq...> - 2011-12-28 11:52:55
|
I konw it in 836,but I think it should bool value::parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line),but not bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line) ? I don not now why.?
------------------ Original ------------------
From: "Marcel Hellwig"<ke...@co...>;
Date: Wed, Dec 28, 2011 07:44 PM
To: "cppcms-users"<cpp...@li...>;
Subject: Re: [Cppcms-users] In json.cpp and json.h I did not see the declareof the parse_stream function but you use it on json.cpp in 1051 line.why /?
grep -Hirn "parse_stream" cppcms/src
cppcms/src/json.cpp:836: bool parse_stream(std::istream &in,value &out,bool force_eof,int &error_at_line)
cppcms/src/json.cpp:1051: if(!parse_stream(in,*this,full,err_line)) {
cppcms/src/json.cpp:1063: if(!parse_stream(in,v,false,line_no))
as you can see it's a method declared in line 836.
Did you use Strg+F?
Am 28.12.2011 12:21, schrieb 44073786: Hello:
when I read the source code. In json.cpp and json.h I did not see the declare of the parse_stream function but you use it on json.cpp in 1051 line.why /?
I don not know why? please help me .thank you very much!
------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev
_______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Marcel H. <ke...@co...> - 2011-12-28 11:44:57
|
grep -Hirn "parse_stream" cppcms/src
cppcms/src/json.cpp:836: bool parse_stream(std::istream &in,value
&out,bool force_eof,int &error_at_line)
cppcms/src/json.cpp:1051: if(!parse_stream(in,*this,full,err_line)) {
cppcms/src/json.cpp:1063: if(!parse_stream(in,v,false,line_no))
as you can see it's a method declared in line 836.
Did you use Strg+F?
Am 28.12.2011 12:21, schrieb 44073786:
> Hello:
> when I read the source code. In json.cpp and json.h I did not see the
> declare of the parse_stream function but you use it on json.cpp in
> 1051 line.why /?
> I don not know why? please help me .thank you very much!
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
>
>
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
|
|
From: 4. <440...@qq...> - 2011-12-28 11:21:30
|
Hello: when I read the source code. In json.cpp and json.h I did not see the declare of the parse_stream function but you use it on json.cpp in 1051 line.why /? I don not know why? please help me .thank you very much! |
|
From: Artyom B. <art...@ya...> - 2011-12-27 21:34:23
|
>________________________________
> From: Marcel Hellwig <ke...@co...>
>To: Artyom Beilis <art...@ya...>; cpp...@li...
>Sent: Tuesday, December 27, 2011 9:34 PM
>Subject: Re: [Cppcms-users] "endless" stream of data
>
>Alright, my code is a bit different from yours and from the chat example but else it doesn't work.
>
>void SSE::loop(std::string /*page*/)
>{
> response().io_mode(cppcms::http::response::asynchronous);
Don't need this... As if the application is mounted as asynchronous
(make sure you did) then it is the default mode.
> response().set_header("Content-Type", "text/event-stream");
>
> int counter = (rand() % 10) + 1;
General notes below
You write the code as it is synchronous code, it is not!
You don't work like this.
>
> while (true) {
> response().out() << "event: ping\n"
><< "data: {\"time\": \""
><< "foo" //note: this is just an example
><< "\"}\n\n";
> counter--;
>
> if (!counter) {
> response().out() << "data: is a message at time "
><< "bar" << "\n\n";
> counter = (rand() % 10) + 1;
> }
>
> context().async_flush_output(boost::bind(&SSE::handler, this, -1));
You should use a handler per call, Once you called async flush
you should not do further operation till you receive completion
notifications
> booster::ptime::sleep(booster::ptime::seconds(1));
You block there entire event loop, you need to use booster::aio::deadline_timer
and handle events asynchronously...
>
> }
>}
>
>void SSE::handler(int status)
>{
> std::cout << "Status: " << status << std::endl;
>}
>
>two major questions. You told me to use release_context but if I do so, the connection "aborts" (access to unassigned context) while the second loop on response().out()
You release it and you become responsible for the context life time,
you need to keep it withing your class as long as you need.
>How can I figure out when the user "leaves" the page, so I can stop producing tons of messages?
>
Two ways:
a) The completion handler of async_flush_output returns a error status
b) You can using async_on_peer_reset callback.
Take a look in the chat example in the cppcms sources
get(std::string no) {
...
else if(pos == messages_.size()) {
// Get the context <-------------------------------------------
booster::shared_ptr<cppcms::http::context> context=release_context();
// Keep it <--------------------------------------------
waiters_.insert(context);
// Handle disconnect Asynchronously!!!
context->async_on_peer_reset(
bind(
&chat::remove_context,
booster::intrusive_ptr<chat>(this),
context));
}
...
}
Now take a look on function broadcast:
void broadcast()
{
for(waiters_type::iterator waiter=waiters_.begin();waiter!=waiters_.end();++waiter) {
(*waiter)->response().set_plain_text_header();
(*waiter)->response().out() << messages_.back();
// n
(*waiter)->async_complete_response();
}
waiters_.clear();
}
Lets change the line
(*waiter)->async_complete_response();
To
(*waiter)->async_flush_output(
boost::bind(&chat::new_handle,
booster::intrusive_ptr<chat>(this),
_1,
*waiter,
messages_.size()));
And add new handler for "endless handling":
void new_handle(cppcms::http::context::completion_type t,
booster::shared_ptr<cppcms::http::context> context,
size_t broadcasted)
{
if(t) return; // non-zero error
if(broadcasted == messages_.size())
// no new messages mark for waiting once agains
waiters_.push_back(context);
else {
// send all we got meanwhile
while(broadcasted < messages_.size()) {
context->response().out() << messages_[broadcaster] <<'\n;
broadcasted++;
}
// send message asychronously
context->async_flush_output(
boost::bind(
&chat::new_handle,
booster::intrusive_ptr<chat>(this),
_1,
context,
messages_.size()));
}
}
And you got chat with "endless" stream, of course it would not work with
the given XMLHttpRequest example but you get the general idea.
BOTTOM LINE
-----------
Think asynchronously...
Regards,
Artyom
|
|
From: Marcel H. <ke...@co...> - 2011-12-27 19:34:22
|
Alright, my code is a bit different from yours and from the chat example
but else it doesn't work.
void SSE::loop(std::string /*page*/)
{
response().io_mode(cppcms::http::response::asynchronous);
response().set_header("Content-Type", "text/event-stream");
int counter = (rand() % 10) + 1;
while (true) {
response().out() << "event: ping\n"
<< "data: {\"time\": \""
<< "foo" //note: this is just an example
<< "\"}\n\n";
counter--;
if (!counter) {
response().out() << "data: is a message at time "
<< "bar" << "\n\n";
counter = (rand() % 10) + 1;
}
context().async_flush_output(boost::bind(&SSE::handler, this, -1));
booster::ptime::sleep(booster::ptime::seconds(1));
}
}
void SSE::handler(int status)
{
std::cout << "Status: " << status << std::endl;
}
two major questions. You told me to use release_context but if I do so,
the connection "aborts" (access to unassigned context) while the second
loop on response().out()
How can I figure out when the user "leaves" the page, so I can stop
producing tons of messages?
Every connection should get it's own messagestream (it's user dependent).
|
|
From: Artyom B. <art...@ya...> - 2011-12-27 14:52:00
|
Please, read carefully the chat example and see how callbacks are used. It is all about event handling. Remember the you run inside event loop. and operations are done via callbacks. It is not like in PHP where "comet" event holds entire thread. Read 3 articles under "Concepts" there: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x You probably looking for something like this. myservice : public cppcms::application { void main(std::string) { context_=release_context(); // now we can handle new connection - note it is very simplistic // we store only one connection, there may be more } void handle_some_external_event() { context_->out() << "event!" << std::endl; context_->async_flush_output(boost::bind(&my_service::on_complete,this,_1); } void on_complete(completion_type c) { if(c!=operation_completed) { // error - disconnect context_.reset(); // delete context } // done we can wait for next event ... } booster::shared_ptr<cppcms::http::context> context_; }; Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ >________________________________ > From: Marcel Hellwig <ke...@co...> >To: Artyom Beilis <art...@ya...>; cpp...@li... >Sent: Tuesday, December 27, 2011 4:15 PM >Subject: Re: [Cppcms-users] "endless" stream of data > >could you give me a simple example? Just writing something stupid. I don't get the async flush output method. Don't know what the handler is and does. > > > |
|
From: Marcel H. <ke...@co...> - 2011-12-27 14:16:03
|
could you give me a simple example? Just writing something stupid. I don't get the async flush output method. Don't know what the handler is and does. |
|
From: Artyom B. <art...@ya...> - 2011-12-27 13:57:03
|
Take a look on a function: cppcms::http::context::async_flush_output http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1context.html#a134469b5dc46667596c360b8b7284dff Small notes: 1. Don't use finalize, it is not needed any more. 2. async_complete_response() - completes the response, and you don't want to. Take a look on the chat example, but instead of calling async_complete_response() you call async_flush_output() with a callback. Note: you need to release the context the same way it is done in chat example. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ >________________________________ > From: Marcel Hellwig <ke...@co...> >To: cpp...@li... >Sent: Tuesday, December 27, 2011 3:42 PM >Subject: [Cppcms-users] "endless" stream of data > > >Hi guys, > >I'd like to use some new, cool, trendy, hightech, modern and ultracool technique called SSE or ServerSentEvents (https://developer.mozilla.org/en/Server-sent_events/Using_server-sent_events) > >But to do that I'd like to make an endless stream of data like the PHP script does. But how to "flush" the data to the client? >I tried > >response().finalize() >>context().async_complete_response() (but i can't use it, because the object isn't useable for communication anymore) >> >> and some other tricks. So I want to now, how to make an asynchron, endless stream of data in cppcms. Maybe you can add an example for this, because it's HTML5, and that rocks ;) > >Regards > >Marcel Hellwig > >------------------------------------------------------------------------------ >Write once. Port to many. >Get the SDK and tools to simplify cross-platform app development. Create >new or port existing apps to sell to consumers worldwide. Explore the >Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join >http://p.sf.net/sfu/intel-appdev >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Marcel H. <ke...@co...> - 2011-12-27 13:42:17
|
Hi guys, I'd like to use some new, cool, trendy, hightech, modern and ultracool technique called SSE or ServerSentEvents (https://developer.mozilla.org/en/Server-sent_events/Using_server-sent_events) But to do that I'd like to make an endless stream of data like the PHP script does. But how to "flush" the data to the client? I tried response().finalize() context().async_complete_response() (but i can't use it, because the object isn't useable for communication anymore) and some other tricks. So I want to now, how to make an asynchron, endless stream of data in cppcms. Maybe you can add an example for this, because it's HTML5, and that rocks ;) Regards Marcel Hellwig |
|
From: 陈抒 <csf...@gm...> - 2011-12-26 12:44:21
|
I removed daemon.lock from config.js file because I can get the process id via this command:" pidof myweb" Thank you. 陈抒 Best regards http://blog.csdn.net/sheismylife On Mon, Dec 26, 2011 at 1:15 PM, Artyom Beilis <art...@ya...> wrote: > Yes, you need to remove lock file: > > http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_config#daemon.lock > > Of course make sure the process is not running (pid= content of this file) > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.sf.net/ > CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ > > ------------------------------ > *From:* 陈抒 <csf...@gm...> > *To:* cpp...@li... > *Sent:* Monday, December 26, 2011 2:43 AM > *Subject:* [Cppcms-users] Can't launch web application > > Hello: > I always got the following error info recently : > Failed to create a lock file:system: File exists > > Any idea? > > > 陈抒 > > Best regards > http://blog.csdn.net/sheismylife > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: Artyom B. <art...@ya...> - 2011-12-26 05:15:11
|
Yes, you need to remove lock file: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_config#daemon.lock Of course make sure the process is not running (pid= content of this file) Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ >________________________________ > From: 陈抒 <csf...@gm...> >To: cpp...@li... >Sent: Monday, December 26, 2011 2:43 AM >Subject: [Cppcms-users] Can't launch web application > > >Hello: > I always got the following error info recently : > Failed to create a lock file:system: File exists > > > Any idea? > > >陈抒 > >Best regards >http://blog.csdn.net/sheismylife > >------------------------------------------------------------------------------ >Write once. Port to many. >Get the SDK and tools to simplify cross-platform app development. Create >new or port existing apps to sell to consumers worldwide. Explore the >Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join >http://p.sf.net/sfu/intel-appdev >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: 陈抒 <csf...@gm...> - 2011-12-26 00:44:16
|
Hello: I always got the following error info recently : Failed to create a lock file:system: File exists Any idea? 陈抒 Best regards http://blog.csdn.net/sheismylife |
|
From: 陈抒 <csf...@gm...> - 2011-12-25 02:57:57
|
Maybe you can have a look at this: http://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx CPPCMS_API Macro supports several platforms,VC++ need __declspec(dllexport) or __declspec(dllimport),and Linux doesn't need this. 陈抒 Best regards http://blog.csdn.net/sheismylife 2011/12/25 44073786 <440...@qq...> > > ** > I know the file, I want to know .what is problem it can solved? > > ------------------ 原始邮件 ------------------ > *发件人:* "csfreebird"<csf...@gm...>; > *发送时间:* 2011年12月25日(星期天) 上午10:38 > *收件人:* "cppcms-users"<cpp...@li...>; ** > *主题:* Re: [Cppcms-users] what is mean of the CPPCMS_API ? > > Do you want to know where the definition of CPPCMS_API? > You can find it in defs.h file. > > #if defined(__WIN32) || defined(_WIN32) || defined(WIN32) || > defined(__CYGWIN__) > # if defined(DLL_EXPORT) > # if defined(CPPCMS_SOURCE) || defined(CPPCMS_LOCALE_SOURCE) > # define CPPCMS_API __declspec(dllexport) > # else > # define CPPCMS_API __declspec(dllimport) > # endif > # else > # define CPPCMS_API > # endif > #else // ELF BINARIES > # define CPPCMS_API > #endif > > 陈抒 > Best regards > http://blog.csdn.net/sheismylife > > > On Sun, Dec 25, 2011 at 10:35 AM, 陈抒 <csf...@gm...> wrote: > >> What problem should be solved? >> >> >> 陈抒 >> Best regards >> http://blog.csdn.net/sheismylife >> >> >> On Sun, Dec 25, 2011 at 10:11 AM, 44073786 <440...@qq...> wrote: >> >>> >>> When i read the source code ,I find the CPPCMS_API in service.h file at >>> 70 line (class CPPCMS_API service).I have never seen this use . what >>> problem did it can solved ? who can tell me it. thank you very much. >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Write once. Port to many. >>> Get the SDK and tools to simplify cross-platform app development. Create >>> new or port existing apps to sell to consumers worldwide. Explore the >>> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join >>> http://p.sf.net/sfu/intel-appdev >>> _______________________________________________ >>> Cppcms-users mailing list >>> Cpp...@li... >>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >> > ** > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: 4. <440...@qq...> - 2011-12-25 02:48:06
|
I know the file, I want to know .what is problem it can solved? ------------------ 原始邮件 ------------------ 发件人: "csfreebird"<csf...@gm...>; 发送时间: 2011年12月25日(星期天) 上午10:38 收件人: "cppcms-users"<cpp...@li...>; 主题: Re: [Cppcms-users] what is mean of the CPPCMS_API ? Do you want to know where the definition of CPPCMS_API? You can find it in defs.h file. #if defined(__WIN32) || defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # if defined(DLL_EXPORT) # if defined(CPPCMS_SOURCE) || defined(CPPCMS_LOCALE_SOURCE) # define CPPCMS_API __declspec(dllexport) # else # define CPPCMS_API __declspec(dllimport) # endif # else # define CPPCMS_API # endif #else // ELF BINARIES # define CPPCMS_API #endif 陈抒 Best regards http://blog.csdn.net/sheismylife On Sun, Dec 25, 2011 at 10:35 AM, 陈抒 <csf...@gm...> wrote: What problem should be solved? 陈抒 Best regards http://blog.csdn.net/sheismylife On Sun, Dec 25, 2011 at 10:11 AM, 44073786 <440...@qq...> wrote: When i read the source code ,I find the CPPCMS_API in service.h file at 70 line (class CPPCMS_API service).I have never seen this use . what problem did it can solved ? who can tell me it. thank you very much. ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: 陈抒 <csf...@gm...> - 2011-12-25 02:38:57
|
Do you want to know where the definition of CPPCMS_API? You can find it in defs.h file. #if defined(__WIN32) || defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # if defined(DLL_EXPORT) # if defined(CPPCMS_SOURCE) || defined(CPPCMS_LOCALE_SOURCE) # define CPPCMS_API __declspec(dllexport) # else # define CPPCMS_API __declspec(dllimport) # endif # else # define CPPCMS_API # endif #else // ELF BINARIES # define CPPCMS_API #endif 陈抒 Best regards http://blog.csdn.net/sheismylife On Sun, Dec 25, 2011 at 10:35 AM, 陈抒 <csf...@gm...> wrote: > What problem should be solved? > > > 陈抒 > Best regards > http://blog.csdn.net/sheismylife > > > On Sun, Dec 25, 2011 at 10:11 AM, 44073786 <440...@qq...> wrote: > >> >> When i read the source code ,I find the CPPCMS_API in service.h file at >> 70 line (class CPPCMS_API service).I have never seen this use . what >> problem did it can solved ? who can tell me it. thank you very much. >> >> >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Write once. Port to many. >> Get the SDK and tools to simplify cross-platform app development. Create >> new or port existing apps to sell to consumers worldwide. Explore the >> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join >> http://p.sf.net/sfu/intel-appdev >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > |
|
From: 陈抒 <csf...@gm...> - 2011-12-25 02:35:53
|
What problem should be solved? 陈抒 Best regards http://blog.csdn.net/sheismylife On Sun, Dec 25, 2011 at 10:11 AM, 44073786 <440...@qq...> wrote: > > When i read the source code ,I find the CPPCMS_API in service.h file at 70 > line (class CPPCMS_API service).I have never seen this use . what problem > did it can solved ? who can tell me it. thank you very much. > > > > > > > > > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: 4. <440...@qq...> - 2011-12-25 02:16:36
|
hello,I read http://art-blog.no-ip.info/wikipp/en/page/wiki_editing and test in the sandox,but when create a link [hello](wikipp/en/page/hello) in the sandox,where i edit the hello page? I do not knonw how to do this action? ------------------ 原始邮件 ------------------ 发件人: "Artyom Beilis"<art...@ya...>; 发送时间: 2011年12月24日(星期六) 晚上9:13 收件人: "cpp...@li..."<cpp...@li...>; 主题: Re: [Cppcms-users] Vandalism on Wiki No problem, :-) Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ >________________________________ > From: 陈抒 <csf...@gm...> >To: Artyom Beilis <art...@ya...>; cpp...@li... >Sent: Saturday, December 24, 2011 2:46 PM >Subject: Re: [Cppcms-users] Vandalism on Wiki > > >By the way,I didn't realize I made a big mistake until you inform us. >:( > > >陈抒 >Best regards >http://blog.csdn.net/sheismylife > > ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: 4. <440...@qq...> - 2011-12-25 02:11:53
|
When i read the source code ,I find the CPPCMS_API in service.h file at 70 line (class CPPCMS_API service).I have never seen this use . what problem did it can solved ? who can tell me it. thank you very much. |