cppcms-users Mailing List for CppCMS C++ Web Framework (Page 85)
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: Leon <le...@wl...> - 2012-05-23 02:30:28
|
Hi, Now that ubuntu 12.04 is released, will cppcms packages be available for it soon? Best regards, |
From: Artyom B. <art...@ya...> - 2012-05-22 20:07:00
|
> On the second thought... > > > It is bug because it is really unexpected behavior.. > > And stuff like this > > > r = sql << "SELECT ... ? .. " << (a+b); > > while(r.next()) { > > } > > Would not work properly > > Please open a bug report with HIGH priority > > Thanks for the enlightenment! > > Artyom > Fixed in svn trunk in chageneset 2178. Please take it and see if it solve the problem (it should) I switched from using SQLITE_STATIC to full copy. I think I'm going to release a hot fix release for cppdb because some assumptions on the scope of the statement were incorrect. Artyom |
From: doug l. <bi...@gm...> - 2012-05-22 20:05:15
|
Brilliant, thankyou. On 22 May 2012 20:20, Artyom Beilis <art...@ya...> wrote: > > > > > One is about using SSL for things like user registration > > & payment processing. Does that facility exist within cppcms? > > Is that more something I'd do in my Apache setup? > > The best practice is to run behind a web server like Apache, Lighttpd or > Nginx > using FastCGI protocol. The web server would handle SSL for you. > > > > Another is about using HTML5 controls in widgets -- is > > there a guide to extending the existing widgets to support things > > like email and number inputs, at all? > > There is already number widget, take a look on it as an example > how to extend widgets. Remember that there is a regex widget > that helps you to do very generic tests in a simple way > > > > Artyom > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@ya...> - 2012-05-22 19:20:26
|
> One is about using SSL for things like user registration > & payment processing. Does that facility exist within cppcms? > Is that more something I'd do in my Apache setup? The best practice is to run behind a web server like Apache, Lighttpd or Nginx using FastCGI protocol. The web server would handle SSL for you. > Another is about using HTML5 controls in widgets -- is > there a guide to extending the existing widgets to support things > like email and number inputs, at all? There is already number widget, take a look on it as an example how to extend widgets. Remember that there is a regex widget that helps you to do very generic tests in a simple way Artyom |
From: doug l. <bi...@gm...> - 2012-05-22 17:34:17
|
Hi -- I'm wanting to develop a full-fledged web app with cppcms, after having written an image server in it (which I'll post details of to here, once it's all dusted off). I have a couple of questions I haven't been able to work out the answers to, though. One is about using SSL for things like user registration & payment processing. Does that facility exist within cppcms? Is that more something I'd do in my Apache setup? Another is about using HTML5 controls in widgets -- is there a guide to extending the existing widgets to support things like email and number inputs, at all? & thanks again for the framework, I'm really enjoying learning it & coding in it. Cheers, Doug. |
From: Artyom B. <art...@ya...> - 2012-05-22 17:13:51
|
> > 1.) I would like to render a form and make a layout of them using css. As I > see, there are currently following options: > html_list_type { > as_p = 0, as_table = 1, as_ul = 2, as_dl = 3, > as_space = 4 > } > > as shown in: > http://cppcms.com/cppcms_ref/latest/structcppcms_1_1form__flags.html#a0c305033878375311a7d5df068eef974 > > Is it possible to render them as_div to get <div> sections? > > You can implement custom rendering they way you wish <% template divrender(cppcms::form &aform) %> <% foreach w as cppcms::form::iterator in aform %> <% item %> <div> <% if w.has_message() %><%= w.message() %>:<% end %> <% form input w %> <% if not w.valid() %>:<%= w.error_message() %><% end %> </div> <% end %> <% end %> <% end template %> > > 2.) Even if I add forms to forms it seems like that they seem to be rendered > completely flat. Yes because cppcms::form iterator iterates over all sub-widgets tree. > > Is it possible to somehow have the same structure in the html output like > the the forms have? > > e.g. I would like to generate following html: > <div> > <div> > element1 element2 > </div> > <div> > element3 element4 > </div> > </div> > > out of: > form1.add(element1); > form1.add(element2); > add(form1); > form2.add(element3); > form2.add(element4); > add(form2); > > (the othermost <div> is from the template) > Organize widgets into subforms and render them separately. <div> <% include divrender(form1) %> </div> <div> <% include divrender(form2) %> </div> You can also put the pointers/references on them in sime list/array and use foreach > > best regards > Markus Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
From: Artyom B. <art...@ya...> - 2012-05-22 17:07:07
|
> > > void main(std:string url) > { > if(!dispatcher().dispatch(url)) { >response().make_error_response(http::response::not_found); > } > cppcms::rpc::json_rpc_server::main(url); > } >}; > You really mixing stuff incorrectly because you will never be able to execute cppcms::rpc::json_rpc_server::main(url); properly as you already have an output Artyom |
From: Artyom B. <art...@ya...> - 2012-05-22 17:02:28
|
----- Original Message ----- > From: Artyom Beilis <art...@ya...> > To: "cpp...@li..." <cpp...@li...> > Cc: > Sent: Tuesday, May 22, 2012 7:58 PM > Subject: Re: [Cppcms-users] Bizarre prepared statement problem > > > >> cppdb::result Base::get_all_items(...) > >> { >> >> cppdb::result r; >> string ts = "2012-05-17 23:59:59"; >> ... >> r=sql .... >> << date_limited_only >> << ts >> << ts >> << ts >> << aircraft_id; >> >> return r; // <---- >> } >> > > And than in some other place > > r = get_all_times(...) > while(r.next()) > ... > > In the first request of r.next() the query is actually > executed, when **ts** goes out of the scope and becomes invalid. > and during query the ts is not valid. > > That is why it does not work. > > I can suggest switch to: > > get_all_times > { > r = sql .... > r.next(); > return r; > > } > > r=get_all_times(); > > while(!r.empty()) { > r >> ... > r.next() > } > > Artyom Beilis > On the second thought... It is bug because it is really unexpected behavior.. And stuff like this r = sql << "SELECT ... ? .. " << (a+b); while(r.next()) { } Would not work properly Please open a bug report with HIGH priority Thanks for the enlightenment! Artyom |
From: Artyom B. <art...@ya...> - 2012-05-22 16:59:02
|
> cppdb::result Base::get_all_items(...) > { > > cppdb::result r; > string ts = "2012-05-17 23:59:59"; > ... > r=sql .... > << date_limited_only > << ts > << ts > << ts > << aircraft_id; > > return r; // <---- > } > And than in some other place r = get_all_times(...) while(r.next()) ... In the first request of r.next() the query is actually executed, when **ts** goes out of the scope and becomes invalid. and during query the ts is not valid. That is why it does not work. I can suggest switch to: get_all_times { r = sql .... r.next(); return r; } r=get_all_times(); while(!r.empty()) { r >> ... r.next() } Artyom Beilis |
From: Markus R. <us...@ma...> - 2012-05-22 16:16:38
|
Hi! 1.) I would like to render a form and make a layout of them using css. As I see, there are currently following options: html_list_type { as_p = 0, as_table = 1, as_ul = 2, as_dl = 3, as_space = 4 } as shown in: http://cppcms.com/cppcms_ref/latest/structcppcms_1_1form__flags.html#a0c305033878375311a7d5df068eef974 Is it possible to render them as_div to get <div> sections? 2.) Even if I add forms to forms it seems like that they seem to be rendered completely flat. Is it possible to somehow have the same structure in the html output like the the forms have? e.g. I would like to generate following html: <div> <div> element1 element2 </div> <div> element3 element4 </div> </div> out of: form1.add(element1); form1.add(element2); add(form1); form2.add(element3); form2.add(element4); add(form2); (the othermost <div> is from the template) best regards Markus |
From: le ba <hma...@gm...> - 2012-05-22 07:39:17
|
Hi Artyom, this is the main overriden that I used: class numbers : public cppcms::rpc::json_rpc_server { public: numbers(cppcms::service &srv) : cppcms::rpc::json_rpc_server (srv) { dispatcher().assign("",&numbers::all,this); mapper().assign(""); } void main(std:string url) { if(!dispatcher().dispatch(url)) { response().make_error_response(http::response::not_found); } cppcms::rpc::json_rpc_server::main(url); } }; 2012/5/21 Artyom Beilis <art...@ya...> > > > > > > >I would like explain my questions. For example I create my dynamic page > > > (like template or templates_inheritance in the example) with ajax using > json_rpc inside: > > 1. Will I do a derivation from cppcms::appliaction and make a json > call inside or > > 2. Will I do a derivation from cppcms::rpc::json_rpc_server for all > application and children. > > See json_rcp_server is derived from cppcms::application, so everything you > have in application > you have in the RPC server. > > So if you use mostly AJAX and JSON-RPC API it makes sence to use > json_rpc_server for your code > > > >I'd like to know if the context is shared by url dispather and > json_rpc_call or they have two different context? > > > > No, but dispatching member functions would not work AFAIR as it dispatches > function calls in main() that > is overriden > > > If you want more specific answers be more specific > > > Artyom > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: Christian G. <chr...@gm...> - 2012-05-22 06:13:25
|
Thanks a lot, I went with solution 3 and its working very nice. -- Christian Gmeiner, MSc 2012/5/21 Artyom Beilis <art...@ya...>: > > > ________________________________ >> From: Christian Gmeiner <chr...@gm...> >> >> >>Hi all, >> >>I am very new to cppcms but I am quite far in doing a conversion of a >>RoR app to cppcms. >>On thing thats missing is the user login. I have a login sub-app, >>which works nicely but I am looking >>for a way to check if users is login in on every page access - >>something like before_filter in RoR. >> >>Does there exists some linke that in cppcms? > > Don't know how "before_filter" in RoR works. However there are two options: > > 1. If you want to check login for entire sub-application you can override main, > check if user logged in and if it is not put some redirect header > and not continue. > > 2. You can provide some kind guard in one of your base classes: > > void check_logged_in() > { > if(!session().is_set("user_id")) { > throw not_logged_in(); > > } > > } > > And add it in every function that requires login > > > And override the main of tompost application with > > void main(std::string url) > { > try { > cppcms::application::main(url); > > } > catch(not_logged_in const &) { > response().set_redirect_header(...) > return; > > } > > } > > > 3. Or even more simple without exceptions: > > > bool check_logged_in() > { > if(!session().is_set("user_id")) { > response().set_redirect_header(...) > return false; > } > return true; > > } > > And on your pages: > > if(!check_logged_in()) > return; > > > > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > >> >>thanks >>-- >>Christian Gmeiner, MSc >> >>------------------------------------------------------------------------------ >>Live Security Virtual Conference >>Exclusive live event will cover all the ways today's security and >>threat landscape has changed and how IT managers can respond. Discussions >>will include endpoint security, mobile security and the latest in malware >>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Leon <le...@wl...> - 2012-05-22 05:05:45
|
Thanks. It's now clear. On Tue, May 22, 2012 at 12:23 PM, Artyom Beilis <art...@ya...> wrote: > >Thank you for your reply. > > > > > >I > have a question. If a huge file is being uploaded using HTTP PUT, will > the whole be in memory or will it be saved to disk? > > > > > You do not upload huge files via PUT, you should do it using POST > and multipart/form-data content type. > > > This case is specially handled and uploaded files are saved on disk. > All other types of content are stored in memory and their size is > limited by following settings: > > http://cppcms.com/wikipp/en/page/cppcms_1x_config#security > > Bottom line, use POST for files. > > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > > > >Best regards, > > > > > > > >On Mon, May 21, 2012 at 8:43 PM, Artyom Beilis <art...@ya...> > wrote: > > > >The same way you handle POST, the data can be accessed using > request().raw_post_data() > >> > >> > >>Artyom Beilis > >>-------------- > >>CppCMS - C++ Web Framework: http://cppcms.com/ > >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > >> > >> > >> > >>>________________________________ > >>> From: Leon <le...@wl...> > >>>To: cpp...@li... > >>>Sent: Friday, May 18, 2012 11:51 AM > >>>Subject: [Cppcms-users] HTTP PUT > >>> > >>> > >>> > >>>Hi, > >>> > >>> > >>>Is there any document on handling HTTP PUT? > >>> > >>> > >>>Thanks! > >>> > >>> > > >>>------------------------------------------------------------------------------ > >>>Live Security Virtual Conference > >>>Exclusive live event will cover all the ways today's security and > >>>threat landscape has changed and how IT managers can respond. > Discussions > >>>will include endpoint security, mobile security and the latest in > malware > >>>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >>>_______________________________________________ > >>>Cppcms-users mailing list > >>>Cpp...@li... > >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users > >>> > >>> > >>> > > >>------------------------------------------------------------------------------ > >>Live Security Virtual Conference > >>Exclusive live event will cover all the ways today's security and > >>threat landscape has changed and how IT managers can respond. Discussions > >>will include endpoint security, mobile security and the latest in malware > >>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >>_______________________________________________ > >>Cppcms-users mailing list > >>Cpp...@li... > >>https://lists.sourceforge.net/lists/listinfo/cppcms-users > >> > >> > > > > >------------------------------------------------------------------------------ > >Live Security Virtual Conference > >Exclusive live event will cover all the ways today's security and > >threat landscape has changed and how IT managers can respond. Discussions > >will include endpoint security, mobile security and the latest in malware > >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >_______________________________________________ > >Cppcms-users mailing list > >Cpp...@li... > >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@ya...> - 2012-05-22 04:24:03
|
>Thank you for your reply. > > >I have a question. If a huge file is being uploaded using HTTP PUT, will the whole be in memory or will it be saved to disk? > You do not upload huge files via PUT, you should do it using POST and multipart/form-data content type. This case is specially handled and uploaded files are saved on disk. All other types of content are stored in memory and their size is limited by following settings: http://cppcms.com/wikipp/en/page/cppcms_1x_config#security Bottom line, use POST for files. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > >Best regards, > > > >On Mon, May 21, 2012 at 8:43 PM, Artyom Beilis <art...@ya...> wrote: > >The same way you handle POST, the data can be accessed using request().raw_post_data() >> >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: Leon <le...@wl...> >>>To: cpp...@li... >>>Sent: Friday, May 18, 2012 11:51 AM >>>Subject: [Cppcms-users] HTTP PUT >>> >>> >>> >>>Hi, >>> >>> >>>Is there any document on handling HTTP PUT? >>> >>> >>>Thanks! >>> >>> >>>------------------------------------------------------------------------------ >>>Live Security Virtual Conference >>>Exclusive live event will cover all the ways today's security and >>>threat landscape has changed and how IT managers can respond. Discussions >>>will include endpoint security, mobile security and the latest in malware >>>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >>------------------------------------------------------------------------------ >>Live Security Virtual Conference >>Exclusive live event will cover all the ways today's security and >>threat landscape has changed and how IT managers can respond. Discussions >>will include endpoint security, mobile security and the latest in malware >>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: <ele...@ex...> - 2012-05-22 04:23:55
|
Table schema: create table af_publication_items_history ( id INTEGER PRIMARY KEY AUTOINCREMENT, root_id INTEGER REFERENCES af_publication_items(id) NOT NULL, parent_id INTEGER REFERENCES af_publication_items(id), aircraft_id INTEGER REFERENCES aircrafts(id) NOT NULL, action TEXT NOT NULL, date_action TEXT, life REAL NOT NULL DEFAULT 0, date_fitted NUMERIC NOT NULL, fitted_at REAL NOT NULL DEFAULT 0, tsn REAL NOT NULL DEFAULT 0, serial_number TEXT, days INTEGER DEFAULT 0, dsn INTEGER DEFAULT 0, created_at NUMERIC DEFAULT CURRENT_TIMESTAMP, disabled_at NUMERIC ); |
From: <ele...@ex...> - 2012-05-22 04:21:21
|
> Have you tried to change the type to datetime? Because > converting dates and numbers is not always well defined... Isn't SQLites datetime data type affinity to NUMERIC anyway? > > Also show the *full* code and full schema. > Ive slightly simplified the SQL query in my original email, but here is the whole function. cppdb::result Base::get_all_items(unsigned int aircraft_id, const Table& tbl, int date_limited_only) { cppdb::result r; //std::tm ts = dt_to_time(session_timestamp()); string ts = "2012-05-17 23:59:59"; ostringstream os; os << "SELECT i.id, i.name, i.remarks, i.part_number, h1.id AS rev_id, "; os << tbl.column_string("h1") << " "; os << "FROM " << tbl.name() << "s i "; os << "INNER JOIN " << tbl.name() << "s_history h1 ON h1.root_id=i.id "; os << "AND h1.days >= ? AND h1.date_fitted <= ? AND (h1.disabled_at IS NULL OR h1.disabled_at > ?) "; os << "AND h1.id IN (SELECT max(h2.id) FROM " << tbl.name() << "s_history h2 WHERE h2.date_fitted <= ? AND h2.root_id=i.id)"; os << "WHERE h1.aircraft_id = ? ORDER BY i.id ASC"; r = sql << os.str() << date_limited_only << ts << ts << ts << aircraft_id; return r; } |
From: <ele...@ex...> - 2012-05-22 04:20:19
|
> Have you tried to change the type to datetime? Because > converting dates and numbers is not always well defined... Isn't SQLites datetime data type affinity to NUMERIC anyway? > > Also show the *full* code and full schema. > Ive slightly simplified the SQL query in my original email, but here is the whole function. cppdb::result Base::get_all_items(unsigned int aircraft_id, const Table& tbl, int date_limited_only) { cppdb::result r; //std::tm ts = dt_to_time(session_timestamp()); string ts = "2012-05-17 23:59:59"; ostringstream os; os << "SELECT i.id, i.name, i.remarks, i.part_number, h1.id AS rev_id, "; os << tbl.column_string("h1") << " "; os << "FROM " << tbl.name() << "s i "; os << "INNER JOIN " << tbl.name() << "s_history h1 ON h1.root_id=i.id "; os << "AND h1.days >= ? AND h1.date_fitted <= ? AND (h1.disabled_at IS NULL OR h1.disabled_at > ?) "; os << "AND h1.id IN (SELECT max(h2.id) FROM " << tbl.name() << "s_history h2 WHERE h2.date_fitted <= ? AND h2.root_id=i.id)"; os << "WHERE h1.aircraft_id = ? ORDER BY i.id ASC"; r = sql << os.str() << date_limited_only << ts << ts << ts << aircraft_id; return r; } |
From: Leon <le...@wl...> - 2012-05-22 02:50:20
|
Thank you for your reply. I have a question. If a huge file is being uploaded using HTTP PUT, will the whole be in memory or will it be saved to disk? Best regards, On Mon, May 21, 2012 at 8:43 PM, Artyom Beilis <art...@ya...> wrote: > The same way you handle POST, the data can be accessed using > request().raw_post_data() > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* Leon <le...@wl...> > *To:* cpp...@li... > *Sent:* Friday, May 18, 2012 11:51 AM > *Subject:* [Cppcms-users] HTTP PUT > > Hi, > > Is there any document on handling HTTP PUT? > > Thanks! > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: Artyom B. <art...@ya...> - 2012-05-21 14:01:47
|
----- Original Message ----- > >> Few points: >> >> 1. What DB (mysql/sqlite/posgressql/mssql) ? >> 2. Can you enable logging (at DB level to see what exactly passed)? >> 3. What is the column type? >> 4. Does it work from direct SQL access? >> 5. How do you count rows? >> > > > 1) Sqlite > 2) How do you do that? You can't with sqlite > 3) The column type is NUMERIC Have you tried to change the type to datetime? Because converting dates and numbers is not always well defined... Also show the *full* code and full schema. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
From: <ele...@ex...> - 2012-05-21 13:24:31
|
> Few points: > > 1. What DB (mysql/sqlite/posgressql/mssql) ? > 2. Can you enable logging (at DB level to see what exactly passed)? > 3. What is the column type? > 4. Does it work from direct SQL access? > 5. How do you count rows? > 1) Sqlite 2) How do you do that? 3) The column type is NUMERIC 4) Yes 5) Counted rows by inserting them into a vector and then size() Petr |
From: Artyom B. <art...@ya...> - 2012-05-21 12:58:19
|
________________________________ > From: Christian Gmeiner <chr...@gm...> > > >Hi all, > >I am very new to cppcms but I am quite far in doing a conversion of a >RoR app to cppcms. >On thing thats missing is the user login. I have a login sub-app, >which works nicely but I am looking >for a way to check if users is login in on every page access - >something like before_filter in RoR. > >Does there exists some linke that in cppcms? Don't know how "before_filter" in RoR works. However there are two options: 1. If you want to check login for entire sub-application you can override main, check if user logged in and if it is not put some redirect header and not continue. 2. You can provide some kind guard in one of your base classes: void check_logged_in() { if(!session().is_set("user_id")) { throw not_logged_in(); } } And add it in every function that requires login And override the main of tompost application with void main(std::string url) { try { cppcms::application::main(url); } catch(not_logged_in const &) { response().set_redirect_header(...) return; } } 3. Or even more simple without exceptions: bool check_logged_in() { if(!session().is_set("user_id")) { response().set_redirect_header(...) return false; } return true; } And on your pages: if(!check_logged_in()) return; Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > >thanks >-- >Christian Gmeiner, MSc > >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: Artyom B. <art...@ya...> - 2012-05-21 12:51:43
|
> > >I would like explain my questions. For example I create my dynamic page > (like template or templates_inheritance in the example) with ajax using json_rpc inside: > 1. Will I do a derivation from cppcms::appliaction and make a json call inside or > 2. Will I do a derivation from cppcms::rpc::json_rpc_server for all application and children. See json_rcp_server is derived from cppcms::application, so everything you have in application you have in the RPC server. So if you use mostly AJAX and JSON-RPC API it makes sence to use json_rpc_server for your code >I'd like to know if the context is shared by url dispather and json_rpc_call or they have two different context? > No, but dispatching member functions would not work AFAIR as it dispatches function calls in main() that is overriden If you want more specific answers be more specific Artyom > |
From: Artyom B. <art...@ya...> - 2012-05-21 12:48:40
|
> >Yeah I tried cloning the string via a copy constructor: > >sql << os.str() << string(ts) << string(ts); > >but it made no difference. I believe string always deep copies. > >In the end, instead of passing it a string, I used strptime() to convert >the string to a std::tm struct and it's working fine. Very weird. > Few points: 1. What DB (mysql/sqlite/posgressql/mssql) ? 2. Can you enable logging (at DB level to see what exactly passed)? 3. What is the column type? 4. Does it work from direct SQL access? 5. How do you count rows? Generally is seems little bit strange. Artyom |
From: Artyom B. <art...@ya...> - 2012-05-21 12:45:19
|
You can convert booster::locale::date_time to tm by selecting individual fields. Currently there is no automatic conversion as converting date_time to std::tm have meaningful when Gregorian calendar is used. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: "ele...@ex..." <ele...@ex...> >To: Artyom Beilis <art...@ya...>; cpp...@li... >Sent: Friday, May 18, 2012 12:40 PM >Subject: Re: [Cppcms-users] sqlite3 CURRENT_TIMESTAMP compare to date_time > >> it is not ptime, booster::ptime::universal_time converts ptime to std::tm >> and vise versa. The overload >> is for std::tm >> > >I see, but the question stays - whats the best way to convert date_time to >std::tm? I'd rather not mix both ptime and date_time in the project. > > >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: Artyom B. <art...@ya...> - 2012-05-21 12:43:43
|
The same way you handle POST, the data can be accessed using request().raw_post_data() Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Leon <le...@wl...> >To: cpp...@li... >Sent: Friday, May 18, 2012 11:51 AM >Subject: [Cppcms-users] HTTP PUT > > >Hi, > > >Is there any document on handling HTTP PUT? > > >Thanks! > > >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |