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!
Related
It seems that it is not possible to use the shortened notation for parent for the use attribute of the key function, at least for my setup.
This does not work
<xsl:key name="eventsSuppressedByTheSameEventKey" match="suppressedMonitor" use="../suppressingMonitor/#event" />
But this does work
<xsl:key name="eventsSuppressedByTheSameEventKey" match="suppressedMonitor" use="parent::suppressingMonitor/#event" />
Why? Is the shortened notation not supported inside the use attribute for any reason?
The short for:
parent::suppressingMonitor/#event
is:
../#event
not:
../suppressingMonitor/#event
I am trying to write a general rule in /WEB-INF/urlrewrite.xml that will take in an arbitrary URI and append the identifiers that follow a root identifier as Name Value Pairs.
For Example:
localhost:8084/URLRewrite/Fruits/Yellow/Banana/banana.jsp
to become
localhost:8084/URLRewrite/Fruits/Yellow/Banana/banana.jsp&key0=Fruits&key1=Yellow&key2=Banana
I know that this will involve regular expressions as well as parameter ambiguity.
Something of similar flavor is like:
<rule>
<from>^/world/([a-z]+)/([a-z]+)$</from>
<to>/world.jsp?country=$1&city=$2</to>
</rule>
Examples:
Input:
nyc
Output:
nyc
Any help or suggestions would be greatly appreciated.
Try this:
<rule>
<from>^/world/([a-z]+)/([a-z]+)$</from>
<to type="redirect">/world.jsp?country=$1&city=$2</to>
</rule>
Maybe you're missing the attribute type with value redirect in your configuration file.
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.
For some reason, YQL's XSLT table can't parse my stylesheet. I have used the stylesheet successfully with the W3C's XSLT service. Here's an example of the problem in YQL Console. Why does this not work in YQL?
Also, I have yet to figure out how to pass the results of a YQL query to the XSLT table as the XML to be transformed while also specifying a stylesheet url. Current workaround is to abuse the W3C's service.
Your stylesheet is defined as 1.0 but you're using replace() and tokenize() which is part of the 2.0 standard. However it is a fully valid XSLT/XPath 2.0 stylesheet.
As an addition to Per T answer, change this:
<xsl:variable name="r">
<xsl:value-of select="replace(tr/td/p/a/following-sibling::text(),
'\s*-\s*(\d+)\.(\d+)\.(\d+)\s*',
'$1,$2,$3')" />
</xsl:variable>
With this:
<xsl:variable name="r"
select="translate(tr/td/p/a/following-sibling::text(),'. -',',')">
These:
tokenize($r,',')[1]
tokenize($r,',')[2]
tokenize($r,',')[3]
With these:
substring-before($r,',')
substring-before(substring-after($r,','),',')
substring-after(substring-after($r,','),',')
Note: This is just in case you don't know the amount of digit in advance, otherwise you could do:
substring($r,1,2)
substring($r,4,2)
substring($r,7)
Also, this
replace(tr/td/p[#class='t11bold']/a,'\s+',' ')
It should be just this:
normalize-space(tr/td/p[#class='t11bold']/a)
And finaly this:
replace($d,'^[^\[]*\[\s*(\d+:\d{2})?\s*-?\s*([^\]]*)\]\s*$','$2')
Could be:
normalize-space(substring-after(substring-before(substring-after($d,'['),']'),'-'))
In EL expressions, used in a jsp page, strings are taken literally. For example, in the following code snippet
<c:when test="${myvar == 'prefix.*'}">
test does not evaluate to true if the value of myvar is 'prefixxxxx.' Does anyone know if there is a way to have the string interpreted as a regex instead? Does EL have something similar to awk's tilde ~ operator?
While this special case can be handled with the JSTL fn:startsWith function, regular expressions in general seem like very likely tests. It's unfortunate that JSTL doesn't include a function for these.
On the bright side, it's pretty easy to write an EL function that does what you want. You need the function implementation, and a TLD to let your web application know where to find it. Put these together in a JAR and drop it into your WEB-INF/lib directory.
Here's an outline:
com/x/taglib/core/Regexp.java:
import java.util.regex.Pattern;
public class Regexp {
public static boolean matches(String pattern, CharSequence str) {
return Pattern.compile(pattern).matcher(str).matches();
}
}
META-INF/x-c.tld:
<taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">
<tlib-version>1.0</tlib-version>
<short-name>x-c</short-name>
<uri>http://dev.x.com/taglib/core/1.0</uri>
<function>
<description>Test whether a string matches a regular expression.</description>
<display-name>Matches</display-name>
<name>matches</name>
<function-class>com.x.taglib.core.Regexp</function-class>
<function-signature>boolean matches(java.lang.String, java.lang.CharSequence)</function-signature>
</function>
</taglib>
Sorry, I didn't test this particular function, but I hope it's enough to point you in the right direction.
Simply add the following to WEB-INF/tags.tld
<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib version="2.1"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
<display-name>Acme tags</display-name>
<short-name>custom</short-name>
<uri>http://www.acme.com.au</uri>
<function>
<name>matches</name>
<function-class>java.util.regex.Pattern</function-class>
<function-signature>
boolean matches(java.lang.String, java.lang.CharSequence)
</function-signature>
</function>
</taglib>
Then in your jsp
<%#taglib uri="http://www.acme.com.au" prefix="custom"%>
custom:matches('aaa.+', someVar) }
This will work exactly the same as Pattern.match
You can use JSTL functions like so -
<c:when test="${fn:startsWith(myVar, 'prefix')}">
Take a look: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fn/tld-summary.html
for using Pattern.matches inside a jsp page in my case it was enough to call
java.util.regex.Pattern.matches(regexString,stringToCompare) because you can't import package in jsp