Xamarin NetStandard Android sfChart DateTimeStripLine not displayed? - xamarin.android

This is fairly specific (as the title suggests).
I've recently ported my Xamarin Forms app to NETStandard, and now my sfChart DateTimeStripLine are not visible on Android.
Things show up more-or-less fine on UWP, so I don't think I've introduced regressions.
Anyone else having similar experiences? Has anyone successfully used ChartStripLine on NET Standard?

We have prepared a sample using DateTimeStripline in SfChart with .Net Standard 1.3 and it’s working fine in this sample. If still you face the problem, please provide Stripline related code snippet, it would be helpful to provide better solution.

So, finally figured out the issue:
The StripLines declared in XAML work fine, but binding to a StripLineCollection did not (android only). Unfortunately, declaring in XAML is not a particularly useful option.
To fix/workaround, declare StripLine in XAML like so:
<chart:DateTimeAxis x:Name="TheTimeAxis" ...>
<chart:DateTimeAxis.StripLines>
<!-- Empty def requires at least one item to be used
This creates container to fill in ViewModel.
Fixes dissappearing StripLines bug on android -->
<chart:DateTimeStripLine WidthType="Day" Width ="1"
Start="09/28/2017">
</chart:DateTimeStripLine >
</chart:DateTimeAxis.StripLines>
Then, in the code behind access the named axis, pull out the striplines and modify to your hearts content.
// Workaround Android: Our StripLines do not appear to be
// refreshing when bound from XAML. To fix we create in XAML,
// then retrieve the existing collection and pass that to the
// viewmodel for modification
DateTimeAxis sl = this.TheTimeAxis;
var slc = sl.StripLines;

Related

Why does LambdaExpression.Compile() work on iOS (Xamarin)?

Since Xamarin.iOS doesn't support code generation at runtime, why do Compile() and DynamicInvoke() work as expected?
For example, the following code works fine:
var lambda = Expression.Lambda(
Expression.Add(
Expression.Constant(1),
Expression.Constant(2)
)
);
var f = lambda.Compile();
var result = f.DynamicInvoke();
// result==3 at this point
Is Xamarin evaluating the expression tree at runtime instead of emitting IL code?
On platforms that support code generation, Reflection.Emit-based LambdaCompiler is used.
If that's not available, the expression is interpreted using the interpreter. For example, there are classes that interpret Constant and Add.
The details of the Xamarin limitations are here.
You don't seem to be using anything in the Reflection.Emit namespace, which is the big no-no. Your code must still be AOT'd. Otherwise, I would imagine it would not work.
But there HAVE been examples of [native] developers thwarting the iOS static analysis tool and circumventing the dynamic code restriction. I tried to locate the article, but couldn't find it.
Anyway, I don't think your scenario exemplifies that. Your code example will still be AOT-compiled.
But you raise a really good question: at what time does the expression get evaluated?
EDIT:
Another SO answer on the same topic: What does Expression.Compile do on Monotouch?
There's also some good info on Expression.Compile() and "full AOT" here:
http://www.mono-project.com/docs/advanced/aot/
EDIT:
After reading some more, I think I know what's going on here. It's not that Expression.Compile() won't work...it's that when your iOS app bundle is subjected to the iOS static analysis tool when you submit it to the app store, it will not pass the analysis, because it is dynamically generating code. So, sure, you can use Expression.Compile(), but don't expect it to be accepted into the app store. But as mentioned by #svick, if you use the "full AOT" compile option, your Expression.Compile() will probably fail at runtime, or perhaps even fail compilation.

cakephp highchart fatal error while rendering

