cppcms-users Mailing List for CppCMS C++ Web Framework (Page 102)
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
|
From: Marcel H. <ke...@co...> - 2011-12-15 09:30:26
|
Hello Artyom, I thank you for this great explanation. This makes some things clear. It makes sense and I will costumize the User Class in that way. Thanks again Am 15.12.2011 10:08, schrieb Artyom Beilis: > Hello Marcel, > > > I'll explain, > > what you are trying to do is to create a "User" class that is derived from cppcms::session > on the fly and then destroy it and this "User" object is not connected to the application. > > cppcms::application objects are designed to be long-living objects. When a request > arrives and an application is selected from the pool it, and **all its children** > receive a cppcms::http::context, which holds the connection, session, request, > response. And once the request is complete, the context is destroyed and > the application object returns to the pool. > > Now, what you are trying to do is to create an application on the fly, > and then destroy it. It is not the way to use application because > they should be either: > > a) Stand alone application that are created from the pool > > (assigned to the applications_pool() of the main service) > b) They are connected long living children of the application > in the pool, sub-applications. In order to work properly > they must be "added" or "attached" to the main application. > > > It is usually done in the constructor of such application. > Once they connected they share and use the same context. > and they live together with this application as long as it > lives. > > > So when you try to call user->session() you get an exception > as user does not know about the specific request context and > > is not connected to any application. > > > In your case User should not be derived from CppCMS application, > or it should be attached the same way to the Techtree the way > Techree is attached to Dispatcher. > > I hope it makes it clear. > > (I think this would be a good entry for wiki, if it is clear enough) > > Best, > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.sf.net/ > CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ > > > ----- Original Message ----- >> From: Marcel Hellwig<ke...@co...> >> To: cpp...@li... >> Cc: >> Sent: Thursday, December 15, 2011 10:08 AM >> Subject: [Cppcms-users] How to avoid "Access to unassigned context" >> >> G ood morning, >> >> I'm writing a program that uses sessions. Here's my config: >> >> "session" : { >> "location" : "server", >> "timeout" : 3600, //1 hour >> "expire" : "renew", >> "cookies" : { >> // "domain" : "localhost", >> "path" : "/", >> "prefix" : "bg_", >> "secure" : false, >> }, >> "server" : { >> "storage" : "files", >> "dir" : "tmp/cookies", >> "shared" : false, >> }, >> "gc" : 86400 //once a day >> }, >> >> now my problem. >> I'm using the dispatcher, there I assign the "fill" method, named >> prepare. Everything works until now. In this "fill" method i declare a >> >> new pointer to an Object and give this pointer to an other method, named >> "fillContent". There i use some methods from the >> "pointed-Object". In >> that object I have to, or I want to the session. That for the >> Constructor of the Object becomes the cppcms::application reference. >> Now I try to set, or to read a cookie. Both fails with the error "Access >> to unassigned context". If i remove that "session-line" >> everything works >> back to normal. >> >> Please, give me some advices. >> >> Regards, >> Marcel Hellwig >> Hamburg, Germany >> >> >> >> Here some code: >> >> Dispatcher::Dispatcher(cppcms::service&s) : cppcms::application(s) { >> ..... >> attach(new Techtree(s), >> "Techtree", >> "/techtree/{1}", >> "/techtree/?(.*)", 1); >> ..... >> } >> >> Techtree::Techtree(cppcms::service& srv) : BasePage(srv) { >> mapper().assign("{1}"); >> mapper().assign(""); >> dispatcher().assign(".*",&Techtree::prepare, this, 0); >> } >> >> void Techtree::prepare(std::string /*page*/) { >> User* user; >> ...... >> user = new User(_srv, session().get<int>("uID")); >> ...... >> session().set("uID", "1"); //this works! >> ..... >> fillContent(c, user); //c is the struct of template strings >> delete user; >> } >> >> void Techtree::fillContent(data::techtree::main c, User* user) { >> >> c.MetalMineDep = "<tr><td>---</td></tr>"; >> user->getBuildingLevel(101, 1); >> c.SolarPowerPlantDep = >> "<tr><td>---</td></tr>"; >> render("techtree", c); >> } >> >> User::User(cppcms::service& srv, int id) : cppcms::application(srv), >> _srv(srv), _userID(id) { >> _conn_str = >> _srv.settings().get<std::string>("bg.connection_string"); >> _sql.open(_conn_str); >> _init(); >> } >> >> void User::_init() { >> ........ >> session().set("test, "test123"); //here the error occurs >> } >> >> ------------------------------------------------------------------------------ >> 10 Tips for Better Server Consolidation >> Server virtualization is being driven by many needs. >> But none more important than the need to reduce IT complexity >> while improving strategic productivity. Learn More! >> http://www.accelacomm.com/jaw/sdnl/114/51507609/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > ------------------------------------------------------------------------------ > 10 Tips for Better Server Consolidation > Server virtualization is being driven by many needs. > But none more important than the need to reduce IT complexity > while improving strategic productivity. Learn More! > http://www.accelacomm.com/jaw/sdnl/114/51507609/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@ya...> - 2011-12-15 09:08:24
|
Hello Marcel, I'll explain, what you are trying to do is to create a "User" class that is derived from cppcms::session on the fly and then destroy it and this "User" object is not connected to the application. cppcms::application objects are designed to be long-living objects. When a request arrives and an application is selected from the pool it, and **all its children** receive a cppcms::http::context, which holds the connection, session, request, response. And once the request is complete, the context is destroyed and the application object returns to the pool. Now, what you are trying to do is to create an application on the fly, and then destroy it. It is not the way to use application because they should be either: a) Stand alone application that are created from the pool (assigned to the applications_pool() of the main service) b) They are connected long living children of the application in the pool, sub-applications. In order to work properly they must be "added" or "attached" to the main application. It is usually done in the constructor of such application. Once they connected they share and use the same context. and they live together with this application as long as it lives. So when you try to call user->session() you get an exception as user does not know about the specific request context and is not connected to any application. In your case User should not be derived from CppCMS application, or it should be attached the same way to the Techtree the way Techree is attached to Dispatcher. I hope it makes it clear. (I think this would be a good entry for wiki, if it is clear enough) Best, Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ ----- Original Message ----- > From: Marcel Hellwig <ke...@co...> > To: cpp...@li... > Cc: > Sent: Thursday, December 15, 2011 10:08 AM > Subject: [Cppcms-users] How to avoid "Access to unassigned context" > >G ood morning, > > I'm writing a program that uses sessions. Here's my config: > > "session" : { > "location" : "server", > "timeout" : 3600, //1 hour > "expire" : "renew", > "cookies" : { > // "domain" : "localhost", > "path" : "/", > "prefix" : "bg_", > "secure" : false, > }, > "server" : { > "storage" : "files", > "dir" : "tmp/cookies", > "shared" : false, > }, > "gc" : 86400 //once a day > }, > > now my problem. > I'm using the dispatcher, there I assign the "fill" method, named > prepare. Everything works until now. In this "fill" method i declare a > > new pointer to an Object and give this pointer to an other method, named > "fillContent". There i use some methods from the > "pointed-Object". In > that object I have to, or I want to the session. That for the > Constructor of the Object becomes the cppcms::application reference. > Now I try to set, or to read a cookie. Both fails with the error "Access > to unassigned context". If i remove that "session-line" > everything works > back to normal. > > Please, give me some advices. > > Regards, > Marcel Hellwig > Hamburg, Germany > > > > Here some code: > > Dispatcher::Dispatcher(cppcms::service &s) : cppcms::application(s) { > ..... > attach(new Techtree(s), > "Techtree", > "/techtree/{1}", > "/techtree/?(.*)", 1); > ..... > } > > Techtree::Techtree(cppcms::service& srv) : BasePage(srv) { > mapper().assign("{1}"); > mapper().assign(""); > dispatcher().assign(".*", &Techtree::prepare, this, 0); > } > > void Techtree::prepare(std::string /*page*/) { > User* user; > ...... > user = new User(_srv, session().get<int>("uID")); > ...... > session().set("uID", "1"); //this works! > ..... > fillContent(c, user); //c is the struct of template strings > delete user; > } > > void Techtree::fillContent(data::techtree::main c, User* user) { > > c.MetalMineDep = "<tr><td>---</td></tr>"; > user->getBuildingLevel(101, 1); > c.SolarPowerPlantDep = > "<tr><td>---</td></tr>"; > render("techtree", c); > } > > User::User(cppcms::service& srv, int id) : cppcms::application(srv), > _srv(srv), _userID(id) { > _conn_str = > _srv.settings().get<std::string>("bg.connection_string"); > _sql.open(_conn_str); > _init(); > } > > void User::_init() { > ........ > session().set("test, "test123"); //here the error occurs > } > > ------------------------------------------------------------------------------ > 10 Tips for Better Server Consolidation > Server virtualization is being driven by many needs. > But none more important than the need to reduce IT complexity > while improving strategic productivity. Learn More! > http://www.accelacomm.com/jaw/sdnl/114/51507609/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Marcel H. <ke...@co...> - 2011-12-15 08:08:25
|
Good morning, I'm writing a program that uses sessions. Here's my config: "session" : { "location" : "server", "timeout" : 3600, //1 hour "expire" : "renew", "cookies" : { // "domain" : "localhost", "path" : "/", "prefix" : "bg_", "secure" : false, }, "server" : { "storage" : "files", "dir" : "tmp/cookies", "shared" : false, }, "gc" : 86400 //once a day }, now my problem. I'm using the dispatcher, there I assign the "fill" method, named prepare. Everything works until now. In this "fill" method i declare a new pointer to an Object and give this pointer to an other method, named "fillContent". There i use some methods from the "pointed-Object". In that object I have to, or I want to the session. That for the Constructor of the Object becomes the cppcms::application reference. Now I try to set, or to read a cookie. Both fails with the error "Access to unassigned context". If i remove that "session-line" everything works back to normal. Please, give me some advices. Regards, Marcel Hellwig Hamburg, Germany Here some code: Dispatcher::Dispatcher(cppcms::service &s) : cppcms::application(s) { ..... attach(new Techtree(s), "Techtree", "/techtree/{1}", "/techtree/?(.*)", 1); ..... } Techtree::Techtree(cppcms::service& srv) : BasePage(srv) { mapper().assign("{1}"); mapper().assign(""); dispatcher().assign(".*", &Techtree::prepare, this, 0); } void Techtree::prepare(std::string /*page*/) { User* user; ...... user = new User(_srv, session().get<int>("uID")); ...... session().set("uID", "1"); //this works! ..... fillContent(c, user); //c is the struct of template strings delete user; } void Techtree::fillContent(data::techtree::main c, User* user) { c.MetalMineDep = "<tr><td>---</td></tr>"; user->getBuildingLevel(101, 1); c.SolarPowerPlantDep = "<tr><td>---</td></tr>"; render("techtree", c); } User::User(cppcms::service& srv, int id) : cppcms::application(srv), _srv(srv), _userID(id) { _conn_str = _srv.settings().get<std::string>("bg.connection_string"); _sql.open(_conn_str); _init(); } void User::_init() { ........ session().set("test, "test123"); //here the error occurs } |
From: Artyom B. <art...@ya...> - 2011-12-12 10:54:49
|
> >Hi, > > > As I understand it, we can always distribute the application and the > library (cppcms) together. Yes of course, as long as you follow LGPLv3 requirements. > So is it really important to maintain > ABI compatibility? > Yes: 1. You can update dynamic library without recompiling the application, including important bug fixes. Makes the deploy and maintenance much easier 2. Many applications can share same library 3. You don't have ABI clashes between libraries or components compiled against different versions. Think what would happen to Qt if they were breaking their ABI every release? Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ |
From: Leon <le...@wl...> - 2011-12-12 10:08:54
|
Hi, As I understand it, we can always distribute the application and the library (cppcms) together. So is it really important to maintain ABI compatibility? |
From: Artyom B. <art...@ya...> - 2011-12-11 09:11:18
|
Hello, I've implemented a simple JsonRPC based chat, it can be found in trunk: http://cppcms.svn.sourceforge.net/viewvc/cppcms/framework/trunk/examples/json_rpc_chat/ It provides an example of using asynchronous JsonRPC services with long-polling, timeouts and other error handling. Also you can find synchronous JsonRPC examples under http://cppcms.svn.sourceforge.net/viewvc/cppcms/framework/trunk/examples/json_rpc/ They both use simple JsonRPC client implementation in JavaScript that can be found in contrib/client_side/jsonrpc: http://cppcms.svn.sourceforge.net/viewvc/cppcms/framework/trunk/contrib/client_side/jsonrpc/ Regards Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ |
From: Marcel H. <ke...@co...> - 2011-12-07 15:22:06
|
you should add different folders for different languages and regions. F.e. en_US en_AU ..... Of course you can use the same tranlation for different languages. Read http://www.gnu.org/s/gettext/ for further infos. Am 07.12.2011 16:10, schrieb ??: > I changed one line code: > dispatcher().assign("^/(en_US|zh_CN)/?$",&hello::say_hello,this,1); > and changed config.js like so: > "locales" : [ "zh_CN.UTF-8", "en_US.UTF-8" ] > > Yes,it works now. > If I want to support three languages,should I create he and zh folders? > > > ?? > Best regards > http://blog.csdn.net/sheismylife > > > On Wed, Dec 7, 2011 at 10:55 PM, Artyom Beilis <art...@ya... > <mailto:art...@ya...>> wrote: > > Because this specific example handles multiple locales in the same > process > and has following lines: > > > dispatcher().assign("^/(en_US|he_IL)/?$",&hello::say_hello,this,1); > dispatcher().assign("^(.*)$",&hello::redirect,this); > > :-) > > You need to set Chinese locale to use the translation under "/zh/" > folder. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.sf.net/ > CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ > > ------------------------------------------------------------------------ > *From:* ?? <csf...@gm... <mailto:csf...@gm...>> > *To:* cpp...@li... > <mailto:cpp...@li...> > *Sent:* Wednesday, December 7, 2011 4:28 PM > *Subject:* [Cppcms-users] Question about file path of hello.po > in example > > Hello, > I tried localization example tonight,it works. > But I don't know why translator can find the hello.po file > in /local/he/LC_MESSAGES folder. But after I rename the folder > he to zh and modify the Makefile,I can't see ??? ???? ???? in > web page. > > > ?? > Best regards > http://blog.csdn.net/sheismylife > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, > checklist and point of > discussion for anyone considering optimizing the pricing and > packaging model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > <mailto:Cpp...@li...> > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist > and point of > discussion for anyone considering optimizing the pricing and > packaging model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > <mailto:Cpp...@li...> > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point of > discussion for anyone considering optimizing the pricing and packaging model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: 陈抒 <csf...@gm...> - 2011-12-07 15:10:35
|
I changed one line code: dispatcher().assign("^/(en_US|zh_CN)/?$",&hello::say_hello,this,1); and changed config.js like so: "locales" : [ "zh_CN.UTF-8", "en_US.UTF-8" ] Yes,it works now. If I want to support three languages,should I create he and zh folders? 陈抒 Best regards http://blog.csdn.net/sheismylife On Wed, Dec 7, 2011 at 10:55 PM, Artyom Beilis <art...@ya...> wrote: > Because this specific example handles multiple locales in the same process > and has following lines: > > dispatcher().assign("^/(en_US|he_IL)/?$",&hello::say_hello,this,1); > dispatcher().assign("^(.*)$",&hello::redirect,this); > > :-) > > You need to set Chinese locale to use the translation under "/zh/" folder. > > 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:* Wednesday, December 7, 2011 4:28 PM > *Subject:* [Cppcms-users] Question about file path of hello.po in example > > Hello, > I tried localization example tonight,it works. > But I don't know why translator can find the hello.po file in > /local/he/LC_MESSAGES folder. But after I rename the folder he to zh and > modify the Makefile,I can't see אני רוצה לומר in web page. > > > 陈抒 > Best regards > http://blog.csdn.net/sheismylife > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point > of > discussion for anyone considering optimizing the pricing and packaging > model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point > of > discussion for anyone considering optimizing the pricing and packaging > model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: Artyom B. <art...@ya...> - 2011-12-07 14:55:46
|
Because this specific example handles multiple locales in the same process and has following lines: dispatcher().assign("^/(en_US|he_IL)/?$",&hello::say_hello,this,1); dispatcher().assign("^(.*)$",&hello::redirect,this); :-) You need to set Chinese locale to use the translation under "/zh/" folder. 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: Wednesday, December 7, 2011 4:28 PM >Subject: [Cppcms-users] Question about file path of hello.po in example > > >Hello, > I tried localization example tonight,it works. > But I don't know why translator can find the hello.po file in /local/he/LC_MESSAGES folder. But after I rename the folder he to zh and modify the Makefile,I can't see אני רוצה לומר in web page. > > > >陈抒 >Best regards >http://blog.csdn.net/sheismylife > >------------------------------------------------------------------------------ >Cloud Services Checklist: Pricing and Packaging Optimization >This white paper is intended to serve as a reference, checklist and point of >discussion for anyone considering optimizing the pricing and packaging model >of a cloud services business. Read Now! >http://www.accelacomm.com/jaw/sfnl/114/51491232/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: 陈抒 <csf...@gm...> - 2011-12-07 14:29:24
|
Hello, I tried localization example tonight,it works. But I don't know why translator can find the hello.po file in /local/he/LC_MESSAGES folder. But after I rename the folder he to zh and modify the Makefile,I can't see אני רוצה לומר in web page. 陈抒 Best regards http://blog.csdn.net/sheismylife |
From: Artyom B. <art...@ya...> - 2011-12-05 20:16:30
|
> > The opt_reconnect does not work as prepared statements do not survive connection > lost. > Another possible way to solve this problem is to clear prepared statements cache in case of error. cppdb::session sql(...) try { sql << ... }catch(cppdb::cppdb_error const &) { sql.clear_cache(); throw; } This would work with opt_reconnect=1, but yet it is a workaround. Artyom |
From: Artyom B. <art...@ya...> - 2011-12-05 20:11:02
|
Hello, I had checked it and yes indeed, there is a problem. The opt_reconnect does not work as prepared statements do not survive connection lost. It works with @use_prepared=off and opt_reconnect=1 but of course it has performance penalty as you loose all advantages of CppDB prepared statements caching. If the connection is lost due to timeout then probably you can change @pool_max_idle to smaller value (default is 600 i.e. 10 minutes) > > But it didn't work. How should I do? Catch exception > and call cppdb::connections_manager::gc() ? > Currently this is only option that works. Also notice that you need to call it **after** connection is closed: try { cppdb::session sql(...) }catch(cppdb::cppdb_error const &) { cppdb::connections_manager::instance().gc(); throw; } I'll look on it deeply ASAP, but it is not something simple to fix. I had opened a ticket: https://sourceforge.net/tracker/?func=detail&aid=3451653&group_id=209965&atid=1011835 Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ >________________________________ > From: 陈抒 <csf...@gm...> > > >Hello, > My web site's DB connection broke because of timeout. My web site is developed in China,but MySQL server is running in the USA. I got one error log: >2011-12-05 15:43:02 GMT; cppcms, error: Caught exception [cppdb::mysql::Lost connection to MySQL server during query] > (http_context.cpp:150) > > > I have used reconnect property already: > stringstream stream; > stream<<"mysql:host="<<config.mysql_ip<<";database="<<config.mysql_db_name<<";user="<<config.mysql_user<<";password="<<config.mysql_password<<";@pool_size=20;set_charset_name=utf8;opt_reconnect=1"; > > > >陈抒 >Best regards >http://blog.csdn.net/sheismylife > >------------------------------------------------------------------------------ >All the data continuously generated in your IT infrastructure >contains a definitive record of customers, application performance, >security threats, fraudulent activity, and more. Splunk takes this >data and makes sense of it. IT sense. And common sense. >http://p.sf.net/sfu/splunk-novd2d >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: 陈抒 <csf...@gm...> - 2011-12-05 16:04:15
|
Hello, My web site's DB connection broke because of timeout. My web site is developed in China,but MySQL server is running in the USA. I got one error log: 2011-12-05 15:43:02 GMT; cppcms, error: Caught exception [cppdb::mysql::Lost connection to MySQL server during query] (http_context.cpp:150) I have used reconnect property already: stringstream stream; stream<<"mysql:host="<<config.mysql_ip<<";database="<<config.mysql_db_name<<";user="<<config.mysql_user<<";password="<<config.mysql_password<<";@pool_size=20;set_charset_name=utf8; opt_reconnect=1"; But it didn't work. How should I do? Catch exception and call cppdb::connections_manager::gc() ? 陈抒 Best regards http://blog.csdn.net/sheismylife |
From: Artyom B. <art...@ya...> - 2011-12-04 13:05:06
|
Hello Daniel, ----- Original Message ----- > From: Daniel Vallejos <chi...@gm...> > To: cpp...@li... > Cc: > Sent: Friday, November 25, 2011 6:15 AM > Subject: [Cppcms-users] Feature Request: Feature added to cppcms::rpc::json_method > > Hello Ayrtom. > > I added (see attachment) a feature to cppcms::rpc::json_method and it's > binders. > > The feature allow to bind parameters of type: > > const cppcms::json::value const & > cppcms::json::object const & > cppcms::json::array const & > std::string const & > > The forwarding of these types are passed by reference (zero copy > overhead). > > For Example we can add a json rpc method of type: > > void my_rpc::my_method(json::array const& a, json::object& o, > json::value& v); > ... > bind("my_method", > json_method(&my_rpc::my_method,this), > json_rpc_server::method_role); > ... > I had reviewed the code it is very good idea. I had changed it a little to handle properly all cases like (foo/foo const/foo const &) and made rather template specialization for struct rather then function. Commited to the trunk to changeset 2013 with updated unit test. Thank you for this patch/idea. > > In theory the changes no breaks backward compatibility and ABI. > Actually till 1.0.0 is released the ABI and even (limited) API can be changed in backward incompatible way. Thanks again, Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ |
From: Artyom B. <art...@ya...> - 2011-12-03 20:36:26
|
>________________________________ > From: Marcel Hellwig <ke...@co...> >To: cpp...@li... >Sent: Saturday, December 3, 2011 5:32 PM >Subject: [Cppcms-users] Loop through files when responding > >Greetings, > >I am trying to loop through .css, .js, .png or everything else to the >browser. >At this time I dispatch all incoming transfers that are redirecting to >/media to a class that will read the content of the asked file and give >out the content via response(). > >But this is not very comfort, because i have to set the MIME type maually. > >I read and found the file_server config node, but there is an >exclamation, that you shouldn't use it in production enviroment. I >understand this, but then tell me how to redirect all the files that are >in a special folder to the browser with the right mime type. >Or should I really set the MIME type manually? I mean this won't be a >big problem, but there has to be a better solution ;) > >Regards, > >Marcel Hellwig >Hamburg, Germany > Two points: a) Why don't you use actual web server to serve the files? Just use Lighttpd, Apache or Nginx connected to CppCMS with FastCGI and let the web server to handle static files (they are very good in it) I assume you are familiar with these pages: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_tut_web_server_config http://art-blog.no-ip.info/wikipp/en/page/run_application_web_server_root b) Starting from CppCMS 0.99.10 the internal web server you can use production use. Also it is mostly intended to be used in embedded environment and not for high traffic web sites. I'd strongly recommend give a web server a job of serving files rather then doing it manually. Especially when serving files involves many important security issues that should be handled properly. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ |
From: Marcel H. <ke...@co...> - 2011-12-03 15:33:03
|
Greetings, I am trying to loop through .css, .js, .png or everything else to the browser. At this time I dispatch all incoming transfers that are redirecting to /media to a class that will read the content of the asked file and give out the content via response(). But this is not very comfort, because i have to set the MIME type maually. I read and found the file_server config node, but there is an exclamation, that you shouldn't use it in production enviroment. I understand this, but then tell me how to redirect all the files that are in a special folder to the browser with the right mime type. Or should I really set the MIME type manually? I mean this won't be a big problem, but there has to be a better solution ;) Regards, Marcel Hellwig Hamburg, Germany |
From: Artyom B. <art...@ya...> - 2011-12-01 17:53:30
|
I've seen your message but hadn't time to review it. If I don't respond till sunday send me a reminder once again Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ >________________________________ > From: Daniel Vallejos <chi...@gm...> >To: cpp...@li... >Sent: Thursday, December 1, 2011 6:50 PM >Subject: Re: [Cppcms-users] Feature Request: Feature added to cppcms::rpc::json_method > > >Hello Artyom. > >Did you have the time to see the code? > >I added very few lines to rpc_json.h. > >For me it is useful to receive json values const references with zero copy. > > >void foo::bar(json::array const &a, json::object const &o,json::value const &v); >>... >>bind("bar",json_method(&foo::bar,this),json_rpc_server::method_role); >>... >> >Good bye. > >On Fri, 2011-11-25 at 01:15 -0300, Daniel Vallejos wrote: >Hello Ayrtom. I added (see attachment) a feature to cppcms::rpc::json_method and its binders. The feature allow to bind parameters of type: const cppcms::json::value const & cppcms::json::object const & cppcms::json::array const & std::string const & The forwarding of these types are passed by reference (zero copy overhead). For Example we can add a json rpc method of type: void my_rpc::my_method(json::array const& a, json::object const& o, json::value const& v); ... bind("my_method", json_method(&my_rpc::my_method,this), json_rpc_server::method_role); ... In theory the changes no breaks backward compatibility and ABI. In practice my whole project compile with it without change. Please review the code if you wish. Thank you. > >------------------------------------------------------------------------------ >All the data continuously generated in your IT infrastructure >contains a definitive record of customers, application performance, >security threats, fraudulent activity, and more. Splunk takes this >data and makes sense of it. IT sense. And common sense. >http://p.sf.net/sfu/splunk-novd2d >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: Daniel V. <chi...@gm...> - 2011-12-01 16:50:50
|
Hello Artyom. Did you have the time to see the code? I added very few lines to rpc_json.h. For me it is useful to receive json values const references with zero copy. void foo::bar(json::array const &a, json::object const &o,json::value const &v); ... bind("bar",json_method(&foo::bar,this),json_rpc_server::method_role); ... Good bye. On Fri, 2011-11-25 at 01:15 -0300, Daniel Vallejos wrote: > Hello Ayrtom. > > I added (see attachment) a feature to cppcms::rpc::json_method and its > binders. > > The feature allow to bind parameters of type: > > const cppcms::json::value const & > cppcms::json::object const & > cppcms::json::array const & > std::string const & > > The forwarding of these types are passed by reference (zero copy > overhead). > > For Example we can add a json rpc method of type: > > void my_rpc::my_method(json::array const& a, json::object const& o, > json::value const& v); > ... > bind("my_method", > json_method(&my_rpc::my_method,this), > json_rpc_server::method_role); > ... > > > In theory the changes no breaks backward compatibility and ABI. > > In practice my whole project compile with it without change. > > Please review the code if you wish. > > Thank you. > |
From: Artyom B. <art...@ya...> - 2011-11-30 12:12:16
|
----- Original Message ----- > From: Marcel Hellwig <ke...@co...> > To: Artyom Beilis <art...@ya...>; cpp...@li... > Cc: > Sent: Wednesday, November 30, 2011 9:12 AM > Subject: Re: [Cppcms-users] Reload views from .so > > no :) > I mean, that you can manually say, reload now! and he reloads. Maybe it > would be good enough if I set the boolean to true and afterwards back to > false, but it would be a nice option to say, reload the next time the > librarys but do not check always, because, you said it, of performance. > Maybe something like this: > > render().reloadLibrary(); > > and then he will set a flag and reloads the librarys but only once. Get it? > Few points. 1. Providing thread safe reload library would have almost the same performance penalty. In order to make it thread safe you need to acquire Read Lock on some R/W mutex. Checking the time-stamp requires small resources as well. So I don't what is the difference it can make. 2. First check how auto_reload option affects the performance if significantly then it may make sense to do something about but if it does not... Don't bother use auto_reload, I don't think it would be that bad. So if you want to switch the library just execute "move" on the shared object replacing it with new one and CppCMS would reload it automatically. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ |
From: kpeo <sla...@ya...> - 2011-11-30 08:58:34
|
Hello, imho, it would make sense if you want to reload a library with a different name, like "load_view('lib')" where pattern in config applies to this name. checking of file timestamp is not so critical for performance. 30.11.2011, 11:12, "Marcel Hellwig" <ke...@co...>: > no :) > I mean, that you can manually say, reload now! and he reloads. Maybe it > would be good enough if I set the boolean to true and afterwards back to > false, but it would be a nice option to say, reload the next time the > librarys but do not check always, because, you said it, of performance. > Maybe something like this: > > render().reloadLibrary(); > > and then he will set a flag and reloads the librarys but only once. Get it? > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a definitive record of customers, application performance, > security threats, fraudulent activity, and more. Splunk takes this > data and makes sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-novd2d > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Marcel H. <ke...@co...> - 2011-11-30 07:12:33
|
no :) I mean, that you can manually say, reload now! and he reloads. Maybe it would be good enough if I set the boolean to true and afterwards back to false, but it would be a nice option to say, reload the next time the librarys but do not check always, because, you said it, of performance. Maybe something like this: render().reloadLibrary(); and then he will set a flag and reloads the librarys but only once. Get it? |
From: Artyom B. <art...@ya...> - 2011-11-29 20:54:36
|
Hello, Two points: 1. If auto_reload is true the views would be automatically reloaded if the shared object had changed. So anything you need to do is to replace a shared object with a new one. This method is thread safe but has some performance penalty (it requires checking file timestamp each time the template is rendered) 2. You can manually load and unload shared object upon signal you get but this may be not thread safe so you need to make sure nothing happens. Such that if some thread renders HTML and you unload shared object bad things can happen. See: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_config#views.auto_reload Does this fits you needs? Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ ----- Original Message ----- > From: Marcel Hellwig <ke...@co...> > To: cpp...@li... > Cc: > Sent: Tuesday, November 29, 2011 10:23 PM > Subject: [Cppcms-users] Reload views from .so > > Hi guys, > > i really love this framework and although I'm still learning CPP it's > great. The performance is... awesome! :) Big contrast to PHP or Tomcat. > So my question. I'd like to run the server and from time to time I'd > like to change the pages, but without resetting the server, so I thought > I'm putting some signal handler, which will reload all the views when > they get a SIGUSR1. I looked into the source and found, that you will > check in "views_pool.cpp:331" if the config auto_reload flag is true. > So > I thought it would be awesome, if you could outsource the thing where > you reload the files into a method you can call from the outside if you > want to. (wow, 4 times you in one sentence) > What is your opinion. Worth a try? > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a definitive record of customers, application performance, > security threats, fraudulent activity, and more. Splunk takes this > data and makes sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-novd2d > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Marcel H. <ke...@co...> - 2011-11-29 20:23:50
|
Hi guys, i really love this framework and although I'm still learning CPP it's great. The performance is... awesome! :) Big contrast to PHP or Tomcat. So my question. I'd like to run the server and from time to time I'd like to change the pages, but without resetting the server, so I thought I'm putting some signal handler, which will reload all the views when they get a SIGUSR1. I looked into the source and found, that you will check in "views_pool.cpp:331" if the config auto_reload flag is true. So I thought it would be awesome, if you could outsource the thing where you reload the files into a method you can call from the outside if you want to. (wow, 4 times you in one sentence) What is your opinion. Worth a try? |
From: Marcel H. <ke...@co...> - 2011-11-27 10:40:41
|
Thanks a lot, it works. Maybe it has something to do with that i use a 64-Bit system and the path is /usr/lib64/libmysqlclient.so Any way to check this? |
From: Daniel V. <chi...@gm...> - 2011-11-25 20:35:44
|
You should install the package that contains "mysql.h" and "libmysqlclient.so". If you already installed that package, try to setup manually the following variables (use cmake or cmake-gui (recomended) ) MYSQL_LIB MYSQL_PATH On my system (ubuntu 11.10): MYSQL_LIB=/usr/lib/libmysqlclient.so MYSQL_PATH=/usr/include/mysql Good bye. On Fri, 2011-11-25 at 20:04 +0000, Marcel Hellwig wrote: > What is the MysqlClient under Fedora? I nearly installed every packed that has > something to do with mysql under fedora, but it still says me: > "-- mysqlclient not found, disableing mysql backend" > I can compile it without, but don't have the mysql features. > What is your experience? |