cppcms-users Mailing List for CppCMS C++ Web Framework (Page 53)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
| 2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
| 2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
| 2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
| 2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
| 2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
| 2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
| 2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
| 2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
| 2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: Karsten A. <kar...@go...> - 2013-06-20 08:49:27
|
Hi, I run the Hello World application of the current cppcms with valgrind. After stopping the application with sending SIGTERM valgrind reports that 18k have not been correctly destroyed. Most of these blocks are related to ICU. Is there anything I can do to cleanup memory correctly? Best regards, Karsten |
|
From: Shutov S. <ser...@gm...> - 2013-06-20 06:20:08
|
I think you need remove script and leave only script_names.
"http" : {
"script_names" : [ "/hello", "/rpc" ]
},
|
|
From: Marcel H. <ke...@co...> - 2013-06-19 16:45:38
|
On 19.06.2013 18:22, Ronnie Chowdhury wrote: > How do I get cppcms to return json objects with the application/json content > type rather than text/html http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1response.html#a8fb156db7d2b0350fb6fee9ce9d300be > Using the 'div' example, response is received fine and if I look at the net > traffic (eg using fiddler), I note it has the correct structure but wrong > content type. Hmm, afaik a json_rpc_server should always set the right content-type, but you could use the method above. > This means jquery's ajax methods reject it with 'Invalid Content type'. Do I > need to have a mime type configured somewhere? If you want to return a json value you could use cppcms::json::value for this http://cppcms.com/cppcms_ref/latest/namespacecppcms_1_1json.html > Thanks > > ROnnie > Regards |
|
From: Ronnie C. <ron...@db...> - 2013-06-19 16:22:46
|
How do I get cppcms to return json objects with the application/json content type rather than text/html Using the 'div' example, response is received fine and if I look at the net traffic (eg using fiddler), I note it has the correct structure but wrong content type. This means jquery's ajax methods reject it with 'Invalid Content type'. Do I need to have a mime type configured somewhere? Thanks ROnnie |
|
From: Ronnie C. <ron...@db...> - 2013-06-19 15:15:28
|
Don't worry, after a bit more research, found application hierarchy page and worked through that. Maybe more tutorials on setting up certain basic apps would be good - maybe I can contribute? Brilliant software btw, it's reduced my previously 60Mb .NET app servers to just 3Mb |
|
From: Ronnie C. <ron...@db...> - 2013-06-19 14:40:14
|
Hi
I'm trying to get a test hello world type app working but I don't seem to be
able to route RPC requests to the appropriate handler.
The regular url routing works fine. I think it's probably in the way I
construct my request in javascript but I'm not sure. Here's the simplest
code demonstrating what I'm trying to achieve.
class hello : public cppcms::application {
public:
hello(cppcms::service& svc) : cppcms::application(svc) {
parse_options("VegaWeb.cfg");
dispatcher().assign("",&hello::welcome,this);
mapper().assign("");
mapper().root("/hello");
}
void welcome();
private:
};
void hello::welcome() {
VegaData::message m;
m.text = "Hello";
render("message",m);
}
class rpc : public cppcms::rpc::json_rpc_server {
public:
rpc(cppcms::service& svc) : cppcms::rpc::json_rpc_server(svc) {
bind("div",cppcms::rpc::json_method(&rpc::div,this),method_role);
};
void div(int x, int y) {
if(y == 0)
return_error("Division by 0");
else
return_result(x/y);
}
};
int main(int argc,char** argv) {
try {
cppcms::service srv(argc,argv);
srv.applications_pool().mount(cppcms::applications_factory<hello>());
srv.applications_pool().mount(cppcms::applications_factory<rpc>());
srv.run();
} catch(std::exception const &e){
std::cerr << e.what() << std::endl;
}
return 0;
}
// script.js
$(document).ready(function () {
$("#button").click(function() {
var xhr = new XMLHttpRequest();
xhr.open("post", '/rpc');
// Required by JSON-RPC over HTTP
xhr.setRequestHeader("Content-Type","application/json");
var x=2; // hardcode
var y=3;
var request = '{"method":"div","params":[' + x + ',' + y
+'],"id":1}';
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
var res;
if(xhr.status === 200) {
// Don't call eval in real code use some
parser
var result = eval('(' + xhr.responseText +
')');
if(result.error==null) {
res = result.result;
}
else {
res = result.error;
}
}
else {
res = 'Invalid Status ' + xhr.status;
}
document.getElementById('result').innerHTML = res;
}
}
xhr.send(request);
return false;
});
});
config.js
{
"service" : {
"api" : "http",
"port" : 8081
},
"http" : {
"script_names" : [ "/hello" ] ,
"script" : "/rpc",
},
"file_server" : {
"enable" : true,
"mime_types" : "mime.types"
}
}
|
|
From: Lee E. <le...@el...> - 2013-06-19 04:10:00
|
you have a problem with your HTML since your option is like this: <option value="2">two</option> the text "two" is used as label - and the browser will NOT send it back to the server, insead it will send the value "2" if you want the value sent from the server to be something else - place whatever you want on the value attribute of the option On Tue, Jun 11, 2013 at 7:52 PM, ccppprogrammer <ccp...@gm...>wrote: > ... small typo in sample html element: > <select name="test"> > <option value="1">one</option> > <option value="2" selected>two</option> > </select> > > So I need method to get value "two" from test widget. > > > On Tue, Jun 11, 2013 at 8:28 PM, ccppprogrammer <ccp...@gm...>wrote: > >> Dear All! >> >> I didn't find method to get selected value of cppcms::widgets::select. >> I need method to get value "two" from test widget. >> Unfortunately selected() method returns integer index of the list not >> value. >> >> http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1widgets_1_1select__base.html >> >> <select name="test"> >> <option value="one">1</option> >> <option value="two" selected>2</option> >> </select> >> >> Thanks in advance! >> >> > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: <ele...@ex...> - 2013-06-17 09:47:43
|
Simple test:
#include <booster/locale.h>
#include <iostream>
#include <sstream>
using namespace booster::locale;
using namespace std;
int main()
{
generator gen;
std::locale::global(gen(""));
std::cout.imbue(std::locale());
string str1="2010-08-10";
string str2="10-08-2010";
istringstream is(str1);
date_time dt;
is >> as::ftime("%Y-%m-%d") >> dt;
cout << as::date << dt << endl;
istringstream is2(str2);
date_time dt2;
is2 >> as::ftime("%d-%m-%Y") >> dt2;
cout << as::date << dt2 << endl;
}
Prints:
[petr@petr-archlinux ~]$ ./a.out
10/08/2010
20/12/2009
|
|
From: Petr J. <ele...@ex...> - 2013-06-17 08:01:13
|
Hi,
I'm not sure what the problem is here.
example:
std::istringstream is("2010-10-01");
date_time dt;
is >> as::ftime("%Y-%m-%d") >> dt;
In this case dt is correctly set to the right date.
But if:
std::istringstream is("10-01-2010");
date_time dt;
is >> as::ftime("%d-%m-%Y") >> dt;
In this case dt is set to the wrong date, usually a year earlier.
cppcms was compiled with ICU. the stringstreams failbit is false in both
cases.
Any ideas?
--
Please use PGP to encrypt your email to ensure our privacy is respected.
|
|
From: Marcel H. <ke...@co...> - 2013-06-15 19:47:15
|
On 14.06.2013 17:50, Marcel Hellwig wrote:
> Hi *,
>
> I use basic HTML pages for displaying and json_rpc_server as backend for
> logic etc.
>
> What is a good/the best way to do this?
> I was trying to do that with the session interface. But how safe is
> that? How is a user indentified? Could I just return the session ID? If
> yes, how? I tried this:
After some time thinking about this my conclusion is that is not good to
return the session_cookie itself, instead I let handle cppcms the
session managment. But there is a little error in the code below, which
I was not aware of.
>> void WebAPI::login(username, password) {
>> //validation
before setting any thing to the session you have to load it via
>> session().load(); //important!!!
>> session().set("username", username);
>> session().save();
>>
>> return_result(session().get_session_cookie());
>> }
> But it does not work :/
Now it works.
> I hope someone has approached this situation.
>
> Regards
> Marcel
The only weird thing is that the following worked, but it shouldn't
> if(!session().load() || !session().is_set("username"))
> {
> return_error("Invalid Session");
> return;
> }
remember that I forgot to load the session in "login"? So at least
session().is_set should say no and give the error. Why does it no do so?
Regards
|
|
From: Marcel H. <ke...@co...> - 2013-06-14 15:51:08
|
Hi *,
I use basic HTML pages for displaying and json_rpc_server as backend for
logic etc.
What is a good/the best way to do this?
I was trying to do that with the session interface. But how safe is
that? How is a user indentified? Could I just return the session ID? If
yes, how? I tried this:
> void WebAPI::login(username, password) {
> //validation
> session().set("username", username);
> session().save();
>
> return_result(session().get_session_cookie());
> }
But it does not work :/
I hope someone has approached this situation.
Regards
Marcel
|
|
From: 陈抒 <csf...@gm...> - 2013-06-13 03:14:06
|
Thanks. It's one of switch statments, I learned it but never used this way - 'without break'. http://msdn.microsoft.com/en-us/library/k0t5wee3.aspx Dean Chen Best regards http://blog.csdn.net/sheismylife On Thu, Jun 13, 2013 at 3:12 AM, Marcel Hellwig <ke...@co...> wrote: > On 12.06.2013 15:55, 陈抒 wrote: > > Another question, when looking into the codes of utf.hpp, I find the > following codes for case 3, 2, 1 are identical, why? > > > 00213 code_point <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a068111a6b9d6d465a63893ed5c05e2f8> c = lead & ((1<<(6-trail_size))-1);00214 00215 // Read the rest00216 unsigned char tmp;00217 switch(trail_size) {00218 case 3:00219 if(BOOST_LOCALE_UNLIKELY(p==e))00220 return incomplete <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38>;00221 tmp = *p++;00222 if (!is_trail <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#ae2cb78fcb8a58bed3e0ce1d6528a719a>(tmp))00223 return illegal <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb>;00224 c = (c << 6) | ( tmp & 0x3F);00225 case 2:00226 if(BOOST_LOCALE_UNLIKELY(p==e))00227 return incomplete <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38>;00228 tmp = *p++;00229 if (!is_trail <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#ae2cb78fcb8a58bed3e0ce1d6528a719a>(tmp))00230 return illegal <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb>;00231 c = (c << 6) | ( tmp & 0x3F);00232 case 1:00233 if(BOOST_LOCALE_UNLIKELY(p==e))00234 return incomplete <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38>;00235 tmp = *p++;00236 if (!is_trail <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#ae2cb78fcb8a58bed3e0ce1d6528a719a>(tmp))00237 return illegal <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb>;00238 c = (c << 6) | ( tmp & 0x3F);00239 } > > > Please note, that there is no break after a case, but rather a > fallthrough. It's not optimal to produce the code three times, but its > valid. Maybe a for/while loop is better here. > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: 陈抒 <csf...@gm...> - 2013-06-12 13:56:18
|
Thank you, Artyom. In my application, we just need to handle the characters in BMP. So I think casting it to uint16_t is okay. And what I want to get is just code point, not another encoding format, i.e. UTF-16 or others. After read the UTF-16, I know the value of it is equal to code point, but its width is 1 or 2 bytes. I will try your suggested way later. Another question, when looking into the codes of utf.hpp, I find the following codes for case 3, 2, 1 are identical, why? 00213 code_point <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a068111a6b9d6d465a63893ed5c05e2f8> c = lead & ((1<<(6-trail_size))-1);00214 00215 // Read the rest00216 unsigned char tmp;00217 switch(trail_size) {00218 case 3:00219 if(BOOST_LOCALE_UNLIKELY(p==e))00220 return incomplete <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38>;00221 tmp = *p++;00222 if (!is_trail <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#ae2cb78fcb8a58bed3e0ce1d6528a719a>(tmp))00223 return illegal <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb>;00224 c = (c << 6) | ( tmp & 0x3F);00225 case 2:00226 if(BOOST_LOCALE_UNLIKELY(p==e))00227 return incomplete <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38>;00228 tmp = *p++;00229 if (!is_trail <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#ae2cb78fcb8a58bed3e0ce1d6528a719a>(tmp))00230 return illegal <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb>;00231 c = (c << 6) | ( tmp & 0x3F);00232 case 1:00233 if(BOOST_LOCALE_UNLIKELY(p==e))00234 return incomplete <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38>;00235 tmp = *p++;00236 if (!is_trail <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#ae2cb78fcb8a58bed3e0ce1d6528a719a>(tmp))00237 return illegal <http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb>;00238 c = (c << 6) | ( tmp & 0x3F);00239 } Dean Chen Best regards http://blog.csdn.net/sheismylife On Sun, Jun 9, 2013 at 2:29 PM, Artyom Beilis <art...@ya...> wrote: > There is a set of functions: booster::locale::conv::utf_to_utf > > > http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/group__codepage.html#gaf0ad39959911b000706e0538ec059d44 > > All you need it to do is to convert UTF-32 to UTF-16 or UTF-8 to UTF-16. > > Also cast to uint16_t is INCORRECT is it would fail on characters outside > of BMP - i.e. characters that are encoded > as two units sequence in UTF-16 (so called surrogate pairs) > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* 陈抒 <csf...@gm...> > *To:* Artyom Beilis <art...@ya...>; " > cpp...@li..." <cpp...@li...> > *Sent:* Saturday, June 8, 2013 6:52 PM > *Subject:* Re: [Cppcms-users] Questions about decode UTF-8 to Unicode > code point > > Hello Artyom: > I know the code_point type is uint32_t. In my app, I need to convert it > into uint16_t. Which one of the following ways is portable and don't need > to worry about the endianness(big-endian or little-endian), also can be > used in both 32bit and 64bit platform. I am using GCC4.x above. > Assume x is a code_point value > 1. static_cast<uint16_t>(x) > 2. x & 0xffff > > Correct me if I am wrong, thanks. > > > Dean Chen > Best regards > http://blog.csdn.net/sheismylife > > > On Wed, Feb 6, 2013 at 12:20 AM, Artyom Beilis <art...@ya...>wrote: > > First of all there is utf_to_utf functions and if sizeof(wchar_t) == 4 > (which is on Linux/Unix) > than all you need is to use them. > > About the error > > code_point c = utf_traits<char, sizeof(char)>::decode(str.begin(), > str.end()); > > the first parameter is reference that is moved forward and std.begin() > can't be changed > so what you need to do is: > > std::string::const_iterator pos = std.begin(),end =str.end(); > code_point c = utf_traits<char, sizeof(char)>::decode(pos,end ); > > See: > http://www.boost.org/doc/libs/1_51_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#a65f0b0e1075dd000d2c2c15af30be372 > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* 陈抒 <csf...@gm...> > *To:* cpp...@li... > *Sent:* Tuesday, February 5, 2013 5:32 PM > *Subject:* [Cppcms-users] Questions about decode UTF-8 to Unicode code > point > > Hello Artyom: > I am using the boost.locale library contributed by you to decode UTF-8. > The following codes works fine: > char const * p = "一"; // one Chinese character here > code_point c = utf_traits<char, sizeof(char)>::decode(p, p + 3); > cout << "code point: 0x" << std::hex << c << " binary format:B" << > PrintIntAsBinaryString(c) << endl; > > My Print.. function prints it as what I expect. > code point: 0x4e00 binary format:B00000000000000000100111000000000 > > But don't know how to apply the decode function to std::string. when using > iterator of string object, got some compilation error: > > string str = "一"; > code_point c = utf_traits<char, sizeof(char)>::decode(str.begin(), > str.end()); > > /home/chenshu/work/asio_echo/codes/main/test/main.cc:18:65: error: no > matching function for call to > ‘boost::locale::utf::utf_traits<char>::decode(std::basic_string<char>::iterator, > std::basic_string<char>::iterator)’ > /home/chenshu/work/asio_echo/codes/main/test/main.cc:18:65: note: > candidate is: > /usr/include/boost/locale/utf.hpp:193:27: note: static > boost::locale::utf::code_point boost::locale::utf::utf_traits<CharType, > 1>::decode(Iterator&, Iterator) [with Iterator = > __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, CharType = > char, boost::locale::utf::code_point = unsigned int] > /usr/include/boost/locale/utf.hpp:193:27: note: no known conversion for > argument 1 from ‘std::basic_string<char>::iterator {aka > __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}’ to > ‘__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >&’ > make[2]: *** [test_bin/CMakeFiles/util_test.dir/main.cc.o] Error 1 > make[1]: *** [test_bin/CMakeFiles/util_test.dir/all] Error 2 > make: *** [all] Error 2 > > The above is my first question, that's about converting one single Unicode > character. > Another question is how to decode all Unicode code points from string > object? > > > 陈抒 > Best regards > http://blog.csdn.net/sheismylife > > > ------------------------------------------------------------------------------ > Free Next-Gen Firewall Hardware Offer > Buy your Sophos next-gen firewall before the end March 2013 > and get the hardware for free! Learn more. > http://p.sf.net/sfu/sophos-d2d-feb > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Free Next-Gen Firewall Hardware Offer > Buy your Sophos next-gen firewall before the end March 2013 > and get the hardware for free! Learn more. > http://p.sf.net/sfu/sophos-d2d-feb > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > > > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: ccppprogrammer <ccp...@gm...> - 2013-06-11 16:52:07
|
... small typo in sample html element: <select name="test"> <option value="1">one</option> <option value="2" selected>two</option> </select> So I need method to get value "two" from test widget. On Tue, Jun 11, 2013 at 8:28 PM, ccppprogrammer <ccp...@gm...>wrote: > Dear All! > > I didn't find method to get selected value of cppcms::widgets::select. > I need method to get value "two" from test widget. > Unfortunately selected() method returns integer index of the list not > value. > > http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1widgets_1_1select__base.html > > <select name="test"> > <option value="one">1</option> > <option value="two" selected>2</option> > </select> > > Thanks in advance! > > |
|
From: ccppprogrammer <ccp...@gm...> - 2013-06-11 16:28:46
|
Dear All! I didn't find method to get selected value of cppcms::widgets::select. I need method to get value "two" from test widget. Unfortunately selected() method returns integer index of the list not value. http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1widgets_1_1select__base.html <select name="test"> <option value="one">1</option> <option value="two" selected>2</option> </select> Thanks in advance! |
|
From: Artyom B. <art...@ya...> - 2013-06-09 06:30:02
|
There is a set of functions: booster::locale::conv::utf_to_utf http://www.boost.org/doc/libs/1_53_0/libs/locale/doc/html/group__codepage.html#gaf0ad39959911b000706e0538ec059d44 All you need it to do is to convert UTF-32 to UTF-16 or UTF-8 to UTF-16. Also cast to uint16_t is INCORRECT is it would fail on characters outside of BMP - i.e. characters that are encoded as two units sequence in UTF-16 (so called surrogate pairs) Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: 陈抒 <csf...@gm...> >To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> >Sent: Saturday, June 8, 2013 6:52 PM >Subject: Re: [Cppcms-users] Questions about decode UTF-8 to Unicode code point > > > >Hello Artyom: > I know the code_point type is uint32_t. In my app, I need to convert it into uint16_t. Which one of the following ways is portable and don't need to worry about the endianness(big-endian or little-endian), also can be used in both 32bit and 64bit platform. I am using GCC4.x above. >Assume x is a code_point value >1. static_cast<uint16_t>(x) >2. x & 0xffff > > >Correct me if I am wrong, thanks. > > > > >Dean Chen >Best regards >http://blog.csdn.net/sheismylife > > >On Wed, Feb 6, 2013 at 12:20 AM, Artyom Beilis <art...@ya...> wrote: > >First of all there is utf_to_utf functions and if sizeof(wchar_t) == 4 (which is on Linux/Unix) >>than all you need is to use them. >> >> >>About the error >> >> >>code_point c = utf_traits<char, sizeof(char)>::decode(str.begin(), str.end()); >> >> >> >>the first parameter is reference that is moved forward and std.begin() can't be changed >>so what you need to do is: >> >> >> >>std::string::const_iterator pos = std.begin(),end =str.end(); >>code_point c = utf_traits<char, sizeof(char)>::decode(pos,end ); >> >> >> >>See: http://www.boost.org/doc/libs/1_51_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#a65f0b0e1075dd000d2c2c15af30be372 >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: 陈抒 <csf...@gm...> >>>To: cpp...@li... >>>Sent: Tuesday, February 5, 2013 5:32 PM >>>Subject: [Cppcms-users] Questions about decode UTF-8 to Unicode code point >>> >>> >>> >>>Hello Artyom: >>> I am using the boost.locale library contributed by you to decode UTF-8. >>>The following codes works fine: >>>char const * p = "一"; // one Chinese character here >>> >>>code_point c = utf_traits<char, sizeof(char)>::decode(p, p + 3); >>>cout << "code point: 0x" << std::hex << c << " binary format:B" << PrintIntAsBinaryString(c) << endl; >>> >>> >>>My Print.. function prints it as what I expect. >>>code point: 0x4e00 binary format:B00000000000000000100111000000000 >>> >>> >>> >>>But don't know how to apply the decode function to std::string. when using iterator of string object, got some compilation error: >>> >>> >>>string str = "一"; >>> >>>code_point c = utf_traits<char, sizeof(char)>::decode(str.begin(), str.end()); >>> >>> >>> >>>/home/chenshu/work/asio_echo/codes/main/test/main.cc:18:65: error: no matching function for call to ‘boost::locale::utf::utf_traits<char>::decode(std::basic_string<char>::iterator, std::basic_string<char>::iterator)’ >>>/home/chenshu/work/asio_echo/codes/main/test/main.cc:18:65: note: candidate is: >>>/usr/include/boost/locale/utf.hpp:193:27: note: static boost::locale::utf::code_point boost::locale::utf::utf_traits<CharType, 1>::decode(Iterator&, Iterator) [with Iterator = __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, CharType = char, boost::locale::utf::code_point = unsigned int] >>>/usr/include/boost/locale/utf.hpp:193:27: note: no known conversion for argument 1 from ‘std::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}’ to ‘__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >&’ >>>make[2]: *** [test_bin/CMakeFiles/util_test.dir/main.cc.o] Error 1 >>>make[1]: *** [test_bin/CMakeFiles/util_test.dir/all] Error 2 >>>make: *** [all] Error 2 >>> >>> >>>The above is my first question, that's about converting one single Unicode character. >>>Another question is how to decode all Unicode code points from string object? >>> >>> >>> >>>陈抒 >>>Best regards >>>http://blog.csdn.net/sheismylife >>>------------------------------------------------------------------------------ >>>Free Next-Gen Firewall Hardware Offer >>>Buy your Sophos next-gen firewall before the end March 2013 >>>and get the hardware for free! Learn more. >>>http://p.sf.net/sfu/sophos-d2d-feb >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >>------------------------------------------------------------------------------ >>Free Next-Gen Firewall Hardware Offer >>Buy your Sophos next-gen firewall before the end March 2013 >>and get the hardware for free! Learn more. >>http://p.sf.net/sfu/sophos-d2d-feb >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > > > |
|
From: 陈抒 <csf...@gm...> - 2013-06-08 15:53:08
|
Hello Artyom: I know the code_point type is uint32_t. In my app, I need to convert it into uint16_t. Which one of the following ways is portable and don't need to worry about the endianness(big-endian or little-endian), also can be used in both 32bit and 64bit platform. I am using GCC4.x above. Assume x is a code_point value 1. static_cast<uint16_t>(x) 2. x & 0xffff Correct me if I am wrong, thanks. Dean Chen Best regards http://blog.csdn.net/sheismylife On Wed, Feb 6, 2013 at 12:20 AM, Artyom Beilis <art...@ya...> wrote: > First of all there is utf_to_utf functions and if sizeof(wchar_t) == 4 > (which is on Linux/Unix) > than all you need is to use them. > > About the error > > code_point c = utf_traits<char, sizeof(char)>::decode(str.begin(), > str.end()); > > the first parameter is reference that is moved forward and std.begin() > can't be changed > so what you need to do is: > > std::string::const_iterator pos = std.begin(),end =str.end(); > code_point c = utf_traits<char, sizeof(char)>::decode(pos,end ); > > See: > http://www.boost.org/doc/libs/1_51_0/libs/locale/doc/html/structboost_1_1locale_1_1utf_1_1utf__traits.html#a65f0b0e1075dd000d2c2c15af30be372 > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* 陈抒 <csf...@gm...> > *To:* cpp...@li... > *Sent:* Tuesday, February 5, 2013 5:32 PM > *Subject:* [Cppcms-users] Questions about decode UTF-8 to Unicode code > point > > Hello Artyom: > I am using the boost.locale library contributed by you to decode UTF-8. > The following codes works fine: > char const * p = "一"; // one Chinese character here > code_point c = utf_traits<char, sizeof(char)>::decode(p, p + 3); > cout << "code point: 0x" << std::hex << c << " binary format:B" << > PrintIntAsBinaryString(c) << endl; > > My Print.. function prints it as what I expect. > code point: 0x4e00 binary format:B00000000000000000100111000000000 > > But don't know how to apply the decode function to std::string. when using > iterator of string object, got some compilation error: > > string str = "一"; > code_point c = utf_traits<char, sizeof(char)>::decode(str.begin(), > str.end()); > > /home/chenshu/work/asio_echo/codes/main/test/main.cc:18:65: error: no > matching function for call to > ‘boost::locale::utf::utf_traits<char>::decode(std::basic_string<char>::iterator, > std::basic_string<char>::iterator)’ > /home/chenshu/work/asio_echo/codes/main/test/main.cc:18:65: note: > candidate is: > /usr/include/boost/locale/utf.hpp:193:27: note: static > boost::locale::utf::code_point boost::locale::utf::utf_traits<CharType, > 1>::decode(Iterator&, Iterator) [with Iterator = > __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, CharType = > char, boost::locale::utf::code_point = unsigned int] > /usr/include/boost/locale/utf.hpp:193:27: note: no known conversion for > argument 1 from ‘std::basic_string<char>::iterator {aka > __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >}’ to > ‘__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >&’ > make[2]: *** [test_bin/CMakeFiles/util_test.dir/main.cc.o] Error 1 > make[1]: *** [test_bin/CMakeFiles/util_test.dir/all] Error 2 > make: *** [all] Error 2 > > The above is my first question, that's about converting one single Unicode > character. > Another question is how to decode all Unicode code points from string > object? > > > 陈抒 > Best regards > http://blog.csdn.net/sheismylife > > > ------------------------------------------------------------------------------ > Free Next-Gen Firewall Hardware Offer > Buy your Sophos next-gen firewall before the end March 2013 > and get the hardware for free! Learn more. > http://p.sf.net/sfu/sophos-d2d-feb > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Free Next-Gen Firewall Hardware Offer > Buy your Sophos next-gen firewall before the end March 2013 > and get the hardware for free! Learn more. > http://p.sf.net/sfu/sophos-d2d-feb > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: <un...@fu...> - 2013-06-07 08:34:25
|
On 2013-06-06 22:57, Marcel Hellwig wrote: > make -j16 is much to high! > some say cores * 2, some just say cores... I prefer cores ;) but 16? true, todays linux scheduler does much better job, so cores*2 isn't necessary. even more with ssd low io latency and intel's virtual cores. 8 would do the job. thank you for pointing |
|
From: Marcel H. <ke...@co...> - 2013-06-07 07:43:36
|
On 06.06.2013 22:27, malus wrote:
> Hi Artyom,
>
> I intended to run jsonrpc chat sample program using http on local machine
> The configuration is as follows:
>
> I put index.html and folder client_side in the same directory and
> add rpc = new JsonRPC('http://localhost:808/chat',['get'],['post']); to
you forgot a *0* => 8080 Maybe this fixes it?!
> index.html
>
> Then I compile and run the chat.cpp with ./chat -c -config.js.
>
> Then I opened index.html,
Do you open it as file:// or as http:// ? the last one is the right one.
> nothing post or get.
What?
> Could help me to figure out
> what wrong it is.
I think you are using the example index and .cpp file, aren't you? Is
this there any output from the webserver (the chat app). Can you do
this? wget -O - http://localhost:8080/chat if not something more is wrong.
> Thank,
>
> malus
Regards
Marcel
>
> config.js
>
> {
> "service" : {
> "api" : "http",
> "port" : 8080
> },
> "http" : {
> "script" : "/chat"
> },
> "file_server" : {
> "enable" : true,
> "alias" : [
> {
> "url" : "/scripts" ,
> "path" : "./client_side/jsonrpc"
> }
> ],
> "document_root" : "."
> },
>
> }
>
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. A cloud service to automate IT design, transition and operations
> 2. Dashboards that offer high-level views of enterprise services
> 3. A single system of record for all IT processes
> http://p.sf.net/sfu/servicenow-d2d-j
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
|
|
From: malus <za...@gm...> - 2013-06-07 05:35:13
|
Hi Artyom,
I intended to run jsonrpc chat sample program using http on local machine
The configuration is as follows:
I put index.html and folder client_side in the same directory and
add rpc = new JsonRPC('http://localhost:808/chat',['get'],['post']); to
index.html
Then I compile and run the chat.cpp with ./chat -c -config.js.
Then I opened index.html, nothing post or get. Could help me to figure out
what wrong it is.
Thank,
malus
config.js
{
"service" : {
"api" : "http",
"port" : 8080
},
"http" : {
"script" : "/chat"
},
"file_server" : {
"enable" : true,
"alias" : [
{
"url" : "/scripts" ,
"path" : "./client_side/jsonrpc"
}
],
"document_root" : "."
},
}
|
|
From: Yiown S. <yi...@gm...> - 2013-06-06 21:17:28
|
i have 8 cores but no noticeable difference found after -j6 . i guess the individual threads are too short lived, at least while compiling cppcms. On Thu, Jun 6, 2013 at 5:57 PM, Marcel Hellwig <ke...@co...> wrote: > make -j16 is much to high! > some say cores * 2, some just say cores... I prefer cores ;) but 16? > > Regards > > > > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
|
From: Marcel H. <ke...@co...> - 2013-06-06 20:57:59
|
make -j16 is much to high! some say cores * 2, some just say cores... I prefer cores ;) but 16? Regards |
|
From: <un...@fu...> - 2013-06-06 16:32:51
|
On 2013-06-06 17:22, Yiown Sugpo wrote: > Perfect! you are right i didn't extracted the tar file. can that be > automated? feel free to customize attached script to your needs. |
|
From: Marcel H. <ke...@co...> - 2013-06-06 15:49:26
|
On 06.06.2013 17:22, Yiown Sugpo wrote: > Perfect! you are right i didn't extracted the tar file. can that be > automated? > In the other hand i am getting these test failing: > 23 - internal_forwarder_test (Failed) > 24 - forwarder_test (Failed) > 27 - http_timeouts_test_write (Failed) > > Thanks Marcel. I think this is a known bug. But you could provide further information about this with > ctest -v --output-on-failure Regards |