Here I am, again. With another question concerning cakephp-2.5 and the plugin 'highcharts'.
I've been looking at the demo's an all the different things I could find were the extendings from the controllers. But... that isn't required because it's a plug, am I right?
So, I have included th plugin to my loadings inside the bootstrap file, and when I'm trying to render my HighChart I'm receiving the following error;
Error: Chart: "1" could not be found. Ensure that Chart Name is the same string that is passed to $this->HighCharts->render() in your view.
But the demos are working fine! Any idea what I f*cked up? The names are the same, I even renamed them to 'asd' ( both! ) and it still doesn't work. ^^"
I know this is an incredibly late response but for the benefit of those still experiencing problems with this, the CakePHP 2.* Highcharts plugin has been updated and is compatible up to CakePHP version 2.5.7.
Do note however that in order to maintain product name consistency throughout the repo, all previous references to "HighCharts" have been changed to "Highcharts" and "high_charts" is now simply "highcharts" . So for eg. you now have to call $this->Highcharts->render() where before you would have used $this->HighCharts->render().
The plugin was not yet compatible with CakePHP 2.5. Right now as we speak the developer is working on a new release for 2.5. :)
In CakePHP 2.5, you can avoid the error above and render your chart by calling it.
For example from within index() within your controller, use:
$this->bar();
In this example, bar() is the name of the function containing your chart.

ContentLoadException problem

I'm very new to XNA. Actually I have XNA 4.0 book by kurt jaegers, so i installed VS 2010 and XNA 4.0 and wrote my first program. But that program didn't run successfully,it kept displaying the ContentLoadException file not found. So i did a bit of research on web and found that there is some issue with XNA 4.0. So I uninstalled the VS 2010 & XNA 4.0 and installed VS 2008(express edition) & XNA 3.0 . Then I compiled my first program on it and i ran successfully.
But,now I'm facing the same problem again with my new projects. I've tried both Syntax :
xx = this.Content.Load<Texture2D>("TitleScreen");
xx = Content.Load<Texture2D>(#"TitleScreen");
And there is no spelling mismatch problem. Please Mods guide me. And please tell me why I'm getting this problem again and again.
System Specs :
XP sp3,i3,2gb RAM.
Content that you want to load into via the ContentManager needs to be in the content project. Pretend for a moment it looks like this
Mygame.Content > SomeFolder > textureName
You would use content.Load<Texture2D>("SomeFolder/textureName") to get to it. If it was at the root of the Content project content.Load<Texture2D>("textureName") will work. If (and since) it isn't there are 2 things to check
Right click on the texture and go to properties. Look at the AssetName properties. This is what you use to load it up via the Content Manger. Try using whatever this name is.
The root directory the Content Manager looks in is "Content". Look at Content.RootDirectory and see what it is. If it isn't "Content" change it to that. That could also work.
In order to properly load content, you'll need to use the generic method
ContentManager.Load<T>
For example, if you're trying to load a Texture2D element, Use the following syntax:
Texture2D texture = Content.Load<Texture2D>("textureName");
Read more about loading content in this link.
There is a known issue with ContentManagers instanced by anything other than the default Game object constructor, which cause the problem you are experiencing.
If you are indeed using a ContentManager object other than the one supplied on the Game object, the solution is:
When you instantiate the ContentManager, you should set it's RootDirectory property to
#"Content"
Hope it helps

How to filter Delphi 2010 compiler output (hints)?

I'm trying to get rid of some hints(*) the Delphi compiler emits. Browsing through the ToolsAPI I see a IOTAToolsFilter that looks like it might help me accomplish this through it's Notifier, but I'm not sure how to invoke this (through what xxxServices I can access the filter).
Can anyone tell me if I´m on the right track here? Thanks!
(*) In particular, H2365 about overridden methods not matching the case of the parent. Not so nice when you have about 5 million lines of active code with a slightly different code convention than Embarcadero's. We've been working without hints for months now, and we kinda miss 'm. :-)
Even if you could query BorlandIDEServices for IOTAToolsFilter, that interface isn't going to help you do what you're asking. That interface was introduced as part of a mechanism for adding additional build tools (compilers, etc.) to the IDE (before the IDE used MSBuild). It allowed you to write a custom "filter" to handle output from a particular build tool, but it would not let you apply a filter to one of the built-in tools (like the delphi compiler).
The reason the Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) call fails in Delphi2010 is that once MSBuild support was added to the IDE, the old way of adding build tools to the IDE was disabled, and the BorlandIDEServices interface no longer supported IOTAToolsFilter.
The declaration of IOTAToolsFilter should probably have been marked deprecated in ToolsAPI.pas (or least it should have been mentioned in the source code comment that it is no longer supported).
As far as your desire to filter a particular hint, I'm not aware of a way to do that via the ToolsAPI. It seems like a reasonable thing that can be added to IOTAMessageServices (the ability to enumerate, filter, and possibly change the messages in the IDE's Message View). I would enter a request in QualityCentral for that.
Also, please vote for QC #35774 (http://qc.embarcadero.com/wc/qcmain.aspx?d=35774), as if that were implemented, you would not need to use the ToolsAPI for this sort of thing.
According to http://docwiki.embarcadero.com/RADStudio/en/Obtaining_Tools_API_Services it should be possible to access it directly using BorlandIDEServices, eg:
var
OTAToolsFilter: IOTAToolsFilter;
begin
if Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) then
ShowMessage('supports IOTAToolsFilter')
else
ShowMessage('IOTAToolsFilter NOT supported');
end;
However this doesn't return the desired interface in Delphi 2010 (you'll get the not supported message), so there's either an error in the documentation, or an error in BorlandIDEServices not returning the correct interface.

