cppcms-users Mailing List for CppCMS C++ Web Framework (Page 130)
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: Julian P. <ju...@wh...> - 2010-08-30 23:52:32
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 30.08.2010 06:15, schrieb Artyom: >> May I use a construct like >> <% foreach widget in form %> here? > > Yes, you can. > > See: http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1form.html > > it has forward iterator in it and thus you can iterate over the > form. > > There is an example from src/hello_world_view1.tmpl > > > <% foreach w as cppcms::form::iterator in form %> > <% separator %><br/><% item %> > <% if w.has_message() %><% w.message() %>:<% end %> > <% form input w %> > <% if not w.valid() %>:<% w.error_message() %><% end %> > <% end %> > <% end %> > > Artyom > > Ok, thanks for this example. But I still have a problem: Because even the forms on this page are dynamically allocated, they are stored in a vector, and because they are not copyable, I store a booster::shared_ptr to them instead. I loop with <% foreach form in forms %> But the problem is, that now the following construct <% foreach w as cppcms::form::iterator in form %> does not work, because the template generator expects form to be the object itself (and therefore generates form.begin() and form.end() instead of form->begin() and form->end() which would have to be used here). Is there a way around this apart of editing the generated template afterwards? Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMfEQ0AAoJENidYKvYQHlQOc8QAMrII619eMkDxv5mMdr341d9 mlqHIMpmJUPB5NwT1sqcoftHW3+6LkBVKSvx9VciOK8PnOaxZEEBW7K479RM943Q 9Pt1m2fBckJi7SQ0UGIaHqr/7rcpkkDNf6x8z/X8KYLWfYI0Jr7OYKKv1pSKTqYT cMepd64wvxxbpdZ1xN1Cw0frB82bTIsO9xek3ZkgDdIfMQ8/NzmLK/bz2/KdJf8c wSYT+3kZS7e4X7/84MgTsVwaLRnOpVyU5m2xzaZfWMeib/FbZWY1RsxMqEzTfaqW cplWPoEJV6zzfRIB7IVTfNd83fQTHu0X3gmnOSq6BnZufK7n5XLc2io2UMGlPWds oFlaJDqwKZL4Hvqd5zCp0e1RcK6m3rRd6+U/vyBZ+Z+Ye480Ubd5VlmdKAmOts8d APdwOJ21xHqj8sfzLAv84hbKDwwbXR54uF7DoqI5rKxwQkRry231wMORjjC1DsII tXQ/zrpT5iMZB8hFxlVIBq4rdQLg2Syfr+LM/6QZN5H9cvhSULlwP6/PMtyMljqe XglId5HmL6uQkjI5D4hagVz4ddqr6uiQAzy+0RGt/0WuE2sx0WR8zkee6hbsLAAx i6fgzuJ9AgDXJOHrfgCJKe1ulRoZjFjpKoRNQBt0aUH2L/LCmrUDdAQkDS+mOUOa vN71su/IIWaudH0/ISsB =hR8o -----END PGP SIGNATURE----- |
From: augustin <aug...@ov...> - 2010-08-30 13:13:46
|
On Monday 30 August 2010 03:04:24 am Artyom wrote: > 2. Install icu using > > apt-get install libicu-dev > > and stop compiling it on your own. > > 3. Remove all files from build directory and run cmake .. and then > make again. > Hello Aris, and welcome! Like you, I am using Ubuntu -64bit. Which version of Ubuntu are you using? I had a small problem with the ICU version on Kubuntu 09.10 but Artyom promptly fixed it so that now cppcms compiles cleanly on this platform with a somewhat older ICU version. So, my advice is to follow Artyom's advice above. Check the wiki for the official list of ubuntu packages to install. Completely delete the build/ directory of your cppcms. Make sure you get the latest code from svn. There is one extra step that I had to do once to make sure the compiler knew to get the extra libraries in /usr/share/local. I forgot what it is, but it is in the 'troubleshooting' section in the wiki. Otherwise, you shouldn't have any problem compiling it using the default options. You should start over from scratch. Good luck, Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Artyom <art...@ya...> - 2010-08-30 04:24:53
|
> > Ok, in meantime I found the locale::generator::add_messages_domain() and > set_default_messages_domain(), but that raised a few more questions: > > - - Is it possible to remove a message domain again? (But only one and not > all message domains, so the clear_domains() method is not what I want) No, you can't. At least in current API. > - - Can I select the domain to use for basic_format::format or > locale::translate at method call somehow or do I have to call > set_default_messages_domain() on generator beforehand? Yes you can, read this: <http://cppcms.sourceforge.net/boost_locale/html/tutorial.html#6f4922f45568161a8cdf4ad2299f6d23> You need to use iostream manipulator booster::locale::as::domain("name") to switch domain in the stream. > If this is the > case, is this thread safe, so that I can change the > default_messages_domain even to different values for parallel requests? > It is not safe, actually access of any non-const member function of booster::locale::generator is not thread safe from multiple threads, see <http://cppcms.sourceforge.net/boost_locale/html/classboost_1_1locale_1_1generator.html> However, you can always create a separate instance of booster::locale::generator, create locale and install it using http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1context.html#9d6ee6ce1d9007ba1c0d7222fa022fd8 Please note, loading dictionaries and creating locale objects may be quite heavy operation, so use it very carefully. You may cache such custom locales withing your cppcms::application derived class that is cached in pool and not created frequently. Artyom |
From: Artyom <art...@ya...> - 2010-08-30 04:15:25
|
> May I use a construct like > <% foreach widget in form %> here? Yes, you can. See: http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1form.html it has forward iterator in it and thus you can iterate over the form. There is an example from src/hello_world_view1.tmpl <% foreach w as cppcms::form::iterator in form %> <% separator %><br/><% item %> <% if w.has_message() %><% w.message() %>:<% end %> <% form input w %> <% if not w.valid() %>:<% w.error_message() %><% end %> <% end %> <% end %> Artyom |
From: Julian P. <ju...@wh...> - 2010-08-30 01:58:30
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hallo, I've a question concerning the custom form rendering. My situation is, that I have a form which gets filled with widgets at runtime (by a JSON configuration), so that I don't know which widgets it will contain when it has to be rendered. So how can I iterate over the form's widgets in my template to do custom rendering? <% form input my_input %> won't work here as I don't know how many widgets there are. May I use a construct like <% foreach widget in form %> here? Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMexA6AAoJENidYKvYQHlQTbcP/2GHE41322Iow1xxjTk7MEbN oeproZQGjEwptgDQVkbTRKjUHiwrJuMjC45RFdeZP2h6G1FtXEmXs2mF4WJcliSg bsuKoQ/q4dRv758+BOLB34C1Hd9sfmq7PomjQYh45MFx6eUQqKG0CuVt6bjTGkaK Z0/RN7aCYfqwtOO5vJo8jjF+INqsldwkmE+EUHGcGdicfT+ZkgxP5JelgCSfPEG0 P7dMWejLxlGhWoW+9hvxzMVv3ZTD0xdiV3Q9LGJHp/BIBTAopwEf8rX7eQEY8mPv tT0Op380sx2PAlFij7OBrp8cUKFLsezhBNhfkX+leEcPY7AhkW9THawFFwwVKbMb 4Ka0wBr/G/gh05/7c0B8e+1vFnoKVUFypZ/qASV8fUqF6IrJlcWHHRzzrMWBhz0m i8GGg7FJ1Ri+FsYKuZmXmyZgJVVtWS+RYQDdvFzxGo95lZuRSEueWZ3BedOb8SaM DglBLw9xhpKuLIBLXcNQZmg1eBQRkObFaZNBko4tadCe/xI70/Fl9qiU0Nk2KSHi OM6zpTogcnHALN2WEH5+AKf8AqdS4t/GKaCE8Y5f+b6hVw+UENDcyoCsWCnXxLLc PTpFEO3yahSHTxegrA8T3xCgRuVx46eZ1y6V0CANMgyt7/qcNusrDQsQhnxFLrfH bg06GLl7rP9U9j+OLHZt =YAH1 -----END PGP SIGNATURE----- |
From: Julian P. <ju...@wh...> - 2010-08-29 23:58:58
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 30.08.2010 01:43, schrieb Julian Pietron: > Hi, > > how can I register textdomains to use with booster::locale::format() > (and translate()) at runtime? > I found the config option localization.messages.domains for the text > domains to be pre-loaded, but how can I register a domain > programmatically? Do I have to use direct calls to gettext (as I > understood, booster features its own libintl implementation, so that > won't work I think) or is there something in booster::locale to call to > register a domain? > > Thanks, > Julian Ok, in meantime I found the locale::generator::add_messages_domain() and set_default_messages_domain(), but that raised a few more questions: - - Is it possible to remove a message domain again? (But only one and not all message domains, so the clear_domains() method is not what I want) - - Can I select the domain to use for basic_format::format or locale::translate at method call somehow or do I have to call set_default_messages_domain() on generator beforehand? If this is the case, is this thread safe, so that I can change the default_messages_domain even to different values for parallel requests? Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMevQ5AAoJENidYKvYQHlQycIP/34FR5xB41ETBmt/3sCC7xrb qarFzFqsFNyqXHDnAjfaLU5RAp6tgdLvOwDo1F7Zbw/AU33Ysx+U+QOzjIDHNJ/D ktjYFNNJMA6e/MCdzKXt6uwOeNs0fsSUFhXhvXxmQQn/ABfK3FSMjfiqiEJM00vF BFGSaOtAenI7lsSfwUZBnQrQio8E++5MEpayPjY/v3BH0uEhv1IuwijEkqevsSng 754Z0MNq3UjdxORc2XRoAKFFOk2vvkwQTy5wP8d/yW8HX2ff1mPpRfHlJU+w24lh U+Co50yus2inoddWjCCVLL1p1QTOfYM0qiJ2ltRwu+bTS9LJvuBJSJUyf6h40kA8 tmdyb/esa2SAlTwlkG/dyNTBu/I1w2hI5w4javy71jcsyJOsFGXNtrwdDCBKCcnG MDxyazul8lzbMQMrNZWFUUCPP36puwW2EXPKBSs+3wxafXIoZYOdJZ8Q9s5yGdgF YZm9hd5ufmPTTEOGADHdyviVXT6NTyyaI6YhY29uqVy0CPrnTLBH0+HYq4UR+Cp/ 1drt+EdlFcjRqt7H2lG2Q5PV1FWs3E/EMfYswvECAzlCgz81e+dq1urh2L+rnFv7 62lygjWbH8JwIIEX2STrzRerxTw4SDAgc9927+gq8ZzM45u7y9745r9b2Ajb2nUt c5rQPPoZARx+Gs1aztsN =XCUX -----END PGP SIGNATURE----- |
From: Julian P. <ju...@wh...> - 2010-08-29 23:49:31
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, how can I register textdomains to use with booster::locale::format() (and translate()) at runtime? I found the config option localization.messages.domains for the text domains to be pre-loaded, but how can I register a domain programmatically? Do I have to use direct calls to gettext (as I understood, booster features its own libintl implementation, so that won't work I think) or is there something in booster::locale to call to register a domain? Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMevCYAAoJENidYKvYQHlQiYwP/29ByyJ/H9Uipn5Pt+1/TF3p 1mmmeFnDW8pH8mvDsDgMUJKWpv1svSaZeOLmMhzKNO7LyFPGQMeehOjOK8VkhqsJ lMS/WFZNdvgfJidIFwgKsO94OhLkWw8uvXiwNQbM0od07QyXvL6I679B7z/cnL5x sbgTDxYi7HdqQT2uZ/zibcKNMolkHgiaLIMOpWmzcdav9M6g5YrdNZDm6Dwo18Ac 2nJ2VIEzWgDGIxdQsKyA/97CG26wu5CQgph5zTYlS/t7lpTAp3McTlTTp66NvZf+ SuaGvuKtv6c4NlIT0q+Q48QyAcUQ8gpazysxw5AuzwiR2MN4DPHVr7z1knyTgoBT cmqzjJfjnsa9bH9vGjTh2Ik1RNAoHkQJbOH3SA8cyOxzlwwa8rqSOz4Ee2Wr/mw4 M63cA4ICBztaEURmLbI1/tf/N8w7HutSSzXZOPrVURu5zSvX230YTZ0XI/6+e0F3 7OqHU6nvyZO9ScS65PyK+V7qz6/hobFzXMbVsNisD+uxUCqgcBTIcv3tFAgA1OSW Gn13D1MD+BdWj15saiUpxc+0ry9OEDwZ/i5RbbiYUI3tOv2uG1aNXbDQm2vsnpSA jWBwOJ0FgXGDBJ7xjb+WBkcPbPk1/Us0cpEoVZQ8abOXS0R//dQ9yBoKnUirjSgS zyxf59cHxya+fWWJmeNZ =CLZw -----END PGP SIGNATURE----- |
From: Aris S. <ari...@gm...> - 2010-08-29 20:10:08
|
> Not, there is not import libraries crap so you link against shared > objects directly. But the code, as you mentioned should be compiled > with -fPIC - make it position independent - suitable for shared objects, > static libraries are usually compiled without this option > as expected to be used in static libraries. I have try to pass --with-pic option into "./configure" command and "--with-pic" option wasn't recognized. Then I execute "./configure --help" command to show all acceptable option with "./configure" command, and there is no "--with-pic" option, as explained in some article which show how to use PIC in compilation. How I can compile with -fPIC command? Is it same if I use "--with-pic" option? I use "--with-pic" command because I don't know yet about passing "-fPIC" option. I don't know in which command I must pass it into; in "./configure" or "gcc/g++"? Thanks -Aris |
From: Artyom <art...@ya...> - 2010-08-29 19:04:35
|
Few points for Linux newcomer: 1. Stop working as root! It is very bad habit! 2. Install icu using apt-get install libicu-dev and stop compiling it on your own. 3. Remove all files from build directory and run cmake .. and then make again. > Before I install my own ICU, there were ICU library in my "/usr/lib64" > folder, but when I run "make" in my "cppcms/buil" folder, there is an > error explain that some dynamic library need libicuuc.a (a static > library). I have remove all libicu*.a and libicu*.so which I just > install in case to repeat that error. They are: If you really what to build ICU on your own, build the default version without any flags, it would build shared version. > > Because of errors above, then I build my own ICU to get static ICU library. > > I'm new in linux programming and manual compiling. It is not normal > when a dynamically library links against static archives, isn't it? Not, there is not import libraries crap so you link against shared objects directly. But the code, as you mentioned should be compiled with -fPIC - make it position independent - suitable for shared objects, static libraries are usually compiled without this option as expected to be used in static libraries. Artyom P.S.: There should be no problems on 64 bit platform as I develop it mostly on 64bit one :-) |
From: Aris S. <ari...@gm...> - 2010-08-29 12:49:10
|
Before I install my own ICU, there were ICU library in my "/usr/lib64" folder, but when I run "make" in my "cppcms/buil" folder, there is an error explain that some dynamic library need libicuuc.a (a static library). I have remove all libicu*.a and libicu*.so which I just install in case to repeat that error. They are: root@aris-laptop:/opt/cppcms/build# cmake .. -- Looking for ICU libraries -- ICU Found, building booster locale -- Configuring done -- Generating done -- Build files have been written to: /opt/cppcms/build root@aris-laptop:/opt/cppcms/build# make make[2]: *** No rule to make target `/usr/lib/libicuuc.a', needed by `booster/libbooster.so.0.0.0'. Stop. make[1]: *** [booster/CMakeFiles/booster.dir/all] Error 2 make: *** [all] Error 2 Because of errors above, then I build my own ICU to get static ICU library. I'm new in linux programming and manual compiling. It is not normal when a dynamically library links against static archives, isn't it? What about -fPIC errors? I have ubuntu-amd 64-bit environment. In this link: http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3#doc_chap7 , descibed about -fPIC errors and explained that on certain architectures (AMD64 amongst them), shared libraries must be "PIC-enabled". The error produced by "-fPIC errors" is similar to my error. How do you think? Thanks -Aris |
From: Artyom <art...@ya...> - 2010-08-29 10:59:53
|
Hello, 1. I'd recommend using your distribution's ICU rather then custom build one, unless you have very good reasons. CppCMS works and tested with ICU 3.6 and above and should work even with ICU 3.2. 2. From what I can see you are trying to link libicuuc.a into shared object, you can't. You need link shared objects with shared objects. It looks like you had compiled only static version of ICU. Take a look on what you had installed if you find only libicu*.a and not libicu*.so then you need to compile shared version or disable building shared libraries of CppCMS (which is very bad idea). Artyom > >From: Aris Setyawan <ari...@gm...> >To: cpp...@li... >Sent: Sun, August 29, 2010 12:49:12 PM >Subject: [Cppcms-users] ICU lib error in building cppcms 64bit environment > >Hi, > >I have following errors when running "make" command, after successfully running >"cmake .." command. I have 64-bit linux environment and I have build ICU library > >with --enable-static and without --disable-shared option. > > >root@aris-laptop:/opt/cppcms/build# make >Linking CXX shared library libbooster.so >/usr/bin/ld: >/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libicuuc.a(utypes.ao): >relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a >shared object; recompile with -fPIC >/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libicuuc.a: could not read >symbols: Bad value >collect2: ld returned 1 exit status >make[2]: *** [booster/libbooster.so.0.0.0] Error 1 >make[1]: *** [booster/CMakeFiles/booster.dir/all] Error 2 >make: *** [all] Error 2 > >What the meaning of errors above? What should I do? > >Thanks you, >-Aris > |
From: Aris S. <ari...@gm...> - 2010-08-29 09:49:18
|
Hi, I have following errors when running "make" command, after successfully running "cmake .." command. I have 64-bit linux environment and I have build ICU library with --enable-static and without --disable-shared option. root@aris-laptop:/opt/cppcms/build# make Linking CXX shared library libbooster.so /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libicuuc.a( utypes.ao): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libicuuc.a: could not read symbols: Bad value collect2: ld returned 1 exit status make[2]: *** [booster/libbooster.so.0.0.0] Error 1 make[1]: *** [booster/CMakeFiles/booster.dir/all] Error 2 make: *** [all] Error 2 What the meaning of errors above? What should I do? Thanks you, -Aris |
From: Artyom <art...@ya...> - 2010-08-29 03:56:21
|
Actually CppCMS's localization is much more powerful then the localization available in standard C++ library - it uses Boost.Locale - renamed to booster namespace <http://cppcms.sourceforge.net/boost_locale/html/tutorial.html> Now, in order to get information about the current locale you may use following: <http://cppcms.sourceforge.net/boost_locale/html/tutorial.html#4e732ced3463d06de0ca9a15b6153677> Generally: std::locale current_locale = context().locale(); booster::locale::info const &inf = std::use_facet<booster::locale::info>(current_locale); lang = inf.language() // for "my" terr = inf.country(); //for "LC" And so on. Artyom ----- Original Message ---- > From: Julian Pietron <ju...@wh...> > To: cpp...@li... > Sent: Sat, August 28, 2010 10:22:07 PM > Subject: Re: [Cppcms-users] Setting context.locale() > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Am 28.08.2010 21:08, schrieb Julian Pietron: > > Hallo, > > > > context().locale("my_LC.enc"); does not work as I expect it to do. > > I configured the cppcms configuration to contain localization.locales [ > > "en_US.utf8", "de_DE.utf8" ] and am now trying to store the user > > selected language in a cookie and read it back on each request and put > > it to context() by using context().locale(session().get("locale")); > > While the cookie contains the correct locale, a following call to > > context().locale().name(); does not read e.g. "de_DE.utf8", but instead > > reads "*" for default locale. So apparently the requested locale is not > > set on the context(). > > What do I have to do to set the locale for context() successfully? > > > > Thanks, > > Julian > > Used hello_locale example to test a bit around, and I realised, that > locale is set correctly, but the currently set locale is not returned by > context().locale(). Instead, the standard locale is returned ("*") I think. > Or do I have to use another call to get the locale's name like > "de_DE.utf-8"? > > Thanks, > Julian > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.15 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQIcBAEBAgAGBQJMeWHeAAoJENidYKvYQHlQ7hYQAMcThPQR4Ydn4uFPnwmXuxQD > vj2oaNwx3b6WcwSNpy5TJR4V3Baa2/fXd8cjskFUuIbm/mG8dfU4PNwQHFbTSWeu > hQfzXPJp4cvJyJgOcCi2NVlrEZbBdqtxGJEonOf6eKJSkkNq3rwC0BKhyINV3EYF > JQza+kO4KcN/KVM8HhoDlf6ENtgYLaDVIKN5Z8CIghvhcUnRqiBv7GQ0FvHPrcVf > AaVeTIloLo5jTSY4J5oSn6SuNaofuIAH7KCmkUye+/yn8V792oUxq4gwGjNm1WhP > nF9yptfQL4CfX7ix+y5jq5YNUx+kuWiVfS/qAA9CJllL2qtu4eCr3uqepCb+2rgc > dRIPB3p/mmztG+7djPkLHwWIz/dilOevTDkMyjk1HVxC5WNbJRMXwPYtA1F3PJft > f4I0PoqAnL4VTKSH5zHjF+JsFtweZSU2J8pFQOjLJMcRQ6ulHciuLeVs1TW5/zW0 > 7rpUpl/e9HKYsOyDBtXcdxC1SBlIqAD2UeIKFAr2eNSMGta7w3LhtjyEc0pakLUR > Mm0RWKGvCtmDQle+5YECliOEcreWcCMTajwvgeLr4AwUjJegxYiTL+2/6ZMEyiqW > BLGKfxJg4u3Z3AB10h+M8xQ46lQDw25JhVu/Wrwx7jA0ev0wa4jrtAeEKT9dl6iH > dYUvNO8OjTlCMdtkv6P0 > =ywJM > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: augustin <aug...@ov...> - 2010-08-29 02:53:10
|
On Sunday 29 August 2010 12:36:22 am Artyom wrote: > I expect some basic knowledge in configuring specific web server > so I just give a major points, as the rest is up to the user. Yes, I understand. I have added a note in the wiki to that effect. Thanks, Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Julian P. <ju...@wh...> - 2010-08-28 19:22:16
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 28.08.2010 21:08, schrieb Julian Pietron: > Hallo, > > context().locale("my_LC.enc"); does not work as I expect it to do. > I configured the cppcms configuration to contain localization.locales [ > "en_US.utf8", "de_DE.utf8" ] and am now trying to store the user > selected language in a cookie and read it back on each request and put > it to context() by using context().locale(session().get("locale")); > While the cookie contains the correct locale, a following call to > context().locale().name(); does not read e.g. "de_DE.utf8", but instead > reads "*" for default locale. So apparently the requested locale is not > set on the context(). > What do I have to do to set the locale for context() successfully? > > Thanks, > Julian Used hello_locale example to test a bit around, and I realised, that locale is set correctly, but the currently set locale is not returned by context().locale(). Instead, the standard locale is returned ("*") I think. Or do I have to use another call to get the locale's name like "de_DE.utf-8"? Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMeWHeAAoJENidYKvYQHlQ7hYQAMcThPQR4Ydn4uFPnwmXuxQD vj2oaNwx3b6WcwSNpy5TJR4V3Baa2/fXd8cjskFUuIbm/mG8dfU4PNwQHFbTSWeu hQfzXPJp4cvJyJgOcCi2NVlrEZbBdqtxGJEonOf6eKJSkkNq3rwC0BKhyINV3EYF JQza+kO4KcN/KVM8HhoDlf6ENtgYLaDVIKN5Z8CIghvhcUnRqiBv7GQ0FvHPrcVf AaVeTIloLo5jTSY4J5oSn6SuNaofuIAH7KCmkUye+/yn8V792oUxq4gwGjNm1WhP nF9yptfQL4CfX7ix+y5jq5YNUx+kuWiVfS/qAA9CJllL2qtu4eCr3uqepCb+2rgc dRIPB3p/mmztG+7djPkLHwWIz/dilOevTDkMyjk1HVxC5WNbJRMXwPYtA1F3PJft f4I0PoqAnL4VTKSH5zHjF+JsFtweZSU2J8pFQOjLJMcRQ6ulHciuLeVs1TW5/zW0 7rpUpl/e9HKYsOyDBtXcdxC1SBlIqAD2UeIKFAr2eNSMGta7w3LhtjyEc0pakLUR Mm0RWKGvCtmDQle+5YECliOEcreWcCMTajwvgeLr4AwUjJegxYiTL+2/6ZMEyiqW BLGKfxJg4u3Z3AB10h+M8xQ46lQDw25JhVu/Wrwx7jA0ev0wa4jrtAeEKT9dl6iH dYUvNO8OjTlCMdtkv6P0 =ywJM -----END PGP SIGNATURE----- |
From: Artyom <art...@ya...> - 2010-08-28 16:36:29
|
> the "Apache, FastCGI, Independent start" sections, there is some > configuration code that is broken up by "unning ...". > I would have fixed it myself if I knew what your intent was. Thanks, fixed, > > Is all the rest of the configurations in the tutorial supposed to be added in > fastcgi.conf? > Shouldn't (couldn't) some of it be configured in a file within > /etc/apache2/sites-enabled/ ? > It depends on your needs and apache configuration. i.e. how do you add generally or per site. I expect some basic knowledge in configuring specific web server so I just give a major points, as the rest is up to the user. Artyom |
From: augustin <aug...@ov...> - 2010-08-28 14:44:30
|
On Monday 23 August 2010 02:58:48 am Artyom wrote: > I've created a tutorial on how to configure different > web servers to work with CppCMS: > > <http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_tut_web_server_config> > That was useful. In the "Apache, FastCGI" sections, there are two places where a copy/paste operation seems to have failed. In the "Apache, FastCGI, Start by Web Server" and the "Apache, FastCGI, Independent start" sections, there is some configuration code that is broken up by "unning ...". I would have fixed it myself if I knew what your intent was. Obviously, one part must be configured in cppcms's config.js. Is all the rest of the configurations in the tutorial supposed to be added in fastcgi.conf? Shouldn't (couldn't) some of it be configured in a file within /etc/apache2/sites-enabled/ ? The aim is to have several scripts (each with their own config.js) running at different addresses on the localhost. Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: augustin <aug...@ov...> - 2010-08-26 08:35:07
|
On Thursday 26 August 2010 01:33:17 pm Artyom wrote: > See as example code in src/hello_world_view1.tmpl > lines: 13-19, in CppCMS sources. Isn't there something missing in that example? I see a <form ..> but no corresponding </form> Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Artyom <art...@ya...> - 2010-08-26 05:33:26
|
> Hi, > > is it possible to specify the class argument for the <th> and <td> cells > being produced when rendering a form by <% form as_table myform %>? So > that e.g. a line like this is produced: > > <th class="my-label-class">Label</th><td class="my-field-class"><input > type="text"></td> > Generally no, But you always can create custom widgets rendering, using simple for loop. See as example code in src/hello_world_view1.tmpl lines: 13-19, in CppCMS sources. Artyom |
From: augustin <aug...@ov...> - 2010-08-26 03:17:40
|
On Wednesday 25 August 2010 08:39:42 pm Artyom wrote: > Very simply. Yes, after you explain, it always looks simple to me... and I am embarrassed I asked in the first place ;) I come for a mostly procedural type of programming (Drupal) and I still don't always think in terms of classes and sub-classes and method override. My mind often goes on the wrong track. Anyway, for other future newbies like me, I created this simple tutorial: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_tut_404 Did you see my patch on the sourceforge bug tracker ? Shalom, Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Julian P. <ju...@wh...> - 2010-08-26 01:58:54
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, is it possible to specify the class argument for the <th> and <td> cells being produced when rendering a form by <% form as_table myform %>? So that e.g. a line like this is produced: <th class="my-label-class">Label</th><td class="my-field-class"><input type="text"></td> Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMdcpUAAoJENidYKvYQHlQw6kP/AjrU4ntQLYvQxfPSbuCv8Go 5p4K0tXlc6yvGp2kEhDmRa8sTjq4fBtuqiz2UpFkCGFv5enP9CE8y/Rr5bu6oiL9 m4q89j2YEAfjWZIaNxJHGN/jLPnIHNZzNP9FtVoc/5mn9WBlJYs6GDfUnGGSOW2r J0wIwiLXHUnkYWCOwxhJYzOZZyJAqn/BWnNo2CWnEy6fsWS89Ea7qksWK1EYjJr/ T2ps4DTs9GdUDowkRyV/GqEsrqPsl06vQhxeD+A+2MDwPqzMp0F2lL9dr4MYyzbL 3KYovLiN5NE1EsisXfCBNn8tRmQCSOUpQ2IqlfJidSo6qNyCznm55efsTBDVOYei uPEx3fAZTweOYCAMPCt08piHcnXJSNN3h3CRGNbyi/3WUea+o3pKTLNNU8T5Jpul QnYcZ4uGPzvKKy5rKipageOMI+gJjAaUd05+8Fh9UWkb5KY5J+deU66gHj/dvdyb uJYihLfOg6fEpxfrGRrPqgrUT/JZ71YurN3nZvdGmdyYoXW7fnm9lbf7IJEPzEAs DH0MBZa7wiIyXa97zuQcSbUp0lNoyfW5ax/GUhcZ2ok73GvLQni4LV+rsjNVoVZz Rosu0kN+Z5NzyPdmHnzI0d5mo54Ce/FUGI5Vh2WJ8OjM7jm/c8bYnaoeaaL9wu1n 5tLgR9+DBxG08S3gL/IL =0T2b -----END PGP SIGNATURE----- |
From: Artyom <art...@ya...> - 2010-08-25 12:39:50
|
> This is main function of the application that is called when it is matched > according to the regular expression in the applications_pool class. > By default, main calls dispatcher().dispatch(url). And if the last fails, > it creates 404 Error page. Very simply. That is the implementation of cppcms::application::main(std::string) exactly according to this description void application::main(std::string url) { if(!dispatcher().dispatch(url)) { response().make_error_response(http::response::not_found); } } So just reimplement it the way you want. Additionally you can just do following: dispatcher().assign(".*",&myclass::my404,this) And make sure it is the last URL you add to the list. Artyom |
From: augustin <aug...@ov...> - 2010-08-25 12:26:13
|
Hello, How to create a custom 404 page. The doc says: virtual void cppcms::application::main ( std::string url ) [virtual] This is main function of the application that is called when it is matched according to the regular expression in the applications_pool class. By default, main calls dispatcher().dispatch(url). And if the last fails, it creates 404 Error page. This allows developers to create its own hooks for reaction on incoming URL as, initialization and cleanup of general resources, Custom 404 and error handlers etc. Reimplemented in cppcms::rpc::json_rpc_server. I don't understand the above explanation. Following the examples provided in the source, I make use of dispatcher().assign() within my application constructor. Thus myApplication::main() is no longer called at all. I fail to see how to use either myApplication::main() or myApplication::myApplication() or even disptacher().assign() to register a callback for 404 pages (or for any other codes, inc. access denied...). Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Artyom <art...@ya...> - 2010-08-25 12:22:11
|
According to CGI specifications you should use cppcms::http::request::getenv with "HTTP_WHICH_HEADER" as parameter Note, it is up to web server to provide such variable. See <http://tools.ietf.org/html/rfc3875#section-4.1.18> Note: some web servers(like Niginx) require a list of specific headers to be passed explicitly, others may filter them. So basically you need: request().getenv("HTTP_WHICH_HEADER"); Artyom ----- Original Message ---- > From: Julian Pietron <ju...@wh...> > To: cpp...@li... > Sent: Wed, August 25, 2010 2:33:05 PM > Subject: Re: [Cppcms-users] Get HTTP Headers of Request > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Am 25.08.2010 13:05, schrieb augustin: > > On Wednesday 25 August 2010 06:29:35 pm Julian Pietron wrote: > >> Hi, > >> > >> how can I get a certain header sent with the client's request? I was > >> looking for a method like std::string request().header("which-header");, > >> but didn't find a method like this. > >> Could one please point me to the method I can use to get a http header? > >> The problem is, that it's a custom header, so the methods from > >> http::request for standard headers won't suffice. > > > > Hi Julian, > > > > Won't this fit your needs? > > > > void cppcms::http::response::set_header ( std::string const & name, > > std::string const & value ) > > <http://art-blog.no- > > >ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1response.html#37b0c6c284c9d8f319a87c86d182f021> > > > > > > > I am not yet familiar which forms can headers take, but I just came across > > this, so I thought I'd mention it. > > > > > > Augustin. > > > > Hi, > > thanks for your reply, but this is not the method I need: It will set > custom headers on the response, but I need to gain a custom reader from > the request (i.e. from the HTTP request the client sent). Setting the > custom header (which is done on an Ajax request, btw) is not the problem. > > Julian > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.15 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQIcBAEBAgAGBQJMdP9xAAoJENidYKvYQHlQ78UP/RDJfXRyOPOvyt1J5eJJaBk9 > lbAJvtlFMKcZnRKtSukZ2zJfr6uFoRGAlrLrP3aOx579OvwdrkQsPzaZG1DrwTl6 > FwE0iIH25TRbhU2rxXfIRl5E/K6lo8OYE9T9NI9/7aQwSf991imKIx4P6QqmVaGF > YePh+LGFuHM25YApN7iKiBnz2k8yAe9if+ZWGwh/XmCYX5lzGyitJtU2oY6zDTFQ > 6jM7tqj/7C2zbWVWm4r8x0CE1dz7o77C6Hz2vCSXOVo/p15yqJCIhZeYdFev3DsI > KbLxpB1ReWU7LX36+fVmBS9+qJVD+46W4i7k3hkhw3b0yTB8JKsyqkVmdvQpoKj/ > lsPP9AwuIelX6eQoxW9s0ZYr7y9d0C/iDzSMvSIY6PzWFKcRNfdjmDlbyltCggoP > /7RJ7wYIfl3JaUwghOFfXyEGa4IpKYUHsIkc0kBL+YxeH+KLteIOqYOVXWihoJrB > y7CDoxlA9jHYV8jdK9MRaHQeBA5/xELexCcfSpov9eD1DcbzLD9oQ4DIRN2y8KN2 > NET1FWWIk8/fyr4tq/ovhXXWn1P2LhwhBBr5BgnkFXfRtFz/vff1u0jBB2lkCPfp > V7b2H4XndHZSaZeTDPbpiXmygl8G2oUHeIqfYRD4wfVxa6BDhtswXfv12AoXDdZP > 9Z3TfpWyJ+cOGnc5bgKy > =oQnx > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Julian P. <ju...@wh...> - 2010-08-25 11:33:17
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 25.08.2010 13:05, schrieb augustin: > On Wednesday 25 August 2010 06:29:35 pm Julian Pietron wrote: >> Hi, >> >> how can I get a certain header sent with the client's request? I was >> looking for a method like std::string request().header("which-header");, >> but didn't find a method like this. >> Could one please point me to the method I can use to get a http header? >> The problem is, that it's a custom header, so the methods from >> http::request for standard headers won't suffice. > > Hi Julian, > > Won't this fit your needs? > > void cppcms::http::response::set_header ( std::string const & name, > std::string const & value ) > <http://art-blog.no- > ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1response.html#37b0c6c284c9d8f319a87c86d182f021> > > > I am not yet familiar which forms can headers take, but I just came across > this, so I thought I'd mention it. > > > Augustin. > Hi, thanks for your reply, but this is not the method I need: It will set custom headers on the response, but I need to gain a custom reader from the request (i.e. from the HTTP request the client sent). Setting the custom header (which is done on an Ajax request, btw) is not the problem. Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMdP9xAAoJENidYKvYQHlQ78UP/RDJfXRyOPOvyt1J5eJJaBk9 lbAJvtlFMKcZnRKtSukZ2zJfr6uFoRGAlrLrP3aOx579OvwdrkQsPzaZG1DrwTl6 FwE0iIH25TRbhU2rxXfIRl5E/K6lo8OYE9T9NI9/7aQwSf991imKIx4P6QqmVaGF YePh+LGFuHM25YApN7iKiBnz2k8yAe9if+ZWGwh/XmCYX5lzGyitJtU2oY6zDTFQ 6jM7tqj/7C2zbWVWm4r8x0CE1dz7o77C6Hz2vCSXOVo/p15yqJCIhZeYdFev3DsI KbLxpB1ReWU7LX36+fVmBS9+qJVD+46W4i7k3hkhw3b0yTB8JKsyqkVmdvQpoKj/ lsPP9AwuIelX6eQoxW9s0ZYr7y9d0C/iDzSMvSIY6PzWFKcRNfdjmDlbyltCggoP /7RJ7wYIfl3JaUwghOFfXyEGa4IpKYUHsIkc0kBL+YxeH+KLteIOqYOVXWihoJrB y7CDoxlA9jHYV8jdK9MRaHQeBA5/xELexCcfSpov9eD1DcbzLD9oQ4DIRN2y8KN2 NET1FWWIk8/fyr4tq/ovhXXWn1P2LhwhBBr5BgnkFXfRtFz/vff1u0jBB2lkCPfp V7b2H4XndHZSaZeTDPbpiXmygl8G2oUHeIqfYRD4wfVxa6BDhtswXfv12AoXDdZP 9Z3TfpWyJ+cOGnc5bgKy =oQnx -----END PGP SIGNATURE----- |