When applying the Twig filter "localizednumber", the following error is thrown:
Unknown "localizednumber" filter in MyBundle:Home:home.html.twig at line 558.
I have installed Twig Extensions as well as PHP Intl.
What could be the issue here?
Did you declare the Intl Extension in your services?
If not, add this:
<service id="twig.extension.intl"
class="Twig_Extensions_Extension_Intl">
<tag name="twig.extension" />
</service>
in your app/config/services.xml.
Related
In an azure devops pipeline I try to run an appcmd command to modify the applicationhost.config file to set the ASPNETCORE_ENVIRONMENT variable
It works fine like this:
appcmd set config -section:system.applicationHost/applicationPools /+"[name='api.hostname.net'].environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='api.hostname.net']"
The problem is that this appcmd command works the first time, but as soon as the environment variable already exist it will throw an error message. Can I somehow ignore errors from appcmd? Or only add the environment variable if it does not exist from before?
I'm running appcmd commands using an azure devops IISWebAppManagementOnMachineGroup#0 task.
You can try to use XML transformation option in the IIS web deploy task. XML transformation supports transforming the configuration files (*.config files) and is based on the environment to which the web package will be deployed.
Transform file sample:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<aspNetCore ...>
<environmentVariables>
<environmentVariable xdt:Transform="Replace" xdt:Locator="Match(name)" name="ASPNETCORE_ENVIRONMENT" value="xxx" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
For details ,please refer to this document.
I have a similar requirement, and I have to scriptize these commands, so any UI-based method doesn't work for me. Provide my solution here.
I want to update an existed key named PasswordChangeEnabled which is located in appSettings section.
<appSettings>
<add key="PasswordChangeEnabled" value="false" />
</appSettings>
If I use set config with plus /+
appcmd set config "Site" /section:appSettings /+"[key='PasswordChangeEnabled',value='true']"
I will get an error message:
ERROR (Cannot add duplicate collection entry of type 'add' with unique
key attribute 'key' set to 'PasswordChangeEnabled')
So I changed the syntax to just modify the value:
appcmd set config "Site" /section:appSettings /"[key='PasswordChangeEnabled'].value:true"
This way worked for me.
Here is my configuration file :
<configuration>
<jdbc>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/db</url>
<user>myuser</user>
<password>mypwd</password>
</jdbc>
<generator>
<database>
<name>org.jooq.util.postgres.PostgresDatabase</name>
</database>
<generate>
<pojos>true</pojos>
<daos>true</daos>
</generate>
<target>
<packageName>com.myproject.gen</packageName>
<directory>src/main/java</directory>
</target>
</generator>
</configuration>
It used to work but now I have the following error :
The <generator/> tag is mandatory
I use jOOQ 3.8.2
Any idea ?
I had the same problem. Found that in JOOQ > 3.8 the encoding in target tag is mandatory.
Try to add the <encoding> in the <target> tag, i.ex. <encoding>UTF-8</encoding>
I was able to fix this in my code. Make sure the code gen library matches the xsd version. See my example
Im using Azure SDK 2.5
I have a web role in a cloud service project. I would like to add a folder in some fashion such that it is deployed in the parent directory of the approot. I havent found a way to do this which kind of makes me wonder what use is the ability to define virtual directories in csdef.
So I thought I would try adding folders via the Contents/Content xml config in the csdef. I am either fundamentally misunderstanding what this bit of config does or its hopelessly broken.
Assuming this folder structure
/
/CloudService
/SomeOtherContent
If I define the following:
<Contents>
<Content destination="frontend">
<SourceDirectory path="..\SomeOtherContent" />
</Content>
</Contents>
and build I get:
error CloudServices089: Cannot find the source directory
'C:\src\template\src\Template.CloudService\bin\Debug\..\SomeOtherContent'
Ok so its starting the bin\Debug, so I'll just make it ..\..\..\SomeOtherContent
error CloudServices089: Cannot find the source directory
'C:\src\template\src\Template.CloudService\..\..\..\SomeOtherContent'
Yes thats right, the folder at which my relative path is resolved has changed!!! Its no longer bin\Debug. Wtf!? How can this be made to work? It works if i enter a full drive qualified absolute path.
So I solved this by having MSBuild resolve the path and push it in to an environment variable which I called FrontendDir.
<Contents>
<Content destination="frontend">
<SourceDirectory path="%FrontendDir%" />
</Content>
</Contents>
and in the ccproj I added:
<UsingTask
TaskName="SetEnvironmentVariableTask"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll">
<ParameterGroup>
<Name ParameterType="System.String" Required="true" />
<Value ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Environment.SetEnvironmentVariable(Name, Value);
]]>
</Code>
</Task>
</UsingTask>
<Target Name="BeforeBuild" Condition=" '$(FrontendDir)' == '' ">
<Message Text="Setting Project Dir" Importance="high" />
<SetEnvironmentVariableTask Name="FrontendDir" Value="$(ProjectDir)\..\Template.FrontEnd\dist" />
</Target>
Its preferable to put the entire path into the env var here as you can then override it easily in your different build scenarios by overriding the value (eg. /p:FrontendDir="c:\foo")
So that works and works fairly well. I still say the behaviour I was seeing before with the relative path resolution changing folders is... broken. It just doesn't work with relative paths in any usable way.
You are seeing the same error but from different msbuild targets.
The first error (when using ..\..\) is thrown at PreValidateServiceModel which passes in the Source location and checks the path
ServiceDefinitionFile="#(SourceServiceDefinition)"
ServiceConfigurationFile="#(SourceServiceConfiguration)"
C:\src\Azure\ServiceDefinition.csdef : error CloudServices089: Cannot
find the source directory 'C:\src\Azure\..\..\Installers\' in role
WebHost. [C:\src\Azure\Azure.ccproj]
Done building target "PreValidateServiceModel" in project "Azure.ccproj" -- FAILED.
The second error is thrown at ValidateServiceFiles which passes in the Target location
ServiceDefinitionFile="#(TargetServiceDefinition)"
ServiceConfigurationFile="#(TargetServiceConfiguration)">
C:\src\Azure\bin\Release\ServiceDefinition.csdef : error CloudServices089: Cannot
find the source directory
'C:\src\Azure\bin\Release\Installers\'
in role WebHost. [C:\src\Azure\Azure.ccproj]
Done building target "ValidateServiceFiles" in project "Azure.ccproj" -- FAILED.
If you reflect on C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\bin\ServiceDescription.dll you can see the ProcessRoleContents method doing the validation but using the SourceFile to resolve the location.
One option is to make sure the target folder exists (even if empty) before the build starts.
It would be better if the PreValidation resolved the path and when the Target is saved, it had the full path.
I ended up editing the ccproj, and adding this
<Target Name="BeforeAddRoleContent">
<ItemGroup>
<AzureRoleContent Include="Installers\">
<RoleName>Azure</RoleName>
<Destination></Destination>
</AzureRoleContent>
</ItemGroup>
</Target>
Referencing runtime content from .ccproj (Azure SDK 2.9)
I am getting following error :
Class 'Lucky_Test_Helper_Data' not found in E:\wamp\www\raj\magento_new\app\Mage.php on line 521
I created this module using module creator.
I checked it with one of my magento installation, it worked fine. Then I copied the module to the actually installation where I wanted to use it.
I did a some debugging, and found that if I comment certain part of config.xml I get no error.
I figured that out after having a look at stack trace of error, which included following line.
include( 'E:\wamp\www\raj\magento_new\app\design\adminhtml\default\default\template\page\menu.phtml' );
here is my config.xml
now if I comment :
<!--<test module="test">
<title>Test</title>
<sort_order>71</sort_order>
<children>
<items module="test">
<title>Manage Test </title>
<sort_order>0</sort_order>
<action>test/adminhtml_test</action>
</items>
</children>
</test>-->
I get no error. Module seems to be loading fine till this point.
Do you see anything wrong?
Help me out.
You have to explicitly define that you are using helpers, like this:
<global>
<helpers>
<test>
<class>Lucky_Test_Helper</class>
</test>
</helpers>
</global>
In the menu you define with module="test" that your module handles the translation for it
How to search for files containing a particular text string using MSBuild?
Thanks guys! I appreciate all of your quick replies!
I've try Grep but I need to read the xml file to see the result.
I've just found out that we can use the task FilterByContent in MSBuild Extension Pack which gives us a direct result in properties & items. I'd like to share it back to you in case you may need it. An example of usage is as below:
<Target Name="ttt">
<ItemGroup>
<files Include="d:\temp\test\**" />
</ItemGroup>
<MSBuild.ExtensionPack.FileSystem.File TaskAction="FilterByContent" RegexPattern="abbcc" Files="#(files)" >
<Output TaskParameter="IncludedFileCount" PropertyName="out"/>
</MSBuild.ExtensionPack.FileSystem.File>
<Message Text="ttt:$(out)" />
</Target>
Nam.
You can find a "grep" task in the MSBuild Contrib project on CodePlex. Haven't used it myself though.
It's not clear whether you want to search of the text in the name or in the file itself.
If you simply want a list of files that their name match particular (simple) criteria I would suggest using the ItemGroup like this:
The Grep taks from the MSBuild Contrib project would look like this
<PropertyGroup>
<MSBuildContribCommonTasksAssembly>$(MSBuildExtensionsPath)\MSBuildContrib\MSBuildContrib.Tasks.dll</MSBuildContribCommonTasksAssembly>
</PropertyGroup>
<UsingTask TaskName="MSBuildContrib.Tasks.Grep" AssemblyFile="$(MSBuildContribCommonTasksAssembly)" Condition="Exists('$(MSBuildContribCommonTasksAssembly)')" />
<ItemGroup>
<FilesToSearch Include="**\*.cs" />
</ItemGroup>
<!-- very simple search -->
<Grep InputFiles="#(FilesToSearch )" OutputFile="out.xml" Pattern="Error" />
<!-- slightly more complicated search (search and extract info) -->
<Grep InputFiles="#(FilesToSearch )"
OutputFile="out.xml"
Pattern="// (?'Type'TODO|UNDONE|HACK): (\[(?'Author'\w*),(?'Date'.*)\])? (?'Text'[^\n\r]*)" />
The Grep task will generate the out.xml file that can subsequently be used to read information from it and use in the build process.