How to create a case insensitive Keyword highlighting rule in AvalonEdit - wpf

I'm looking to update my .xshd highlighting file to match certain keywords case-insensitively.
As an example, the highlighting rules below are a subset of the SQL highlighting file on the AvalonEdit repo. How does one make keywords like this and super highlight case-insensitively?
<?xml version="1.0"?>
<!-- syntaxdefinition for Java 2001 by Jonathan Pierce & Mike Krueger -->
<!-- converted to AvalonEdit format by Siegfried Pammer in 2010 -->
<SyntaxDefinition name="Java" extensions=".java" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Punctuation" foreground="DarkGreen" />
<Color name="AccessKeywords" foreground="Black" fontWeight="bold" />
<RuleSet ignoreCase="false">
<Rule color="Punctuation">
[?,.()\[\]{}+\-/%*<>^!|]+
</Rule>
<Keywords color="AccessKeywords">
<Word>this</Word>
<Word>super</Word>
</Keywords>
<Keywords color="OperatorKeywords">
<Word>new</Word>
<Word>instanceof</Word>
<Word>true</Word>
<Word>false</Word>
</Keywords>
</RuleSet>
</SyntaxDefinition>
Important to note here is that I only want to match keywords within AccessKeywords case insensitively, but keywords within OperatorKeywords should be case-sensitive.

Related

Making Intellisense see resources generated by custom MSBuild target (WPF)

In my net4.8 WPF project I have an Art folder which contains .svg files.
I have created an MSBuild target which:
Invokes inkscape to convert .svg files to .xaml, placing the generated files in the project's intermediate output directory.
Includes the generated .xaml files into the target binary as resources.
Then, in the XAML of my application, I have <Frame> elements that reference the .xaml resources to display the images.
So far, so good; all this works.
The problem is that when I do this, intellisense knows nothing of my generated resource files. I would like intellisense to know those files, and give me suggestions, because the application is bound to have lots of them, so using blind binding-by-name is soon going to be problematic.
Steps to reproduce the problem:
STEP 1: make sure you have a relatively recent version of inkscape installed and accessible via your path.
STEP 2: Create a new C# Windows Desktop "WPF App (.NET Framework)" application project (+solution) targeting .Net Framework 4.8.
STEP 3: Add a XamlFromSvg.targets file with the following content:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Ensure Visual Studio puts the XamlFromSvg item in the Build Action dropdown -->
<ItemGroup>
<AvailableItemName Include="XamlFromSvg"/>
</ItemGroup>
<!-- Instruct MsBuild to include our "Compile" and "Resource" targets in the Build -->
<PropertyGroup>
<BuildDependsOn>
XamlFromSvgCompile;
XamlFromSvgResource;
$(BuildDependsOn);
</BuildDependsOn>
</PropertyGroup>
<!-- Convert ("compile") .svg to .svg.xaml -->
<Target Name="XamlFromSvgCompile" Condition="#(XamlFromSvg)!=''" BeforeTargets="BeforeBuild;BeforeRebuild"
Inputs="#(XamlFromSvg)"
Outputs="$(IntermediateOutputPath)X\%(XamlFromSvg.Identity).xaml">
<Message Importance="High" Text="XamlFromSvgCompile: %(XamlFromSvg.Identity) -> $(IntermediateOutputPath)X\%(XamlFromSvg.Identity).xaml"/>
<MakeDir Directories="$(IntermediateOutputPath)X\%(XamlFromSvg.RelativeDir)" Condition="!Exists('$(IntermediateOutputPath)X\%(XamlFromSvg.RelativeDir)')"/>
<Exec Command="cmd /c inkscape "%(XamlFromSvg.Identity)" --export-filename="$(IntermediateOutputPath)X\%(XamlFromSvg.Identity).xaml""
Outputs="$(IntermediateOutputPath)X\%(XamlFromSvg.Identity).xaml">
</Exec>
</Target>
<!-- Add .svg.xaml as resource -->
<Target Name="XamlFromSvgResource" Condition="#(XamlFromSvg)!=''">
<ItemGroup>
<GeneratedXamlFromSvg Include="$(IntermediateOutputPath)X\%(XamlFromSvg.Identity).xaml"/>
</ItemGroup>
<Message Importance="High" Text="XamlFromSvgResource: $(IntermediateOutputPath)X\#(XamlFromSvg.Identity).xaml -> %(GeneratedXamlFromSvg.Identity)"/>
<CreateItem Include="%(GeneratedXamlFromSvg.Identity)">
<Output TaskParameter="Include" ItemName="Resource"/>
</CreateItem>
</Target>
<!--This is here just to prevent "unknown item group" warnings. -->
<ItemGroup>
<XamlFromSvg Include="foo" Condition="False"/>
</ItemGroup>
</Project>
STEP 4: Near the end of WpfApp1.csproj, after the <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> line, add the following line:
<Import Project="XamlFromSvg.targets" />
STEP 5: Add an /Art folder with an .svg file (Say, Misc.HamburgerMenu.svg.) You can use the following sample .svg file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg8" width="500" height="500" viewBox="0 0 500 500">
<g id="g6" transform="matrix(27.777778,0,0,27.777778,-83.333334,-81.333336)">
<path d="M 3,6 H 21 V 8 H 3 V 6 m 0,5 h 18 v 2 H 3 v -2 m 0,5 h 18 v 2 H 3 Z" id="path4" />
</g>
</svg>
STEP 6: From within Solution Explorer, right-click on the .svg file and select "Include in project".
STEP 7: Right-click on the .svg file again, select "Properties", and set the Build Action to XamlFromSvg.
STEP 8: In App.xaml insert the following:
<Frame x:Shared="false" x:Key="Icon.Misc.HamburgerMenu" Source="/X/Art/Misc.HamburgerMenu.svg.xaml" />
STEP 9: In MainWindow.xaml, replace <Grid></Grid> with the following:
<ContentControl Content="{StaticResource Icon.Misc.HamburgerMenu}" Margin="50"/>
STEP 10: Build and run; You should see a window displaying your .svg file.
STEP 11: Now go back to App.xaml. If you place the cursor on /X/ and hit Ctrl+Space.
Intellisense will suggest anything but /X/Art/Misc.HamburgerMenu.svg.xaml. Intellisense knows nothing of this resource.
And ideas how to solve this problem or achieve the same result by other means would be welcome.
(However, any ideas aiming to achieve the same result by other means must actually achieve the same result, which is to begin with .svg files and to have these files displayed in a net4.8 WPF application without the need to perform any manual steps whatsoever.)
Note: I know netcore supports .svg files, but I am sticking with net4.8 for now, which does not. And I have heard of 'XAML Islands', it seems like a clunky additional moving part held together by shoestrings, so I do not want to try it.
Also, any suggestions on how to improve XamlFromSvg.targets would be welcome. (I just compiled it from samples, I hardly know what I am doing.)

How to publish additional postgis raster layer attributes in geoserver?

i was wondering if any of You can help me with my problem. I'm storing some rasters in Postgis database. Each raster is in its own table and besides 'rid' and 'rast' columns, I manualy added other columns to store raster attributes such as 'metadata'...
I have successfully imported rasters in geoserver using ImageMosaic JDBC and in Layers Preview (OpenLayers) I can see rasters and use getFeatureInfo function, but the problem is that function getFeatureInfo returns table with correct pixel value , 'rid' field is empty (only table header apears) and no other attribute is shown (not even attribute header in table). I'm using default geoserver method for layer preview function.
mapping.postgis.xml.inc file
<!-- possible values: universal,postgis,db2,mysql,oracle -->
<spatialExtension name="pgraster"/>
<mapping>
<masterTable name="mosaic" >
<coverageNameAttribute name="name"/>
<maxXAttribute name="maxx"/>
<maxYAttribute name="maxy"/>
<minXAttribute name="minx"/>
<minYAttribute name="miny"/>
<resXAttribute name="resx"/>
<resYAttribute name="resy"/>
<tileTableNameAtribute name="tiletable" />
</masterTable>
<tileTable>
<blobAttributeName name="rast" />
<keyAttributeName name="rid" />
<textAttributeName name="metadata" />
</tileTable>
</mapping>
connect.postgis.xml.inc
<connect>
<!-- value DBCP or JNDI -->
<dstype value="DBCP"/>
<!-- <jndiReferenceName value=""/> -->
<username value="postgres" />
<password value="postgres" />
<jdbcUrl value="jdbc:postgresql://localhost:5432/web_kartografija" />
<driverClassName value="org.postgresql.Driver"/>
<maxActive value="10"/>
<maxIdle value="0"/>
</connect>
layer.postgis.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ImageMosaicJDBCConfig [
<!ENTITY mapping PUBLIC "mapping" "mapping.postgis.xml.inc">
<!ENTITY connect PUBLIC "connect" "connect.postgis.xml.inc">]>
<config version="1.0">
<coverageName name="jan"/> <!-- Name of the table in database -->
<coordsys name="EPSG:4326"/>
<!-- interpolation 1 = nearest neighbour, 2 = bilinear, 3 = bicubic -->
<scaleop interpolation="1"/>
<verify cardinality="false"/>
&mapping;
&connect;
</config>
I tried to include <textAttributeName name="metadata" /> as a column name where aditional data is stored, but still no effect. Can anobudy help me with this problem ? Thanks in advance !

Limits of a Publisher when a topic and writer is conserned

Could anyone let me know if one publisher can be used for passing different parameters (Data Types), like integer, float, string, char etc...
Does Open Splice DDS Community edition have any limitations for publishers? If so how many publishers can it accommodate?
<OpenSplice>
<Domain>
<Name>ospl_sp_ddsi</Name>
<Id>0</Id>
<SingleProcess>true</SingleProcess>
<Service name="ddsi2">
<Command>ddsi2</Command>
</Service>
<Service name="durability">
<Command>durability</Command>
</Service>
<Service enabled="false" name="cmsoap">
<Command>cmsoap</Command>
</Service>
</Domain>
<DDSI2Service name="ddsi2">
<General>
<NetworkInterfaceAddress>192.168.147.179</NetworkInterfaceAddress>
<AllowMulticast>true</AllowMulticast>
<EnableMulticastLoopback>true</EnableMulticastLoopback>
<CoexistWithNativeNetworking>false</CoexistWithNativeNetworking>
</General>
<Compatibility>
<!-- see the release notes and/or the OpenSplice configurator on DDSI interoperability -->
<StandardsConformance>lax</StandardsConformance>
<!-- the following one is necessary only for TwinOaks CoreDX DDS compatibility -->
<!-- <ExplicitlyPublishQosSetToDefault>true</ExplicitlyPublishQosSetToDefault> -->
</Compatibility>
</DDSI2Service>
<DurabilityService name="durability">
<Network>
<Alignment>
<TimeAlignment>false</TimeAlignment>
<RequestCombinePeriod>
<Initial>2.5</Initial>
<Operational>0.1</Operational>
</RequestCombinePeriod>
</Alignment>
<WaitForAttachment maxWaitCount="10">
<ServiceName>ddsi2</ServiceName>
</WaitForAttachment>
</Network>
<NameSpaces>
<NameSpace name="defaultNamespace">
<Partition>*</Partition>
</NameSpace>
<Policy alignee="Initial" aligner="true" durability="Durable" nameSpace="defaultNamespace"/>
</NameSpaces>
</DurabilityService>
<TunerService name="cmsoap">
<Server>
<PortNr>none</PortNr>
</Server>
</TunerService>
</OpenSplice>
A DDS-publisher can have multiple writers of different topics where each topic-type can include various parameters of various types (including bounded and unbounded types such as arrays and sequences).
The OpenSplice CE (Community Edition) doesn't have any limitation for publishers, but when you want to run more than 10 applications on a single machine you have to change the DDSI/Discovery/ParticipantIndex parameter from its default 'auto' value to 'none', see also this post: http://forums.opensp...index#entry4024
Cheers

Obout Suite Superform DateField issue

