NLog Event Log Target: problems with Source/Provider Name & message format - event-log

I'm trying to use NLog to log events for a new application to a file and to the Event Log. I'm almost there, but not quite - I can get events logged to the Event Log, and in the Details/XML view (of the Event Log) everything looks OK. But in the General tab of the viewer, I don't get the event message displayed as expected; instead I get "DRGImporterError"; this matches which happens to be the SymbolicName (see below) from my EventLogMessages.mc file, but when I modified this value and recompiled the error message file, this didn't change. The event log source is 'DRGImporter' as is the application name, so I can't be sure what 'DRGImporterError' actually refers to!
I've manually created and edited the registry entries storing the EventMessageFile location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\MyAppLog\DRGImporter. Originally, I pointed this key to my custom EventLogMessages.dll, but in trying to debug it, I also set it to one of the standard DLLs under \Windows\Microsoft.NET\..., but it didn't change the outcome.
I have a number of other applications using the same event log, but these use a different logging framework. Nevertheless they work, but more curiously, if I change the source that NLog points to to one of these older ones, NLog entries are logged successfully and the General view in the event log shows the expected text. The only difference I can see from the XML view is the EventRecordID and the timestamp, which is to be expected.
Is there another element to this equation that I am missing?
EventLogMessages.mc:
;//***********Event Definitions**************
MessageId=2000
SymbolicName=MailerError
Language=English
%1.
.
MessageId=2100
SymbolicName=DRGImporterError
Language=English
%1.
.
NLog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true" autoReload="true" internalLogFile="nlog.log" internalLogLevel="Debug">
<targets>
<target name="eventLogHeaderTarget" xsi:type="EventLog" log="Hexadex" source="DRGImporter" eventId="0" layout="${message}" />
</targets>
<rules>
<logger name="appLogHeader" minlevel="Debug" writeTo="eventLogHeaderTarget" />
</rules>

Related

How to automatically update fields in Office.js add-in for Word?

I have an Office.js add-in that uses custom document properties. To update them i have to use deleteAll() because setting the value or a properties object gives weird generalexceptions and access denieds.
but deleting them all and adding them one by one works fine. But after the properties have been added, I have to press ctlr-A and F9 to update all the changed fields. Some are in headers footers so I have to select those and press ctrl-A/F9 there too.
In my VSTO i needed to call Word.application.activeDocument.fields.update() but is there something similar in Office.js? I scanned the API docs up and down but can't find a call that works. How do I update the fields in the document after I changed them?
In a docx we have a docProps/custom.xml which has something like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="schemas.openxmlformats.org/officeDocument/2006/…" xmlns:vt="schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="Categorie">
<vt:lpwstr>My category</vt:lpwstr>
</property>
</Properties>
If we can bind those to content controls, that would be great. If that can be a 2way binding it would be awesome ;)

Problem with rule validation - valid on save, invalid on load

While testing the unchanged CodeEffects asp.net core demo application (Editor 5.0.4.8, Engine 5.0.2.6) I've found an interesting problem.
If I create an execution rule that checks for example if FirstName contains two spaces, I can save this rule without a problem, and in SaveRule action it passes the validation using editor.Rule.IsValid. Here is an example of the rule definition:
<if>
<clause>
<condition type="contains" stringComparison="OrdinalIgnoreCase">
<property name="FirstName" />
<value> </value>
</condition>
</clause>
<then>
<method name="Register">
<value>aaaa</value>
</method>
</then>
</if>
But when refreshing the editor and trying to load this saved rule it won't load into editor. The reason is that the LoadRule controller action returns empty json.
While investigating this further it looks that the editor.GetClientRuleData returns null because the rule is invalid. If I check editor.Rule.IsValid just before calling editor.GetClientRuleData I can see it return false and the editor.Rule.InvalidElements holds one element:
{{c:"",h:"v120"}}
The error message would be "The only allowed operators for empty string values are IS and IS NOT" but of course it's not shown in the editor in the demo project as this is not expected to happen.
Not sure if this is in any way related to the problem, but one obvious difference between LoadRule and SaveRule actions is how the rule is loaded.
When saving the rule, the rule data (coming from the UI) is loaded into editor with
editor.LoadClientData(data.Data);
and when loading the rule it's loaded using the xml (from the storage) effectively calling this:
editor.Rule = Rule.Models.RuleModel.Create(ruleXml, typeof(Models.Patient))
So my question is why can invalid rule pass the validation on save, and then the same rule fails the validation on load? Any fix I can try or a workaround?
This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:
CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8

Creating a working copy for Plone 4 custom content types

I have created a custom Plone content type in my package i.e. my.product.
I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.
Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?
I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:
diff_tool.xml
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
</difftypes>
</object>
repositorytool.xml
<?xml version="1.0"?>
<repositorytool>
<policymap>
<type name="MyCustomType">
<policy name="at_edit_autoversion"/>
<policy name="version_on_revert"/>
</type>
</policymap>
</repositorytool>
I have never used plone.app.iterate, but this is the generic approach how to solve the problem.
Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml
Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.
The view is defined here
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/configure.zcml#L7
The checks that are performed for the content item if it's archiveable
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/control.py#L47
Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.

Computing repeatControls property of a repeat generate designer error

I am trying to compute the repeatControls property of a repeat but get an error
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:repeat id="repeat1" rows="30" value="#{javascript:10}">
<xp:this.repeatControls><![CDATA[${javascript:"true"}]]> </xp:this.repeatControls>
</xp:repeat>
</xp:view>
Here is the error
Description Resource Path Location Type
Could not generate a .java file for the page /test.xsp: Could not find the runtime class for the tag xp:repeat, due to a problem invoking com.ibm.xsp.component.xp.XspDataIterator.getJavaClass(class com.ibm.xsp.page.parse.types.FacesInstance). test.xsp test.nsf/XPages line 1 com.ibm.designer.domino.ide.resources.designerproblem
Is this some kind of bug in DDE or am doing it wrong?
I have tried putting the "true" without quotes as well
I am using notes 9 beta 1
The Repeat (xp:repeat) control specifies the following tooltip for the repeatControls property.
Repeat Controls (boolean:repeatControls)
Specifies if the controls should be created multiple times or the single set of controls should be iterated over multiple times.
The repeatControls property accepts boolean values; specifically either "true" or "false". In Domino Designer from the All Properties View despite the presence of the blue diamond (indicating it can be computed), this property should not be computed.
At design time, the repeatControls property value is used to inform how the compiled XPage is generated hence invalid values prevent this from succeeding; this is the error being reported by Domino Designer and has been logged with the team with reference "DEGN95SMPT".

Zend: How does LDML work?

Currently I try to fix a issue on our SocialEngine installation (which is built on Zend) which shows in the language selector one language not in its native name (like "Deutsch" for "German") but in the language the user has set the frontend (so instead of "Deutsch" you would see "German" when you set the language to English).
When looking in the source I've seen that Zend_Locale_Data loads a list of languages which are available for the system and tries to read a LDML file from a path which seems not to be on my machine:
$temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language', 'type');
When the path is not on my computer, it has to be in the web but doing a search for "ldml" or "zend ldml" I don't get any hint on this topic. Could you guide me through the fog?
Any help is appreciated. Thank you!
The '/ldml/localeDisplayNames/languages/language' that you see is not a file path but a XPath expression, the file that is read is an XML file located in Zend/Locale/Data/ and the filename is related to the given $locale parameter.
e.g. For the english locale, the XML file loaded should be Zend/Locale/Data/en.xml. Opening this file will show you the structure selected by the XPath expression
<?xml version="1.0" encoding="UTF-8" ?>
<ldml>
<!-- content skipped -->
<localeDisplayNames>
<!-- content skipped -->
<languages>
<language type="aa">Afar</language>
<language type="ab">Abkhazian</language>
<!-- etc... -->