cppcms-users Mailing List for CppCMS C++ Web Framework (Page 121)
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: Artyom <art...@ya...> - 2011-01-05 17:41:38
|
> Joël Lamotte Wrote: > >Just a really tiny minor info about accessing the http://art-blog.no-ip.info/... > >websites : the proxy at my dayjob blocks any access to that domain because it >says it's "suspicious". >It's not very important as I can still access those websites from home and there > >is the mirror on sourceforge for the wiki. >However I can't access the dev blog from my dayjob as there is no mirror I know >of. > Blog has different purpose from wiki: it is much more about communication rather then about information. If you want to read the blog without accessing art-blog.no-ip.info domain you can use any external RSS-Feed reader like GMail's rss reader or Yahoo's rss reader that download its content on hist own so you would not have to access this domain directly. CppCMS's blog content can be fully read from RSS. Artyom |
From: Artyom <art...@ya...> - 2011-01-05 17:37:00
|
----- Original Message ---- > From: Якунин Владимир <sla...@ya...> > To: cpp...@li... > Sent: Wed, January 5, 2011 12:13:23 PM > Subject: [Cppcms-users] event driven functions inside CppCMS 1x > > Hello Artyom and Happy New Year! > > Whether there is an elegant way to use threaded callback functions inside >CppCMS? > As i know - CppCMS use Asio & boost::thread - so i still can use boost::thread >natively > (with some callback template inside calling). But may have a more ready >solution inside CppCMS? > Hello, You should be more specific about what you mean. If you want to post something for execution in the event loop you can use cppcms::service::post if you want to post something for execution in thread pool you can cppcms::service::thread_pool. Artyom > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Klaim <mj...@gm...> - 2011-01-05 15:37:07
|
Hi, Just a really tiny minor info about accessing the http://art-blog.no-ip.info/... websites : the proxy at my dayjob blocks any access to that domain because it says it's "suspicious". It's not very important as I can still access those websites from home and there is the mirror on sourceforge for the wiki. However I can't access the dev blog from my dayjob as there is no mirror I know of. So, is there already a mirror of the dev blog somewhere that I missed? If not, can it be set? It's really minor request so I'm just asking, no problem if it's too problematic to setup. :) Joël Lamotte |
From: hce <web...@gm...> - 2011-01-05 10:36:14
|
Thanks Artyom, that is exactly what I was looking for, works well. Best regards, hce On Tue, Jan 4, 2011 at 10:05 PM, Artyom <art...@ya...> wrote: >> From: hce <web...@gm...> >> >> Hi, >> >> I am building cppcms-0.99.5 with non-standardard pcre and libgcrypt >> location. I set up pcre and libgcrypt in ldconfig > > Fist of all you need make sure you specify the path to the > location of these files in CMake > > cmake -DCMAKE_INCLUDE_PATH="/opt/myprce/include;/opt/mygcrypt/include" \ > -DCMAKE_LIBRARY_PATH="/opt/myprce/lib;/opt/mygcrypt/lib" \ > (other options) > > > Then make sure that CMake finds what you need. i.e.: > > Take a look on your CMakeCache.txt > > It should be contain likes that look like this: > > //Path to a file. > PCRE_INCLUDE:PATH=/opt/myprce/include > > //Path to a library. > PCRE_LIB:FILEPATH=/opt/myprce/lib/libpcre.so > > //Path to a file. > GCRYPT_INCLUDE_DIR:PATH=/opt/mygcrypt/include > > //Path to a library. > LIB_GCRYPT:FILEPATH=/opt/mygcrypt/lib/libgcrypt.so > > > And not pointing to standard location /usr/lib/libpcre.so > >> I've still got >> error of "undefined reference to `pcre_fullinfo" and "undefined >> reference to `gcry_cipher_setkey". > > Are these the only functions you miss and other don't > like gcry_cipher_encrypt and pcre_compile? > > If so can this be an issue with your specific build of these libraries > that miss these functions, or it may be that CMake searches for the libraries > in standard location rather in the location you need. > >> Is there any way to set up pcre and >> libgcrypt in cmake configuration files? >> > > You can specify the variables above manually, i.e. > > cmake \ > -DPCRE_INCLUDE:PATH=/opt/myprce/include \ > -DPCRE_LIB:FILEPATH=/opt/myprce/lib/libpcre.so \ > -DGCRYPT_INCLUDE_DIR:PATH=/opt/mygcrypt/include \ > -DLIB_GCRYPT:FILEPATH=/opt/mygcrypt/lib/libgcrypt.so \ > .. > > However first method is recommended (with specification if > CMAKE_INCLUDE_PATH/CMAKE_LIBRARY_PATH > > Best, > Artyom > > > > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Якунин В. <sla...@ya...> - 2011-01-05 10:13:32
|
Hello Artyom and Happy New Year! Whether there is an elegant way to use threaded callback functions inside CppCMS? As i know - CppCMS use Asio & boost::thread - so i still can use boost::thread natively (with some callback template inside calling). But may have a more ready solution inside CppCMS? |
From: Artyom <art...@ya...> - 2011-01-05 05:19:38
|
Generally this is one of the features I'm planning to include in one of the next releases, however I hadn't had a time to work on this and I don't know when I would be able to start working on it. It is not such simple for several reasons: 1. I need to implement full HTTP/1.1 protocol and not simple HTTP/1.0 subset I have now. 2. I need to provide fallback substitution and protocol for web browsers not capable of handling web sockets at all. So... I have this on my mind but I still had not time to work on this. Artyom > >From: Ping.Zheng <ky...@gm...> >To: cpp...@li... >Sent: Wed, January 5, 2011 4:11:56 AM >Subject: [Cppcms-users] Is it possible to support websocket in cppcms 1.0 ? > >Hello, all: > I think it should to support websocket in cppcms 1.0. Because modern browsers >will support websocket, and it can bring more features to us. > >-- >with all kind regards > |
From: Ping.Zheng <ky...@gm...> - 2011-01-05 02:12:02
|
Hello, all: I think it should to support websocket in cppcms 1.0. Because modern browsers will support websocket, and it can bring more features to us. -- with all kind regards |
From: Artyom <art...@ya...> - 2011-01-04 11:05:15
|
> From: hce <web...@gm...> > > Hi, > > I am building cppcms-0.99.5 with non-standardard pcre and libgcrypt > location. I set up pcre and libgcrypt in ldconfig Fist of all you need make sure you specify the path to the location of these files in CMake cmake -DCMAKE_INCLUDE_PATH="/opt/myprce/include;/opt/mygcrypt/include" \ -DCMAKE_LIBRARY_PATH="/opt/myprce/lib;/opt/mygcrypt/lib" \ (other options) Then make sure that CMake finds what you need. i.e.: Take a look on your CMakeCache.txt It should be contain likes that look like this: //Path to a file. PCRE_INCLUDE:PATH=/opt/myprce/include //Path to a library. PCRE_LIB:FILEPATH=/opt/myprce/lib/libpcre.so //Path to a file. GCRYPT_INCLUDE_DIR:PATH=/opt/mygcrypt/include //Path to a library. LIB_GCRYPT:FILEPATH=/opt/mygcrypt/lib/libgcrypt.so And not pointing to standard location /usr/lib/libpcre.so > I've still got > error of "undefined reference to `pcre_fullinfo" and "undefined > reference to `gcry_cipher_setkey". Are these the only functions you miss and other don't like gcry_cipher_encrypt and pcre_compile? If so can this be an issue with your specific build of these libraries that miss these functions, or it may be that CMake searches for the libraries in standard location rather in the location you need. > Is there any way to set up pcre and > libgcrypt in cmake configuration files? > You can specify the variables above manually, i.e. cmake \ -DPCRE_INCLUDE:PATH=/opt/myprce/include \ -DPCRE_LIB:FILEPATH=/opt/myprce/lib/libpcre.so \ -DGCRYPT_INCLUDE_DIR:PATH=/opt/mygcrypt/include \ -DLIB_GCRYPT:FILEPATH=/opt/mygcrypt/lib/libgcrypt.so \ .. However first method is recommended (with specification if CMAKE_INCLUDE_PATH/CMAKE_LIBRARY_PATH Best, Artyom |
From: hce <web...@gm...> - 2011-01-04 10:44:28
|
Hi, I am building cppcms-0.99.5 with non-standardard pcre and libgcrypt location. I set up pcre and libgcrypt in ldconfig, but I've still got error of "undefined reference to `pcre_fullinfo" and "undefined reference to `gcry_cipher_setkey". Is there any way to set up pcre and libgcrypt in cmake configuration files? Thank you. hce |
From: Artyom <art...@ya...> - 2011-01-04 10:33:15
|
> >From: Klaim <mj...@gm...> >To: cpp...@li... >Sent: Tue, January 4, 2011 12:18:59 PM >Subject: Re: [Cppcms-users] Cppdb: How to fetch a column of unknown type at >compile time? > >Hi, >reading this example > > > try { >> int x = r.get<int>(v); >> } >> catch(cppdb::bad_value_cast const &e) { >> // ok it can't be integer >> } > >I'm thinking : could it be possible to provide a way to make it return a >specific value instead of throwing when the conversion can't be done? >I'm not sure that would be useful in this case but it have been when using >boost::property_tree for example. >Something like > > > int x = r.get<int>( v , -1 ); // return -1 if something gone wrong > >Alllowing the two syntaxes help avoiding unnecessary try/catch when you just >want an obviously wrong result instead of a potential exception you'll have to >remember to catch to stop crashing. > Generally you can do following: int x = -1; r.fetch(v,x); HOWEVER this works only when the value is NULL value, in case of impossible type conversion bad_value_cast would be thrown. If you don't want the bad_value_cast being thrown when you don't know the type, just fetch the value as string and manipulate over it. Artyom |
From: Klaim <mj...@gm...> - 2011-01-04 10:19:05
|
Hi, reading this example try { > int x = r.get<int>(v); > } > catch(cppdb::bad_value_cast const &e) { > // ok it can't be integer > } > I'm thinking : could it be possible to provide a way to make it return a specific value instead of throwing when the conversion can't be done? I'm not sure that would be useful in this case but it have been when using boost::property_tree for example. Something like int x = r.get<int>( v , -1 ); // return -1 if something gone wrong Alllowing the two syntaxes help avoiding unnecessary try/catch when you just want an obviously wrong result instead of a potential exception you'll have to remember to catch to stop crashing. |
From: Artyom <art...@ya...> - 2011-01-04 07:29:34
|
> > How to fetch a column of unknown type at compile time with cppdb? > You can always fetch it as string, any value (with small exception of Binary Large OBjects) is convertible to string and actually under the hood it is almost always string. Why there is no functionality to get the type of the column? Because it is not always well defined. With some databases like sqlite3 the data is "typeless" and even sometimes when you fetch a column it may have some "original" type it does not promises that it would be actually the type you are trying to use or it may be even undefined as it is some combined value. Bottom line: - CppDB is dynamically typed and try to perform the conversions in the best way it can. - If you need to check whether specific value can be treated as for example integer, you can do following: try { int x = r.get<int>(v); } catch(cppdb::bad_value_cast const &e) { // ok it can't be integer } But of course of the original type is string and it holds the text "123" as string, cppdb would happily cast if for you. Artyom |
From: Daniel V. <chi...@gm...> - 2011-01-03 20:48:34
|
How to fetch a column of unknown type at compile time with cppdb? For example in soci we can do code like this: row r; sql << "select arbitrary_column from arbitrary_table where id = 1", into(r); const column_properties & props = r.get_properties(0); switch(props.get_data_type()) { case dt_string: cout << r.get<std::string>(i); break; case dt_integer: cout << r.get<int>(i); break; //others cases... } What is the recommended way to accomplish this with cppdb? ( If one exists). Thanks. |
From: Artyom <art...@ya...> - 2011-01-03 19:01:51
|
Done In CppDB 0.0.2 that had just been released. Artyom ----- Original Message ---- > From: Daniel Vallejos <chi...@gm...> > > I would like a cppdb::session constructor and open method like this: > > session::session(cppdb::connection_info const &ci) > { > open(ci); > } > > void session::open(cppdb::connection_info const &ci) > { > conn_ = connections_manager::instance().open(ci); > } > > This prevent from parsing connection string every time we need a > session. > > Current workaround: > > cppdb::connection_info ci("..."); > //... > cppdb::session sql(cppdb::connections_manager::instance().open(ci)); > > > Thanks. > |
From: Frank E. <fra...@an...> - 2011-01-03 08:59:55
|
hi artyom, thank you very much - this worked in deed :) regards frank Am 30.12.2010 22:10, schrieb Artyom: >> >> my actual problem is that i want to use the QNetworkAccessManager in a >> cppcms application object to perform an external https call which is >> required for an authentication to an external 3rd party provider. >> actually i do something like this in the cppcms application object: >> >> QNetworkAccessManager * nmgr = new QNetworkAccessManager(); >> QNetworkReply * nrep = nmgr->get(QNetworkRequest(url)); >> if(!nrep->waitForReadyRead(30000)) { >> // read failed >> } else { >> QByteArray json = nrep->readAll(); >> // do something with the json data.. >> } >> >> when i run this i get the following runtime error from qt: >> >> QObject::startTimer: QTimer can only be used with threads started with >> QThread >> >> this must originate inside the waitForReadyRead call since the >> QNetworkAccessManager works asynchronous.. >> >> the problem according to the error message must be that the thread is >> not created through QThread and therefore misses some supplemental data >> which hinders QTimer on working. so my first thought was to gt the >> cppcms application somehow inside a QThread. of course i have no idea if >> that's possible at all.. > > I had found this: > > http://doc.trolltech.com/qq/qq27-responsive-guis.html#waitinginalocaleventloop > > Basically it is an example you may use as draft. > > You need to have QCoreApplication created. > > This simple example taken from Qt site works fine, even > not from the main thread: > > #include<QNetworkAccessManager> > #include<QNetworkReply> > #include<QNetworkRequest> > #include<QUrl> > #include<QEventLoop> > #include<QTimer> > #include<QCoreApplication> > #include<iostream> > > > void *func(void *) > { > QNetworkAccessManager manager; > QEventLoop q; > QTimer tT; > > tT.setSingleShot(true); > QObject::connect(&tT, SIGNAL(timeout()),&q, SLOT(quit())); > QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)), > &q, SLOT(quit())); > QNetworkReply *reply = manager.get(QNetworkRequest( > QUrl("http://www.google.com"))); > > tT.start(5000); // 5s timeout > q.exec(); > > if(tT.isActive()){ > // download complete > std::cout<< reply->readAll().data()<< std::endl; > tT.stop(); > } else { > std::cout<< "Timeout"<< std::endl; > // timeout > } > return 0; > > } > > > int main(int argc,char **argv) > { > QCoreApplication app(argc,argv); > pthread_t pid; > pthread_create(&pid,0,func,0); > pthread_join(pid,0); > > } > > Best, > Artyom > > > > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- Dipl.-Ing. (FH) Frank Enderle anamica GmbH Beinsteinerstr. 6 71334 Waiblingen Mobil: +49 151 14981091 Telefon: +49 7151 1351565 1 Telefax: +49 7151 1351565 9 E-Mail: fra...@an... Internet: www.anamica.de Handelsregister: AG Stuttgart HRB 732357 Geschäftsführer: Yvonne Holzwarth, Frank Enderle |
From: Artyom <art...@ya...> - 2011-01-01 10:18:09
|
Hello, CppCMS 0.99.5 released. Full release notes and changelog can be found at: <http://art-blog.no-ip.info/cppcms/blog/post/71> All users are encouraged to update to the latest version. Besides numerous bug fixes, there is one important features included: XSS filter. It is new and experimental feature that requires some "public" testing and review as anything security related to make sure it works find. XSS Filter documentation can be found there: http://art-blog.no-ip.info/cppcms_ref_v0_99/namespacecppcms_1_1xss.html All users are encouraged to review the code that can be found under src/xss.cpp and cppcms/xss.h try to bypass this filter on CppCMS's wiki, editing the sandbox: http://art-blog.no-ip.info/wikipp/en/page/sandbox If you find any vulnerability, submit me the report immediately! Artyom |
From: Artyom <art...@ya...> - 2010-12-30 21:10:32
|
> > my actual problem is that i want to use the QNetworkAccessManager in a > cppcms application object to perform an external https call which is > required for an authentication to an external 3rd party provider. > actually i do something like this in the cppcms application object: > > QNetworkAccessManager * nmgr = new QNetworkAccessManager(); > QNetworkReply * nrep = nmgr->get(QNetworkRequest(url)); > if(!nrep->waitForReadyRead(30000)) { > // read failed > } else { > QByteArray json = nrep->readAll(); > // do something with the json data.. > } > > when i run this i get the following runtime error from qt: > > QObject::startTimer: QTimer can only be used with threads started with > QThread > > this must originate inside the waitForReadyRead call since the > QNetworkAccessManager works asynchronous.. > > the problem according to the error message must be that the thread is > not created through QThread and therefore misses some supplemental data > which hinders QTimer on working. so my first thought was to gt the > cppcms application somehow inside a QThread. of course i have no idea if > that's possible at all.. I had found this: http://doc.trolltech.com/qq/qq27-responsive-guis.html#waitinginalocaleventloop Basically it is an example you may use as draft. You need to have QCoreApplication created. This simple example taken from Qt site works fine, even not from the main thread: #include <QNetworkAccessManager> #include <QNetworkReply> #include <QNetworkRequest> #include <QUrl> #include <QEventLoop> #include <QTimer> #include <QCoreApplication> #include <iostream> void *func(void *) { QNetworkAccessManager manager; QEventLoop q; QTimer tT; tT.setSingleShot(true); QObject::connect(&tT, SIGNAL(timeout()), &q, SLOT(quit())); QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)), &q, SLOT(quit())); QNetworkReply *reply = manager.get(QNetworkRequest( QUrl("http://www.google.com"))); tT.start(5000); // 5s timeout q.exec(); if(tT.isActive()){ // download complete std::cout << reply->readAll().data() << std::endl; tT.stop(); } else { std::cout << "Timeout" << std::endl; // timeout } return 0; } int main(int argc,char **argv) { QCoreApplication app(argc,argv); pthread_t pid; pthread_create(&pid,0,func,0); pthread_join(pid,0); } Best, Artyom |
From: Frank E. <fra...@an...> - 2010-12-30 17:14:52
|
Am 30.12.2010 17:01, schrieb Artyom: >> >> hi, >> >> i'm writing a server application which runs cppcms as the server engine, >> but the cppcms applications are written using QT 4.6. This is a >> requirement and can't be changed. >> > > What are you using Qt for? the project depends on the qt datatypes and classes. it does not have an ui, but it uses qt classes and concepts. >> I managed to get everything working except for the thread crossing >> signal/slot mechanism from qt > > If you want to send a signal between CppCMS application and Qt part > you need to use this via either Posting events to each one's main > loop or use other trick. > > Both CppCMS and Qt framework has their event loops. > To use each even loop you need to play by their rules. > > If you want to have separate GUI and HTTP "GUI" you > make them to cooperate by positing events, both Qt > and CppCMS has such tools to do this in thread safe way. > this sounds complicated.. :( > >> and qt timers since they all depend on >> QThreads but the cppcms applications are generated by the cppcms >> application_pool and therefore are (i suppose) more booster threads than >> qt threads. > > Threads are threads... and has nothing to do with Qt or CppCMS - all > pthreads under the hood. > > So if you'll describe requirements in more clear way > or show what is the exact problem you have I probably can help > you but otherwise I don't understand what you need. > my actual problem is that i want to use the QNetworkAccessManager in a cppcms application object to perform an external https call which is required for an authentication to an external 3rd party provider. actually i do something like this in the cppcms application object: QNetworkAccessManager * nmgr = new QNetworkAccessManager(); QNetworkReply * nrep = nmgr->get(QNetworkRequest(url)); if(!nrep->waitForReadyRead(30000)) { // read failed } else { QByteArray json = nrep->readAll(); // do something with the json data.. } when i run this i get the following runtime error from qt: QObject::startTimer: QTimer can only be used with threads started with QThread this must originate inside the waitForReadyRead call since the QNetworkAccessManager works asynchronous.. the problem according to the error message must be that the thread is not created through QThread and therefore misses some supplemental data which hinders QTimer on working. so my first thought was to gt the cppcms application somehow inside a QThread. of course i have no idea if that's possible at all.. >> >> My qeustion is: is it possible to factor the cppcms applications in a >> way that they are QThreads? >> > > CppCMS applications are not threads, they just objects that created > and cached and they called from CppCMS's thread pool upon request > (of course if you talking about synchronous model). > so CppCMS just instances new objects via new - right? (yes, synchronous model) > Asynchonous CppCMS applications are object that interact > via main event loop of CppCMS and called upon HTTP requests. > >> Thanks, >> >> Frank > > Artyom > > > > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- Dipl.-Ing. (FH) Frank Enderle anamica GmbH Beinsteinerstr. 6 71334 Waiblingen Mobil: +49 151 14981091 Telefon: +49 7151 1351565 1 Telefax: +49 7151 1351565 9 E-Mail: fra...@an... Internet: www.anamica.de Handelsregister: AG Stuttgart HRB 732357 Geschäftsführer: Yvonne Holzwarth, Frank Enderle |
From: Artyom <art...@ya...> - 2010-12-30 16:01:40
|
> > hi, > > i'm writing a server application which runs cppcms as the server engine, > but the cppcms applications are written using QT 4.6. This is a > requirement and can't be changed. > What are you using Qt for? > I managed to get everything working except for the thread crossing > signal/slot mechanism from qt If you want to send a signal between CppCMS application and Qt part you need to use this via either Posting events to each one's main loop or use other trick. Both CppCMS and Qt framework has their event loops. To use each even loop you need to play by their rules. If you want to have separate GUI and HTTP "GUI" you make them to cooperate by positing events, both Qt and CppCMS has such tools to do this in thread safe way. > and qt timers since they all depend on > QThreads but the cppcms applications are generated by the cppcms > application_pool and therefore are (i suppose) more booster threads than > qt threads. Threads are threads... and has nothing to do with Qt or CppCMS - all pthreads under the hood. So if you'll describe requirements in more clear way or show what is the exact problem you have I probably can help you but otherwise I don't understand what you need. > > My qeustion is: is it possible to factor the cppcms applications in a > way that they are QThreads? > CppCMS applications are not threads, they just objects that created and cached and they called from CppCMS's thread pool upon request (of course if you talking about synchronous model). Asynchonous CppCMS applications are object that interact via main event loop of CppCMS and called upon HTTP requests. > Thanks, > > Frank Artyom |
From: Frank E. <fra...@an...> - 2010-12-30 15:36:37
|
hi, i'm writing a server application which runs cppcms as the server engine, but the cppcms applications are written using QT 4.6. This is a requirement and can't be changed. I managed to get everything working except for the thread crossing signal/slot mechanism from qt and qt timers since they all depend on QThreads but the cppcms applications are generated by the cppcms application_pool and therefore are (i suppose) more booster threads than qt threads. My qeustion is: is it possible to factor the cppcms applications in a way that they are QThreads? Thanks, Frank -- Dipl.-Ing. (FH) Frank Enderle anamica GmbH Beinsteinerstr. 6 71334 Waiblingen Mobil: +49 151 14981091 Telefon: +49 7151 1351565 1 Telefax: +49 7151 1351565 9 E-Mail: fra...@an... Internet: www.anamica.de Handelsregister: AG Stuttgart HRB 732357 Geschäftsführer: Yvonne Holzwarth, Frank Enderle |
From: Artyom <art...@ya...> - 2010-12-30 07:44:25
|
> From: Daniel Vallejos > > I would like a cppdb::session constructor and open method like this: > > session::session(cppdb::connection_info const &ci) > { > open(ci); > } > > void session::open(cppdb::connection_info const &ci) > { > conn_ = connections_manager::instance().open(ci); > } > > This prevent from parsing connection string every time we need a > session. Good point. Actually I was thinking the when you call connections_manager::instance().open(std::string const &) I would not parse the connection string as I can search the string by key in the pool, so actually open(std::string const &) would not cause additional parsing. Looking to the code I had found that I do parse the string before I check the connection pool, and it should be optimized. In any case, what you suggested is very good point and I'll add this. Artyom |
From: Daniel V. <chi...@gm...> - 2010-12-29 15:46:20
|
I would like a cppdb::session constructor and open method like this: session::session(cppdb::connection_info const &ci) { open(ci); } void session::open(cppdb::connection_info const &ci) { conn_ = connections_manager::instance().open(ci); } This prevent from parsing connection string every time we need a session. Current workaround: cppdb::connection_info ci("..."); //... cppdb::session sql(cppdb::connections_manager::instance().open(ci)); Thanks. |
From: Daniel V. <chi...@gm...> - 2010-12-29 15:33:06
|
On Tue, 2010-12-28 at 23:50 -0800, Artyom wrote: > When connection is closed all prepared statements are destroyed. > They would be prepared upon first request automatically. > > Of course you should **not** keep them on your own, i.e.: > > class foo { > foo() > { > sql("mysql:..."); > my_insert = sql.prepare("INSERT ..."); > } > void insert() { > my_insert.bind(...); > my_insert.exec() > } > session sql; > statement my_insert; > } > > But rather access them as usually, > > class foo { > foo() > { > conn_str = "mysql:...;@pool_size=5" > } > void insert() { > session sql(conn_str); > sql << "INSERT ..." << x << exec; > } > std::string conn_str; > } > My problem was that I kept them on my own!. Thank you! I see into your code, and I figure out you not rebuild prepared statements, instead you fetch them from cache. I think this information is useful for new users to guide them on how to use the library. |
From: Artyom <art...@ya...> - 2010-12-29 07:50:22
|
>Hello. > >I can't find a method to test database connection. I think there is no such >method (Similarly, there is no such method in SOCI). > >I think this method would be useful for connection error handling and >robustness. The simplest way to do this would be int value; sql << "SELECT 1" >> cppdb::row >> value; The problem is that usually you do not want to "ping" a server for each query. The reason is round trip cost. So if you query the database every second you probably don't need this, and if you idle for hours you probably not need to keep the idle connection opened. cppdb allows you use connection pooling. Each connection in pool has its maximal idle timeout so if you fetch a connection from the pool and it was idle for more then certain period of time it would just be closed and a new one opened for you. So basically what you need it following: every time you need a connection you just open it. However if you specify option @pool_size=8 it would keep up to 8 open connections and each time you request it it would give you an opened connection from pool. If the connection was idle for too long time (10 min by default) it would be closed and new connection would be opened for you. For details see: http://art-blog.no-ip.info/sql/cppdb/connstr.html For example: void some_func() { session sql("mysql:user=foo;password=bar;@pool_size=5"); sql << "SELECT foo FROM bar"; ... } Thats it, all timeouts would be handled for you. If you want to explicitly close all idle connections and not close them of attempt to connect. you may use void cppdb::connections_manager::gc() > >Another issue related: When connection is lost to database and we reconnect >later, we need to re build all prepared statements. > > >The ideal would have a statement object to be rebuilt when its associated >session is reconnected. > When connection is closed all prepared statements are destroyed. They would be prepared upon first request automatically. Of course you should **not** keep them on your own, i.e.: class foo { foo() { sql("mysql:..."); my_insert = sql.prepare("INSERT ..."); } void insert() { my_insert.bind(...); my_insert.exec() } session sql; statement my_insert; } But rather access them as usually, class foo { foo() { conn_str = "mysql:...;@pool_size=5" } void insert() { session sql(conn_str); sql << "INSERT ..." << x << exec; } std::string conn_str; } > For example in mysql by default the server closes the connection after eight > hours if nothing has happened. ("MySQL server has gone away" error ). Then a >web > > application that is idle for 8 hours or more suffer from such problems. I've had with issue with my blog - the cache was too damn good so I hadn't need my database at all and it was gone after hours. I had changed MySQL server options and increased idle time. However with CppDB and connection pooling it would be much simpler. Artyom |
From: Daniel V. <chi...@gm...> - 2010-12-28 21:40:08
|
Hello. I can't find a method to test database connection. I think there is no such method (Similarly, there is no such method in SOCI). I think this method would be useful for connection error handling and robustness. Another issue related: When connection is lost to database and we reconnect later, we need to re build all prepared statements. The ideal would have a statement object to be rebuilt when its associated session is reconnected. This would be a code like this: cppdb::session sql("..."); ... if (! sql.is_connect() ) { sql.reconnect(); // reconnect session and rebuild all prepared statement associated } Would it be possible in future cppdb releases? For example in mysql by default the server closes the connection after eight hours if nothing has happened. ( "MySQL server has gone away" error ). Then a web application that is idle for 8 hours or more suffer from such problems. What is the proper way to deal with this problem with actual version? Thank you. |