ASP.NET MVC ViewData (using indices)

I had a working solution using ASP.NET MVC Preview 3 (was upgraded from a Preview 2 solution) that uses an untyped ViewMasterPage like so:
public partial class Home : ViewMasterPage
On Home.Master there is a display statement like this:
<%= ((GenericViewData)ViewData["Generic"]).Skin %>
However, a developer on the team just changed the assembly references to Preview 4.
Following this, the code will no longer populate ViewData with indexed values like the above.
Instead, ViewData["Generic"] is null.
As per this question, ViewData.Eval("Generic") works, and ViewData.Model is also populated correctly.
However, the reason this solution isn't using typed pages etc. is because it is kind of a legacy solution. As such, it is impractical to go through this fairly large solution and update all .aspx pages (especially as the compiler doesn't detect this sort of stuff).
I have tried reverting the assemblies by removing the reference and then adding a reference to the Preview 3 assembly in the 'bin' folder of the project. This did not change anything. I have even tried reverting the Project file to an earlier version and that still did not seem to fix the problem.
I have other solutions using the same technique that continue to work.
Is there anything you can suggest as to why this has suddenly stopped working and how I might go about fixing it (any hint in the right direction would be appreciated)?
We made that change because we wanted a bit of symmetry with the [] indexer. The Eval() method uses reflection and looks into the model to retrieve values. The indexer only looks at items directly added to the dictionary.
I've decided to replace all instances of ViewData["blah"] with ViewData.Eval("blah").
However, I'd like to know the cause of this change if possible because:
If it happens on my other projects it'd be nice to be able to fix.
It would be nice to leave the deployed working code and not overwrite with these changes.
It would be nice to know that nothing else has changed that I haven't noticed.
How are you setting the viewdata? This works for me:
Controller:
ViewData["CategoryName"] = a.Name;
View:
<%= ViewData["CategoryName"] %>
BTW, I am on Preview 5 now. But this has worked on 3 and 4...
Re: Ricky
I am just passing an object when I call the View() method from the Controller.
I've also noticed that on my deployed server where nothing has been updated, ViewData.Eval fails and ViewData["index"] works.
On my development server ViewData["index"] fails and ViewData.Eval works...
Yeah, so whatever you pass into the View is accessible in the View as ViewData.Model. But that will be just a good old object if you don't do the strongly typed Views...

Resources