Possible to add attributes via NcML to non-cached THREDDS datasets? - ncml

For several years on our THREDDS Data Server (TDS) we've been happily using the cache="false" functionality on datasetRoot to tell the TDS not to cache several netcdf files.
<service name="allServices" serviceType="Compound" base="">
<service name="ncdods" serviceType="OpenDAP" base="/thredds/dodsC/"/>
<service name="HTTPServer" serviceType="HTTPServer" base="/thredds/fileServer/"/>
<service name="iso" serviceType="ISO" base="/thredds/iso/"/>
<service name="uddc" serviceType="UDDC" base="/thredds/uddc/"/>
</service>
<datasetRoot path="FVCOM" location="/http/www/CODFISH/Data/FVCOM/" cache="false"/>
<dataset name="NECOFS GOM2 Forecast" ID="gom2_nocache" serviceName="allServices"
urlPath="FVCOM/NECOFS/Forecasts/NECOFS_GOM2_FORECAST.nc" dataType="Grid"/>
The reason we don't want to ever cache these files is that every day these daily forecast files get overwritten with files that have the same name, but different data.
But now we have a need to add and modify the attributes of these datasets. In particular, we would like to add the global attribute
<attribute name="cdm_data_type" value="any"/>
Can we modify attributes via NcML when the dataset to be modified is contained in this kind of datasetRoot construct?

Related

TF401262: Value of long text field System.Description exceeds the maximum length allowed length of 1048576

