cppcms-users Mailing List for CppCMS C++ Web Framework (Page 97)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Artyom B. <art...@ya...> - 2012-02-06 09:41:14
|
> >> If you want to store only date you have two options: >> >> Use string and format it as "YYYY-MM-DD" or >> use std::tm with relevant fields set if the SQL engine >> knows to convert one type to another. > > > Thanks a lot. It makes much more sense to me now. > > What if I want a date iterator for example? See: Boost.Locale date-time tutorial: http://www.boost.org/doc/libs/1_48_0/libs/locale/doc/html/dates_times_timezones.html Calendar example: http://www.boost.org/doc/libs/1_48_0/libs/locale/doc/html/calendar_8cpp-example.html Note Booster.Locale == Boost.Locale in different namespace so everything applicable to Boost.Locale is same for Booster.Locale. > Should I just use > boost::date_time? >(since Im 99% certain i'll only be using gregorian > calendar anyway) Or does booster offer something similar? > You can use boost::date_time but... I'd recommend to use boost(er)::locale::date_time as it offers more power as it locale dependent. See: http://www.boost.org/doc/libs/1_48_0/libs/locale/doc/html/dates_times_timezones.html#dates_times_timezones_qn For example what if you want to display a calendar for a current month? Where should you start a week at? boost(er)::locale::date_time gives you that knowledge while Boost.DateTime does not. So it is really up-to-you Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: <ele...@ex...> - 2012-02-06 09:10:35
|
> If you want to store only date you have two options: > > Use string and format it as "YYYY-MM-DD" or > use std::tm with relevant fields set if the SQL engine > knows to convert one type to another. Thanks a lot. It makes much more sense to me now. What if I want a date iterator for example? Should I just use boost::date_time?(since Im 99% certain i'll only be using gregorian calendar anyway) Or does booster offer something similar? Petr |
From: Marcel H. <ke...@co...> - 2012-02-06 08:05:30
|
hmm. I don't actually know what do you want. You have a database with some some unix timestamps in it, right? Next thing you want to do is to covert them into a human readable format? Read the doc from the date_time class. Maybe in fact that is what you are really looking for. Maybe you combine both, DateTime and ptime. http://cppcms.com/cppcms_ref_v0_99/classbooster_1_1locale_1_1calendar__facet.html http://cppcms.com/cppcms_ref_v0_99/group__date__time.html There is also a note when he throws an exception. Maybe you look into the messageboard example. I think there is what you want. Also i don't know what do you mean with "storing only date" I think what you want is to make it const. Or you define a class and make it private with a "getter" (: Happy trying. ele...@ex... schrieb: Ah yes, thank you. This is what im doing now - c.topics[i].created_at = booster::ptime::local_time(r.get<std::tm>("created_at")); Next question is - what data type to use for storing only date? Thanks again Petr > Sorry for the "late" reply. > What you are looking for is this > > http://cppcms.com/cppcms_ref_v0_99/classbooster_1_1ptime.html > > greetings > _____________________________________________ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _____________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@ya...> - 2012-02-06 08:04:26
|
Let's make an order: std::time_t - number POSIX time general time representation, time zone independent booster::ptime - POSIX time - general time representation as a number similar to time_t but with higher precision. Time zone independent. booster::locale::date_time - localized time representation. Internally similar to time_t but allows operations according to current locale for example what is the first day of this week which maybe Sunday or Monday according to the locale (US/FR) Internally time zone independent but operations are time zone dependent. Requires special locale for operations (not necessary global) std::tm Standard C++ date-time representation. Does not hold and information about time zone. So which one do you need? if you want to use ptime with cppdb: p = booster::ptime::universal_time(get<std::tm>(column)) p = booster::ptime::local_time(get<std::tm>(column)) statement.bind(booster::ptime::universal_time(p)); statement.bind(booster::ptime::local_time(p)); If you want to use boost::locale::date_time with cppdb, you need to convert it into std::tm or from std::tm Usually it is not stright-forward as date_time may use for example Hebrew or Japanese calendar and the conversion to std::tm would not be correct as Gregorian month and Hebrew month are different. So you need to convert it first to either time_t or booster::ptime and then to std::tm and the other way around. Of course you can set std::tm's fields manually if you know that boost::locale::date_time uses Gregorian calendar. If you want to store only date you have two options: Use string and format it as "YYYY-MM-DD" or use std::tm with relevant fields set if the SQL engine knows to convert one type to another. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: "ele...@ex..." <ele...@ex...> >To: cpp...@li... >Sent: Monday, February 6, 2012 9:36 AM >Subject: Re: [Cppcms-users] How to store/manipulate dates? > >Ah yes, thank you. > >This is what im doing now - > >c.topics[i].created_at = >booster::ptime::local_time(r.get<std::tm>("created_at")); > >Next question is - what data type to use for storing only date? > >Thanks again >Petr > >> Sorry for the "late" reply. >> What you are looking for is this >> >> http://cppcms.com/cppcms_ref_v0_99/classbooster_1_1ptime.html >> >> greetings >> > > >------------------------------------------------------------------------------ >Try before you buy = See our experts in action! >The most comprehensive online learning library for Microsoft developers >is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >Metro Style Apps, more. Free future releases when you subscribe now! >http://p.sf.net/sfu/learndevnow-dev2 >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: <ele...@ex...> - 2012-02-06 07:36:27
|
Ah yes, thank you. This is what im doing now - c.topics[i].created_at = booster::ptime::local_time(r.get<std::tm>("created_at")); Next question is - what data type to use for storing only date? Thanks again Petr > Sorry for the "late" reply. > What you are looking for is this > > http://cppcms.com/cppcms_ref_v0_99/classbooster_1_1ptime.html > > greetings > |
From: Marcel H. <ke...@co...> - 2012-02-06 07:08:27
|
Sorry for the "late" reply. What you are looking for is this http://cppcms.com/cppcms_ref_v0_99/classbooster_1_1ptime.html greetings ele...@ex... schrieb: Another update - reading the locale docs, i found out I have to install a default global locale to use date_time Right now what I do is this - std::tm created_at = r.get<std::tm>("created_at"); c.topics[i].created_at = mktime(&created_at); created_at is of data type date_time. Is there any library function to make it less complicated so I dont have to first convert tm to time_t and then to date_time? Thanks Petr > A little update, using just <ctime>, by fetching the timestamp as std::tm > and then converting it to time_t works. However, I noticed another issue. > > struct topic{ > topic() : id(0) {} > std::string title; > std::string body; > booster::locale::date_time created_at; > int id; > }; > > Using date_time hits exception - std::bad_cast. I've actually removed > every reference to created_at in the code and it seems that by merely > including in the struct, it causes the server to error 500. > > The struct gets copied into a vector that holds all the topics. > > I assume this is a bug. > > Petr > >> Hi, >> >> Essentially my problem is this - I need to load timestamp from a >> database >> table, what data type should I use to store it? (I see >> booster::locale::date_time, is that it?) >> >> Cheers, >> Petr Janda >> >> >>_____________________________________________ >> Try before you buy = See our experts in action! >> The most comprehensive online learning library for Microsoft developers >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> Metro Style Apps, more. Free future releases when you subscribe now! >> http://p.sf.net/sfu/learndevnow-dev2 >>_____________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > > >_____________________________________________ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 >_____________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > _____________________________________________ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _____________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: <ele...@ex...> - 2012-02-06 06:43:16
|
Another update - reading the locale docs, i found out I have to install a default global locale to use date_time Right now what I do is this - std::tm created_at = r.get<std::tm>("created_at"); c.topics[i].created_at = mktime(&created_at); created_at is of data type date_time. Is there any library function to make it less complicated so I dont have to first convert tm to time_t and then to date_time? Thanks Petr > A little update, using just <ctime>, by fetching the timestamp as std::tm > and then converting it to time_t works. However, I noticed another issue. > > struct topic{ > topic() : id(0) {} > std::string title; > std::string body; > booster::locale::date_time created_at; > int id; > }; > > Using date_time hits exception - std::bad_cast. I've actually removed > every reference to created_at in the code and it seems that by merely > including in the struct, it causes the server to error 500. > > The struct gets copied into a vector that holds all the topics. > > I assume this is a bug. > > Petr > >> Hi, >> >> Essentially my problem is this - I need to load timestamp from a >> database >> table, what data type should I use to store it? (I see >> booster::locale::date_time, is that it?) >> >> Cheers, >> Petr Janda >> >> >> ------------------------------------------------------------------------------ >> Try before you buy = See our experts in action! >> The most comprehensive online learning library for Microsoft developers >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> Metro Style Apps, more. Free future releases when you subscribe now! >> http://p.sf.net/sfu/learndevnow-dev2 >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: <ele...@ex...> - 2012-02-06 05:31:21
|
A little update, using just <ctime>, by fetching the timestamp as std::tm and then converting it to time_t works. However, I noticed another issue. struct topic{ topic() : id(0) {} std::string title; std::string body; booster::locale::date_time created_at; int id; }; Using date_time hits exception - std::bad_cast. I've actually removed every reference to created_at in the code and it seems that by merely including in the struct, it causes the server to error 500. The struct gets copied into a vector that holds all the topics. I assume this is a bug. Petr > Hi, > > Essentially my problem is this - I need to load timestamp from a database > table, what data type should I use to store it? (I see > booster::locale::date_time, is that it?) > > Cheers, > Petr Janda > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: <ele...@ex...> - 2012-02-06 04:36:38
|
Hi, Essentially my problem is this - I need to load timestamp from a database table, what data type should I use to store it? (I see booster::locale::date_time, is that it?) Cheers, Petr Janda |
From: Artyom B. <art...@ya...> - 2012-02-02 08:55:09
|
>But, is it possible for cmake to call the TERM signal after a recompile? I >know this probably belongs to cmake mailing list... See:http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_custom_command Quick guess: add_custom_command(TARGET myapp POST_BUILD COMMAND killall myapp) Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: <ele...@ex...> - 2012-02-02 08:38:38
|
> See, unlike web server that can "re-read" its configuration > on -HUP signal, you should actually reload executable after > recompilation - replace it. > > You can do this easily with a simple script: > > while ./myapp -c myconfig ; do sleep 0.5 ; done > > And when you kill it by > > killall -TERM myapp > > It would restart automatically. > > while ./myapp is needed to prevent infinite restart > in case myapp exists with error code. Thank you. But, is it possible for cmake to call the TERM signal after a recompile? I know this probably belongs to cmake mailing list... Petr |
From: Artyom B. <art...@ya...> - 2012-02-02 07:51:41
|
> From: "ele...@ex..." <ele...@ex...> > >Hi, > >One thing that is slightly annoying when compiling a project is having to >restart the server after every little change. Is there anyway to make >cmake automatically "killall -HUP appname" the server process after every >successful recompile? > >Cheers, >Petr > > See, unlike web server that can "re-read" its configuration on -HUP signal, you should actually reload executable after recompilation - replace it. You can do this easily with a simple script: while ./myapp -c myconfig ; do sleep 0.5 ; done And when you kill it by killall -TERM myapp It would restart automatically. while ./myapp is needed to prevent infinite restart in case myapp exists with error code. ------------------ If you change only views (templates) and you compile them as independent shared object you can reload them by setting an option: views.auto_reload in cppcms configuration to true. See: <http://cppcms.com/wikipp/en/page/cppcms_1x_config#views.auto_reload> This would make cppcms to reload shared object views automatically in case they had changed. This is useful for HTML/templates editing. Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: <ele...@ex...> - 2012-02-02 01:53:43
|
Hi, One thing that is slightly annoying when compiling a project is having to restart the server after every little change. Is there anyway to make cmake automatically "killall -HUP appname" the server process after every successful recompile? Cheers, Petr |
From: Leon <le...@wl...> - 2012-01-31 08:50:51
|
I have added a feature request. After browsing the libraries you suggested, I think libcurl is the only option (although I do not like the api style). Thanks! On Mon, Jan 30, 2012 at 11:08 PM, Artyom Beilis <art...@ya...> wrote: > >> Hi, >> >> So cookie is the only answer. > > You know what... Open a feature request. For non-cookies based session support. > > It is something that was frequently asked before... > So I may provide some middle-ware hooks to support it, it should > not be so hard. > > Artyom Beilis > ------------- > > Support CppCMS by donating money: > https://sourceforge.net/donate/index.php?group_id=209965 > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@ya...> - 2012-01-31 08:45:55
|
>There is a tutorial about forms and about databases > Combine them and you are fine (: the way you do is fine. But make sure to validate the data. Read these articles for further use >http://cppcms.com/wikipp/en/page/secure_programming NOTE: >http://cppcms.com/wikipp/en/page/ref_cppcms_forms THE link ABOVE ^ is outdated (it is for cppcms 0.0.8) >http://cppcms.com/sql/cppdb/ > >There are some very good examples. You can help by adding and editing them. > >Cheers, > >Marcel Hellwig > > Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: Marcel H. <ke...@co...> - 2012-01-31 08:29:55
|
There is a tutorial about forms and about databases. Combine them and you are fine (: the way you do is fine. But make sure to validate the data. Read these articles for further use http://cppcms.com/wikipp/en/page/secure_programming http://cppcms.com/wikipp/en/page/ref_cppcms_forms http://cppcms.com/sql/cppdb/ There are some very good examples. You can help by adding and editing them. Cheers, Marcel Hellwig ele...@ex... schrieb: Hi, I've just recently started experimenting with cppcms and so far I quite like it. (thanks!) I've been studying the message board code in the examples section to get my head around things and at the same time developing a simple blog application. My question is this - what is the best way to load data from database into a typical edit form, make it available for user to edit and submit changes? One way I think I could do it is simply cpdbb::result >> user.id >> user.name >> user.title etc and then copy the values into the members of the form struct. Is this the preferred way or is there another? Should this be done in the controller or elsewhere? Thanks, Petr _____________________________________________ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _____________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@ya...> - 2012-01-30 15:08:23
|
> Hi, > > So cookie is the only answer. You know what... Open a feature request. For non-cookies based session support. It is something that was frequently asked before... So I may provide some middle-ware hooks to support it, it should not be so hard. Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: Artyom B. <art...@ya...> - 2012-01-30 10:55:46
|
> From: Leon <le...@wl...> > > Hi, > > So cookie is the only answer. The only correct answer :-) > Do you have any suggestion for C++ HTTP client side library > which provides the following features: > > 1. Cookies. > 2. Keep-Alive. > 3. Asynchronous. > > Thanks. > Actually it depends on what kind of asynchronous event loop you are using. Some libraries are asynchronus and event loop independent like libcurl that does all you need. Some rely on their own event loop Yes, there are plenty: libcurl, MIT license, supports all to mentioned: http://curl.haxx.se/docs/features.html POCO toolkit has HTTPClient with cookies support (not tested on my own), Boost License. http://pocoproject.org The answer really depends on what do you looking for. There is Boost.Networking library but it does not provide decent cookies support - i.e. you need to set headers manually. The event loop is based on Boost.Asio So what do you need? Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: Leon <le...@wl...> - 2012-01-30 10:16:16
|
Hi, So cookie is the only answer. Do you have any suggestion for C++ HTTP client side library which provides the following features: 1. Cookies. 2. Keep-Alive. 3. Asynchronous. Thanks. On Fri, Jan 27, 2012 at 8:39 PM, Artyom Beilis <art...@ya...> wrote: >> From: Leon <le...@wl...> > >> >> Hi, >> >> Cppcms uses cookies to manage session. This is fine if the client is a >> browser. However, if the client is not a browser, cookie support may >> not available. In this case how can we manage sessions? What is the >> best practice? >> >> Thanks. >> > > Any decent HTTP client supports cookies, so there is no reasons to > to use them with non-browser clients. > > There is a very good reason to use Cookies for session management > security, see for example this: > > <http://cppcms.com/wikipp/en/page/secure_programming#Session.handling.is.cookie.based> > > And if even there is no "referrer" issue, passing session id via URL > > for example exposes it in web server logs, proxy servers logs and so on. > > So the best is to use Cookies, this is what they were designed for > keeps the state of the stateless HTTP protoco > > Artyom Beilis > ------------- > > Support CppCMS by donating money: > https://sourceforge.net/donate/index.php?group_id=209965 > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@ya...> - 2012-01-30 08:21:09
|
> From: "ele...@ex..." <ele...@ex...> > Hi, Hello, > > I've just recently started experimenting with cppcms and so far I quite > like it. (thanks!) > > I've been studying the message board code in the examples section to get > my head around things and at the same time developing a simple blog > application. > BTW there is a blog application in svn http://cppcms.svn.sourceforge.net/viewvc/cppcms/blog/trunk/ This once runs CppCMS blog. > My question is this - what is the best way to load data from database into > a typical edit form, make it available for user to edit and submit > changes? > > One way I think I could do it is simply cpdbb::result >> user.id >> > user.name >> user.title etc and then copy the values into the members of > the form struct. > > Is this the preferred way or is there another? > > Should this be done in the controller or elsewhere? Honestly whatever feels right. You may create some set of "model" classes over cppdb and then set the values to the form from this model. You may use temporary variables. You can call. cppdb::result r = ... my_from.name.value(r.get<std::string>(0)); my_from.title.value(r.get<std::string>(1)); And so on. Its really up to you. Some users create some set of model classes and separate them from controller some use directly SQL in controller and setup their content. Whatever feels right > > Thanks, > Petr > > Best, Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: <ele...@ex...> - 2012-01-30 02:40:47
|
Hi, I've just recently started experimenting with cppcms and so far I quite like it. (thanks!) I've been studying the message board code in the examples section to get my head around things and at the same time developing a simple blog application. My question is this - what is the best way to load data from database into a typical edit form, make it available for user to edit and submit changes? One way I think I could do it is simply cpdbb::result >> user.id >> user.name >> user.title etc and then copy the values into the members of the form struct. Is this the preferred way or is there another? Should this be done in the controller or elsewhere? Thanks, Petr |
From: Artyom B. <art...@ya...> - 2012-01-27 12:39:56
|
> From: Leon <le...@wl...> > > Hi, > > Cppcms uses cookies to manage session. This is fine if the client is a > browser. However, if the client is not a browser, cookie support may > not available. In this case how can we manage sessions? What is the > best practice? > > Thanks. > Any decent HTTP client supports cookies, so there is no reasons to to use them with non-browser clients. There is a very good reason to use Cookies for session management security, see for example this: <http://cppcms.com/wikipp/en/page/secure_programming#Session.handling.is.cookie.based> And if even there is no "referrer" issue, passing session id via URL for example exposes it in web server logs, proxy servers logs and so on. So the best is to use Cookies, this is what they were designed for keeps the state of the stateless HTTP protoco Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: Marcel H. <ke...@co...> - 2012-01-27 08:57:04
|
hi too, afaik, there is not solution for you. Session is only available over cookies. Maybe you can do a little bit cheating and post the sessionID in the URL and then, before every connection you can read it out and parse it as a session cookie. Can't guaranteethat this is a) a possible solution and b) a secure and good solution. Nevermind, have fun and good luck :) Am 27.01.2012 09:33, schrieb Leon: > Hi, > > Cppcms uses cookies to manage session. This is fine if the client is a > browser. However, if the client is not a browser, cookie support may > not available. In this case how can we manage sessions? What is the > best practice? > > Thanks. > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 [1] > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... [2] > https://lists.sourceforge.net/lists/listinfo/cppcms-users [3] Links: ------ [1] http://p.sf.net/sfu/learndevnow-dev2 [2] mailto:Cpp...@li... [3] https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Leon <le...@wl...> - 2012-01-27 08:33:17
|
Hi, Cppcms uses cookies to manage session. This is fine if the client is a browser. However, if the client is not a browser, cookie support may not available. In this case how can we manage sessions? What is the best practice? Thanks. |
From: Artyom B. <art...@ya...> - 2012-01-26 08:49:02
|
Hello CppCMS users, The project web site moved to a new domain name. Please update your RSS feeds and bookmarks: - Project's main web site: <http://cppcms.com> - Project's blog: <http://blog.cppcms.com> - Project author's blog (Hebrew): <http://artyom.cppcms.com> Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |