cppcms-users Mailing List for CppCMS C++ Web Framework (Page 70)
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
|
| 2026 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: sergey l. <ccp...@gm...> - 2012-10-24 09:02:54
|
Hi All!
What is the best practice to serialize vector of struct
(std::vector<struct_name>)?
Now I use ugly method to wrap main struct into struct container with
std:vector member:
struct page_container : public cppcms::serializable {
struct page : public cppcms::serializable {
std::string uuid;
time_t insert_date;
time_t update_date;
void serialize(cppcms::archive &a) {
a & uuid & insert_date & update_date;
}
};
std::vector<page> pages;
void serialize(cppcms::archive &a) {
a & pages;
}
};
page_container pages;
if(!cache().fetch_data("pages", pages)) {
get_pages(pages);
cache().store_data("pages", pages);
}
Thanks in advance!
|
|
From: Shiv S. D. <shi...@gm...> - 2012-10-23 18:14:44
|
Hi, Is it simple to do write a backend driver based on what is available for Hypertable? On Tue, Oct 23, 2012 at 10:19 PM, Artyom Beilis <art...@ya...> wrote: > Using cppdb you only need to add a small parameter to connection string > to enable connection pooling. > It would automatically use a pool withing a special singleton. > > Usually you don't need to use the pool class directly. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* Lee Elenbaas <lee...@gm...> > *To:* cpp...@li... > *Sent:* Tuesday, October 23, 2012 5:33 PM > *Subject:* Re: [Cppcms-users] DB connection pooling > > I have not used cppDB yet - aside from some testing - but if you look at > its API, it comes with a pool class, > > just hold an instance of that pool in your app, and use it whenever you > need a connection > you can pass a shared_ptr around for it - or just store it in a single > place. > > but this is not part of the cppcms framework itself, and i have no idea > how the pool will handle multiple threads requesting a connection at the > same time - perhaps Artyom could answer that > > On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal < > shi...@gm...> wrote: > > Agreed. So where do I put my DB connection pool? As mentioned in > documentation "The CppCMS service has a simple design of a single event > loop and a thread pool that handles actual user application responses." > this means on outer side there is an event-based design and internally > there is a thread pool. Therefore I draw a conclusion that I need a thread > based pool and once the application is mounted and a factory object is > created right where I hit first db query I should use one connection from > pool. > > > On Mon, Oct 22, 2012 at 6:30 PM, Lee Elenbaas <lee...@gm...>wrote: > > I fail to see the connection between the application being asynchronious > and the DB connections being pooled > > if you need to do several things with the same DB at the same time (or > simply in different threads) > you need several DB connections - you can choose to pool them - and this > way reuse them > > both synchronious and asynchronious applications can handle multiple > threads - so both need some way of using db connections - and a pool is one > good way to do that > > On Mon, Oct 22, 2012 at 2:22 PM, Shiv Shankar Dayal < > shi...@gm...> wrote: > > Hi, > Consider the following piece of documentation > If the application that handles it is a synchronous application, its > execution is passed to the *thread pool*. The user application prepares > the response and sends it synchronously to the client and the context is > destroyed, completing the "requst/response" cycle. > If the application is asynchronous, the HTTP Context remains inside the > event loop's thread and it is handled by the asynchronous application. This > application may decide to complete the response immediately or postpone it > by implementing, for example, long polling. > and following code > > 1. int main(int argc,char ** argv) > 2. { > 3. try { > 4. cppcms::service srv(argc,argv); > 5. srv.applications_pool().mount( > 6. cppcms::applications_factory<hello>() > 7. ); > > now as it is also written that applications are asynchronous what is the > need of more that one database connection. Is it the case that one > persistent connection will suffice? > -- > Best regards, > Shiv Shankar Dayal > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > -- > -- > lee > Lee Elenbaas > lee...@gm... > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > -- > Best regards, > Shiv Shankar Dayal > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > -- > -- > lee > Lee Elenbaas > lee...@gm... > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > -- Best regards, Shiv Shankar Dayal |
|
From: Artyom B. <art...@ya...> - 2012-10-23 16:49:21
|
Using cppdb you only need to add a small parameter to connection string to enable connection pooling. It would automatically use a pool withing a special singleton. Usually you don't need to use the pool class directly. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Lee Elenbaas <lee...@gm...> >To: cpp...@li... >Sent: Tuesday, October 23, 2012 5:33 PM >Subject: Re: [Cppcms-users] DB connection pooling > > >I have not used cppDB yet - aside from some testing - but if you look at its API, it comes with a pool class, > > >just hold an instance of that pool in your app, and use it whenever you need a connection >you can pass a shared_ptr around for it - or just store it in a single place. > > >but this is not part of the cppcms framework itself, and i have no idea how the pool will handle multiple threads requesting a connection at the same time - perhaps Artyom could answer that > > >On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal <shi...@gm...> wrote: > >Agreed. So where do I put my DB connection pool? As mentioned in documentation "The CppCMS service has a simple design of a single event loop and a thread pool that handles actual user application responses." this means on outer side there is an event-based design and internally there is a thread pool. Therefore I draw a conclusion that I need a thread based pool and once the application is mounted and a factory object is created right where I hit first db query I should use one connection from pool. >> >> >> >>On Mon, Oct 22, 2012 at 6:30 PM, Lee Elenbaas <lee...@gm...> wrote: >> >>I fail to see the connection between the application being asynchronious and the DB connections being pooled >>> >>> >>>if you need to do several things with the same DB at the same time (or simply in different threads) >>>you need several DB connections - you can choose to pool them - and this way reuse them >>> >>> >>>both synchronious and asynchronious applications can handle multiple threads - so both need some way of using db connections - and a pool is one good way to do that >>> >>> >>>On Mon, Oct 22, 2012 at 2:22 PM, Shiv Shankar Dayal <shi...@gm...> wrote: >>> >>>Hi, >>>> >>>>Consider the following piece of documentation >>>> >>>>If the application that handles it is a synchronous application, its execution is passed to the thread pool. The user application prepares the response and sends it synchronously to the client and the context is destroyed, completing the "requst/response" cycle. >>>>If the application is asynchronous, the HTTP Context remains inside the event loop's thread and it is handled by the asynchronous application. This application may decide to complete the response immediately or postpone it by implementing, for example, long polling.and following code >>>> >>>> 1. int main(int argc,char ** argv) >>>> 2. { >>>> 3. try { >>>> 4. cppcms::service srv(argc,argv); >>>> >>>> 5. srv.applications_pool().mount( >>>> 6. cppcms::applications_factory<hello>() >>>> 7. ); >>>> >>>>now as it is also written that applications are asynchronous what is the need of more that one database connection. Is it the case that one persistent connection will suffice? >>>>-- >>>>Best regards, >>>>Shiv Shankar Dayal >>>> >>>>------------------------------------------------------------------------------ >>>>Everyone hates slow websites. So do we. >>>>Make your web apps faster with AppDynamics >>>>Download AppDynamics Lite for free today: >>>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>>_______________________________________________ >>>>Cppcms-users mailing list >>>>Cpp...@li... >>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>> >>> >>> >>>-- >>>-- >>>lee >>>Lee Elenbaas >>>lee...@gm... >>> >>> >>>------------------------------------------------------------------------------ >>>Everyone hates slow websites. So do we. >>>Make your web apps faster with AppDynamics >>>Download AppDynamics Lite for free today: >>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >> >> >>-- >>Best regards, >>Shiv Shankar Dayal >> >>------------------------------------------------------------------------------ >>Everyone hates slow websites. So do we. >>Make your web apps faster with AppDynamics >>Download AppDynamics Lite for free today: >>http://p.sf.net/sfu/appdyn_sfd2d_oct >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > > > >-- >-- >lee >Lee Elenbaas >lee...@gm... > > >------------------------------------------------------------------------------ >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_sfd2d_oct >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Lee E. <lee...@gm...> - 2012-10-23 16:29:47
|
I have not used cppDB yet - aside from some testing - but if you look at
its API, it comes with a pool class,
just hold an instance of that pool in your app, and use it whenever you
need a connection
you can pass a shared_ptr around for it - or just store it in a single
place.
but this is not part of the cppcms framework itself, and i have no idea how
the pool will handle multiple threads requesting a connection at the same
time - perhaps Artyom could answer that
On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal <
shi...@gm...> wrote:
> Agreed. So where do I put my DB connection pool? As mentioned in
> documentation "The CppCMS service has a simple design of a single event
> loop and a thread pool that handles actual user application responses."
> this means on outer side there is an event-based design and internally
> there is a thread pool. Therefore I draw a conclusion that I need a thread
> based pool and once the application is mounted and a factory object is
> created right where I hit first db query I should use one connection from
> pool.
>
>
> On Mon, Oct 22, 2012 at 6:30 PM, Lee Elenbaas <lee...@gm...>wrote:
>
>> I fail to see the connection between the application being asynchronious
>> and the DB connections being pooled
>>
>> if you need to do several things with the same DB at the same time (or
>> simply in different threads)
>> you need several DB connections - you can choose to pool them - and this
>> way reuse them
>>
>> both synchronious and asynchronious applications can handle multiple
>> threads - so both need some way of using db connections - and a pool is one
>> good way to do that
>>
>> On Mon, Oct 22, 2012 at 2:22 PM, Shiv Shankar Dayal <
>> shi...@gm...> wrote:
>>
>>> Hi,
>>>
>>> Consider the following piece of documentation
>>>
>>> If the application that handles it is a synchronous application, its
>>> execution is passed to the *thread pool*. The user application prepares
>>> the response and sends it synchronously to the client and the context is
>>> destroyed, completing the "requst/response" cycle.
>>>
>>> If the application is asynchronous, the HTTP Context remains inside the
>>> event loop's thread and it is handled by the asynchronous application. This
>>> application may decide to complete the response immediately or postpone it
>>> by implementing, for example, long polling.
>>> and following code
>>>
>>> 1. int main(int argc,char ** argv)
>>> 2. {
>>> 3. try {
>>> 4. cppcms::service srv(argc,argv);
>>> 5. srv.applications_pool().mount(
>>> 6. cppcms::applications_factory<hello>()
>>> 7. );
>>>
>>> now as it is also written that applications are asynchronous what is the
>>> need of more that one database connection. Is it the case that one
>>> persistent connection will suffice?
>>> --
>>> Best regards,
>>> Shiv Shankar Dayal
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Everyone hates slow websites. So do we.
>>> Make your web apps faster with AppDynamics
>>> Download AppDynamics Lite for free today:
>>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>>> _______________________________________________
>>> Cppcms-users mailing list
>>> Cpp...@li...
>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>>
>>>
>>
>>
>> --
>> --
>> lee
>> Lee Elenbaas
>> lee...@gm...
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>>
>
>
> --
> Best regards,
> Shiv Shankar Dayal
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
--
--
lee
Lee Elenbaas
lee...@gm...
|
|
From: Shiv S. D. <shi...@gm...> - 2012-10-22 13:48:02
|
Agreed. So where do I put my DB connection pool? As mentioned in
documentation "The CppCMS service has a simple design of a single event
loop and a thread pool that handles actual user application responses."
this means on outer side there is an event-based design and internally
there is a thread pool. Therefore I draw a conclusion that I need a thread
based pool and once the application is mounted and a factory object is
created right where I hit first db query I should use one connection from
pool.
On Mon, Oct 22, 2012 at 6:30 PM, Lee Elenbaas <lee...@gm...>wrote:
> I fail to see the connection between the application being asynchronious
> and the DB connections being pooled
>
> if you need to do several things with the same DB at the same time (or
> simply in different threads)
> you need several DB connections - you can choose to pool them - and this
> way reuse them
>
> both synchronious and asynchronious applications can handle multiple
> threads - so both need some way of using db connections - and a pool is one
> good way to do that
>
> On Mon, Oct 22, 2012 at 2:22 PM, Shiv Shankar Dayal <
> shi...@gm...> wrote:
>
>> Hi,
>>
>> Consider the following piece of documentation
>>
>> If the application that handles it is a synchronous application, its
>> execution is passed to the *thread pool*. The user application prepares
>> the response and sends it synchronously to the client and the context is
>> destroyed, completing the "requst/response" cycle.
>>
>> If the application is asynchronous, the HTTP Context remains inside the
>> event loop's thread and it is handled by the asynchronous application. This
>> application may decide to complete the response immediately or postpone it
>> by implementing, for example, long polling.
>> and following code
>>
>> 1. int main(int argc,char ** argv)
>> 2. {
>> 3. try {
>> 4. cppcms::service srv(argc,argv);
>> 5. srv.applications_pool().mount(
>> 6. cppcms::applications_factory<hello>()
>> 7. );
>>
>> now as it is also written that applications are asynchronous what is the
>> need of more that one database connection. Is it the case that one
>> persistent connection will suffice?
>> --
>> Best regards,
>> Shiv Shankar Dayal
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>>
>
>
> --
> --
> lee
> Lee Elenbaas
> lee...@gm...
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
--
Best regards,
Shiv Shankar Dayal
|
|
From: Lee E. <lee...@gm...> - 2012-10-22 13:00:44
|
I fail to see the connection between the application being asynchronious
and the DB connections being pooled
if you need to do several things with the same DB at the same time (or
simply in different threads)
you need several DB connections - you can choose to pool them - and this
way reuse them
both synchronious and asynchronious applications can handle multiple
threads - so both need some way of using db connections - and a pool is one
good way to do that
On Mon, Oct 22, 2012 at 2:22 PM, Shiv Shankar Dayal <
shi...@gm...> wrote:
> Hi,
>
> Consider the following piece of documentation
>
> If the application that handles it is a synchronous application, its
> execution is passed to the *thread pool*. The user application prepares
> the response and sends it synchronously to the client and the context is
> destroyed, completing the "requst/response" cycle.
>
> If the application is asynchronous, the HTTP Context remains inside the
> event loop's thread and it is handled by the asynchronous application. This
> application may decide to complete the response immediately or postpone it
> by implementing, for example, long polling.
> and following code
>
> 1. int main(int argc,char ** argv)
> 2. {
> 3. try {
> 4. cppcms::service srv(argc,argv);
> 5. srv.applications_pool().mount(
> 6. cppcms::applications_factory<hello>()
> 7. );
>
> now as it is also written that applications are asynchronous what is the
> need of more that one database connection. Is it the case that one
> persistent connection will suffice?
> --
> Best regards,
> Shiv Shankar Dayal
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
--
--
lee
Lee Elenbaas
lee...@gm...
|
|
From: Shiv S. D. <shi...@gm...> - 2012-10-22 12:22:31
|
Hi,
Consider the following piece of documentation
If the application that handles it is a synchronous application, its
execution is passed to the *thread pool*. The user application prepares the
response and sends it synchronously to the client and the context is
destroyed, completing the "requst/response" cycle.
If the application is asynchronous, the HTTP Context remains inside the
event loop's thread and it is handled by the asynchronous application. This
application may decide to complete the response immediately or postpone it
by implementing, for example, long polling.
and following code
1. int main(int argc,char ** argv)
2. {
3. try {
4. cppcms::service srv(argc,argv);
5. srv.applications_pool().mount(
6. cppcms::applications_factory<hello>()
7. );
now as it is also written that applications are asynchronous what is the
need of more that one database connection. Is it the case that one
persistent connection will suffice?
--
Best regards,
Shiv Shankar Dayal
|
|
From: Artyom B. <art...@ya...> - 2012-10-20 15:14:49
|
>________________________________ > From: sergey lavrov <ccp...@gm...> >To: cpp...@li... >Sent: Saturday, October 20, 2012 2:29 PM >Subject: Re: [Cppcms-users] How to get attached applications? > > >Can I create a feature request or do you think such functionality are unnecessary? > You can create a feature request, even though I don't think it is critical. The best? Implement such a feature and send a patch. Hints: create an sub-application iterator (using iterator facade in booster headers) Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > >On Sat, Oct 20, 2012 at 3:45 PM, Artyom Beilis <art...@ya...> wrote: > >No, such an api is not provided, you can only get a pointer to parent application. >> >> >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: sergey lavrov <ccp...@gm...> >>>To: cpp...@li... >>>Sent: Saturday, October 20, 2012 11:15 AM >>>Subject: Re: [Cppcms-users] How to get attached applications? >>> >>> >>> >>>Dear Artyom, thanks for quick reply! >>> >>> >>>Yes your approach is obviously but is it some method in cppcms to get pointer of attached application (attached_app) and not creating member in main application class and storing pointer in it? >>> >>> >>>Thanks in advance! >>> >>> >>> >>>On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...> wrote: >>> >>>Obviously... keep a pointer on it? >>>> >>>> >>>>this->my_attached_app = new attached_app(service); >>>>attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); >>>> >>>> >>>>Artyom Beilis >>>>-------------- >>>>CppCMS - C++ Web Framework: http://cppcms.com/ >>>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >>>> >>>> >>>> >>>>>________________________________ >>>>> From: sergey lavrov <ccp...@gm...> >>>>>To: cpp...@li... >>>>>Sent: Saturday, October 20, 2012 10:25 AM >>>>>Subject: [Cppcms-users] How to get attached applications? >>>>> >>>>> >>>>> >>>>>Dear All! >>>>> >>>>> >>>>>How can I get attached application (attached_app) from main application (main_app)? >>>>>I need to call some functions (for example attached_app::check()) from attached application (attached_app) in main application (main_app) before redirect to another page or process further. >>>>> >>>>> >>>>>For example my application consist of: >>>>> >>>>> >>>>>int main() { >>>>> ... >>>>> service.applications_pool().mount(cppcms::applications_factory<main_app>()); >>>>> ... >>>>>} >>>>> >>>>> >>>>>bool attached_app::check() { >>>>> return true; >>>>>} >>>>> >>>>> >>>>>main_app::main_app(cppcms::service &service) : cppcms::application(service) { >>>>> ... >>>>> attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); >>>>> ... >>>>>} >>>>> >>>>> >>>>>main_app::main(std::string url) { >>>>> /* There I need to call attached_app::check() first to check user session variables and url before redirect to another page or process further. */ >>>>>} >>>>> >>>>> >>>>>Thanks in advance! >>>>> >>>>> >>>>>------------------------------------------------------------------------------ >>>>>Everyone hates slow websites. So do we. >>>>>Make your web apps faster with AppDynamics >>>>>Download AppDynamics Lite for free today: >>>>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>>>_______________________________________________ >>>>>Cppcms-users mailing list >>>>>Cpp...@li... >>>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>>> >>>>> >>>>> >>>>------------------------------------------------------------------------------ >>>>Everyone hates slow websites. So do we. >>>>Make your web apps faster with AppDynamics >>>>Download AppDynamics Lite for free today: >>>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>>_______________________________________________ >>>>Cppcms-users mailing list >>>>Cpp...@li... >>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>> >>>------------------------------------------------------------------------------ >>>Everyone hates slow websites. So do we. >>>Make your web apps faster with AppDynamics >>>Download AppDynamics Lite for free today: >>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >>------------------------------------------------------------------------------ >>Everyone hates slow websites. So do we. >>Make your web apps faster with AppDynamics >>Download AppDynamics Lite for free today: >>http://p.sf.net/sfu/appdyn_sfd2d_oct >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > >------------------------------------------------------------------------------ >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_sfd2d_oct >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: sergey l. <ccp...@gm...> - 2012-10-20 12:29:19
|
Can I create a feature request or do you think such functionality are unnecessary? On Sat, Oct 20, 2012 at 3:45 PM, Artyom Beilis <art...@ya...> wrote: > No, such an api is not provided, you can only get a pointer to parent > application. > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* sergey lavrov <ccp...@gm...> > *To:* cpp...@li... > *Sent:* Saturday, October 20, 2012 11:15 AM > *Subject:* Re: [Cppcms-users] How to get attached applications? > > Dear Artyom, thanks for quick reply! > > Yes your approach is obviously but is it some method in cppcms to get > pointer of attached application (attached_app) and not creating member in > main application class and storing pointer in it? > > Thanks in advance! > > > On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...>wrote: > > Obviously... keep a pointer on it? > > this->my_attached_app = new attached_app(service); > attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* sergey lavrov <ccp...@gm...> > *To:* cpp...@li... > *Sent:* Saturday, October 20, 2012 10:25 AM > *Subject:* [Cppcms-users] How to get attached applications? > > Dear All! > > How can I get attached application (attached_app) from main application > (main_app)? > I need to call some functions (for example attached_app::check()) > from attached application (attached_app) in main application > (main_app) before redirect to another page or process further. > > For example my application consist of: > > int main() { > ... > > service.applications_pool().mount(cppcms::applications_factory<main_app>()); > ... > } > > bool attached_app::check() { > return true; > } > > main_app::main_app(cppcms::service &service) : > cppcms::application(service) { > ... > attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); > ... > } > > main_app::main(std::string url) { > /* There I need to call attached_app::check() first to check user > session variables and url before redirect to another page or > process further. */ > } > > Thanks in advance! > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: Artyom B. <art...@ya...> - 2012-10-20 11:45:19
|
No, such an api is not provided, you can only get a pointer to parent application. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: sergey lavrov <ccp...@gm...> >To: cpp...@li... >Sent: Saturday, October 20, 2012 11:15 AM >Subject: Re: [Cppcms-users] How to get attached applications? > > >Dear Artyom, thanks for quick reply! > > >Yes your approach is obviously but is it some method in cppcms to get pointer of attached application (attached_app) and not creating member in main application class and storing pointer in it? > > >Thanks in advance! > > > >On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...> wrote: > >Obviously... keep a pointer on it? >> >> >>this->my_attached_app = new attached_app(service); >>attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); >> >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: sergey lavrov <ccp...@gm...> >>>To: cpp...@li... >>>Sent: Saturday, October 20, 2012 10:25 AM >>>Subject: [Cppcms-users] How to get attached applications? >>> >>> >>> >>>Dear All! >>> >>> >>>How can I get attached application (attached_app) from main application (main_app)? >>>I need to call some functions (for example attached_app::check()) from attached application (attached_app) in main application (main_app) before redirect to another page or process further. >>> >>> >>>For example my application consist of: >>> >>> >>>int main() { >>> ... >>> service.applications_pool().mount(cppcms::applications_factory<main_app>()); >>> ... >>>} >>> >>> >>>bool attached_app::check() { >>> return true; >>>} >>> >>> >>>main_app::main_app(cppcms::service &service) : cppcms::application(service) { >>> ... >>> attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); >>> ... >>>} >>> >>> >>>main_app::main(std::string url) { >>> /* There I need to call attached_app::check() first to check user session variables and url before redirect to another page or process further. */ >>>} >>> >>> >>>Thanks in advance! >>> >>> >>>------------------------------------------------------------------------------ >>>Everyone hates slow websites. So do we. >>>Make your web apps faster with AppDynamics >>>Download AppDynamics Lite for free today: >>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >>------------------------------------------------------------------------------ >>Everyone hates slow websites. So do we. >>Make your web apps faster with AppDynamics >>Download AppDynamics Lite for free today: >>http://p.sf.net/sfu/appdyn_sfd2d_oct >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > >------------------------------------------------------------------------------ >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_sfd2d_oct >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: sergey l. <ccp...@gm...> - 2012-10-20 09:15:40
|
Dear Artyom, thanks for quick reply!
Yes your approach is obviously but is it some method in cppcms to get
pointer of attached application (attached_app) and not creating member in
main application class and storing pointer in it?
Thanks in advance!
On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...> wrote:
> Obviously... keep a pointer on it?
>
> this->my_attached_app = new attached_app(service);
> attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1);
>
> Artyom Beilis
> --------------
> CppCMS - C++ Web Framework: http://cppcms.com/
> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>
> ------------------------------
> *From:* sergey lavrov <ccp...@gm...>
> *To:* cpp...@li...
> *Sent:* Saturday, October 20, 2012 10:25 AM
> *Subject:* [Cppcms-users] How to get attached applications?
>
> Dear All!
>
> How can I get attached application (attached_app) from main application
> (main_app)?
> I need to call some functions (for example attached_app::check())
> from attached application (attached_app) in main application
> (main_app) before redirect to another page or process further.
>
> For example my application consist of:
>
> int main() {
> ...
>
> service.applications_pool().mount(cppcms::applications_factory<main_app>());
> ...
> }
>
> bool attached_app::check() {
> return true;
> }
>
> main_app::main_app(cppcms::service &service) :
> cppcms::application(service) {
> ...
> attach(new attached_app(service), "index", "{1}", "^(.*)$", 1);
> ...
> }
>
> main_app::main(std::string url) {
> /* There I need to call attached_app::check() first to check user
> session variables and url before redirect to another page or
> process further. */
> }
>
> Thanks in advance!
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
|
|
From: Artyom B. <art...@ya...> - 2012-10-20 09:01:28
|
Obviously... keep a pointer on it?
this->my_attached_app = new attached_app(service);
attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1);
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>________________________________
> From: sergey lavrov <ccp...@gm...>
>To: cpp...@li...
>Sent: Saturday, October 20, 2012 10:25 AM
>Subject: [Cppcms-users] How to get attached applications?
>
>
>Dear All!
>
>
>How can I get attached application (attached_app) from main application (main_app)?
>I need to call some functions (for example attached_app::check()) from attached application (attached_app) in main application (main_app) before redirect to another page or process further.
>
>
>For example my application consist of:
>
>
>int main() {
> ...
> service.applications_pool().mount(cppcms::applications_factory<main_app>());
> ...
>}
>
>
>bool attached_app::check() {
> return true;
>}
>
>
>main_app::main_app(cppcms::service &service) : cppcms::application(service) {
> ...
> attach(new attached_app(service), "index", "{1}", "^(.*)$", 1);
> ...
>}
>
>
>main_app::main(std::string url) {
> /* There I need to call attached_app::check() first to check user session variables and url before redirect to another page or process further. */
>}
>
>
>Thanks in advance!
>
>
>------------------------------------------------------------------------------
>Everyone hates slow websites. So do we.
>Make your web apps faster with AppDynamics
>Download AppDynamics Lite for free today:
>http://p.sf.net/sfu/appdyn_sfd2d_oct
>_______________________________________________
>Cppcms-users mailing list
>Cpp...@li...
>https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
> |
|
From: sergey l. <ccp...@gm...> - 2012-10-20 08:25:42
|
Dear All!
How can I get attached application (attached_app) from main application
(main_app)?
I need to call some functions (for example attached_app::check())
from attached application (attached_app) in main application
(main_app) before redirect to another page or process further.
For example my application consist of:
int main() {
...
service.applications_pool().mount(cppcms::applications_factory<main_app>());
...
}
bool attached_app::check() {
return true;
}
main_app::main_app(cppcms::service &service) : cppcms::application(service)
{
...
attach(new attached_app(service), "index", "{1}", "^(.*)$", 1);
...
}
main_app::main(std::string url) {
/* There I need to call attached_app::check() first to check user session
variables and url before redirect to another page or process further. */
}
Thanks in advance!
|
|
From: Dietrich M. <die...@gm...> - 2012-10-19 17:14:30
|
Actually the problem was that I used multiple sockets in a vector. So I eventually iterated over them and the buffer might have been copied around. The socket could not be copied as it had to be stored as a shared_ptr. Finally I solved the issue by moving the sockets to a vector of unique_ptr and the problem was gone. Thanks for you help anyway! On Thu, Oct 18, 2012 at 1:53 PM, Artyom Beilis <art...@ya...> wrote: > > > From: Dietrich Müller <die...@gm...> > >To: cpp...@li... > >Sent: Friday, October 12, 2012 6:32 PM > >Subject: [Cppcms-users] Can I create an asynchronous socket connection > from within an asynchronously mounted application? > > > > > >Hello, I try to create a socket connection from within my application and > I seem to fail. > >I tried to setup the code like in this boost asio sample for an > asynchronous http client ( > http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/example/http/client/async_client.cpp) > without the resolving part. > >Btw this resolver is pretty useful. Can it be integrated into booster aio? > > > >//the call > >socket->async_connect(endpoint, std::bind(&ClassX::onConnected, this, > std::placeholders::_1)); > > > >//the first callback > >void ClassX::onConnected(const booster::system::error_code &e) { > > if(!e) > > //print some member of ClassX > > //... > > //and write something to the socket > > socket->async_write(buff, std::bind(&ClassX::onWritten, this, > std::placeholders::_1)); > >} > > > > Where buf's content resides? The memory areas pointed by buff should > remain valid untill asynchronous write > operation is cimpleted. > > Also if you want any help, show the full code > > > > >//onWritten callback > > >//onRead callback > > > >Now the problem is that as soon as I access a class member in any > callback, the result is a segmentation fault. > >If I pass shared_from_this() and not this I get a assertion error in > enable_shared_from_this.h:56 that p.get() == this is not true. > > > What is shared from this? I assume you try to make application with > shared_from_this? You can't. Because > it is not created with shared_ptr, also if application exists all the time > than you don't need to care > about shared from this stuff and use ordinary this. > > >I think the problems are related to some synchronisation issues between > the main and the application thread, as the synchronous calls work. > >Please give me some advice how I correctly use the socket in my > application. > > > > If you use asynchronous application than its thread and the event loop > threads are the same. > > > **Next Time** > > Show the full code. > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Artyom B. <art...@ya...> - 2012-10-18 11:53:09
|
> From: Dietrich Müller <die...@gm...> >To: cpp...@li... >Sent: Friday, October 12, 2012 6:32 PM >Subject: [Cppcms-users] Can I create an asynchronous socket connection from within an asynchronously mounted application? > > >Hello, I try to create a socket connection from within my application and I seem to fail. >I tried to setup the code like in this boost asio sample for an asynchronous http client (http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/example/http/client/async_client.cpp) without the resolving part. >Btw this resolver is pretty useful. Can it be integrated into booster aio? > >//the call >socket->async_connect(endpoint, std::bind(&ClassX::onConnected, this, std::placeholders::_1)); > >//the first callback >void ClassX::onConnected(const booster::system::error_code &e) { > if(!e) > //print some member of ClassX > //... > //and write something to the socket > socket->async_write(buff, std::bind(&ClassX::onWritten, this, std::placeholders::_1)); >} > Where buf's content resides? The memory areas pointed by buff should remain valid untill asynchronous write operation is cimpleted. Also if you want any help, show the full code >//onWritten callback >//onRead callback > >Now the problem is that as soon as I access a class member in any callback, the result is a segmentation fault. >If I pass shared_from_this() and not this I get a assertion error in enable_shared_from_this.h:56 that p.get() == this is not true. What is shared from this? I assume you try to make application with shared_from_this? You can't. Because it is not created with shared_ptr, also if application exists all the time than you don't need to care about shared from this stuff and use ordinary this. >I think the problems are related to some synchronisation issues between the main and the application thread, as the synchronous calls work. >Please give me some advice how I correctly use the socket in my application. If you use asynchronous application than its thread and the event loop threads are the same. **Next Time** Show the full code. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
|
From: Artyom B. <art...@ya...> - 2012-10-18 11:48:27
|
Two options. Provide variables -DCMAKE_C_COMPILER=/path/to/gcc -DCMAKE_CXX_COMPILER=/path/to/g++ If still have problems refer to CMake manuals Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Shiv Shankar Dayal <shi...@gm...> >To: cpp...@li... >Sent: Saturday, October 6, 2012 9:15 PM >Subject: [Cppcms-users] CppCMS with Xcode 4.5 > > >Hi, > > >I am trying to build CppCMS with Xcode 4.5 but since Xcode now comes as a monolithic application CMake cannot find the compiler. Is there a workaround available? > > >-- >Best regards, >Shiv Shankar Dayal > >------------------------------------------------------------------------------ >Don't let slow site performance ruin your business. Deploy New Relic APM >Deploy New Relic app performance management and know exactly >what is happening inside your Ruby, Python, PHP, Java, and .NET app >Try New Relic at no cost today and get our sweet Data Nerd shirt too! >http://p.sf.net/sfu/newrelic-dev2dev >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Christian G. <chr...@gm...> - 2012-10-12 16:49:53
|
2012/9/22 Christian Gmeiner <chr...@gm...>:
> 2012/9/22 Christian Gmeiner <chr...@gm...>:
>> Hi all,
>>
>>
>> I have found some time and I am still working in this issue. The
>> current state is the following:
>>
>> void Service::calibrate()
>> {
>> // valid session needed
>> if (!session().is_set("user"))
>> {
>> BOOSTER_DEBUG("Service") << __func__ << ") not logged in";
>> return;
>> }
>>
>> // only local host is allowed to do this
>> if (request().remote_addr() != "127.0.0.1")
>> {
>> BOOSTER_DEBUG("Service") << __func__ << ") only on local host
>> - called from " << request().remote_addr();
>> response().out() << "$.jGrowl(\"" << translate("Touch
>> calibration only allowed on local host") << "\");" << "\n";
>> return;
>> }
>>
>> response().out() << "$.jGrowl(\"" << translate("Starting
>> calibration") << "...\");" << "\n";
>> BOOSTER_DEBUG("Service") << __func__ << ") doing action";
>>
>> system("/opt/scripts/set-backlight.sh 0");
>> system("/opt/scripts/xcalibrate-touch.sh");
>> system("/opt/scripts/set-backlight.sh 100");
>>
>> BOOSTER_DEBUG("Service") << __func__ << ") done";
>> }
>>
>>
>> system("/opt/scripts/set-backlight.sh 0"); call works as expected but
>> the whole web apps hangs
>> at the next call:
>> system("/opt/scripts/xcalibrate-touch.sh");
>>
>>
>> -----------------------------------------
>> #!/bin/bash
>> # Invokes touch screen calibrator (x11)
>>
>> export DISPLAY=:0.0
>> BINARY=/opt/xinput_calibrator
>>
>> CALDATA=`$BINARY | grep 'Setting new calibration data:' | cut -d ":"
>> -f 2 | tr -d ' ' | sed 's/,/ /g'`
>>
>> # if CALDATA is empty simply return
>> if [ -z $CALDATA ]; then
>> exit 0
>> fi
>>
>> # at the moment we store our axis_calib data in
>> # the ID-Register. in some rare cases the
>> # ID-Register is not accessable and we need a
>> # fallback place to store our data.
>> if [ -e /proc/idreg/axis_calib ]; then
>> echo $CALDATA > /proc/idreg/axis_calib
>> else
>> echo $CALDATA > /home/vis/.axis_calib
>> fi
>> -----------------------------------------
>>
>> xinput_calibrator can be found here https://github.com/tias/xinput_calibrator
>>
>>
>> At the moment I am not sure whats wrong and how to debug it. maybe someone
>> has an idea.
>>
>
> Here is the syslog output:
>
> May 31 08:00:38 OT tssw: ajax_render: template: touch_display
> chromeless: 1 (base.cpp:79)
> May 31 08:00:38 OT tssw: i18n: current used locale en (base.cpp:88)
> May 31 08:00:38 OT tssw: cppcms_http: GET /keyboard.png (http_api.cpp:251)
> May 31 08:00:38 OT tssw: cppcms_http: GET /favicon.ico (http_api.cpp:251)
> May 31 08:00:41 OT tssw: cppcms_http: POST /tssw/rpc (http_api.cpp:251)
> May 31 08:00:41 OT tssw: cppcms: JSON-RPC Method call:calibrate
> (rpc_json.cpp:162)
> May 31 08:00:41 OT tssw: TsswService: calibrate) doing action (tssw.cpp:73)
I am quite sorry that I need to 'reopen' this thread but .... I do not
get it working :(
I want to run the following demo app from a cppcms app - its based on
http://www.unix.com/programming/60469-runaway-sigalrm-signal-handler.html
#include <stdio.h>
#include <signal.h>
#include <sys/time.h>
#include <fcntl.h>
#include <syslog.h>
void on_alarm(int); /* handler for alarm */
void on_input(int); /* handler for keybd */
int set_timer( int which, long initial, long repeat );
volatile sig_atomic_t finished = 0;
int main( int argc, char * argv[])
{
int fd_flags;
int k = 0;
struct sigaction newhandler;
sigset_t blocked;
newhandler.sa_handler = on_input; /* handler function */
newhandler.sa_flags = 0;
sigemptyset(&blocked);
newhandler.sa_mask = blocked;
if ( sigaction(SIGIO, &newhandler, NULL) == -1 )
perror("sigaction");
newhandler.sa_handler = on_alarm; /* handler function */
if ( sigaction(SIGALRM, &newhandler, NULL) == -1 )
perror("sigaction");
fcntl(0, F_SETOWN, getpid());
fd_flags = fcntl(0, F_GETFL);
fcntl(0, F_SETFL, (fd_flags|O_ASYNC));
set_timer(ITIMER_REAL, 500, 500);
while( !finished ) {
pause();
printf("still in loop and finished = %d\n", finished);
}
return 0;
}
void on_input(int signum)
{
int c = getchar();
if ( c == 'q' )
finished = 1;
}
void on_alarm(int signum)
{
static int k = 0;
syslog(LOG_INFO, "call number %d\n", k++);
}
int set_timer( int which, long initial, long repeat )
{
struct itimerval itimer;
long secs;
// initialize initial delay
secs = initial / 1000 ;
itimer.it_value.tv_sec = secs;
itimer.it_value.tv_usec = (initial - secs*1000 ) * 1000 ;
// initialize repeat inveral
secs = repeat / 1000 ;
itimer.it_interval.tv_sec = secs;
itimer.it_interval.tv_usec = (repeat - secs*1000 ) * 1000 ;
return setitimer(which, &itimer, NULL);
}
It should print something like this to syslog
Oct 12 00:01:59 OT xinput_calibrator: call number 0
Oct 12 00:02:00 OT xinput_calibrator: call number 1
Oct 12 00:02:00 OT xinput_calibrator: call number 2
Oct 12 00:02:01 OT xinput_calibrator: call number 3
Oct 12 00:02:01 OT xinput_calibrator: call number 4
Oct 12 00:02:02 OT xinput_calibrator: call number 5
Oct 12 00:02:02 OT xinput_calibrator: call number 6
Oct 12 00:02:03 OT xinput_calibrator: call number 7
If I run this within a json rpc request I via
system("/opt/xinput_calibrator");
void Service::calibrate()
{
// valid session needed
if (!session().is_set("user"))
{
BOOSTER_DEBUG("Service") << __func__ << ": not logged in";
return;
}
// only local host is allowed to do this
if (request().remote_addr() != "127.0.0.1")
{
BOOSTER_DEBUG("Service") << __func__ << ": only on local host
- called from " << request().remote_addr();
flash(translate("Touch calibration only allowed on local host"));
}
else
{
flash(translate("Starting calibration"));
BOOSTER_DEBUG("Service") << __func__ << ": doing action";
#if 0
// here comes unix magic
int master;
pid_t pid = forkpty(&master, 0, 0, 0);
if (pid == -1)
{
BOOSTER_ERROR("Service") << __func__ << ": pid = " << pid;
return;
}
else if (pid == 0)
{
if (execl("/bin/su", "/bin/su", "vis", "-c",
"/opt/scripts/xcalibrate-touch.sh", (char *)0) == -1 )
{
BOOSTER_ERROR("Service") << __func__ << ": execlp " << errno;
}
BOOSTER_ERROR("Service") << __func__ << ": program exited";
return;
}
BOOSTER_DEBUG("Service") << __func__ << ": Child process: " << pid;
BOOSTER_DEBUG("Service") << __func__ << ": done";
// TODO ...
#endif
//system("/bin/su vis -c /opt/scripts/xcalibrate-touch.sh");
system("/opt/xinput_calibrator");
}
getFlashMessage();
BOOSTER_DEBUG("Service") << __func__ << ": done";
}
It starts but nothing is in the system log :/ I think its a problem
with the timer stuff..
has anybody an idea... would sponsor a (virtual) beer.
root@OT:~# ps aux | grep xinput
root 2070 0.0 0.0 1792 496 ? S 00:12 0:00 sh -c
/opt/xinput_calibrator
root 2071 0.0 0.0 1580 248 ? S 00:12 0:00
/opt/xinput_calibrator
root 2075 0.0 0.1 3820 716 pts/2 S+ 00:12 0:00 grep xinput
Other stuff like system("/sbin/reboot"); works...
thanks
---
Christian Gmeiner, MSc
|
|
From: Dietrich M. <die...@gm...> - 2012-10-12 16:32:40
|
Hello, I try to create a socket connection from within my application and I seem to fail. I tried to setup the code like in this boost asio sample for an asynchronous http client ( http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/example/http/client/async_client.cpp) without the resolving part. Btw this resolver is pretty useful. Can it be integrated into booster aio? *//the call socket->async_connect(endpoint, std::bind(&ClassX::onConnected, this, std::placeholders::_1)); //the first callback void ClassX::onConnected(const booster::system::error_code &e) { if(!e) //print some member of ClassX //... //and write something to the socket socket->async_write(buff, std::bind(&ClassX::onWritten, this, std::placeholders::_1)); } //onWritten callback //onRead callback *Now the problem is that as soon as I access a class member in any callback, the result is a segmentation fault. If I pass *shared_from_this()* and not *this *I get a assertion error in * enable_shared_from_this.h:56* that *p.get() == this* is not true. I think the problems are related to some synchronisation issues between the main and the application thread, as the synchronous calls work. Please give me some advice how I correctly use the socket in my application. greetings |
|
From: Dietrich M. <die...@gm...> - 2012-10-08 21:08:38
|
Ok, I think I do not need to read the buffer object the way I thought I have to after studying the boost asio documentation. Problem solved... On Sun, Oct 7, 2012 at 3:08 PM, Dietrich Müller <die...@gm...> wrote: > Hey all, > maybe I am totally blind, but I cannot figure out how I am supposed to get > the data that e.g. a mutable_buffer contains. > In you async example you use the read data from the socket to write it > back to it again without modifying it. > My plan is to call booster::aio::stream_socket::async_read<http://cppcms.com/cppcms_ref/latest/classbooster_1_1aio_1_1stream__socket.html#a8352a7b239da7e658c52b740488ed45a>to get the complete data in the callback and then parse it. > A string or at least a char* to all the data would be totally fine, but as > far as I see I can only get the first entry... > > Could someone give my a snippet or explain to me how to put the data of > the buffer into a string? > Thank you! > |
|
From: Dietrich M. <die...@gm...> - 2012-10-07 13:08:32
|
Hey all, maybe I am totally blind, but I cannot figure out how I am supposed to get the data that e.g. a mutable_buffer contains. In you async example you use the read data from the socket to write it back to it again without modifying it. My plan is to call booster::aio::stream_socket::async_read<http://cppcms.com/cppcms_ref/latest/classbooster_1_1aio_1_1stream__socket.html#a8352a7b239da7e658c52b740488ed45a>to get the complete data in the callback and then parse it. A string or at least a char* to all the data would be totally fine, but as far as I see I can only get the first entry... Could someone give my a snippet or explain to me how to put the data of the buffer into a string? Thank you! |
|
From: Shiv S. D. <shi...@gm...> - 2012-10-06 19:15:33
|
Hi, I am trying to build CppCMS with Xcode 4.5 but since Xcode now comes as a monolithic application CMake cannot find the compiler. Is there a workaround available? -- Best regards, Shiv Shankar Dayal |
|
From: Shiv S. D. <shi...@gm...> - 2012-10-06 18:53:22
|
Hi, There is no client. CppDB has no support for this. You need to use MongoDB C++ driver. On Sat, Oct 6, 2012 at 11:31 PM, Dmitri Snytkine <d.s...@gm...>wrote: > Hello! I am interested in using CPPCMS for my project - an REST API. > My data is already stored in MongoDB, so I need a way to connect to > Mongo. Are you planning on adding support for MongoDB? > > Any advice on how I should proceed with it myself? > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > -- Best regards, Shiv Shankar Dayal |
|
From: Dmitri S. <d.s...@gm...> - 2012-10-06 18:01:10
|
Hello! I am interested in using CPPCMS for my project - an REST API. My data is already stored in MongoDB, so I need a way to connect to Mongo. Are you planning on adding support for MongoDB? Any advice on how I should proceed with it myself? |
|
From: Artyom B. <art...@ya...> - 2012-10-05 18:55:42
|
>________________________________ > From: Dietrich Müller <die...@gm...> >To: cpp...@li... >Sent: Friday, October 5, 2012 8:24 AM >Subject: [Cppcms-users] booster::aio::stream_socket connect timeout? > > >Hey, >is there a timeout implemented during a socket connection? It has the same timeout behavior as native socket. i.e. > The problem I currently face is that a strange embedded tcp server > does not accept, nor reject the request at some point, and a timeout > that interrupts the request would help a lot. > thanks guys > For this kind of stuff you should use asynchronous programming. i.e. Use async_connect with callback withing an event loop to get connection completion notification and use booster::aio::deadline_timer to manage timeouts Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
|
From: Dietrich M. <die...@gm...> - 2012-10-05 06:24:33
|
Hey, is there a timeout implemented during a socket connection? The problem I currently face is that a strange embedded tcp server does not accept, nor reject the request at some point, and a timeout that interrupts the request would help a lot. thanks guys |