cppcms-users Mailing List for CppCMS C++ Web Framework (Page 41)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
| 2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
| 2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
| 2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
| 2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
| 2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
| 2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
| 2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
| 2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
| 2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: augustin <aug...@ov...> - 2013-12-10 01:54:34
|
On Monday, December 09, 2013 02:24:42 PM Artyom Beilis wrote:
> The problem with this clode
>
> std::ostringstream buf;
> app()->render(std::string("my_skin"), std::string("book_page"), buf, c);
> cp->rContent = buf.str();
>
> is that buf does not have a locale object associated with it.
>
> You need to add following line
>
> buf.imbue(app()->context().locale());
>
> i.e.
>
> std::ostringstream buf;
> buf.imbue(app()->context().locale());
> app()->render(std::string("my_skin"), std::string("book_page"), buf, c);
> cp->rContent = buf.str();
>
> The response().out() - the default output already has a locale embedded in
> it. when you create a generic std::ostream you need to imbue application
> specific locale (even if it is default system locale) to make various
> localization related tools to work.
That's it!
Thanks a lot.
Do you think it would be useful for me to add something about this in the
wiki?
If you wish, I can create a page in an appropriate place to document such
newbie gotchas.
augustin.
.
|
|
From: Ross R. <ros...@gm...> - 2013-12-09 18:28:50
|
Thanks. I am but a rube. - Ross On Sun, Dec 8, 2013 at 4:29 PM, Eric Gendron <con...@gm...> wrote: > I think it's only about embeded webserver. > > Of you use another webserver that support ssl, your cppcms app will support > ssl... Your app won't see a difference since all ssl process will be done > via your webserver. > > On Dec 8, 2013 6:20 PM, "Ross Rogers" <ros...@gm...> wrote: >> >> Hello, >> >> I notice that SSL connections are still a TODO on this page: >> http://cppcms.com/wikipp/en/page/cppcms_1x_tasks#Implement.HTTPS.support >> >> In lieu of the implementation of that task, is there a way to bolt on >> SSL using some other program to tunnel HTTP through SSL? If that were >> possible, would it just as good? >> >> - Ross >> >> >> ------------------------------------------------------------------------------ >> Sponsored by Intel(R) XDK >> Develop, test and display web and hybrid apps with a single code base. >> Download it for free now! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Artyom B. <art...@ya...> - 2013-12-09 16:09:05
|
By default, when the SIGTERM is sent to the application, the cppcms::run() exits and you can perform any cleanup you need. No need to do anything special. The situation described in wiki is for reloading (i.e. restarting the service rather than exiting the full program) Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ -------------------------------------------- On Mon, 12/9/13, CN <cn...@fa...> wrote: Subject: [Cppcms-users] Can't catch signals after service::run() To: cpp...@li... Date: Monday, December 9, 2013, 5:35 PM I have read http://cppcms.com/wikipp/en/page/cppcms_1x_reload_application and the mailing list archive dated 2013-11-19 08:05:50 GMT before posting my question. I need to do some clean-up tasks after the program is killed (kill <pid>), but before it terminates. As shown below, version 1 can catch signals. Version 2 fails to catch signals. I wonder this is because cppcms::service::run() overwrites all the signal specifications set before it. How do I circumvent it? //------------------------------------------------ #include <iostream> #include <signal.h> #include <unistd.h> #include <cstring> #include <cppcms/service.h> #include <cppcms/thread_pool.h> void signal_handler(int signal_number); static bool got_signal=false; int main(int argc,char ** argv) { struct sigaction actions; memset(&actions,0,sizeof(actions)); sigemptyset(&actions.sa_mask); actions.sa_flags=0; actions.sa_handler=signal_handler; int sig_result; if((sig_result=sigaction(SIGHUP,&actions,NULL)) != 0){ std::cerr << "sigaction(SIGHUP) failed: " << sig_result << std::endl; std::terminate(); } if((sig_result=sigaction(SIGTERM,&actions,NULL)) != 0){ std::cerr << "sigaction(SIGTERM) failed: " << sig_result << std::endl; std::terminate(); } /* //version 1: signal can be caught. while(true){ std::cerr<<"loop"<<std::endl; if(got_signal){ std::cerr<<"caught signal"<<std::endl; break; } sleep(1); } */ //version 2: signal can NOT be caught. cppcms::thread_pool pool(3); //pools.post(...); cppcms::service s(argc,argv); s.run(); if(got_signal){ pool.stop(); //Stop all in progress threads before program terminates. std::cerr<<"caught signal"<<std::endl; } return 0; } void signal_handler(int signal_number) { got_signal=true; } //------------------------------------------------ Regards, CN -- http://www.fastmail.fm - mmm... Fastmail... ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: CN <cn...@fa...> - 2013-12-09 15:35:54
|
I have read http://cppcms.com/wikipp/en/page/cppcms_1x_reload_application and the mailing list archive dated 2013-11-19 08:05:50 GMT before posting my question. I need to do some clean-up tasks after the program is killed (kill <pid>), but before it terminates. As shown below, version 1 can catch signals. Version 2 fails to catch signals. I wonder this is because cppcms::service::run() overwrites all the signal specifications set before it. How do I circumvent it? //------------------------------------------------ #include <iostream> #include <signal.h> #include <unistd.h> #include <cstring> #include <cppcms/service.h> #include <cppcms/thread_pool.h> void signal_handler(int signal_number); static bool got_signal=false; int main(int argc,char ** argv) { struct sigaction actions; memset(&actions,0,sizeof(actions)); sigemptyset(&actions.sa_mask); actions.sa_flags=0; actions.sa_handler=signal_handler; int sig_result; if((sig_result=sigaction(SIGHUP,&actions,NULL)) != 0){ std::cerr << "sigaction(SIGHUP) failed: " << sig_result << std::endl; std::terminate(); } if((sig_result=sigaction(SIGTERM,&actions,NULL)) != 0){ std::cerr << "sigaction(SIGTERM) failed: " << sig_result << std::endl; std::terminate(); } /* //version 1: signal can be caught. while(true){ std::cerr<<"loop"<<std::endl; if(got_signal){ std::cerr<<"caught signal"<<std::endl; break; } sleep(1); } */ //version 2: signal can NOT be caught. cppcms::thread_pool pool(3); //pools.post(...); cppcms::service s(argc,argv); s.run(); if(got_signal){ pool.stop(); //Stop all in progress threads before program terminates. std::cerr<<"caught signal"<<std::endl; } return 0; } void signal_handler(int signal_number) { got_signal=true; } //------------------------------------------------ Regards, CN -- http://www.fastmail.fm - mmm... Fastmail... |
|
From: Artyom B. <art...@ya...> - 2013-12-09 06:24:50
|
The problem with this clode
std::ostringstream buf;
app()->render(std::string("my_skin"), std::string("book_page"), buf, c);
cp->rContent = buf.str();
is that buf does not have a locale object associated with it.
You need to add following line
buf.imbue(app()->context().locale());
i.e.
std::ostringstream buf;
buf.imbue(app()->context().locale());
app()->render(std::string("my_skin"), std::string("book_page"), buf, c);
cp->rContent = buf.str();
The response().out() - the default output already has a locale embedded in it.
when you create a generic std::ostream you need to imbue application
specific locale (even if it is default system locale) to make various localization
related tools to work.
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
--------------------------------------------
On Mon, 12/9/13, augustin <aug...@ov...> wrote:
Subject: Re: [Cppcms-users] How to format readable date from unix timestamp within template?
To: cpp...@li...
Date: Monday, December 9, 2013, 2:25 AM
On Sunday, December 08, 2013 05:52:31
PM Artyom Beilis wrote:
> > r.date_returned is a time_t unix timestamp.
> >
> > <% gt "{1,datetime=s}" using
r.date_returned %>
> > <%= r.date_returned | date %>
> > <%= r.date_returned |
strftime("%d/%m/%Y") %>
> >
> > What am I missing?
> >
> > thanks,
> >
> > augustin.
>
> It actually should work....
>
> How do you render the template?
> What are the locale settings?
> Do you render to a stream that isn't the
respone().out()?
>
> The only point I can see that this isn't working is
that the stream you
> are rendering into is missing the locale
configuration.
Thanks for your reply, Artyom, as always.
For my locale, I have in config.js:
"localization" : {
"locales" : ["en_US.UTF-8"],
},
I have not yet specifically studied locale and translations.
For the time
being English is hard coded in my application.
That particular piece of template is rendered thus:
namespace content {
struct book_page : public cppcms::base_content;
}
void view_book::render_main_content(content::page* cp) {
content::book_page c;
// ... snipped parts where I add content to c,
including r.date_returned.
std::ostringstream buf;
// app() returns a pointer to my class myApp : public
cppcms::application;
app()->render(std::string("my_skin"),
std::string("book_page"), buf, c);
cp->rContent = buf.str();
}
I have simplified the code above. Hopefully, I have not
removed anything
relevant.
The wiki page about template filters is pretty long:
http://cppcms.com/wikipp/en/page/cppcms_1x_templates_comm
Do you think I should complement it by setting up a separate
wiki page about
best practices for rendering times and dates?
Thanks,
augustin.
--
Friends: http://www.reuniting.info/
My projects:
http://astralcity.org/ http://lesenjeux.fr/ http://linux.overshoot.tv/
http://overshoot.tv/ http://charityware.info/ http://masquilier.org/
http://openteacher.info/ http://minguo.info/ http://jacqueslemaire.fr/
http://www.wechange.org/ http://searching911.info/
.
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single
code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Cppcms-users mailing list
Cpp...@li...
https://lists.sourceforge.net/lists/listinfo/cppcms-users
|
|
From: Eric G. <con...@gm...> - 2013-12-09 00:29:50
|
I think it's only about embeded webserver. Of you use another webserver that support ssl, your cppcms app will support ssl... Your app won't see a difference since all ssl process will be done via your webserver. On Dec 8, 2013 6:20 PM, "Ross Rogers" <ros...@gm...> wrote: > Hello, > > I notice that SSL connections are still a TODO on this page: > http://cppcms.com/wikipp/en/page/cppcms_1x_tasks#Implement.HTTPS.support > > In lieu of the implementation of that task, is there a way to bolt on > SSL using some other program to tunnel HTTP through SSL? If that were > possible, would it just as good? > > - Ross > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: augustin <aug...@ov...> - 2013-12-09 00:25:45
|
On Sunday, December 08, 2013 05:52:31 PM Artyom Beilis wrote:
> > r.date_returned is a time_t unix timestamp.
> >
> > <% gt "{1,datetime=s}" using r.date_returned %>
> > <%= r.date_returned | date %>
> > <%= r.date_returned | strftime("%d/%m/%Y") %>
> >
> > What am I missing?
> >
> > thanks,
> >
> > augustin.
>
> It actually should work....
>
> How do you render the template?
> What are the locale settings?
> Do you render to a stream that isn't the respone().out()?
>
> The only point I can see that this isn't working is that the stream you
> are rendering into is missing the locale configuration.
Thanks for your reply, Artyom, as always.
For my locale, I have in config.js:
"localization" : {
"locales" : ["en_US.UTF-8"],
},
I have not yet specifically studied locale and translations. For the time
being English is hard coded in my application.
That particular piece of template is rendered thus:
namespace content {
struct book_page : public cppcms::base_content;
}
void view_book::render_main_content(content::page* cp) {
content::book_page c;
// ... snipped parts where I add content to c, including r.date_returned.
std::ostringstream buf;
// app() returns a pointer to my class myApp : public cppcms::application;
app()->render(std::string("my_skin"), std::string("book_page"), buf, c);
cp->rContent = buf.str();
}
I have simplified the code above. Hopefully, I have not removed anything
relevant.
The wiki page about template filters is pretty long:
http://cppcms.com/wikipp/en/page/cppcms_1x_templates_comm
Do you think I should complement it by setting up a separate wiki page about
best practices for rendering times and dates?
Thanks,
augustin.
--
Friends: http://www.reuniting.info/
My projects:
http://astralcity.org/ http://lesenjeux.fr/ http://linux.overshoot.tv/
http://overshoot.tv/ http://charityware.info/ http://masquilier.org/
http://openteacher.info/ http://minguo.info/ http://jacqueslemaire.fr/
http://www.wechange.org/ http://searching911.info/
.
|
|
From: Ross R. <ros...@gm...> - 2013-12-08 23:20:37
|
Hello, I notice that SSL connections are still a TODO on this page: http://cppcms.com/wikipp/en/page/cppcms_1x_tasks#Implement.HTTPS.support In lieu of the implementation of that task, is there a way to bolt on SSL using some other program to tunnel HTTP through SSL? If that were possible, would it just as good? - Ross |
|
From: Szilágyi Z. <zol...@ya...> - 2013-12-08 20:09:43
|
Hi, Thank you. I will try out next weekend. Regads, Zoltan On Sunday, December 8, 2013 5:40 PM, 陈抒 <csf...@gm...> wrote: On Ubuntu, if you want to install newest Nginx version, try following steps: wget http://nginx.org/keys/nginx_signing.key apt-key add nginx_signing.key Create /etc/apt/sources.list.d/nginx.list file, add two lines in it deb http://nginx.org/packages/mainline/ubuntu/ raring nginx deb-src http://nginx.org/packages/mainline/ubuntu/ raring nginx Then update & install Nginx apt-get update apt-get install nginx Then you can configure your cppcms app, below is my way, my web app is called wind_tunnel put the wind_tunnel.conf file under /etc/nginx/conf.d/ folder server { listen 80; server_name localhost; access_log /opt/wind_tunnel.log main; location = /favicon.ico { log_not_found off; log_subrequest off; } location ~ ^/(img|images|script|style|plugin)/ { root /home/dean/work/windtunnel/code/site/resources; expires 1d; } include ./conf.d/fastcgi.wind_tunnel; } Then create /etc/nginx/conf.d/fastcgi.wind_tunnel file location ~ ^/wind_tunnel.*$ { fastcgi_pass localhost:8088; fastcgi_split_path_info ^(/wind_tunnel)(.*)$; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_NAME /wind_tunnel; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; } You can change wind_tunnel to your own app name. I didn't hear about SCGI, will have a look at this when free, thank you. Dean Chen Best regards http://blog.csdn.net/csfreebird On Sun, Dec 8, 2013 at 9:17 PM, Sergei Shutov <dan...@gm...> wrote: https://help.ubuntu.com/community/lighttpd > >sudo apt-get install lighttpd >sudo lighttpd-enable-mod fastcgi >sudo service lighttpd reload > >or nginx > >https://help.ubuntu.com/community/Nginx > >sudo apt-get install nginx > > > >------------------------------------------------------------------------------ >Sponsored by Intel(R) XDK >Develop, test and display web and hybrid apps with a single code base. >Download it for free now! >http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: 陈抒 <csf...@gm...> - 2013-12-08 15:39:49
|
On Ubuntu, if you want to install newest Nginx version, try following steps: wget http://nginx.org/keys/nginx_signing.key apt-key add nginx_signing.key Create /etc/apt/sources.list.d/nginx.list file, add two lines in it deb http://nginx.org/packages/mainline/ubuntu/ raring nginx deb-src http://nginx.org/packages/mainline/ubuntu/ raring nginx Then update & install Nginx apt-get update apt-get install nginx Then you can configure your cppcms app, below is my way, my web app is called wind_tunnel put the wind_tunnel.conf file under /etc/nginx/conf.d/ folder server { listen 80; server_name localhost; access_log /opt/wind_tunnel.log main; location = /favicon.ico { log_not_found off; log_subrequest off; } location ~ ^/(img|images|script|style|plugin)/ { root /home/dean/work/windtunnel/code/site/resources; expires 1d; } include ./conf.d/fastcgi.wind_tunnel; } Then create /etc/nginx/conf.d/fastcgi.wind_tunnel file location ~ ^/wind_tunnel.*$ { fastcgi_pass localhost:8088; fastcgi_split_path_info ^(/wind_tunnel)(.*)$; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_NAME /wind_tunnel; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; } You can change wind_tunnel to your own app name. I didn't hear about SCGI, will have a look at this when free, thank you. Dean Chen Best regards http://blog.csdn.net/csfreebird On Sun, Dec 8, 2013 at 9:17 PM, Sergei Shutov <dan...@gm...> wrote: > https://help.ubuntu.com/community/lighttpd > > sudo apt-get install lighttpd > sudo lighttpd-enable-mod fastcgi > sudo service lighttpd reload > > or nginx > > https://help.ubuntu.com/community/Nginx > > sudo apt-get install nginx > > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Sergei S. <dan...@gm...> - 2013-12-08 13:17:35
|
https://help.ubuntu.com/community/lighttpd sudo apt-get install lighttpd sudo lighttpd-enable-mod fastcgi sudo service lighttpd reload or nginx https://help.ubuntu.com/community/Nginx sudo apt-get install nginx |
|
From: 陈抒 <csf...@gm...> - 2013-12-08 12:11:27
|
Using Nginx with CppCMS together is simple, for me, I always use them and FastCGI protocol. Don't know my way is simplest or not because I did't try other web servers. I choose CppCMS because its high performance, and Nginx has high performance too. So from my angel, Nginx is the best web server for working with CppCMS. Dean Chen Best regards http://blog.csdn.net/csfreebird On Sun, Dec 8, 2013 at 7:47 PM, Szilágyi Zoltán <zol...@ya... > wrote: > Hi, > > Anybody could help me with Lighttpd FastCGI under Debian? I found out that > I need to installl lighttpd-mod-fastcgi. I cannot found deb package for > it (or repository). I found : > redhat/fedora/centos - yum install lighttpd-fastcgi > www.fastcgi.com site right now it is not working. > > For SCGI with synaptic package manager I find nginx-full. > Should I go rather with ngix and SCGI, (no fastcgi support)? > Or should install Apache? (On Windows I had painfull and time waist full > experince with apache + fastcgi module, I blame fastcgi(but it can be lack > of knowledge), without successs), but perhaps on linux it would be easyer, > but I guess rather would try something now like ngix, rather (not) having > so long ride with fastcgi.With synaptic package manger I find only > libapache2-mod-scgi module anyway. > > I just want to try out hello world example, but without web server it is > not working. Ok, I reformulate my question: witch webserver under Debian > you think it would be the easiest for a newbies to install and configure > for the hello world example. > > (Why neeed 3 layer arhitecture: for example lighttpd + fastcgi + cppcms? > I would not be better if fastcgi and SCGI, protocol would be implemented > in cppcms?) > > Best regards, > Zoltan > > > > > > . > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: Szilágyi Z. <zol...@ya...> - 2013-12-08 11:50:45
|
Hi, Anybody could help me with Lighttpd FastCGI under Debian? I found out that I need to installl lighttpd-mod-fastcgi. I cannot found deb package for it (or repository). I found :redhat/fedora/centos - yum install lighttpd-fastcgi www.fastcgi.com site right now it is not working. For SCGI with synaptic package manager I find nginx-full.Should I go rather with ngix and SCGI, (no fastcgi support)? Or should install Apache? (On Windows I had painfull and time waist full experince with apache + fastcgi module, I blame fastcgi(but it can be lack of knowledge), without successs), but perhaps on linux it would be easyer, but I guess rather would try something now like ngix, rather (not) having so long ride with fastcgi.With synaptic package manger I find only libapache2-mod-scgi module anyway. I just want to try out hello world example, but without web server it is not working. Ok, I reformulate my question: witch webserver under Debian you think it would be the easiest for a newbies to install and configure for the hello world example. (Why neeed 3 layer arhitecture: for example lighttpd + fastcgi + cppcms? I would not be better if fastcgi and SCGI, protocol would be implemented in cppcms?) Best regards, Zoltan . |
|
From: Artyom B. <art...@ya...> - 2013-12-08 09:52:38
|
> r.date_returned is a time_t unix timestamp.
>
> <% gt "{1,datetime=s}" using r.date_returned %>
> <%= r.date_returned | date %>
> <%= r.date_returned | strftime("%d/%m/%Y") %>
> What am I missing?
>
> thanks,
>
> augustin.
It actually should work....
How do you render the template?
What are the locale settings?
Do you render to a stream that isn't the respone().out()?
The only point I can see that this isn't working is that the stream you
are rendering into is missing the locale configuration.
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
|
|
From: augustin <aug...@ov...> - 2013-12-08 05:59:59
|
Hello,
How to format a readable date from a unix timestamp within a template?
I thought it would be something straightforward to do but I seem to be stuck.
I've spent a fair amount of time reading the API documentation, the cppcms
wiki, and code examples found in cpp blog, but the only thing I ever get
displayed within my application is the unix timestamp itself.
I have tried all of the following within my .tmpl file, but none of them
actually filter the timestamp:
r.date_returned is a time_t unix timestamp.
<% gt "{1,datetime=s}" using r.date_returned %>
<%= r.date_returned | date %>
<%= r.date_returned | strftime("%d/%m/%Y") %>
What am I missing?
thanks,
augustin.
|
|
From: 陈抒 <csf...@gm...> - 2013-12-06 07:26:00
|
You want to use cppcms session with mysql & cppdb. also using static linking. I have not used this way before. Let's see who can give you correct. :) Dean Chen Best regards http://blog.csdn.net/csfreebird On Fri, Dec 6, 2013 at 3:16 PM, Heiko Irrgang <hi...@93...> wrote: > Hi, > > On Fri, Dec 06, 2013 at 01:48:33PM +0800, 陈抒 wrote: > > If you have chosen a database already and don't want to change this, > > could you find a way to link the database client lib into your app > > statically? > > i am already using cppdb with mysql which you can link statically, but > maybe i did not understand this right? When i look at session docs, it > says session.server.storage can have the values: > > files > memory > network > external > > So i assume i need to use external when i want to use cppcms session? > Which seems to be limited to dynamic linking, or am i missing something? > > Kind regards, > Heiko > > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Heiko I. <hi...@93...> - 2013-12-06 07:16:38
|
Hi, On Fri, Dec 06, 2013 at 01:48:33PM +0800, 陈抒 wrote: > If you have chosen a database already and don't want to change this, > could you find a way to link the database client lib into your app > statically? i am already using cppdb with mysql which you can link statically, but maybe i did not understand this right? When i look at session docs, it says session.server.storage can have the values: files memory network external So i assume i need to use external when i want to use cppcms session? Which seems to be limited to dynamic linking, or am i missing something? Kind regards, Heiko |
|
From: 陈抒 <csf...@gm...> - 2013-12-06 05:49:01
|
Hi, Shiv, If Heiko uses in-memory database, that means he still enables session in web server. The web server cannot be clustered unless Redis provides a way to sync their data in different machines. And my current project is using MongoDB, mongodb driver can be statically linked in my app. So when deploying my app on product server, no mongodb driver's dll or so file is required. Hi, Heiko: If you have chosen a database already and don't want to change this, could you find a way to link the database client lib into your app statically? Dean Chen Best regards http://blog.csdn.net/csfreebird On Fri, Dec 6, 2013 at 1:39 PM, Shiv Shankar Dayal < shi...@gm...> wrote: > You can use something like Redis for this which is in-memory database. > > > On Fri, Dec 6, 2013 at 11:02 AM, Heiko Irrgang <hi...@93...> wrote: > >> Hi, >> >> well, thats exactly the point, i am not storing the session in a >> database and therefor i do not want to save things like user password in >> the browser cookie. >> >> using a database for session storage would definately be an option, but >> as far as i see, this involves dynamic linking, i do not want this, when >> my project is near to finish, i will get a commercial license and link >> everything into a single file, having some extra files in the filesystem >> is not an option. >> >> any way to implement db session without dynamic linking? >> >> Kind regards, >> Heiko >> >> On Fri, Dec 06, 2013 at 12:25:11PM +0800, 陈抒 wrote: >> > 1. You can save a key-value data structure in singleton application >> object, >> > key will be user id, value can be any user-specific data. >> > But if you do this, you actually implement your own version of user >> > session. Why not use cppcms session? >> > >> > 2. If the web server has session, it's not stateless anymore. When >> > clustering several web servers together to do load balance and to >> prevent >> > single point of failure, sync these session between these web servers >> are >> > important and hard job. So my way is to avoid use session, just use >> > database cluster or cache server to hold session values. >> > >> > >> > Dean Chen >> > Best regards >> > http://blog.csdn.net/csfreebird >> > >> > >> > On Fri, Dec 6, 2013 at 2:38 AM, Heiko Irrgang <hi...@93...> wrote: >> > >> > > Hi, >> > > >> > > thanx, i thought about singleton, but wouldn't this be application >> wide? >> > > So if i store user information in a singleton, everyone would count as >> > > that user? >> > > >> > > Kind regards, >> > > Heiko >> > > >> > > On Fri, Dec 06, 2013 at 12:08:05AM +0800, 陈抒 wrote: >> > > > Not sure the different locations mean what? Different web URLs? >> > > > If you want to save something in web app, in my way, I usually >> create a >> > > > singleton object called my_app, you could use any singleton >> technology to >> > > > create it. And save the variables that you want to cache and share >> as >> > > the >> > > > my_app object's member variable. >> > > > For multi-thread protection, use boost::mutex to protect them. >> > > > >> > > > >> > > > Dean Chen >> > > > Best regards >> > > > http://blog.csdn.net/csfreebird >> > > > >> > > > >> > > > On Thu, Dec 5, 2013 at 11:45 PM, Heiko Irrgang <hi...@93...> wrote: >> > > > >> > > > > Hi, >> > > > > >> > > > > hm.. maybe i'm missing something here... i do not want to store >> full >> > > > > user information in the session cookie, i just want to safe it >> > > somewhere >> > > > > for the current request, so i do not re-re-re-re-read it from the >> > > > > database, just because i need it on 5 different locations. >> > > > > >> > > > > i already have a cookie session running, but it only holds the >> user id >> > > > > and a usertoken. >> > > > > >> > > > > What i would need is some storage, that is neither file/cookie >> based >> > > and >> > > > > does not interfere with the session. >> > > > > >> > > > > Pretty much like some local variables in the actual application >> > > instance, >> > > > > but on a point where i do not have this application instance. >> > > > > >> > > > > Is something like this available, or do i have to give the >> application >> > > > > instance as parameters to every function that might need >> information >> > > > > limited to the current request? >> > > > > >> > > > > Maybe i'm just thinking too much php here ;) >> > > > > >> > > > > Thanx in advance, >> > > > > Heiko >> > > >> > > >> > > >> ------------------------------------------------------------------------------ >> > > Sponsored by Intel(R) XDK >> > > Develop, test and display web and hybrid apps with a single code base. >> > > Download it for free now! >> > > >> > > >> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk >> > > _______________________________________________ >> > > Cppcms-users mailing list >> > > Cpp...@li... >> > > https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > >> >> > >> ------------------------------------------------------------------------------ >> > Sponsored by Intel(R) XDK >> > Develop, test and display web and hybrid apps with a single code base. >> > Download it for free now! >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk >> >> > _______________________________________________ >> > Cppcms-users mailing list >> > Cpp...@li... >> > https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> -- >> Heiko Irrgang >> 93-interactive >> Hochfeldstr. 30 >> 82377 Penzberg >> Germany >> >> Web....: http://93i.de >> Email..: hi...@93... >> Phone..: +49-160-7873168 >> >> >> ------------------------------------------------------------------------------ >> Sponsored by Intel(R) XDK >> Develop, test and display web and hybrid apps with a single code base. >> Download it for free now! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > > > -- > Respect, > Shiv Shankar Dayal > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: Shiv S. D. <shi...@gm...> - 2013-12-06 05:39:57
|
You can use something like Redis for this which is in-memory database. On Fri, Dec 6, 2013 at 11:02 AM, Heiko Irrgang <hi...@93...> wrote: > Hi, > > well, thats exactly the point, i am not storing the session in a > database and therefor i do not want to save things like user password in > the browser cookie. > > using a database for session storage would definately be an option, but > as far as i see, this involves dynamic linking, i do not want this, when > my project is near to finish, i will get a commercial license and link > everything into a single file, having some extra files in the filesystem > is not an option. > > any way to implement db session without dynamic linking? > > Kind regards, > Heiko > > On Fri, Dec 06, 2013 at 12:25:11PM +0800, 陈抒 wrote: > > 1. You can save a key-value data structure in singleton application > object, > > key will be user id, value can be any user-specific data. > > But if you do this, you actually implement your own version of user > > session. Why not use cppcms session? > > > > 2. If the web server has session, it's not stateless anymore. When > > clustering several web servers together to do load balance and to prevent > > single point of failure, sync these session between these web servers are > > important and hard job. So my way is to avoid use session, just use > > database cluster or cache server to hold session values. > > > > > > Dean Chen > > Best regards > > http://blog.csdn.net/csfreebird > > > > > > On Fri, Dec 6, 2013 at 2:38 AM, Heiko Irrgang <hi...@93...> wrote: > > > > > Hi, > > > > > > thanx, i thought about singleton, but wouldn't this be application > wide? > > > So if i store user information in a singleton, everyone would count as > > > that user? > > > > > > Kind regards, > > > Heiko > > > > > > On Fri, Dec 06, 2013 at 12:08:05AM +0800, 陈抒 wrote: > > > > Not sure the different locations mean what? Different web URLs? > > > > If you want to save something in web app, in my way, I usually > create a > > > > singleton object called my_app, you could use any singleton > technology to > > > > create it. And save the variables that you want to cache and share > as > > > the > > > > my_app object's member variable. > > > > For multi-thread protection, use boost::mutex to protect them. > > > > > > > > > > > > Dean Chen > > > > Best regards > > > > http://blog.csdn.net/csfreebird > > > > > > > > > > > > On Thu, Dec 5, 2013 at 11:45 PM, Heiko Irrgang <hi...@93...> wrote: > > > > > > > > > Hi, > > > > > > > > > > hm.. maybe i'm missing something here... i do not want to store > full > > > > > user information in the session cookie, i just want to safe it > > > somewhere > > > > > for the current request, so i do not re-re-re-re-read it from the > > > > > database, just because i need it on 5 different locations. > > > > > > > > > > i already have a cookie session running, but it only holds the > user id > > > > > and a usertoken. > > > > > > > > > > What i would need is some storage, that is neither file/cookie > based > > > and > > > > > does not interfere with the session. > > > > > > > > > > Pretty much like some local variables in the actual application > > > instance, > > > > > but on a point where i do not have this application instance. > > > > > > > > > > Is something like this available, or do i have to give the > application > > > > > instance as parameters to every function that might need > information > > > > > limited to the current request? > > > > > > > > > > Maybe i'm just thinking too much php here ;) > > > > > > > > > > Thanx in advance, > > > > > Heiko > > > > > > > > > > ------------------------------------------------------------------------------ > > > Sponsored by Intel(R) XDK > > > Develop, test and display web and hybrid apps with a single code base. > > > Download it for free now! > > > > > > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > > > _______________________________________________ > > > Cppcms-users mailing list > > > Cpp...@li... > > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > > > ------------------------------------------------------------------------------ > > Sponsored by Intel(R) XDK > > Develop, test and display web and hybrid apps with a single code base. > > Download it for free now! > > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > -- > Heiko Irrgang > 93-interactive > Hochfeldstr. 30 > 82377 Penzberg > Germany > > Web....: http://93i.de > Email..: hi...@93... > Phone..: +49-160-7873168 > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > -- Respect, Shiv Shankar Dayal |
|
From: Heiko I. <hi...@93...> - 2013-12-06 05:32:23
|
Hi, well, thats exactly the point, i am not storing the session in a database and therefor i do not want to save things like user password in the browser cookie. using a database for session storage would definately be an option, but as far as i see, this involves dynamic linking, i do not want this, when my project is near to finish, i will get a commercial license and link everything into a single file, having some extra files in the filesystem is not an option. any way to implement db session without dynamic linking? Kind regards, Heiko On Fri, Dec 06, 2013 at 12:25:11PM +0800, 陈抒 wrote: > 1. You can save a key-value data structure in singleton application object, > key will be user id, value can be any user-specific data. > But if you do this, you actually implement your own version of user > session. Why not use cppcms session? > > 2. If the web server has session, it's not stateless anymore. When > clustering several web servers together to do load balance and to prevent > single point of failure, sync these session between these web servers are > important and hard job. So my way is to avoid use session, just use > database cluster or cache server to hold session values. > > > Dean Chen > Best regards > http://blog.csdn.net/csfreebird > > > On Fri, Dec 6, 2013 at 2:38 AM, Heiko Irrgang <hi...@93...> wrote: > > > Hi, > > > > thanx, i thought about singleton, but wouldn't this be application wide? > > So if i store user information in a singleton, everyone would count as > > that user? > > > > Kind regards, > > Heiko > > > > On Fri, Dec 06, 2013 at 12:08:05AM +0800, 陈抒 wrote: > > > Not sure the different locations mean what? Different web URLs? > > > If you want to save something in web app, in my way, I usually create a > > > singleton object called my_app, you could use any singleton technology to > > > create it. And save the variables that you want to cache and share as > > the > > > my_app object's member variable. > > > For multi-thread protection, use boost::mutex to protect them. > > > > > > > > > Dean Chen > > > Best regards > > > http://blog.csdn.net/csfreebird > > > > > > > > > On Thu, Dec 5, 2013 at 11:45 PM, Heiko Irrgang <hi...@93...> wrote: > > > > > > > Hi, > > > > > > > > hm.. maybe i'm missing something here... i do not want to store full > > > > user information in the session cookie, i just want to safe it > > somewhere > > > > for the current request, so i do not re-re-re-re-read it from the > > > > database, just because i need it on 5 different locations. > > > > > > > > i already have a cookie session running, but it only holds the user id > > > > and a usertoken. > > > > > > > > What i would need is some storage, that is neither file/cookie based > > and > > > > does not interfere with the session. > > > > > > > > Pretty much like some local variables in the actual application > > instance, > > > > but on a point where i do not have this application instance. > > > > > > > > Is something like this available, or do i have to give the application > > > > instance as parameters to every function that might need information > > > > limited to the current request? > > > > > > > > Maybe i'm just thinking too much php here ;) > > > > > > > > Thanx in advance, > > > > Heiko > > > > > > ------------------------------------------------------------------------------ > > Sponsored by Intel(R) XDK > > Develop, test and display web and hybrid apps with a single code base. > > Download it for free now! > > > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- Heiko Irrgang 93-interactive Hochfeldstr. 30 82377 Penzberg Germany Web....: http://93i.de Email..: hi...@93... Phone..: +49-160-7873168 |
|
From: 陈抒 <csf...@gm...> - 2013-12-06 04:25:40
|
1. You can save a key-value data structure in singleton application object, key will be user id, value can be any user-specific data. But if you do this, you actually implement your own version of user session. Why not use cppcms session? 2. If the web server has session, it's not stateless anymore. When clustering several web servers together to do load balance and to prevent single point of failure, sync these session between these web servers are important and hard job. So my way is to avoid use session, just use database cluster or cache server to hold session values. Dean Chen Best regards http://blog.csdn.net/csfreebird On Fri, Dec 6, 2013 at 2:38 AM, Heiko Irrgang <hi...@93...> wrote: > Hi, > > thanx, i thought about singleton, but wouldn't this be application wide? > So if i store user information in a singleton, everyone would count as > that user? > > Kind regards, > Heiko > > On Fri, Dec 06, 2013 at 12:08:05AM +0800, 陈抒 wrote: > > Not sure the different locations mean what? Different web URLs? > > If you want to save something in web app, in my way, I usually create a > > singleton object called my_app, you could use any singleton technology to > > create it. And save the variables that you want to cache and share as > the > > my_app object's member variable. > > For multi-thread protection, use boost::mutex to protect them. > > > > > > Dean Chen > > Best regards > > http://blog.csdn.net/csfreebird > > > > > > On Thu, Dec 5, 2013 at 11:45 PM, Heiko Irrgang <hi...@93...> wrote: > > > > > Hi, > > > > > > hm.. maybe i'm missing something here... i do not want to store full > > > user information in the session cookie, i just want to safe it > somewhere > > > for the current request, so i do not re-re-re-re-read it from the > > > database, just because i need it on 5 different locations. > > > > > > i already have a cookie session running, but it only holds the user id > > > and a usertoken. > > > > > > What i would need is some storage, that is neither file/cookie based > and > > > does not interfere with the session. > > > > > > Pretty much like some local variables in the actual application > instance, > > > but on a point where i do not have this application instance. > > > > > > Is something like this available, or do i have to give the application > > > instance as parameters to every function that might need information > > > limited to the current request? > > > > > > Maybe i'm just thinking too much php here ;) > > > > > > Thanx in advance, > > > Heiko > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Heiko I. <hi...@93...> - 2013-12-05 18:38:57
|
Hi, thanx, i thought about singleton, but wouldn't this be application wide? So if i store user information in a singleton, everyone would count as that user? Kind regards, Heiko On Fri, Dec 06, 2013 at 12:08:05AM +0800, 陈抒 wrote: > Not sure the different locations mean what? Different web URLs? > If you want to save something in web app, in my way, I usually create a > singleton object called my_app, you could use any singleton technology to > create it. And save the variables that you want to cache and share as the > my_app object's member variable. > For multi-thread protection, use boost::mutex to protect them. > > > Dean Chen > Best regards > http://blog.csdn.net/csfreebird > > > On Thu, Dec 5, 2013 at 11:45 PM, Heiko Irrgang <hi...@93...> wrote: > > > Hi, > > > > hm.. maybe i'm missing something here... i do not want to store full > > user information in the session cookie, i just want to safe it somewhere > > for the current request, so i do not re-re-re-re-read it from the > > database, just because i need it on 5 different locations. > > > > i already have a cookie session running, but it only holds the user id > > and a usertoken. > > > > What i would need is some storage, that is neither file/cookie based and > > does not interfere with the session. > > > > Pretty much like some local variables in the actual application instance, > > but on a point where i do not have this application instance. > > > > Is something like this available, or do i have to give the application > > instance as parameters to every function that might need information > > limited to the current request? > > > > Maybe i'm just thinking too much php here ;) > > > > Thanx in advance, > > Heiko |
|
From: 陈抒 <csf...@gm...> - 2013-12-05 16:08:33
|
Not sure the different locations mean what? Different web URLs? If you want to save something in web app, in my way, I usually create a singleton object called my_app, you could use any singleton technology to create it. And save the variables that you want to cache and share as the my_app object's member variable. For multi-thread protection, use boost::mutex to protect them. Dean Chen Best regards http://blog.csdn.net/csfreebird On Thu, Dec 5, 2013 at 11:45 PM, Heiko Irrgang <hi...@93...> wrote: > Hi, > > hm.. maybe i'm missing something here... i do not want to store full > user information in the session cookie, i just want to safe it somewhere > for the current request, so i do not re-re-re-re-read it from the > database, just because i need it on 5 different locations. > > i already have a cookie session running, but it only holds the user id > and a usertoken. > > What i would need is some storage, that is neither file/cookie based and > does not interfere with the session. > > Pretty much like some local variables in the actual application instance, > but on a point where i do not have this application instance. > > Is something like this available, or do i have to give the application > instance as parameters to every function that might need information > limited to the current request? > > Maybe i'm just thinking too much php here ;) > > Thanx in advance, > Heiko > > On Thu, Dec 05, 2013 at 07:21:04AM -0800, Artyom Beilis wrote: > > http://cppcms.com/wikipp/en/page/cppcms_1x_sessions > > > > Artyom Beilis > > -------------- > > CppCMS - C++ Web Framework: http://cppcms.com/ > > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > -------------------------------------------- > > On Thu, 12/5/13, Heiko Irrgang <hi...@93...> wrote: > > > > Subject: [Cppcms-users] per request data storage? > > To: cpp...@li... > > Date: Thursday, December 5, 2013, 4:50 PM > > > > Hi there, > > > > how can i save data per request? > > > > I store the user id in a browser cookie, then there is a > > function > > called getCurrentUser() which looks into the cookie, then > > gets the user from the database. > > > > Obviously i do not want to have a database query every time > > getCurrentUser() is called within one request, so i want to > > store the current user for the current request. > > > > How can i do this? > > > > Thanx in advance. > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Heiko I. <hi...@93...> - 2013-12-05 15:45:34
|
Hi, hm.. maybe i'm missing something here... i do not want to store full user information in the session cookie, i just want to safe it somewhere for the current request, so i do not re-re-re-re-read it from the database, just because i need it on 5 different locations. i already have a cookie session running, but it only holds the user id and a usertoken. What i would need is some storage, that is neither file/cookie based and does not interfere with the session. Pretty much like some local variables in the actual application instance, but on a point where i do not have this application instance. Is something like this available, or do i have to give the application instance as parameters to every function that might need information limited to the current request? Maybe i'm just thinking too much php here ;) Thanx in advance, Heiko On Thu, Dec 05, 2013 at 07:21:04AM -0800, Artyom Beilis wrote: > http://cppcms.com/wikipp/en/page/cppcms_1x_sessions > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > -------------------------------------------- > On Thu, 12/5/13, Heiko Irrgang <hi...@93...> wrote: > > Subject: [Cppcms-users] per request data storage? > To: cpp...@li... > Date: Thursday, December 5, 2013, 4:50 PM > > Hi there, > > how can i save data per request? > > I store the user id in a browser cookie, then there is a > function > called getCurrentUser() which looks into the cookie, then > gets the user from the database. > > Obviously i do not want to have a database query every time > getCurrentUser() is called within one request, so i want to > store the current user for the current request. > > How can i do this? > > Thanx in advance. |
|
From: Artyom B. <art...@ya...> - 2013-12-05 15:21:11
|
http://cppcms.com/wikipp/en/page/cppcms_1x_sessions Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ -------------------------------------------- On Thu, 12/5/13, Heiko Irrgang <hi...@93...> wrote: Subject: [Cppcms-users] per request data storage? To: cpp...@li... Date: Thursday, December 5, 2013, 4:50 PM Hi there, how can i save data per request? I store the user id in a browser cookie, then there is a function called getCurrentUser() which looks into the cookie, then gets the user from the database. Obviously i do not want to have a database query every time getCurrentUser() is called within one request, so i want to store the current user for the current request. How can i do this? Thanx in advance. -- Heiko ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |