How can I configure Web Essentials 2013 to ignore files? - web-essentials

I have a fresh MVC 5.1 web app project in VS 2013 (Update 1) w/ Web Essential 2013 (latest as of today) installed. After building the project, Web Essentials scans for javascript files and post messages to the output window for any issues it finds. For a brand new MVC 5.1 project, it generates over 11,000 messages - not really useful.
I've tried two methods to get it to ignore the offending javascript files that are included with new MVC 5 projects by default:
Used the Web Essentials > Edit Global JSCS Settings command to open the .jscs.json file in my user profile directory. Then modified the "excludeFiles" property to ["test/data/.js", "Scripts/jquery.js"].
Created a .jshintignore file in my Scripts folder with "jquery*.js".
Neither of these methods has had any impact on the JSCS messages generated. Am I doing something wrong, or is this an issue with Web Essentials?

Update 4:
The newest Web Essentials 2013 1.9 has "Better ignore logic for the lint runners", all the problems are cleared. You can turn on "Run on build" now. It has default ignore rule for common js library and minified js. The following excludeFiles config still works, but not necessary anymore.
Update 3:
Cross my post from https://github.com/madskristensen/WebEssentials2013/issues/603.
If you don't need JSHint and JSCS's function, just go to "Tools - Options - Web Essentials - JavaScript", set "Run on build" and "Run on save" to False.
If you wish to use them, keep "Run on build" False, set "Run on save" to True. All js will be JSHint and JSCS while preview, open and save. With this change, you can build successfully without slow down. Error list will only be filled with currently opened js's JSHint and JSCS items.
By default setting, JSHint won't run on all minified and some common js library, but JSCS will run always. While JSCS, it may delay you about serval seconds with minified js. If you don't wanna wait, then go to "Web Essentials - Edit global JSCS settings". Change
"excludeFiles": ["test/data/*.js"],
into
"excludeFiles": ["**/*.min.js", "**/*.debug.js", "**/*.intellisense.js", "**/*-vsdoc.js"],
to skip JSCS only on minified js. Or change to
"excludeFiles": ["**"],
to stop JSCS totally, only keep JSHint running.
Of cause you can write your own rule to exclude those you don't need. Just put double stars at the beginning, use '/' instead of '\', other part just use single star for wildcard. Like "**/Scripts/*.js".
With exclude rule, it will still generate an xml information item for each js, that will be fix later (hopefully), but at last you can start coding.
At last, you can upgrade to 1.8.5, but it only stop "Run on build" from running. "Run on save" still need these settings. So it don't change what I say here.
Hope these informations are right and helpful, with current version of 1.8 and 1.8.5.
Update 1:
Install new version 1.8.5. It will stop "Run on build" function. That means even you turn it on, it will not run on build. But "Run on save True" will still and actually run on preview, open and save. The right relative pattern of excludeFiles is **/Script/**.
So the recommand exclude rule for minified js will be:
"excludeFiles": ["**/Scripts/**.min.js", "**/Scripts/**.debug.js", "**/Scripts/**.intellisense.js", "**/Scripts/**-vsdoc.js"],
Or just use **/Script/** to exclude them all.
The <?xml problem will be fix by next version, according to JSHint/JSCS Errors on .min files and others?. So this pattern should be the final right one, with one problem that should and will be fix by next Web Essentials version. Or maybe next WE will provide a good default excludeFiles rule.
Update 2:
A better one:
"excludeFiles": ["**/*.min.js", "**/*.debug.js", "**/*.intellisense.js", "**/*-vsdoc.js"],
to exclude all minified js no matter where it is.
The easy way I found is go to "Tools - Options - Web Essentials - JavaScript", set Run on Build/Save to False.
Another method is go to "Web Essentials - Edit global JSCS settings", to set excludeFiles.
But multiple excludeFiles is wrong syntax. Should use [ "a", "b"] syntax.
And should use absolute path, (while setting in global?) with path divider '/', '\' is not allowed.
Sub directory is no use, you should specify every single path.
So a valid setting like this:
"excludeFiles": ["C:/Solution/Project/Scripts/*", "C:/Solution/Project/Scripts/kendo/*"]
But this way will generate another Build error per js file:
JSCS parse error: <?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
</checkstyle>
And information item per js file:
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
</checkstyle>
I don't know how to avoid it. So maybe the best way is just the first easy way.

I had the same issue after installing KendoUI. It was basically impossible to run the project. I solved it by going to Web Essentials -> Edit global JSCS settings and adding:
"excludeFiles": ["Scripts/kendo/*"]
below the "excludeFiles": ["test/data/*.js"] entry.
Now the .jscs.json file looks like this:
{
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
"requireLeftStickedOperators": [","],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,
"disallowKeywordsOnNewLine": ["else"],
"excludeFiles": ["test/data/*.js"],
"excludeFiles": ["Scripts/kendo/*"]
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
}
}
Just replace the ["Scripts/kendo/*"] with whatever you want to exclude. Worked like a charm for me.

The excludeFiles option in the .jscsrc is the right way to go but you need to specify it as a full file system path and not a relative path for your project to get it to work. Note the leading forward slash / rather than just the **. You can target more specific folders as well but it seems you need to include the / to get it to work. I suspect you could research node file globbing documentation to really understand the options.
On my machine, with Web Essentials 2013 for Update 2, the following steps disabled JSCS for all files:
Select the Web Essentials Menu->Edit Global JSCS settings (.jscsrc)...
Add "excludeFiles": ["/**"], and save the settings file
Run JSCS manually on the problem JS file or by saving it again (Dependent on Tools->Options->Web Essentials->JavaScript->Linter->Run on save option
It is not necessary to restart Visual Studio.

Web Essentials 2013 Version 2.3 add a new way to deal this problem: .weignore. See http://vswebessentials.com/features/general#weignore or https://github.com/madskristensen/WebEssentials2013/pull/1250. The new way is better then old way, because this is the centralize and consistent place to manage all compilers and linters. And it is faster because the old way will still need to run each target file by compilers and linters, and then ignored by them. New way will just ignore from Web Essentials itself, reduce the time/CPU/disk that runs into compilers and linters. And no need to understand each compilers and linters specific config format to do the same thing.

Related

Disable file output of hydra

I'm using hydra to log hyperparameters of experiments.
#hydra.main(config_name="config", config_path="../conf")
def evaluate_experiment(cfg: DictConfig) -> None:
print(OmegaConf.to_yaml(cfg))
...
Sometimes I want to do a dry run to check something. For this I don't need any saved parameters, so I'm wondering how I can disable the savings to the filesystem completely in this case?
The answer from Omry Yadan works well if you want to solve this using the CLI. However, you can also add these flags to your config file such that you don't have to type them every time you run your script. If you want to go this route, make sure you add the following items in your root config file:
defaults:
- _self_
- override hydra/hydra_logging: disabled
- override hydra/job_logging: disabled
hydra:
output_subdir: null
run:
dir: .
There is an enhancement request aimed at Hydra 1.1 to support disabling working directory management.
Working directory management is doing many things:
Creating a working directory for the run
Changing the working directory to the created dir.
There are other related features:
Saving log files
Saving files like config.yaml and hydra.yaml into .hydra in the working directory.
Different features has different ways to disable them:
To prevent the creation of a working directory, you can override hydra.run.dir to ..
To prevent saving the files into .hydra, override hydra.output_subdir to null.
To prevent the creation of logging files, you can disable logging output of hydra/hydra_logging and hydra/job_logging, see this.
A complete example might look like:
$ python foo.py hydra.run.dir=. hydra.output_subdir=null hydra/job_logging=disabled hydra/hydra_logging=disabled
Note that as always you can also override those config values through your config file.

unable to launch custom brackets.exe

I have created a desktop app using brackets-shell version sprint-38. I have done the following changes.
config.h -changed APP_NAME from 'Brackets' to 'MyBrackets'.
appshell_config.gypi - changed appname from 'Brackets' to 'MyBrackets'.
Gruntfile - changed build.name from 'Brackets' to 'MyBrackets'.
After building brackets-shell with these changes i used to get 'MyBrackets.exe'
inside brackets-shell/release folder.
while executing the exe one file chooser popup comes, and node & MyBrackets.exe processes will start in the background.
his works fine with Sprint38,But after migrating to brackets-shell tag version release-1.3 or master, this dose not work. The file chooser is not coming as well as no node process starts.
Is any thing i am missing with the latest release ?
Bingo!!!
I got the problem. actually xcopy command is not generating properly in MyBrackets.vscsproj file. and this is well know problem i think so. To fix this problem one fix-msvc.sh file has written.
Since brackets.vscsproj name is hardcoded here so changes is not reflecting in my MyBrackets.vscsproj

Can't deploy precompiled, merged webapp to Azure

I'm trying to deploy an ASP.NET web application to Azure. It's hybrid Web Forms, MVC, and WebAPI, and there are a TON of aspx/ascx files, such that they really need to be precompiled or every deploy will render the site sluggish for awhile.
I am trying to deploy via SCM integration with GitHub via kudu, with precompiled views, all merged to a single assembly.
Note that:
Deploy works fine with precompilation disabled.
Deploy works fine from Visual Studio
Build works fine if I copy the msbuild command from the Azure log, replace the relevant paths, and run it locally on my Windows 8.1 machine.
I've set up the Advanced Precompile settings as:
Don't allow precompiled site to be udpatable
Don't emit debug information
Merge all pages and control outputs to a single assembly = AppViews.dll
Here's the .deployment file for Azure
[config]
project = WebSite/WebSite.csproj
SCM_BUILD_ARGS=/p:Configuration=Release;PublishProfile=azure-prod /v:n
You notice I'm sending the verbosity /v to "normal" for extra diagnostic information.
Here is info I get toward the tail of the deployment log:
AspNetPreCompile:
D:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v \ -p D:\home\site\repository\WebSite\obj\Release\AspnetCompileMerge\Source -c D:\home\site\repository\WebSite\obj\Release\AspnetCompileMerge\TempBuildDir
GenerateAssemblyInfoFromExistingAssembleInfo:
Creating directory "obj\Release\AssemblyInfo".
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /out:obj\Release\AssemblyInfo\AssemblyInfo.dll /target:library Properties\AssemblyInfo.cs
AspNetMerge:
Running aspnet_merge.exe.
D:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\aspnet_merge.exe D:\home\site\repository\WebSite\obj\Release\AspnetCompileMerge\TempBuildDir -w AppViews.dll -copyattrs obj\Release\AssemblyInfo\AssemblyInfo.dll -a
aspnet_merge : error 1003: The directory 'D:\home\site\repository\WebSite\obj\Release\AspnetCompileMerge\TempBuildDir' does not exist. [D:\home\site\repository\WebSite\WebSite.csproj]
Done Building Project "D:\home\site\repository\WebSite\WebSite.csproj" (Build;pipelinePreDeployCopyAllFilesToOneFolder target(s)) -- FAILED.
Build FAILED.
It looks like aspnet_compiler.exe runs, but doesn't do what it's supposed to, which is why the TempBuildDir directory (supposed to be the output of the compiler) does not exist in time for the AspNetMerge target. Contrast that with my system, where that directory DOES in fact exist, containing the marker aspx/ascx/etc. files, static content, a PrecompiledApp.config file, and a whole mess of stuff in the bin directory.
aspnet_compiler.exe has an -errorstack flag but it's not clear to me how I could get MSBuild to add this just via the .deployment file, or even if that app is really even throwing an error.
I could just deploy via Visual Studio, but I would really like to take advantage of the SCM integration so I can just push to my prod branch and let it go. Any suggestions?
I replied on https://github.com/projectkudu/kudu/issues/1341, but copying my answer here in case someone lands here...
Way back, we had found that aspnet_compiler.exe was not working within Azure Websites due to how it dealt with the profile folder. We made a change at the time that's a bit of a hack but got us going: we turned it into a no-op, by pointing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\aspnet_compiler.exe to our own dummy exe (D:\Program Files (x86)\aspnet_compiler\KuduAspNetCompiler.exe).
But trying it now, it appears to work correctly today, likely thanks to improvements in the Azure Websites hosting environment. So we will try getting rid of this hack and doing a full test pass to make sure it doesn't cause any major regressions. If all goes well, we can get that into production, which should enable those scenarios.
In the short term, you may be able to work around this by having your build script:
copy aspnet_compiler.exe from D:\Windows\Microsoft.NET\Framework\v4.0.30319 into your own site files, but under a different name (e.g. aspnet_compiler2.exe)
convince msbuild to use that one
Note: This GitHub issue on projectkudu will eventually make this solution obsolete, but for the meantime, that issue is filed as Backlog, and this works right now.
Thank you thank you David Ebbo. With this information, I was able to bootstrap my build to work for the short term.
First, I downloaded the aspnet_compiler.exe from the Azure instance using the Diagnostic Console available at https://{WEBSITE_NAME}.scm.azurewebsites.net/DebugConsole and added that to my own repository. This way there's no question about any difference between 32/64-bit, etc. I renamed it to azure_aspnet_compiler.exe in my repository.
Second, the AspNetCompiler task doesn't give you the option to change the tool name. It's hardcoded, but as a virtual property so it's overrideable. So I had to create my own task class, and package it in its own assembly, which I built in Release mode and also included in my repository.
public class AzureAspNetCompiler : Microsoft.Build.Tasks.AspNetCompiler
{
private string _toolName = "aspnet_compiler.exe";
protected override string ToolName
{
get { return _toolName; }
}
public string CustomToolName // Because ToolName cannot have a setter
{
get { return _toolName; }
set { _toolName = value; }
}
}
Next I needed to replace the AspNetPreCompile task in MSBuild, but I couldn't figure out how to do that directly. But that task wasn't doing anything anyway, so why not just run right after it?
I added this to the top of my Website.csproj file to import the DLL containing the AzureAspNetCompiler class. Note that the path is relative to the Website.csproj file I'm editing.
<UsingTask TaskName="AzureBuildTargets.AzureAspNetCompiler"
AssemblyFile="..\DeploymentTools\AzureBuildTargets.dll" />
Then I added this right below it, which is basically stealing the MSBuild target definition of AspNetPreCompile from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets, with some of the property setting stuff near the top of it left out (because the original task will do that for us anyway.) Just take note of the ToolPath and CustomToolName values at the bottom of the (renamed) AzureAspNetCompiler element.
<PropertyGroup>
<!--Relative to solution root apparently-->
<LocalRepoDeploymentTools>.\DeploymentTools</LocalRepoDeploymentTools>
<AzureAspnetCompilerPath>$([System.IO.Path]::GetFullPath($(LocalRepoDeploymentTools)))</AzureAspnetCompilerPath>
</PropertyGroup>
<Target Name="NoReallyAspNetPreCompile" AfterTargets="AspNetPreCompile">
<AzureAspNetCompiler
PhysicalPath="$(_PreAspnetCompileMergeSingleTargetFolderFullPath)"
TargetPath="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)"
VirtualPath="$(_AspNetCompilerVirtualPath)"
Force="$(_AspNetCompilerForce)"
Debug="$(DebugSymbols)"
Updateable="$(EnableUpdateable)"
KeyFile="$(_AspNetCompileMergeKeyFile)"
KeyContainer="$(_AspNetCompileMergeKeyContainer)"
DelaySign="$(DelaySign)"
AllowPartiallyTrustedCallers="$(AllowPartiallyTrustedCallers)"
FixedNames="$(_AspNetCompilerFixedNames)"
Clean="$(Clean)"
MetabasePath="$(_AspNetCompilerMetabasePath)"
ToolPath="$(AzureAspnetCompilerPath)"
CustomToolName="azure_aspnet_compiler.exe"
/>
<!--
Removing APP_DATA is done here so that the output groups reflect the fact that App_data is
not present
-->
<RemoveDir Condition="'$(DeleteAppDataFolder)' == 'true' And Exists('$(_PostAspnetCompileMergeSingleTargetFolderFullPath)\App_Data')"
Directories="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)\App_Data" />
<CollectFilesinFolder Condition="'$(UseMerge)' != 'true'"
RootPath="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)" >
<Output TaskParameter="Result" ItemName="_AspnetCompileMergePrecompiledOutputNoMetadata" />
</CollectFilesinFolder>
<ItemGroup Condition="'$(UseMerge)' != 'true'">
<FileWrites Include="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)\**"/>
</ItemGroup>
With this in place, everything works as I would expect it to.

Flex Localization: Could not find compiled resource bundle

I tried every solution i found in the internet.
Im using flex 4.5, This is what im doing:
created directory locale/en_US in my src directory
add resources.properties file to that directory with some mappings.
add -locale en_US -source-path=./locale/{locale} -allow-source-path-overlap=true to the compile args.
checked in the framework that the en_US locale directory appear.
add metadata:
<fx:Metadata>
[ResourceBundle("resources")]
</fx:Metadata>
starting the app gives me the exception:
Error: Could not find compiled resource bundle 'resources' for locale 'en_US'.
This is some of the main solutions i tried:
uncheck "Remove unused RSLs" from the build path.
add the directory as a source path.
using the argument -include-resource-bundles and give my directory here (with using the argument -resource-bundle-list to get all bundles).
Any idea what else can i do?
Here is my structure for a mobile app (Android and iOS):
In src/locale I have 3 subdirs: de_DE, en_US, ru_RU
And in compiler options: -locale=ru_RU,en_US,de_DE -source-path=locale/{locale}
For another mobile app I have:
In src/locale 4 subdirs: en_US, hr_HR, sr_RS, sl_SI.
I had to add the latter 3 dirs with copylocale command.
And in compiler options: -locale hr_HR sr_RS sl_SI en_US -allow-source-path-overlap=true
Both apps work well for me with the latest Apache Flex SDK.
Here is the contents of a src/locale/hr_HR/recources.properties file:
# resources.properties file for locale hr_HR
navbar.tables=Stolovi za igranje:
navbar.all=Svi
navbar.vacant_long=Slobodni
navbar.vacant_short=Slb.
navbar.full_long=Su puni
navbar.full_short=Su puni
comments.good_long=dobri
comments.good_short=Dbr.
comments.bad_long=loši
comments.bad_short=loši
comments.without_long=neutralni
comments.without_short=ntr.
help.title=Pomoć
OK i found a solution here:
http://www.nbilyk.com/flex-localization-example
im really not sure why it should be that difficult.
anyway, if someone ever need a help with that. after you successfully compile the file using ant (like described in the link), if you want to load it dynamcally like i needed just use (for example):
resourceManager.localeChain = ["en_US", "es_ES"];
resourceManager.loadResourceModule("Resources_en_US.swf");
resourceManager.loadResourceModule("Resources_es_ES.swf");
worked well for me, no need to add anything to the compiler args for that solution.
Try using the fully qualified directory path name. If you're using ant you can use ${basedir}/src/locale/{locale}

Compile error in empty cocos2d 2.0 (iPhone)

When I try to compile new cocos2d+box2d project in xcode4.
I got error message like:
/Users/bla-bla/Cocos2d testing/Cocos2d testing/libs/cocos2d/CCDirector.h:32:9: fatal error: 'kazmath/mat4.h' file not found [2]
/Users/bla-bla/Cocos2d testing/Cocos2d testing/libs/cocos2d/CCNode.h:37:9: fatal error: 'kazmath/kazmath.h' file not found [2]
File I checked, what is wrong?
This is caused by having a space in the path name to your project. To work around this, you'll need to add the following under your project's configuration... in Build Settings, in the group of Search Paths, set the Header Search Paths to the following value:
"${SRCROOT}/Cocos2d testing/libs/kazmath/include"
Be sure to include the double-quotes.
did you check in Finder to see if there is a real folder named kazmath in the same path as where CCNode is ? if not, there is probably a flaw in the templates install script for that version of coco. But dont rely on the 'tree view' of the Xcode project navigator to really know whether a file is present or not. If the path is wrong in the include, suggest you report it to the coco team. You could temporarily fix the import statements to get going, but that would be throw-away code :) when coco issues another release candidate, presumably fixed.
Ensure you are editing the right header search paths for the right target. 1 hour of my life wasted editing the main project or the app rather than the test!

Resources