How to use global variable in razor file in nancyfx framework - razor

How can I use a global defined variable in NancyFX Framework to be used in a HTML (Razor) Template file?
Is it the right place to add those variables in app.config?
How do I access it in the HTML Template files then?

Related

generate a variable in index.html variable in flutter web

Is there any way that I can generate the index.html file with a global variable for example a base URL using flutter.so that if I change it in the index.html file later on, it will use the same value through out the app. For example if I have a string variable with a base URL value and it is used in URLs as a base and after creating the build if I change it in index.html file, It starts using the new value of it thoroughly. So, that I won't have to go to the dart code again and again?

Use of undefined constant SERVICE_HTTP_PATH - assumed 'SERVICE_HTTP_PATH' in YII2

SERVICE_HTTP_PATH is not getting recognised although it has been added into the XML file which contains this for web service URL.Do I need to include the XML file in the controller? If yes then how?
The problem was because I was trying to use Zend format along with YII2. Actually there is no config.inc.in file in Yii2 so we have to read the properties of the XML file using different functions and run a foreach on it so as to achieve the desired URL value.

How to get the namespace of t4 template

I'm working on a code generation with T4 template. I'm generating multiple .cs files by one template and i need to write correct namespace for this files. Namespace depends on the template location.
How can i get the template namespace for generated .cs files?
I know the only one way to do this - explicit setted property "Custom Tool Namespace" for the template and then get this property via EnvDTE assembly. But this way is not ok for me, cause i need a locate a lot of copies this template for generate files in different propjects and i want to get namespace dynamically by the template location.
Can anyone help me?
Can you use EnvDTE's FileCodeModel to get the relative path of your template; and then use that to build your outputted namespaces?
You might want to browse through this post: http://t4-editor.tangible-engineering.com/blog/walking-the-visual-studio-code-model-with-t4-template.html

struts2 namespace name issue

Hi i am using struts2 and hibernate in my project. I need to use a namespace for my admin section so that i have used the namepace as companyAdmin and i have created a folder inside the web folder named companyAdmin and it is worked fine. But when i delete the folder companyAdmin from the web folder the struts show an error error message when trying to access the namespace. Is there a folder with name as namespace name is a must in struts2 for using the namespace. Also i can't able to use the namespace as "admin" even though i have created a folder in the web folder with a name admin.
Please be clear that Struts2 namespace is nothing related to folder/any other resource in your web-application.
Namespace inside Struts2 subdivides action configurations into logical modules, each with its own identifying prefix.Namespaces avoid conflicts between action names.
This is what doc say about namespace
Namespaces are not a path!
Namespace are not hierarchical like a file system path. There is one namespace level. For example if the URL /barspace/myspace/bar.action is requested, the framework will first look for namespace /barspace/myspace. If the action does not exist at /barspace/myspace, the search will immediately fall back to the default namespace "". The framework will not parse the namespace into a series of "folders". In the Namespace Example, the bar action in the default namespace would be selected.
I suggest you to go through the official documentation of Namespace to get an idea what they are and how they work inside S2
namespace-configuration

Classes generated by XML Data Generator Tool are not contained within the specified namespace

I have the same problem as described in this connect issue
http://connect.microsoft.com/VisualStudio/feedback/details/577382/classes-generated-by-xml-data-generator-tool-are-not-contained-within-the-specified-namespace
"An XSD file using the XML Data Generator Tool within a C++/CLI project will create a set of classes that are NOT within a namespace. The classes should be within the namespace specified by the Namespace property of the XML Data Generator Tool. This was detected when upgrading a VS2008 project to VS2010."
I see the /namespace option is on the command line of the XML Data Generator tool but still it does not write the namespace.
In VS 2008
// This source code was auto-generated by xsd, Version=2.0.50727.3038.
//
namespace IOLib {
using namespace System;
ref class CPDS;
In VS 2010
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
using namespace System;
ref class CPDS;
Is there a way to force xsd tool to write the namespace too.
for xsd.exe the parameter /n: is used to specify the namespace. Don't put a space between the parameter and the value.
Example:
xsd myschema.xsd /c /n:MyNamespace
Visual Studio uses MSBuild to build the targets specified in the solution. They seem to be abandoning C++ in favor of VB and C#. VS 2010 uses settings in
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets`
file. The XSD section is missing an entry namely "Namespace". I set mine to
Namespace ="%(Xsd.Namespace)"
and compliled the xsd and the classes are now in the namespace I specify in the projects property pages.