We are using TFS 2017 update 1 (on premise install). When I try to paste a large number of HTML tables and lots of text into the Description field, I get the following error:
TF401262: Value of long text field System.Description exceeds the maximum length allowed length of 1048576.
Can I change this limit ?
I had the same kind of necessity, so I tried a little bit harder...
This is my tfs database (Tfs_Dev):
I executed this procedure to add a registry value in TFS configuration:
EXEC [dbo].[prc_SetRegistryValue]
#partitionId=1,
#key='#\Service\WorkItemTracking\Settings\MaxLongTextSize\',
#value='2000000000'
I could find this solution after looking in TFS source code, thanks to a great tool named dnspy
You can find the specific TFS dll in a path similar to C:\Program Files\Microsoft Team Foundation Server 15.0\Application Tier\Web Services\bin\Microsoft.TeamFoundation.WorkItemTracking.Server.dll
Tested and cannot reproduce this issue on my side. But obviously it has the limitation for the maximum allowed length.
Generally String fields take a max of 255 characters. PlainText/HTML will take a max of 32K. If it crosses this limits, you can opt to store it to a file and add it as an attachment.
However you can try to change the limit by editing the web.config of the TFS site follow the instruction mentioned in this article : Easy Ways to Upload and Validate Large Files in ASP.NET
If you use IIS7 and you want to upload files larger than the
restricted 30000000 bytes or 28.6 MB, you can add the following code
to your web.config file in order to set that value to 100 MB:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
</system.webServer>
If that still not work then please share the steps to reproduce the issue, especially for the "large number of HTML tables and lots of text" you mentioned (You can store the strings in a file e.g word if it's too large then share the file in Onedrive or another site we can access).

Adding a datamodule to the delphi object repository

I am using D10 Pro. I added a datamodule to the object repository by right clicking it and selecting "Add to Repository" on the popup menu.
The datamodule shows up in the New>Other dialog and I am able to click the icon for it. When I do, I get the following exception: "Unable to find both a form () and source file (). The same exception occurs with forms I place there. The object that came with Delphi load without any problem. How do I fix this?
When adding items to the repository, you should avoid using dotnet style names for your files. For example, I originally named the file "MyLib.Datamodule.TextImporter.pas" and I received the error in my question. I experienced the same problem with a form using the same dotnet style naming. After changing the file name to "TextImporterDatamodule.pas" and adding it to the repository, I was able to use it to create new datamodules without a problem. This is something Embarcadero needs to address.
I can't answer your q, but maybe this will help you track down your problem.
Contrary to what the DocWiki says for Seattle, the repository .Xml file is actually named "Repository.Xml" and in my case is located here:
C:\Users\MA\AppData\Roaming\Embarcadero\BDS\17.0\Repository.Xml
I added a data module to it, resulting in the entry shown below being added.
Notice that for a datamodule, the path to it is stored in its IDString
attribute along with the filename, unlike a form, where the path+name is stored
in the the Value attribute of the FormName node.
With that entry in place, unlike you I can then include a copy of it in a project
by going to File | New | Other in the IDE. However, if I then change the
on-disk name of the folder where the item is located, and try to use it, I get the error
message you quoted. Of course, that doesn't mean that's why you're getting
it, but I thought it might help to see the repository entry for something that's known to work.
<Item IDString="D:\Delphi\Code\SO\Devex\DM1" CreatorIDString="BorlandDelphiRepositoryCreator">
<Name Value="AAADataModule"/>
<Icon Value=""/>
<Description Value="MA datamodule"/>
<Author Value="MA"/>
<Personality Value="Delphi.Personality"/>
<Platforms Value=""/>
<Frameworks Value=""/>
<Identities Value="RADSTUDIO"/>
<Categories>
<Category Value="InternalRepositoryCategory.MyCategory" Parent="Borland.Delphi.NewFiles">MyCategory</Category>
<Category Value="Borland.Delphi.NewFiles" Parent="Borland.Delphi.New">Delphi Files</Category>
<Category Value="Borland.Delphi.New" Parent="Borland.Root">Delphi Projects</Category>
</Categories>
<Type Value="FormTemplate"/>
<Ancestor Value=""/>
<FormName Value=""/>
<Designer Value="Any"/>
</Item>
If this doesn't help, best I can suggest is to post your q in the IDE section
of EMBA's newsgroups here:
https://forums.embarcadero.com/forum.jspa?forumID=62
I don't think that should provoke cross-posting complaints, seeing as your q has been up here for a while without getting a definitive answer.

Specify directory for Serilog rolling file path

Consider this app.config appSetting entry:
<add key="serilog:write-to:RollingFile.pathFormat"
value="ServerServiceApp-{Date}.log" />
This is done at app startup:
Log.Logger = new LoggerConfiguration()
.ReadFrom.AppSettings()
.Enrich.WithThreadId()
.CreateLogger();
This is in a Windows service app. The log file ends up here:
C:\Windows\SysWOW64
Clearly, we’d rather have the log file end up in the same directory that houses this service’s .exe (customers don’t want us writing stuff to SysWOW64). But how?
We need the ReadFrom.AppSettings in there so that the customer can supply serilog settings in the app.config, as necessary.
Is there some way to change the directory used for the log file after the ReadFrom.AppSettings has been done?
Would be awesome if we could say something like:
<add key="serilog:write-to:RollingFile.pathFormat"
value="{ApDomainBaseDirectory}\ServerServiceApp-{Date}.log" />
(And where is {Date}, which can be put in the file path, documented?)
Just put this before the creation of LoggerConfiguration:
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
Then File.path will be constructed based on the project root path.
The best place for services to write their logs is %PROGRAMDATA% which, by default, is in C:\ProgramData\.
Try:
<add key="serilog:write-to:RollingFile.pathFormat"
value="%PROGRAMDATA%\ServerService\Logs\log-{Date}.txt" />
(Program Files is usually considered to be read-only, and writing stuff here will lead to oddities being left behind unexpectedly during uninstall.)

Localization with SSRS

I'm trying to localize a SSRS reports. I have a DLL that uses a ResourceManager to access resource files that are embedded in the dll. My report has a reference to the dll. The dll is signed and strongly named. The dll and resource files' dll are compiled and in MicrosoftVisualStudio9.0/Common7/IDE/PrivateAssemblies and in Microsoft SQL Server\MSRS10.REPORTSERVER\Reporting Services\ReportServer\bin. The resource dll's are also installed in the GAC using gacutil.
Occasionally the SSRS correctly finds the resource key it needs and displays it. However, when changing the resource files to add more key's and values, I cannot get the SSRS to access the newly added files. I have repeated all of the above steps and even uninstalled and installed the resources in the GAC. Still I cannot get it to work.
Any idea what step I'm missing? Clearly the process works, I'm just not repeating something that I need to be.
For those interested in a slightly different approach, you may want to try using a localization assembly that doesn't use the standard resource management, but instead relies on simple file IO. This makes making changes to existing resx files or adding new ones less problematic. You can add or change the resx files and instantly be able to retrieve values for use in the reports. I followed this example, with only minor tweaks and have been very happy with the results:
http://www.codeproject.com/Articles/294636/Localizing-SQL-Server-Reporting-Services-Reports
One note though, the steps to follow when adding the new CodeGroup are lacking a bit in that if you place the new CodeGroup anywhere except after the unnamed UnionCodeGroup (it's the one with the Url="$CodeGen$/*") your attempts to access your custom assembly will fail.
After a lot of digging I was able to find confirmation of this on one of the msdn pages (see the "Placement of CodeGroup Elements for Extensions" section). Their wording was that "it is recommended", but from my testing I'd say it's required, at least when testing directly on the report server:
http://msdn.microsoft.com/en-us/library/ms152828.aspx
The xpath to use in wix for this location in the rssrvpolicy.config file is:
//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]/CodeGroup[\[]#PermissionSetName='ReportLocalization'[\]]
Here's an example of how this can be done in WiX using the util:XmlConfig extension:
<DirectoryRef Id="TARGETDIR">
<Component Id="I18N_RSSRVPOLICY_CONFIG" Guid="some GUID">
<util:XmlConfig
Id="RS_i18n_PermissionSet_remove_if_already_exists"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="delete"
On="install"
ElementPath="//NamedPermissionSets"
VerifyPath="//NamedPermissionSets/PermissionSet[\[]#Name='ReportLocalization'[\]]"
Node="element"
Sequence="100">
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_PermissionSet_add"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//NamedPermissionSets"
VerifyPath="//NamedPermissionSets/PermissionSet[\[]#Name='ReportLocalization'[\]]"
Node="document"
Sequence="101">
<![CDATA[
<PermissionSet class="NamedPermissionSet" version="1" Unrestricted="true" Name="ReportLocalization" Description="A special permission set that allows Execution and Assertion" />
]]>
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_CodeGroup_remove_if_already_exists"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="delete"
On="install"
ElementPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]"
VerifyPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]/CodeGroup[\[]#PermissionSetName='ReportLocalization'[\]]"
Node="element"
Sequence="102">
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_CodeGroup_add"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]"
VerifyPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]/CodeGroup[\[]#PermissionSetName='ReportLocalization'[\]]"
Node="document"
Sequence="103">
<![CDATA[
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="ReportLocalization" Name="Verint.SSRS.Localization" Description="This grants the Verint.SSRS.Localization.dll ReportLocalization Permissions">
<IMembershipCondition class="UrlMembershipCondition" version="1" Url="UPDATE_ME"/>
</CodeGroup>]]>
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_CodeGroup_update"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//IMembershipCondition[\[]#Url='UPDATE_ME'[\]]"
Name="Url"
Value="[SQLREPORTINGSERVICESPATH]ReportServer\bin\Verint.SSRS.Localization.dll"
Node="value"
Sequence="104">
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_REDP_CodeGroup_update"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//CodeGroup[\[]#Name='Report_Expressions_Default_Permissions'[\]]"
Name="PermissionSetName"
Value="FullTrust"
Node="value"
Sequence="105">
</util:XmlConfig>
</Component>
</DirectoryRef>
I recommend backing up the original config files (with WiX or custom actions). This can make uninstall easier since you can just replace those originals, and also because you can test this over and over again till it's doing what you want. Good luck to you all!
Are your rebuilding and redeploying all the satellite assemblies with each of your updates (including in the GAC)?
If not, it sounds like the problem is due to assembly versioning. There is a SatelliteContractVersion attribute that you can apply to your main assembly to help with this problem. Although rebuilding/resigning/redeploying all satellite assemblies each time you deploy an update may be easier.

Mule ESB IMAP questions

Currently we need fetch mails from an IMAP server using Mule ESB. Once the mails have been fetched, we only need the attachments and save them on the harddrive. So far so good. Now I got a couple of questions:
How do I keep the original name intact using a file:outbound-endpoint?
How can I check how many attachments I got?
How do save a copy of the mail on the IMAP and local drive?
#1: I tried #header:fileName or #originalFileName or even removing the outputpattern (this results in the filename being "35c7dea0-519a-11e1-b8b2-092b658ae008.dat")
#2: I am trying to make a flow where I check how many attachments there are. If there are less then 1 then I want to save the files and no further process them. If it's more then 1, then save it and process it. I tried COUNT but it didn't work.
#3: am trying to MOVE a message when READ to a back-up folder on the IMAP-server. On top of that I'll save a copy on the local server. Problem is that with the current code, the message does not get marked as read nor moved. The messages stay unread and they get copied (over and over, enldess loop) instead of getting moved to the IMAP back-up folder. When enabling the deleteReadMessages then the loop is broken but the message does not get copied on the IMAP.
Here's the code I am currently using:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:imap="http://www.mulesoft.org/schema/mule/imap"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:email="http://www.mulesoft.org/schema/mule/email"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.2/mule-file.xsd
http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/imap/3.2/mule-imap.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/3.2/mule-email.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd">
<imap:connector name="imapConnector" checkFrequency="5000"
backupEnabled="true" backupFolder="/home/mark/workspace/Eclipse/RHZ_Project/src/Archive/"
mailboxFolder="INBOX" moveToFolder="INBOX.Backup" deleteReadMessages="false"
defaultProcessMessageAction="SEEN" />
<expression-transformer name="returnAttachments">
<return-argument evaluator="attachments-list" expression="*.txt,*.ozb,*.xml" optional="false"/>
</expression-transformer>
<flow name="Flow1_IMAP_fetch">
<imap:inbound-endpoint user="USER" password="PASS" host="IP"
port="143" transformer-refs="returnAttachments" disableTransportTransformer="true"/>
<collection-splitter/>
<file:outbound-endpoint path="/home/mark/workspace/Eclipse/RHZ_Project/src/Inbox/#[function:datestamp].dat">
<expression-transformer>
<return-argument expression="payload.inputStream" evaluator="groovy" />
</expression-transformer>
</file:outbound-endpoint>
</flow>
</mule>
1) How do I keep the original name intact using a file:outbound-endpoint?
Attachments are javax.activation.DataHandler instances so you should be able to call getName() on them, with an OGNL or Groovy expression. For example:
#[groovy:payload.name]
Should give you the original attachment name.
2) How can I check how many attachments I got?
Before the splitter, use a choice router and an condition that checks the size() attribute of the attachment list, like:
#[groovy:payload.size()>1]
3) How do save a copy of the mail on the IMAP and local drive?
I do not know what the issue is here. Maybe marking as seen is not supported. Or maybe the fact that you disable the transport transformer prevents a post-read action to kick in.
By the way, I suggest you leave the default transport transformer as-is and move the returnAttachments transformer after the inbound endpoint, before the splitter.

Resources