Resolve formatted table value in wix custom action - c++

I've created certificate wix extension (extension of IisExtension). This includes a custom table, which is consumed by a custom action.
A column is defined as follows:
<columnDefinition name="Account" type="string" length="72"
primaryKey="yes" modularize="property" category="formatted"
description="..." />
This column contains values like "[Property]". When the custom action reads this column like this:
hr = WcaGetRecordString(hRecCertificate, vcpqAccount, &pwzTemp);
it get's the string "[Property]". But I need "PropertyValue". How can this string be resolved?
Regards Michael

WcaGetRecordFormattedString is what you're looking for.

I've not really used WcaGetRecrodString. Take a look at the MsiFormatRecord function. Check the return code and read all the gotchas on MSDN for tips on what might be going wrong.

Related

Coldfusion 2016 how to include template when using cfscript mail()?

A simple example of what I'm trying to accomplish using tag based code:
<cfmail
to="someone#x.com"
from="someone#y.com"
subject="howdy"
type="html">
<cfinclude template="path/to/emailtemplates/sometemplate.htm"/>
</cfmail>
I've tried all manner of solutions using cfscript and am at a roadblock. I thought this might do it, but alas no.
savecontent variable="mailBody" {
include "path/to/emailtemplates/sometemplate.htm";
};
mail = new mail();
mail.setTo( "someone#x.com" );
mail.setFrom( "someone#y.com" );
mail.setSubject( "howdy!" );
mail.setType( "HTML" );
mail.setBody( mailBody );
mail.send();
We're not sending multi-part e-mails - just HTML. Is there a way to do this in script?
The issue is that, in cfinlcude you will not be able to include an HTML file. Looks like you are going to need the help of FileRead() function instead of include.
mailBody=FileRead('absolute/path/to/emailtemplates/sometemplate.htm' [, charsetIfNeeded]);
For FileRead to work you should provide an absolute path to an on-disk or in-memory text file on the server.
Not sure if this answers the initial question but fyi in coldfusion 10 I used to be able to tell CF to process other files than cfm. In your application use this line:
<cfset THIS.compileextforinclude = "htm" />

Notepad++ method autocompletion

I'd like to create a auto-completion definition file to my domain specific language so that the I get parameter hints for predefined class methods.
In the doc I have the following example:
<?xml version="1.0" encoding="Windows-1252" ?>
<NotepadPlus>
<AutoComplete language="C++">
<Environment ignoreCase="no" startFunc="(" stopFunc=")" paramSeparator="," terminal=";" additionalWordChar = "."/>
<KeyWord name="abs" func="yes">
<Overload retVal="int" descr="Returns absolute value of given integer">
<Param name="int number" />
</Overload>
</KeyWord>
That works like a charm for function calls such as:
abs(-12)
That is, I hit "a" and Notepad++ suggests the function abs and hints to its parameters.
However what if abs is a method of a class? For instance:
MyObject.abs(-12)
I would expect that once I hit the key "." and "a" Notepad++ would propose me the abs method and all the parameter hints. However, with the xml definition listed above it does not work.
Does anybody know how to deal with this issue? Is there a regular expression mode that we can use?
Thanks in advance.
I just found out solution. Posting here to leave a trace and help others out.
If I remove additionalWordChar = "." it wokrs!

How to check if attribute is present in value using Mule expression language

I want to check logged in user’s authorization based on ‘groupmembership’ header attribute.
The output of
<logger level="INFO" message="groups are =#[message.inboundProperties['GROUPMEMBERSHIP']]" doc:name="Logger"/> is
[groups are =cn=ZZZ-XXXX-Write-Users,ou= ZZZ-XXXX,ou=1234,ou=Groups,dc=someone,dc=net]
Now a user can have multiple group memberships but all I am interested in checking if user is member of ‘ZZZ-XXXX-Write-Users’?
Is there a way in MEL to check that, something like
<when expression="#[message.inboundProperties.GROUPMEMBERSHIP.cn != ' ZZZ-XXXX-Write-Users ']">
Is this the right approach or am I missing anything here?
The scenario you describe looks more like a flow control stuff.
In that case I would say that you use just that MEL expression inside a choice router:
<choice doc:name="Choice">
<when expression="#[!message.inboundProperties.GROUPMEMBERSHIP.cn.equals('ZZZ-XXXX-Write-Users')]">
<!-- DO SOMETHING -->
</when
<otherwise>
<!-- DO SOMETHING ELSE -->
</otherwise>
</choice>
Just a small change the use of equals to compare strings ;).
The other option, as we are talking flow control here, is a filter.
A expression filter will just ignore the message if the expression doesn't evaluate to true. The catch with this is, it either pass or not you can not have an alternative route not even a log message saying that a message was filtered.
<expression-filter expression="#[!message.inboundProperties.GROUPMEMBERSHIP.cn.equals('ZZZ-XXXX-Write-Users')]" doc:name="Expression"/>
HTH

