.Net Core 3 HtmlGrid WithFooter not an option - asp.net-mvc-3

I am a noob when it comes to .Net Core and I was asked to upgrade an existing project from Core 2.2 to 3.1. I have been slowly working though the issues but this one I can not find any help on.
I am getting an error:
CS1061 'IHtmlGrid' does not contain a definition for
'WithFooter' and no accessible extension method 'WithFooter' accepting
a first argument of type 'IHtmlGrid' could be found (are
you missing a using directive or an assembly reference?)
Here is the full page code from my FollowupOnTimeGrid.cshtml:
#(Html.Grid(Model)
.Build(c =>
{
c.Add(m => m.SurveyDateRange).Titled("Survey Period").InitialSort(GridSortOrder.Asc);
c.Add(m => m.Due);
c.Add(m => String.Format("{0} ({1:f2}%)", m.OnTime, m.Due == 0 ? 0
: Math.Round((((double)m.OnTime) / m.Due) * 100.0, 2)))
.Titled("Surveys Taken on Time (N (%))");
})
.Css("table-striped table-bordered table-hover")
.Named("FollowupOnTimeGrid")
.Empty("No Records Found!")
.WithFooter("_FollowupOnTimeGridFooter")
)

I was able to find the solution. NonFactor changed the .WithFooter to .UsingFooter in release 7.

Related

Use one version of java library or another => make code compatible for both

I'm working on a Spring Boot project built with Gradle and the main language is Kotlin.
In this project, there is one imported library (developed in Java) which, depending on the version I use, has 5 or 6 parameters in the constructor of a specific class I use.
For now, I switch between the versions manually by changing the version number in the build.gradle.kts file so my question would be : regardless of the version I use, how could my code work for all the versions ?
So, basically,
library-version1.jar => Class(6 parameters)
library-version2.jar => Class(5 parameters)
project with library-version1.jar or library-version2.jar imported => universal code to create instance of Class
P.S : may I add that I have to use those 2 versions of the library.
I found the solution for my initial question :
val yourVariable = YourClass::class.java
val constructor = yourVariable.constructors[0] //The class I use has only one constructor
val implementationVersion = yourVariable.`package`.implementationVersion
if (implementationVersion < "a specific version number") {
constructor.newInstance(6 parameters) as YourClass
} else {
constructor.newInstance(5 parameters) as YourClass
}
But now I have a follow-up question that you can find in the comments (I can still post it here though) :
In my build.gradle.kts file, I have this line in my dependencies :
dependencies {
implementation("myLibrary:1.0")
...
}
Obviously, I don't want to switch between myLibrary v1 and v2 manually. Just by changing the build.gradle.kts file, would it be possible to have :
build.gradle.kts -> appV1 (if myLibrary v1 used)
-> appV2 (if myLibrary v2 used)
?

Getting error when trying to install R Package "Tidytext"

Error: package or namespace load failed for ‘tidytext’ in library.dynam(lib, package, package.lib): shared object ‘stringi.so’ not found
6.
stop(msg, call. = FALSE, domain = NA)
5.
value[3L]
4.
tryCatchOne(expr, names, parentenv, handlers[[1L]])
3.
tryCatchList(expr, classes, parentenv, handlers)
2.
tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps) ...
1.
library(tidytext)
upon running
tidyverse:::tidyverse_attach()
tidyverse:::tidyverse_conflicts()
> tidyverse:::tidyverse_attach()
Error in library.dynam(lib, package, package.lib) :
shared object ‘stringi.so’ not found
> tidyverse:::tidyverse_conflicts()
Error in library.dynam(lib, package, package.lib) :
shared object ‘stringi.so’ not found
Try running install.packages('stringi')
See this issue thread for more details: https://github.com/bvieth/powsimR/issues/20
I personally found that when my OS updates R, all of my downloaded packages get broken in some weird way. I've yet to find a fix for it.

Migration to CRM 2016: Unable to get property 'getPageData' of undefined or null reference

