MediaWiki invoke image not working - c#

I'm trying to invoke an image with infobox and infoboxImage. Here is what I have....
|image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|upright= {{{image_upright|1}}}|alt={{{alt|}}}}}
And I get the following error on my index.php?title=Module:InfoboxImage&action=submit#mw-ce-l1 page
Script error: Lua error at line 1: unexpected symbol near '|'.
What do I need to do to get this working?
Here is my LocalSettings.php for Scribunto:
require_once "$IP/extensions/Scribunto/Scribunto.php";
#$wgScribuntoDefaultEngine = "luastandalon"';

So you're adding template syntax like {{{image|}}} in a module page? Why?
I doubt you really need to handle such a Lua module for your wiki. However, if you really want to copy the Lua-powered infobox templates of other wikis, make sure you import them with Special:Import and select the recursive import checkbox.
Hopefully you'll then have all the modules you need without fiddling with them.

Related

Getting error when load the bing map version 8

when i run my code it show a script error dialog
"Error -Script error ,URL - http://www.bing.com/api/maps/mapcontrol?callback=OnLoad"
OnLoad is function which i call to initialize the map
Url i used to get map in my html file -
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=OnLoad' async defer></script>
Two things to try. First make sure your network can reach the http://bing.com website. Second, make sure you have a function call OnLoad that is accessible to the map control to call. Verify spelling and that it al control doesn't try and call this function before it is available. Try adding async defer to your script tag and this will allow your other code to load a bit faster.

Call html partial from different folder C#

I have the following DIR structure:
Public
--mobile
----Views
------UK
--------Recipes
----------ViewRecipePlain.cshtml // pull this
--mobilePublic
----Views
------UK
--------Recipes
----------ViewRecipe.cshtml // into this
I want to call ViewRecipePlain.cshtml from within ViewRecipe.cshtml
Inside ViewRecipe.cshtml I'm trying:
#Html.Partial("../../../../mobile/Views/UK/Recipes/ViewRecipePlain")
But am getting the error:
Cannot use a leading .. to exit above the top directory.
Is there another way to do this?
UPDATE
I also tried:
#Html.Partial("~/mobile/Views/UK/Recipes/ViewRecipePlain.cshtml")
But get the following error:
The partial view '~/mobile/Views/UK/Recipes/ViewRecipePlain.cshtml' was not found or no view engine supports the searched locations.
The following locations were searched:
~/mobile/Views/UK/Recipes/ViewRecipePlain.cshtml
Have also update DIR structure to be more accurate if it makes a difference but doubt it does.
You can just use the absolute path of the view:
#Html.Partial("~/mobile/Views/UK/Recipes/ViewRecipePlain.cshtml")

How to load referenced script libraries from a Roslyn script file?

I figured out I cannot load one script library from another easily:
module.csx
string SomeFunction() {
return "something";
}
script.csx
ExecuteFile("module.csx");
SomeFunction() <-- causes compile error "SomeFunction" does not exist
This is because the compiler does not know of module.csx at the time it compiles script.csx afaiu. I can add another script to load the two files from that one, and that will work. However thats not that pretty.
Instead I like to make my scripthost check for a special syntax "load module" within my scripts, and execute those modules before actual script execution.
script.csx
// load "module.csx"
SomeFunction()
Now, with some basic string handling, I can figure out which modules to load (lines that contains // load ...) and load that files (gist here https://gist.github.com/4147064):
foreach(var module in scriptModules) {
session.ExecuteFile(module);
}
return session.Execute(script)
But - since we're talking Roslyn, there should be some nice way to parse the script for the syntax I'm looking for, right?
And it might even exist a way to handle module libraries of code?
Currently in Roslyn there is no way to reference another script file. We are considering moving #load from being a host command of the Interactive Window to being a part of the language (like #r), but it isn't currently implemented.
As to how to deal with the strings, you could parse it normally, and then look for pre-processor directives that are of an unknown type and delve into the structure that way.
Support for #load in script files has been added as of https://github.com/dotnet/roslyn/commit/f1702c.
This functionality will be available in Visual Studio 2015 Update 1.
Include the script:
#load "common.csx"
...
And configure the source resolver when you run the scripts:
Script<object> script = CSharpScript.Create(code, ...);
var options = ScriptOptions.Default.WithSourceResolver(new SourceFileResolver(new string[] { }, baseDirectory));
var func = script.WithOptions(options).CreateDelegate()
...

How to correctly save a WF4 ActivityBuilder

I am currently saving my .NET FX 4.0.1 StateMachine activity like this:
var sb = new StringBuilder();
var xamlWriter = ActivityXamlServices.CreateBuilderWriter(
new XamlXmlWriter(new StringWriter(sb),
new XamlSchemaContext()));
XamlServices.Save(xamlWriter, activityBuilder);
return sb.ToString();
This works fine and the generated XAML looks good. Unfortunately, it is invalid. I can read it back in using ActivityXamlServices.Load but when I execute it, it says that it doesn't know the properties defined in the workflow. Opening it in the Visual Studio designer yields the same errors:
Compiler error(s) encountered processing expression "ActiveCall". "ActiveCall" is not declared. It may be inaccessible due to its protection level.
Through comparing the original XAML with the XAML produced by my code, I found out how to fix this problem. I have to have this tag before the StateMachine tag:
<mva:VisualBasic.Settings>
Assembly references and imported namespaces for internal implementation
</mva:VisualBasic.Settings>
By the way:
The text inside the tag must be exactly like this, otherwise there will be an error when opening the WF in VS:
Failed to create a 'Settings' from the text 'FooBar'
Question:
What do I have to change in my code to have this tag in the generated XAML?
I think I found the answer.
I have to use the following code before calling Save:
VisualBasic.SetSettings(activityBuilder, new VisualBasicSettings());
If the activityBuilder has been created from a DynamicActivity it is even better to use the following code:
VisualBasic.SetSettings(activityBuilder,
VisualBasic.GetSettings(dynamicActivity));
If this is not used, namespaces that are only needed for extension methods are not written to the XAML and will lead to an error when loading and executing the XAML.
I summarized my findings on code project.

list problem in c#. how to do this in c#

i have a list of struct
list who have a detail of stuff.
i need a another string info with this list.
so i wrote many function already who is used in my project
so i make a new list
who called stuffdetailedanother
who have a stuffdetailed stuff
and string info;
but when i send it to page using viewdata then he not worked when i use immediate window everything is fine.
are any another way i use ?
or how to pass him to a control
i pass it by a way
controller > View > Partial view
but it is not worked
i got the error
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1519: Invalid token '(' in class, struct, or interface member declaration
Source Error:
Line 347: #line default
Line 348: #line hidden
Line 349: #__w.Write("\r\n </div>\r\n</div>\r\n");
Line 350: }
Line 351:
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2114142c\1d077c0d\App_Web_wishproductlist.ascx.89207646.1grmjmuq.0.cs Line: 349
The problem is that you have a syntax error on line 351 of your ASPX file. Take a closer look at it. If you don't understand why it's not compiling, post the code.
The problem is that the following line:
#__w.Write("\r\n </div>\r\n</div>\r\n");
(Line 349 in App_Web_wishproductlist.ascx.cs) contains a syntax error - probably the # symbol.
Without knowing more context its difficult to know what other advice to give, however hopefully this helps make the error a little clearer.

Categories