Parsing og: tags with ColdFusion regex

If one wants to extract/match Open Graph (og:) tags from html, using regex (and ColdFusion 9+), how would one go about doing it?
And the tricky bit is that is has to cover both possible variations of tag formation as in the following examples:
<meta property="og:type" content="website" />
<meta content="website" property="og:type"/>
So far all I got is this:
<cfset tags = ReMatch('(og:)(.*?)>',html_content)>
It does match both of the links, however only the first type has the content bit returned with it. And content is something that I require.
Just to make it absolutely clear, the desired output should be an array with all of the OG tags (they could be 'type,image,author,description etc.). That means it should be flexible and not based on the og:type example alone.
Of course if it's possible, the ideal output would be a struct with the first column being the name of tag, and the second containing the value (content). But that can be achieved with the post processing and is not as important as extracting the tags themselves.
Cheers,
Simon
So you want an array like ['og:author','og:type', 'og:image'...]?
Try using a regex like og:([\w]+)
That should give you a start. You will have duplicates if you have two of the same og:foo meta tags.
You can look at JSoup also to help parse the HTML for you. It makes it a lot easier.
There are a few good blog posts on using it in CFML
jQuery-like parsing in Java
Parsing, Traversing, And Mutating HTML With ColdFusion And jSoup
Ok, so after the suggestion from #abbottmw (thank you very much!), here's the solution:
Download Jsoup jar file from here: http://jsoup.org/download
Then initiate it like this:
<cfhttp url="...." result="oghtml" > /*to get your html content*/
<cfscript>
paths = expandPath("/lib/jsoup.jar"); //or wherever you decide to place the file
loaderObj =createObject("component","javaloader.JavaLoader").init([expandPath('/lib/jsoup.jar')]);
jsoup = loaderObj.create("org.jsoup.Jsoup");
doc = jsoup.parse(oghtml);
tags = doc.select("meta[property*=og:]");
</cfscript>
<cfloop index="e" array="#tags#">
<cfoutput>
#e.attr("property")# | #e.attr("content")#<br />
</cfoutput>
</cfloop>
And that is it. The complete list of og tags is in the [tags] array.
Of course it's not the regex solutions, which was originally requested, but hey, it works!

Change message name

Here is the part of my WSDL. I'm using the code first approach.
<portType name="MyWebService">
<operation name="echoString"/>
<input message="echoString"/>
<output message="echoStringResponse"/>
</operation>
</portType>
What annotation should I add or change so to change this
<input message="echoString"/>
to read as
<input message="echoStringRequest"/>
Thanks all.
I am quite surprised myself, but after trying for a while I looked into the spec and it seems you cannot really do this in jax-ws (except in a non-standard way, depending on the implementation). Here is what the jax-ws 2.0 specification says on this issue. See Java to WSDL 1.1 Mapping, Section 3.5, page 32:
The value of a wsdl:message element’s name attribute is not
significant but by convention it is normally equal to the
corresponding operation name for input messages and the operation name
concatenated with “Response” for output messages. Naming of fault
messages is described in section section 3.7.
So the only option that comes to my mind is to rename your operation, for example by changing or adding a #WebMethod annotation. Here is an example:
#WebMethod(operationName = "echoStringRequest")
public String echoString(String echoStringRequest) {
return echoStringRequest;
}
This will generate the following portType:
<portType name="MyWebService">
<operation name="echoStringRequest">
<input message="tns:echoStringRequest"></input>
<output message="tns:echoStringRequestResponse"></output>
</operation>
</portType>
The decision of whether you are more happy with this version is up to you.
I've encountered this problem myself recently and stumbled upon this thread multiple times. In our application we have a JAX-WS servlet which must use the format of ...Request and ...Response.
After a few days of searching, I found the solution.
Let's say your echoStringRequest has one String property that should be echoed back in the response.
class EchoMessage {
private String message;
//add getter and setter
}
First add this annotation to the web service class:
#SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
Then annotate your web service method like this:
#WebMethod
#WebResult(name = "echoStringResponse")
public EchoMessage echoString (#WebParam(name = "echoStringRequest") EchoMessage inputMessage) {
...
}
Without the parameterStyle BARE annotation, JAX-WS would automatically generate messages like this:
<echoString>
<echoStringRequest>
...
</echoStringRequest>
</echoString>
With the annotation, the outer element does not exist anymore.
The #WebParam and #ReturnType annotations are needed to determine the names of the root elements in the SOAP request and response body.