About jontas

I like to make things that people find useful.

CrystalReports supress if field is empty

In order to supress (for instance a section) when a field is empty, mark the section as suppress, open the “Section expert” and click the pen next to “Supress” and then enter when to supress like:

{MyTable.MyField} = '' OR IsNull({MyTable.MyField})

This example will supress the field wither if it is an empty string or DBNull

MSTest on build-server

Keept getting errormessages like the following

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): 
warning MSB3245: 
Could not resolve this reference. 
Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". 
Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

Turns out there is a simpler solution than installing Visual Studio on the build-server.
there is a nuget package that resolves this error

PM> Install-Package Microsoft.VisualStudio.QualityTools.UnitTestFramework.Updated

Web.Config use a defaultdocument from a subfolder

Using a default document located in a subfolder is easy, just fill in the path to the document, and it will be used (The path and document name will not be displayed in the browser).

<system.webServer>
  <defaultDocument enabled="true">
    <files>
      <clear/>
      <add value="path/to/page.ashx"/>
    </files>      
  </defaultDocument>
</system.webServer>

Grep from files matching a name in a directory

To look only at files matching a certain name (or part of a name) -name or -iname can be used.

-name pattern Base of file name (the path with the leading directories removed) matches shell pattern pattern. Because the leading directories are removed, the file names considered for a match with -name will never include a slash, so `-name a/b’ will never match anything (you probably need to use -path instead). The metacharacters (`*’, `?’, and `[]’) match a `.’ at the start of the base name (this is a change in findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a directory and the files under it, use -prune; see an example in the description of -path. Braces are not recognised as being special, despite the fact that some shells including Bash imbue braces with a special meaning in shell patterns. The filename matching is performed with the use of the fnmatch(3) library function. Don’t forget to enclose the pattern in quotes in order to protect it from expansion by the shell.

-iname pattern Like -name, but the match is case insensitive. For example, the patterns `fo*’ and `F??’ match the file names `Foo’, `FOO’, `foo’, `fOo’, etc. The pattern `*foo*` will also match a file called ‘.foobar’.

$ find /path/to/search/in/ -iname '201512*' -type f -print0 | xargs -0 grep "LookForString"
/path/to/search/in/20151209-000855.LOG:2015-12-09 08:01:15 LookForString is in this file
/path/to/search/in/20151219-001855.LOG:2015-12-19 23:15:47 LookForString is also in this file

AnkhSVN “No uncommitted changes” but nothing is shown in the log and update does not solve the warning

When doing a merge using AnkhSVN and doing “pre-merge best practices check” the error message “No uncommitted changes” is shown this means that the working copy is not updated or has changes that are not commited.

However sometimes this error can be shown even when the pending changes window in Visual Studio is empty and you have done update to Latest version. (Most likely there are files that Subversion see as missing or Deleted but that are not shown in the pending changes window)

The solution I use when this happens is to open the working copy folder and use TortoiseSVN to see what is going on and then solve things so that TortoiseSVN shows nothing in the pending changes.

Also from the console “svn status -q” can be used to see what files have changes. (-q means that we only would like status on files that are under version control.