After migration from CRM 2013 to CRM 2016 (On Premise), we have error messages in the browser like:
Unable to get property 'getPageData' of undefined or null reference
Unable to get property 'className' of undefined or null reference
Unable to get property 'firstChild' of undefined or null reference
The error happens in components of CRM. Any idea, what the reason could be?
<ReportVersion>1.0</ReportVersion>
<ScriptErrorDetails>
<Message>Unable to get property 'getPageData' of undefined or null reference</Message>
<Line>2083</Line>
<URL>/_static/form/formcontrols.js?ver=1804820318</URL>
<PageURL>/form/page.aspx?lcid=1033&themeId=f499443d-2082-4938-8842-e7ee62de9a23&tstamp=197130723&updateTimeStamp=635905304768102438&userts=131002784247688030&ver=1804820318#etc=2&extraqs=%3fetc%3d2%26id%3d%257b7DE4DCC6-207F-E511-9528-005056A03927%257d&pagemode=iframe&pagetype=entityrecord&counter=1455804831411</PageURL>
<Function>anonymousr:Unabletogetproperty'getPageData'ofundefinedornullreference</Function>
<FunctionRaw>TypeError: Unable to get property 'getPageData' of undefined or null reference</FunctionRaw>
<CallStack>
<Function>anonymousr:Unabletogetproperty'getPageData'ofundefinedornullreference</Function>
</CallStack>
</ScriptErrorDetails>
Try suggestion provided at the end of thread - https://community.dynamics.com/crm/f/117/p/190275/482107
When do errors occur?
I' v had similar error [1] on 8.2.2.112 when pressing Next Stage on Business Process Flow. Much effort was put into debugging so wanted to document it somwhere.
Rollup field
The error was caused by rollup fields that provides SUM for Money fields. The HTML generated by CRM and javascript function didn't match.
Guilty line is within /_static/form/formcontrols.js called on line 28871:
XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode)))))).innerHTML = CrmEncodeDecode.CrmHtmlDecode((this.$5_1.$3_2).get_currencySymbol());
This one returns null and it therefore spits error: XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode
Solution
FIX 1: Enable "Use legacy form rendering" under System Settings
OR Fix 2: Remove Currency rollup fields from form.
OR Fix 3: Create non-rollup fields that get calculated with workflow or plugin.
OR Fix 4: You may do some jQuery stuff and add some empty siblings which it -
expects. Except it may show duplicate currency symbol (at least for EUR currency) - one as prefix the other one as suffix.
OR Fix 5: Most undesirable way: patch that .js yourself if you're on-premises.
Replace line 28871:
XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode)))))).innerHTML = CrmEncodeDecode.CrmHtmlDecode((this.$5_1.$3_2).get_currencySymbol());
With:
if (XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode) !== null) {
XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetFirstChild(XUI.Html.DomUtils.GetNextSibling(this.get_controlValue().parentNode)))))).innerHTML = CrmEncodeDecode.CrmHtmlDecode((this.$5_1.$3_2).get_currencySymbol());
}
[1] Error:
<ScriptErrorDetails>
<Message>Cannot read property 'firstChild' of null</Message>
<Line>0</Line>
<URL>/form/page.aspx?lcid=1033&themeId=2cf54f8a-be4d-477c-a1f5-29b894a487ca&tstamp=53798526&updateTimeStamp=636392540341784672&userts=131546192871874626&ver=-1991520363#etc=3&extraqs=%3f_gridType%3d3%26etc%3d3%26id%3d%257b586C2C21-E8F8-E611-80F5-005056BD19EE%257d%26opened%3dgrid%26process%3dc9426a91-9fc0-4c2d-a21c-4b9d2a38a6d5%26processts%3d51389819%26rskey%3d%257b00000000-0000-0000-00AA-000010003001%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010003001%7d&counter=1510145890205</URL>
<PageURL>/form/page.aspx?lcid=1033&themeId=2cf54f8a-be4d-477c-a1f5-29b894a487ca&tstamp=53798526&updateTimeStamp=636392540341784672&userts=131546192871874626&ver=-1991520363#etc=3&extraqs=%3f_gridType%3d3%26etc%3d3%26id%3d%257b586C2C21-E8F8-E611-80F5-005056BD19EE%257d%26opened%3dgrid%26process%3dc9426a91-9fc0-4c2d-a21c-4b9d2a38a6d5%26processts%3d51389819%26rskey%3d%257b00000000-0000-0000-00AA-000010003001%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010003001%7d&counter=1510145890205</PageURL>
<Function>anonymous(dirtyVisiblePropertyData){var$v_0=dirtyVisiblePropertyData.getKeys();for(var$v_1=0;$v_1<$v_0.length;$v_1++){var$v_2=$v_0[$v_1];if(IsNull(this.get_viewMap().get_item($v_2))){}else{try{this.get_viewMap().get_item($v_2).update(dirtyVisiblePropertyD</Function>
<FunctionRaw>function (dirtyVisiblePropertyData) {
var $v_0 = dirtyVisiblePropertyData.getKeys();
for (var $v_1 = 0; $v_1 < $v_0.length; $v_1++) {
var $v_2 = $v_0[$v_1];
if (IsNull(this.get_viewMap().get_item($v_2))) {
</FunctionRaw>
<CallStack>
<Function>anonymous(dirtyVisiblePropertyData){var$v_0=dirtyVisiblePropertyData.getKeys();for(var$v_1=0;$v_1<$v_0.length;$v_1++){var$v_2=$v_0[$v_1];if(IsNull(this.get_viewMap().get_item($v_2))){}else{try{this.get_viewMap().get_item($v_2).update(dirtyVisiblePropertyData.get_item($v_2));}catch($v_3){Mscrm.CrmDebug.fail(String.format('ExceptionencounteredupdatingUIelement{0}:{1}',$v_2,$v_3.message));catchError($v_3.message,window.location.href,0,true);}}}}</Function>
<Function>anonymous(){if(this.$AV_1){var$v_0=this.$4h_1;this.$4h_1=new(Mscrm.TurboForm.Control.TypedDictionary$1.$$(Mscrm.TurboForm.Control.PropertyBag))();this.ui.updateUI($v_0);}}</Function>
<Function>anonymous(){this.$7A_1++;var$v_0=null;if(!this.$AE_1){setPerformanceMarkerTimestamp(String.format('UIUpdate{0}StartTime',this.$7A_1));$v_0=Xrm.Internal.startMetricsStopwatch(String.format('UIUpdate{0}',this.$7A_1));$v_0.start();}this.$8w_1=false;for(var$v_1=0;$v_1<this.$2F_1.length;$v_1++){var$v_2=this.$2F_1[$v_1];if(!IsNull($v_2)){$v_2.flushVisibilityChanges();}}if($v_0){$v_0.stop();setPerformanceMarkerTimestamp(String.format('UIUpdate{0}EndTime',this.$7A_1));}window.top.TurboFormLoadStartTime=null;}</Function>
<Function>anonymous(){Mscrm.Performance.PerformanceMarkerManager.get_instance().addMarker('MDDEnd',1);try{var$v_0=Xrm.Internal.startMetricsStopwatch('PostOnLoadUIUpdate');$v_0.start();this.finishUIUpdate();$v_0.stop();}finally{this.$Ih_1();this.updateFormDirtyState();try{if(isOutlookHostedWindow()){getOutlookHostedWindow().handlePostOnLoad();}}catch($$e_1){}}}</Function>
<Function>anonymous(){var$v_0=Xrm.Internal.startMetricsStopwatch('HandlePostOnLoad');$v_0.start();if(Mscrm.TurboForm.Control.PageManager.get_instance().$L_1===this){this.get_pidRequestManager().clearRecords();Mscrm.TurboForm.Control.PageManager.get_instance().handlePostOnLoad();var$v_1=Mscrm.TurboForm.Control.PageBootstrapper.getPageState();if(!IsNull($v_1)&&$v_1.formType!==7&&!$v_1.recordId.equals(Microsoft.Crm.Client.Core.Framework.Guid.get_empty())){Mscrm.TurboForm.Control.PageBootstrapper.requestSubGridData();}this.get_pidRequestManager().requestPidPtsWithLookupService();setAttributeInWindow('FormEntityLogicalName',(this.data.getEntity())?this.data.getEntity().getEntityName()||'':'');setAttributeInWindow('FormEntityTypeCode',(this.data.getEntity()&&!Mscrm.InternalUtilities.JSTypes.isNull(this.data.getEntity().getEntityTypeCode()))?this.data.getEntity().getEntityTypeCode().toString():'');if(!Mscrm.InternalUtilities.JSTypes.isNullOrEmptyString(window.CUSTOM_ETC_LIST)&&JSON.parse(window.CUSTOM_ETC_LIST).indexOf(this.data.getEntity().getEntityTypeCode())>-1){setAttributeInWindow('IsCustomEntity','true');}else{setAttributeInWindow('IsCustomEntity','false');}if(!IsNull(window.turboHeaderScriptIncludes)){if(this.scriptIncludesSearch(window.turboHeaderScriptIncludes,'/_static/cs/articlesearchribbon/articlesearchribbon.js')){Mscrm.CrmHeader.setScriptFileForTurboForm(Mscrm.CrmUri.create('/_static/CS/ArticleSearchRibbon/ArticleSearchRibbon.js'));}}Mscrm.TurboForm.Control.PageManager.get_instance().loadActionHubIframe();window.setTimeout(this.$$d_$Ff_1,15);if(!IsNull($v_1)&&$v_1.formType!==7){Mscrm.MetricsCollector.collectAndReportClientMetrics(2);}}else{Mscrm.TurboForm.Control.PageManager.get_instance().finishUIUpdate();}$v_0.stop();}</Function>
<Function>anonymous(){returnb.apply(a,arguments)}</Function>
<Function>anonymous(c,d){for(varb=0,e=a.length;b<e;b++)a[b](c,d)}</Function>
<Function>anonymous(message){switch(message){case'TurboFormPostOnloadTimestamp':setPerformanceMarkerTimestamp('TurboFormPostOnloadTimestamp');Mscrm.Performance.PerformanceMarkerManager.get_instance().addMarker('TurboFormPostOnloadTimestamp',1);var$v_0=Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$7d_1.getHandler(String.format('MessageEventFormat_{0}',message));if(!IsNull($v_0)){$v_0();window.pageLoadedCheckForNavigateApi=true;if(!IsNull(window.parent)&&!IsNull(window.parent.parent)){window.parent.pageLoadedCheckForNavigateApi=true;window.parent.parent.pageLoadedCheckForNavigateApi=true;}}break;case'ScriptsAreLoaded':if(Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$57_1){Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$57_1=false;}var$v_1=Mscrm.TurboForm.Control.CustomScriptsManager.get_instance().$7d_1.getHandler(String.format('ScriptsAreLoaded',message));if(!IsNull($v_1)){$v_1();}break;}}</Function>
<Function>SendMessageToPageManager(message)</Function>
<Function>RunHandlerInternal(method,parameters,executionContext,executeIfAvailableOnly)</Function>
<Function>RunHandlers()</Function>
<Function>OnScriptTagLoaded(url)</Function>
<Function>anonymous(){OnScriptTagLoaded(url);}</Function>
</CallStack>
</ScriptErrorDetails>
Thanks to Andrii!
Removing a composite control in the header did the trick.
It seems to be a bug in CRM 2016, but our customers can live without this information in the header. All fine!
Kind regards,
Matthias

InstantCommons not working in MediaWiki 1.19 and SELinux

I am setting my own MediaWiki website locally, and am not able to get the InstantCommons feature to work (used to directly embed files from commons.wikimedia.org).
I get no error message, the files I try to load from Commons using the following syntax:
[[File:Cervus elaphus Luc Viatour 1.jpg|Cervus elaphus Luc Viatour 1]]
are just not loaded, and I end up with a red link on my page, referring to a non-existing file. It has been 2 days now that I am looking for a solution, but so far without any success.
I am running:
MediaWiki v.1.19.1
Fedora 16 (with SElinux)
PHP 5.3.15
MySQL Ver 14.14 Distrib 5.5.25a, for Linux (x86_64)
I have tried the following two configurations in my LocalSettings.php, without success:
$wgUseInstantCommons = true;
AND
$wgForeignFileRepos[] = array(
'class' => 'ForeignAPIRepo',
'name' => 'shared',
'apibase' => 'http://commons.wikimedia.org/w/api.php',
'fetchDescription' => true, // Optional
'descriptionCacheExpiry' => 43200, // 12 hours, optional (values are seconds)
'apiThumbCacheExpiry' => 43200, // 12 hours, optional, but required for local thumb caching
);
Any suggestion is most welcome.
OK, this is not (yet) an answer, but a debugging suggestion. It looks to me like the HTTP request from your server to Commons is failing for some reason, but unfortunately ForeignAPIRepo doesn't indicate the cause of the error in any way.
This is really a bug in MediaWiki, and should be fixed, but in the mean time, could you please try applying the following diff (or just manually adding the line marked with the + sign) to your includes/filerepo/ForeignAPIRepo.php file:
Index: includes/filerepo/ForeignAPIRepo.php
===================================================================
--- includes/filerepo/ForeignAPIRepo.php (revision 97048)
+++ includes/filerepo/ForeignAPIRepo.php (working copy)
## -385,6 +385,7 ##
if ( $status->isOK() ) {
return $req->getContent();
} else {
+ wfDebug( "ForeignAPIRepo: HTTP GET failed: " . $status->getXML() );
return false;
}
}
After applying it, try loading the file description page for a Commons image and look at the MediaWiki debug log. There should now be a line starting with ForeignAPIRepo: HTTP GET failed: followed by a few lines of XML error dump. That error data should hopefully indicate what's going wrong; please copy and paste it here.
Mine is not a definitive answer either. Referring to Ilmari Karonen's post, I was unable to find or get the getXML() method to execute for my version of Mediawiki v1.23.0. I was looking at the reference documentation found here to try and find any other method calls on the Status class that would give me good troubleshooting info. I ended up finding the following and editing the same file as mentioned in Ilmari Karonen's post includes/filerepo/ForeignAPIRepo.php beginning at line #521:
if ( $status->isOK() ) {
return $req->getContent();
} else {
$error = $status->getErrorsArray();
$dump = print_r($error, true);
wfDebug("ForeignAPIRepo: HTTP GET failed: $dump\n");
return false;
}
The default InstantCommons configuration of older MediaWikis is a bit silly. Due to T114098 I recommend one of the following, which will hopefully fix your problems:
upgrade to MediaWiki 1.27 (when it's released), or
set your LocalSettings.php to hotlink images to save on server-side requests and processing.
$wgUseInstantCommons = false;
$wgForeignFileRepos[] = array(
'class' => 'ForeignAPIRepo',
'name' => 'commonshotlink',
'apibase' => 'https://commons.wikimedia.org/w/api.php',
'hashLevels' => 2,
'url' => 'https://upload.wikimedia.org/wikipedia/commons',
'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
'transformVia404' => true,
'fetchDescription' => true,
'descriptionCacheExpiry' => 43200,
'apiThumbCacheExpiry' => 24 * 3600,
);

How can I concatenate multiple variables in my MVC3 Razor code?

I have some razor code and I am having a problem with getting the syntax working. The code is as follows:
else
{
#(x.RowKey.Substring(0, 2).TrimStart('0') + "." + x.RowKey.Substring(2, 2).TrimStart('0').PadLeft(1, '0')) - #Html.Raw(x.Title)<br>
}
This is giving me the following error:
Compiler Error Message: CS1002: ; expected
When you start your #(x.RowKey...., Razor still thinks that it's still in C# mode, not HTML mode (to use the totally non-technical terms). Nick Bork's suggestion about wrapping that stuff in the <text> tags gets the page back into HTML mode so you can go back to using your normal Razor syntax.
Try this:
else
{
var st = x.RowKey.Substring(0, 2).TrimStart('0') + "." + x.RowKey.Substring(2, 2).TrimStart('0').PadLeft(1, '0'));
#st - #Html.Raw(x.Title)<br/>
}

Resources