Trying to get the following to work, but it seems that react-intl doesn't support it. Curious to know if there are any alternatives? Seems like it might be a common probably
<FormattedMessage
values={{session:{user:{first_name:'fred'}}}}
defaultMessage="Hello {session.user.first_name}!"
/>
Outputs:
Hello {session.user.first_name}!
Desired:
Hello fred!
. is not a valid ICU argument token, which is why react-intl doesn't support it.
Related
I'm using MongoDB C++ driver (version 3.4.0 for reference). I need to get the _id of a given document. First, I grab the document:
bsoncxx::stdx::optional<bsoncxx::document::value> sub = conn["mydb"]["csubs"].find_one(...);
so I can access to the _id this way:
sub->view()["_id"].get_oid();
So far, so good.
As far as I have read in driver API this object is of type types::b_oid. However, I would need to get it as std::string.
Surprisingly, I haven't found any method in the types::b_oid class documentation for string conversion. I mean, the typical to_string() method so I can call something like:
sub->view()["_id"].get_oid().to_string();
Probably I'm missing something (because the use case seems to be too obvious :), but after a while checking documentation I haven't find the solution. Any help is welcome!
I think you can call to_string() from the value field:
sub->view()["_id"].get_oid().value.to_string();
Here's an example from the mongocxx github repo
I'm working on a php based site and integrating some facebook sdk into it to get some basic user information. One thing I've been running into is, when I make a request to the graph, how do I know if I should be using getGraphObject or getGraphEdge? I'm not seeing anything intuitive yet to tell me that.
I'm running the php-sdk4 -> version 5
Here's one example that I ran into last night..
$response = $fb->get('/me/friends', $fbToken);
$fbfriends = $response->getGraphEdge()->asArray();
In the documentation, if you look at the php example, they use getGraphObject. But when I use it, I get an error telling me I should probably use the Edge. There are a lot of "get" functions, but I don't see anything that tells me how to know what to use. getGraphObject, getGraphEdge, getGraphUser, etc. I'd love some insight into this one, because it's been a guessing game for me.
Basicly, when:
Getting /{node-id}, you should use getGraphNode() (getGraphObject() is deprecated)
Getting /{node-id-with-known-type}, you should use getGraph{Type}().
For example, getting /me then use getGraphUser(), getting /{event-id} then use getGraphEvent()
Getting /{node-id}/{edge-name}, you should use getGraphEdge() (getGraphList() is deprecated)
Getting /{node-id}/{edge-name-with-children-known-type}, you should use getGraphEdge({children-type-class}).
For example, getting /me/albums then use getGraphEdge('GraphAlbum')
Nodes class name are in Facebook\GraphNodes namespace.
I have a project that is my first serious dive into Mongoid.
I saw a tip to use the following command:
Parent.where('childrens._id' => Moped::BSON::ObjectId(params[:id])).first
But this doesn't work. Error message was:
NameError: uninitialized constant Moped::BSON
I found that BSON is no longer included, so I added it to my Gemfile, as well as Moped. Then, I did another fix I found (placing Moped::BSON=BSON in application.rb).
This still didn't work, but the error changed to:
NoMethodError: undefined method `ObjectId' for BSON:Module
So I am assuming that this method got deprecated or something. Does anyone have any other tips?
Just to be clear, I am finding myself in the situation where I want to sort embedded documents using jquery-sortable. This requires me to update them in the database, but the serialize from that doesn't include the parent document in the hash. So I figured I'd try to get it on the back end using an ID from the embedded document. That is why I need it.
Thanks again for any help you can provide.
Try simply:
Parent.where('childrens._id' => params[:id]).first
I have solved the question though this won't be of much help to people in the future. The requirements have changed and now I am using human-readable strings as IDs to assist in friendly URLs and some other stuff.
Therefore, I don't have any issues with ObjectIds. Cortex's solution should (from what I have read) work for dealing with ObjectIds but I cannot verify it now.
My question may first of all seem to have a duplicate but i have hit something that has suprised me. Yaws Webserver comes with a complete set SOAP example, but when i tried running it as is, this is what i get:
In text form, this is what i see in the shell:
1> inets:start().
ok
2> yaws_soap_lib:call("http://www.webservicex.net/WeatherForecast.asmx?WSDL","GetWeatherByPlaceName",["Boston"]).
=ERROR REPORT==== 15-Apr-2013::20:32:11 ===
Call to tuple fun {erlsom_parse,xml2StructCallback}.
Tuple funs are deprecated and will be removed in R16. Use "fun M:F/A" instead, for example "fun erlsom_parse:xml2StructCallback/2".
(This warning will only be shown the first time a tuple fun is called.)
{error,{decoding,"Malformed: Illegal character in prolog"}}
3> yaws_soap_lib:call("http://www.webservicex.net/WeatherForecast.asmx?WSDL","GetWeatherByPlaceName",["Boston"]).
{error,{decoding,"Malformed: Illegal character in prolog"}}
4>
You could try the yaws example following this page.
Another problem, is that i have tried other SOAP libraries like detergent and erlsoap and they are either too old or completely un-usable. Most of the solutions, even yaws, mentions his dependency on erlsom i pretty think for the XML parsing. But, i can hardly use erlsom single-handedly to offer soap services.
Somebody provide some information on how i can work with soap services (both a sa client and server) in erlang, and please explain the error i am getting with yaws. I am using the latest yaws version and erlang 15B.
This is an ugly hack, but here's how I deal with SOAP requests:
Write a function/module that wraps the following:
Set up some request templates (static XMLs) and fill them up with erlydtl
Make a HTTP POST request (using your client of choice) with SoapAction header set.
Take off the important stuff from the response using erlsom
From the official documentation we can read the following:
Tuple funs (a two-element tuple with a module name and a function) are
now officially deprecated and will be removed in R16. Use 'fun M:F/A'
instead.
So, Yaws should be updated. As a workaround, you have at least two options:
the Detergent library
Or, if you don't mind using the (not so) older Erlang R15, I believe it should work, as other users reported.
Well, I've configured the database.php file, added the 'encoding'=>'utf8' option.
also added the $this->charset('utf8') to my view.
Now, when I use the find('list') and echo its content I get those known question-marks. But, when I use the find('all) method, the data is delivered correctly.
And my questions are:
Why?
Who is to blame?
How to solve ?(I really prefer the list way..)
Should I drink more coffee?
can you try $this->find('all') and then use set to extract the values, like Set::extract('/Post/title', $posts); and print it out. if the find all was good and the set::extract is bad there could be a bug. If it works like normal then there is something weird as that is what the core does.