When I try to use it, an error appears saying that there are no attributes. Do I have to use it in a different way when using ddp?
Related
I am trying to convert the contents of a UWP RichEditBox to HTML.
For that purpose, I've tried using the RtfPipe library (https://github.com/erdomke/RtfPipe). From the looks of it, this library has a problem on UWP, due to the fact that not all encodings are defined on that target framework. (This is the error you get, if you are interested: Encoding.GetEncoding can't work in UWP app, but the accepted answer seems not to be the best option on all platforms - I haven't even managed to make the suggested fix compile, so it might not be valid anymore)
Now, as a way of avoiding this from happening, I am wondering whether there is a way to force the control to always use one of the UWP-defined UTF-variants for encoding the data when the user types his text.
Because, now, when I type into it, I get things like that:
{\rtf1\fbidis\ansi\ansicpg1253\deff0\nouicompat\deflang1032{
....
\pard\tx720\cf1\f0\fs23\lang1033
...that make the library throw exceptions.
I guess, if I manage to make it not use ASCII code pages, things will be great.
After taking a look at the control properties though, I do not see something I could use. Is there any way to achieve this?
This is the error you get, if you are interested: Encoding.GetEncoding can't work in UWP app
As you described, there is an inner error thrown when using this package with UWP app. System.ArgumentException: 'Windows-1252' is not a supported encoding name, by testing on my side, which is thrown by the code line public static readonly Encoding AnsiEncoding = Encoding.GetEncoding("Windows-1252"); of RtfSpec.cs when UpdateEncoding.
It seems like Windows-1252 may not be supported in UWP from the error details,also see this similar thread. You could use UTF instead as you want, for example, have a change on the library with following then it will work (testing demo here).
public static readonly Encoding AnsiEncoding = Encoding.UTF8;
I haven't even managed to make the suggested fix compile, so it might not be valid anymore
Encoding.RegisterProvider method should be work, but it only support UWP or .NET Framework 4.6, it does't support the Portable Class Library. The RtfPipe library you mentioned is Portable Class Library, so that you cannot use Encoding.RegisterProvider. Encoding.GetEncoding method supports Portable Class Library, details please check the version information of the two classed.
I guess, if I manage to make it not use ASCII code pages
RTF itself uses the ANSI, PC-8, Macintosh, or IBM PC character set to control the representation and formatting of a document, you may not able to change that. Consider to update the library to resolve the issue for UWP.
So far I have seen, the API allows me to add certain parameters to my calls such as filter_by and sort_by.
This works well for me, but I would like to know how do I use multiple parameters at the same time and using the filter_by parameter.
Currently, I am working with the Silex-Boilerplate, which offers me this function:
options('{"sort_by":"name:asc","is_startpage":false}')
I have tried to pass this JSON as options-parameter:
'{"filter_by":"{"component":"reference"}", "sort_by":"name:asc"}'
But it doesn't seem to work. Are there any suggestions about how the JSON could look like?
Thanks in advance!
As I can see you're already using the options Twig helper which is the right way to go.
options('{"sort_by":"name:asc","is_startpage":false}')
you can use the filter_by parameter directly using this syntax:
options('{"sort_by":"name:asc","filter_by[component]":"reference"}')
Also this syntax would be possible:
getStories('starts_with', 1, 10, 'name:ASC', options('{"filter_by":{"component":"reference"}}'))
this will be mapped directly for the API call by our PHP Client Library. Those requests are also cached in your Silex Boilerplate without any extra effort.
My application works perfectly locally however upon uploading to live server there's a couple of issues.
The first one is I get the following error on one specific page of my application but not on other that user the same class.
Class 'yii\helpers\url' not found
The above error is found even though I have the below line at the top of my view file.
use yii\helpers\url;
The other issue I get is when trying to locate a record within my Seo table using my Seo model however this error again only occurs on one part of my application but not the other part that uses the same table/model. Below is the error I get:
Class 'common\models\seo' not found
When I use the following line (I can confirm table relations work and the necessary data is their)
$seo = Seo::find()->where(['id' => $model->seo_id])->one();
use yii\helpers\url;
change to
use yii\helpers\Url;
The same way seo class name will be started using capital case
Seo
How do I use Googlemaps in Yii2 ?
I am not able to follow the Usage placed in http://www.yiiframework.com/extension/yii2-google-maps-library
Installation has been done, but I am getting error
Class 'dosamigos\google\maps\LatLng' not found
Could anyone provide a tutorial/examples where Yii uses Google Maps ?
Normally the use directive for third party extensione start with vendor
could be you must add the vendor to the use where you use these class.
try using
use vendor\dosamigos\google\maps\LatLng;
use vendor\dosamigos\google\maps\services\DirectionsWayPoint;
use vendor\dosamigos\google\maps\services\TravelMode;
use vendor\dosamigos\google\maps\overlays\PolylineOptions;
use vendor\dosamigos\google\maps\services\DirectionsRenderer;
use vendor\dosamigos\google\maps\services\DirectionsService;
use vendor\dosamigos\google\maps\overlays\InfoWindow;
use vendor\dosamigos\google\maps\overlays\Marker;
use vendor\dosamigos\google\maps\Map;
use vendor\dosamigos\google\maps\services\DirectionsRequest;
use vendor\dosamigos\google\maps\overlays\Polygon;
use vendor\dosamigos\google\maps\layers\BicyclingLayer;
I've tried the following bit of razor code:
#room.Media("summaryImage","umbracoFile")
but I get something like ~/media/155/lux.jpg, how do I remove the initial ~ to get a server path ie, /media/155/lux.jpg or http://some_url/media/155/lux.jpg?
EDIT:
I've tried
#{
dynamic summaryImagePath = room.Media("summaryImage","umbracoFile");
}
#Page.ResolveUrl(#summaryImagePath)
and
#Page.ResolveUrl(#room.Media("summaryImage","umbracoFile"))
but I keep getting the error:
Error loading Razor Script Cannot perform runtime binding on a null reference
even though #room.Media("summaryImage","umbracoFile") gives ~/media/155/lux.jpg.
Any ideas?
I'm not sure whether there is a solution within Umbraco, I'd just use the .NET framework. With ASP.NET, you can use MapPath to resolve virtual paths to physical file paths:
#HttpContext.Current.Server.MapPath(room.Media("summaryImage","umbracoFile"))
EDIT:
If you are looking for the absolute URL, you may use one of the following variants:
#Page.ResolveUrl(room.Media("summaryImage","umbracoFile"))
or
#VirtualPathUtility.ToAbsolute(room.Media("summaryImage","umbracoFile"))
You may would like to read this article about different approaches for resolving URLs.