I am using the Obout Suite in a website.
I have a SuperForm control in which I have inserted some controls like BoundFields or DateFields.
The problem is that when I select a date at the DateField Calendar, the textbox associated doesn't refresh the value of the date.
I have something like:
<obout:SuperForm ID="SuperForm2" runat="server" AutoGenerateInsertButton ="true" AutoGenerateEditButton="false" AutoGenerateDeleteButton="false" AutoGenerateRows="false" DataKeyNames="IdDocumento" DefaultMode="Insert" Width="525" DataSourceID="SqlDataSource2">
<Fields>
<obout:BoundField DataField="DocumentType" HeaderText="Name" FieldSetID="FieldSet1" />
<obout:DateField DataField="OrderDate" HeaderText="Order Date" FieldSetID="FieldSet2" DataFormatString="{0:MM/dd/yyyy}" ApplyFormatInEditMode="true" />
<obout:DateField DataField="RequiredDate" HeaderText="Required Date" FieldSetID="FieldSet2" DataFormatString="{0:MM/dd/yyyy}" ApplyFormatInEditMode="true" />
</Fields>
<FieldSets>
<obout:FieldSetRow>
<obout:FieldSet ID="FieldSet1" />
</obout:FieldSetRow>
<obout:FieldSetRow>
<obout:FieldSet ID="FieldSet2" />
</obout:FieldSetRow>
</FieldSets>
</obout:SuperForm>
The tag prefix is:
<%# Register TagPrefix="obout" Namespace="Obout.SuperForm" Assembly="obout_SuperForm" %>
The "obout_Calendar2_Net.dll" is referenced by the solution.
Am I forgotting something?
Thanks in advance.
Cartojal
Well, finally I found the solution. If you are using .net 4.0, like me.... you must to add the attribute clientIDMode="AutoID" to the section "pages" at the web.config file:
<pages clientIDMode="AutoID">
....
</pages>
This generate the asp.net controls ids like past versions of .net

iBatis - Why is sqlMapConfig.xml unable to find the sql maps defined in it?

I have a sqlMapConfig.xml that has three SQLMaps defined in it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<!-- Statement namespaces are required for Ibator -->
<settings enhancementEnabled="true" useStatementNamespaces="true"/>
<!-- Setup the transaction manager and data source that are
appropriate for your environment
-->
<transactionManager type="JDBC">
<dataSource type="SIMPLE" >
<property name="JDBC.Driver"
value="com.mysql.jdbc.Driver"/>
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://localhost:3306/sug"/>
<property name="JDBC.Username"
value="root"/>
<property name="JDBC.Password"
value="admin"/>
</dataSource>
</transactionManager>
<!-- SQL Map XML files should be listed here -->
<sqlMap resource="com/tatakelabs/dbmaps/categories_SqlMap.xml" />
<sqlMap resource="com/tatakelabs/dbmaps/pro_SqlMap.xml" />
<sqlMap resource="com/tatakelabs/dbmaps/pro_category_SqlMap.xml" />
</sqlMapConfig>
I get a runtime error - Cause: java.io.IOException: Could not find resource com/tatakelabs/dbmaps/categories_SqlMap.xml
categories_SqlMap.xml is present in that location. I tried changing the location of the map xml, but that did not help. sqlMapConfig.xml validates against the DTD. categories_SqlMap.xml also validates against the right DTD. I am at my wits end trying to figure out why it can't find the resource. The sqlMap files are generated by iBator.
This was happening because the sqlmap file location was not getting copied to target. Added a copy goal and that fixed it.
I had the same problem. It appears the problem lies with the location of the config file. Thus, its in relation of the project resource structure.
I moved the config file in the same package as the mapper classes and it worked. In this case try moving all the resources to this package and update the resource attributes to:
<sqlMap resource="categories_SqlMap.xml" />
<sqlMap resource="pro_SqlMap.xml" />
<sqlMap resource="pro_category_SqlMap.xml" />
Solved it.
I moved the xml file to where the Pojo was located and provided the path as follows:
<sqlMap resource="com/heena/ibatis/model/jsr/jsr.xml" />
And it worked.
place it ...src\java\abc.xml under the Source Packages directory.
If you are using Spring, you can use a SqlMapClientFactoryBean specifying property "mappingLocations". In this property you can specify a generic path, such as "com/tatakelabs/dbmaps/*_SqlMap.xml" or with a variable such as ${mapfiles}, that will be resolved by Spring as an array of file names. This lets you omit sqlMap element in sqlMapConfig. This technique will run with iBatis 2.3.4 on. However sql-map-config-2.dtd is also contained inside iBatis.jar, so you can experience some parsing errors, as /com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd may have a bug. In this case you may want to replace it inside the jar with the one from the URL:
http://ibatis.apache.org/dtd/sql-map-config-2.dtd.

Resources