What is the extent of Arabic letters in HTML?
<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Graphics="ReLogic.Content.Pipeline">
<Asset Type="Graphics:DynamicFontDescription">
<FontName>aboodedcF1</FontName>
<Size>14</Size>
<Spacing>0</Spacing>
<UseKerning>true</UseKerning>
<Style>Bold</Style>
<DefaultCharacter>*</DefaultCharacter>
<VerticalOffset>DefaultFontAscent</VerticalOffset>
<CharacterRegions>
<CharacterRegion>
<Start> </Start>
<End>©</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>
between
<CharacterRegion>
<Start> </Start>
<End>©</End>
</CharacterRegion>
I searched a lot on the internet and didn't find anything
<!-- arabic Characters -->
<CharacterRegion>
<FontName>Anaqa</FontName> <!-- font name -->
<Size>30</Size>
<Style>Regular</Style>
<Start></Start>
<End>ۿ</End>
</CharacterRegion>
<CharacterRegion>
<FontName>Anaqa</FontName> <!-- font name -->
<Size>30</Size>
<Style>Regular</Style>
<Start>ﹰ</Start>
<End></End>
</CharacterRegion>
Related
I have a multipoint geometry (a single geometry containing multiple points) and I want to place a label on each of the points (the label is always the same). Is it possible to achieve this with SLD? Right now the label is only displayed on a single point.
My SLD looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Multipoint with labels</Name>
<UserStyle>
<Title>Default Point</Title>
<Abstract>A sample style that draws a point</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>rule1</Name>
<Title>Red Square</Title>
<Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>square</WellKnownName>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</Mark>
<Size>6</Size>
</Graphic>
</PointSymbolizer>
<TextSymbolizer>
<Label>NAME</Label>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
By default the GeoServer label engine goes to a lot of trouble to not label multiple times on the same feature, so this is hard!
I finally managed it using the following (ugly) SLD:
<Rule>
<Title>Capitals</Title>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>0</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
</Rule>
However this assumes you know how many points there are in your largest multi-point, and that is quite small (otherwise it's a lot of copy & paste).
I had originally hoped to be able to use the vertices function or possibly the labelAllGroup vendor option, but sadly neither worked with multi-points.
I'm building go web application. I found some anomaly on the rendered html page. All of my html comments <!-- --> are suddenly not being rendered. My guess it's because the go version I used (just updated to higher version), because it was fine before I updated it.
This is my code:
<!-- prepare the breadcrumbs -->
<ul class="breadcrumb" data-bind="foreach: viewModel.breadcrumbs">
<!-- ko if: ($index() + 1) < len(viewModel.breadcrumbs()) -->
<li>
<a data-bind="attr: { href: href }">
<i class="fa fa-home"></i>
<span data-bind="text: title"></span>
</a>
</li>
<!-- /ko -->
<!-- ko if: ($index() + 1) == len(viewModel.breadcrumbs()) -->
<li class="active" data-bind="text: title"></li>
<!-- /ko -->
</ul>
And this is the rendered page source:
Because of this issue, many of my KnockoutJS codes which are written using containerless control flow syntax goes crazy, it doesn't work at all.
What should I do to solve this? Thanks in advance
There is a special type in the html/template package: template.HTML. Values of this type in the template are not escaped when the template is rendered.
So you may "mark" your HTML comments as template.HTML and so they will not be escaped or omitted during executing your template.
One way to do this is to register a custom function for your template, a function which can be called from your template which takes a string argument and returns it as template.HTML. You can "pass" all the HTML comments to this function, and as a result, your HTML comments will be retained in the output.
See this example:
func main() {
t := template.Must(template.New("").Funcs(template.FuncMap{
"safe": func(s string) template.HTML { return template.HTML(s) },
}).Parse(src))
t.Execute(os.Stdout, nil)
}
const src = `<html><body>
{{safe "<!-- This is a comment -->"}}
<div>Some <b>HTML</b> content</div>
</body></html>`
Output (try it on the Go Playground):
<html><body>
<!-- This is a comment -->
<div>Some <b>HTML</b> content</div>
</body></html>
So basically after registering our safe() function, transform all your HTML comments to a template action calling this safe() function and passing your original HTML comment.
Convert this:
<!-- Some HTML comment -->
To this:
{{safe "<!-- Some HTML comment -->"}}
Or alternatively (whichever you like):
{{"<!-- Some HTML comment -->" | safe}}
And you're good to go.
Note: If your HTML comment contains quotation marks ('"'), you can / have to escape it like this:
{{safe "<!-- Some \"HTML\" comment -->"}}
Note #2: Be aware that you shouldn't use conditional HTML comments as that may break the context sensitive escaping of html/template package. For details read this.
You can use text/template instead of html/template and do all escaping manually using built-in functions such as html and js (https://golang.org/pkg/text/template/#hdr-Functions). Be aware that this is very error prone though.
I try to use WMS to dispaly raster map in geotiff format on web. I want to classify the raster file. how can I do this? I use mapserver for windows. The following is my .map file.
what I get through this is
MAP
NAME PM10
IMAGECOLOR 255 255 255
SIZE 600 800
IMAGETYPE PNG24 ## use AGG to for anti-aliassing
OUTPUTFORMAT
NAME 'AGG'
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END # outputformat
PROJECTION
"init=epsg:3035" #latlon on etrs 1989 laea
END
EXTENT 3487500 2297500 4402500 3202500 # meters extents of region2
WEB
IMAGEPATH "c:/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"ows_enable_request" "*"
"map" "C:/ms4w/apps/airpollution/config.map"
"ows_schemas_location" "http://schemas.opengeospatial.net"
"ows_title" "Sample WMS"
"ows_enable_request" "*"
"ows_onlineresource" "http://localhost:7070/cgi-bin/mapserv.exe? map=C:/ms4w/apps/airpollution/config.map&"
"ows_srs" "EPSG:3035 " #latlon
"wms_feature_info_mime_type" "text/plain"
"wms_feature_info_mime_type" "text/html"
"wms_server_version" "1.1.1"
"wms_formatlist" "image/png,image/gif,image/jpeg, image/geotiff"
"wms_format" "image/geotiff"
END #metadata
END #web
LAYER
NAME "pm10"
DATA "pm10.tif"
TYPE RASTER
STATUS ON
METADATA
"ows_title" "pollution"
END #metadata
PROJECTION
"init=epsg:3035"
END #projection
CLASSITEM "[pixel]"
# class using simple string comparison, equivelent to ([pixel] = 0)
CLASS
EXPRESSION "0"
STYLE
COLOR 20 20 20
END
END
# class using an EXPRESSION using only [pixel].
CLASS
EXPRESSION ([pixel] >= 0AND [pixel] < 7)
STYLE
COLOR 255 0 0
END
CLASS
EXPRESSION ([pixel] >= 7AND [pixel] < 20)
STYLE
COLOR 0 255 0
END
END
CLASS
EXPRESSION ([pixel] >= 7AND [pixel] < 50)
STYLE
COLOR 0 0 255
END
END
END #layer pm10
END #map
and what I get as a responce is this image
it seems that it only reads line 3
IMAGECOLOR 255 255 255
I don't know map server very well, but I know that you can style Rasters from a WMS using SLD (Styled Layer Descriptor), which is simply a xml file that you can pass in a WMS request according to OGC standards.
In other words: You can specify the classification in a XML schema. Following is an example of a simple SLD that styles everything in a raster black except white pixels, which are styled opaque.
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>undefined</Name>
<UserStyle>
<Name>rasterr</Name>
<Title>Rasterr</Title>
<Abstract>A simple raaster style</Abstract>
<FeatureTypeStyle>
<FeatureTypeName>Feature</FeatureTypeName>
<Rule>
<RasterSymbolizer>
<Opacity>1.0</Opacity>
<ColorMap>
<ColorMapEntry color="#ffffff" quantity="0" opacity="0.0" />
<ColorMapEntry color="#000000" quantity="1" />
<ColorMapEntry color="#000000" quantity="2" />
<ColorMapEntry color="#000000" quantity="3" />
<ColorMapEntry color="#000000" quantity="4" />
<ColorMapEntry color="#000000" quantity="5" />
<ColorMapEntry color="#000000" quantity="6" />
<ColorMapEntry color="#000000" quantity="7" />
<ColorMapEntry color="#000000" quantity="8" />
<ColorMapEntry color="#000000" quantity="9" />
<ColorMapEntry color="#000000" quantity="10" />
</ColorMap>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Pass the SLD like this:
http://demo.mapserver.org/cgi-bin/wms?SERVICE=wms&VERSION=1.1.1&REQUEST=GetMap&LAYERS=country_bounds&SLD=http://demo.mapserver.org/ogc-demos/map/sld/sld_line_simple.xml
Read more here:
http://mapserver.org/ogc/sld.html - This is for mapserver, use the RasterSymbolizer and a ColorMap to do your classification. On that page it is also described how the colormap works.
http://www.opengeospatial.org/standards/sld
Wikipedia
Use ItemOperations to get a message:
How do I get the Headers in Particular the MessageID for the Email?
I'm confused the example on MSDN clearly shows the email Header.
http://msdn.microsoft.com/en-us/library/ee220018%28v=EXCHG.80%29.aspx
Am I missing an additional command/field/Flag?
Thanks,
Pat
Environment
Exchange 2003 Protocol: 12.1 ActiveSync
IN:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<ItemOperations xmlns:airsync=\"AirSync:\" xmlns:airsyncbase=\"AirSyncBase:\" xmlns=\"ItemOperations:\">
<Fetch>
<Store>Mailbox</Store>
<airsync:CollectionId>6</airsync:CollectionId>
<airsync:ServerId>6:1</airsync:ServerId>
<Options>
<airsync:MIMESupport>1</airsync:MIMESupport>
<airsyncbase:BodyPreference>
<airsyncbase:Type>2</airsyncbase:Type>
<airsyncbase:TruncationSize>5120</airsyncbase:TruncationSize>
<airsyncbase:AllOrNone>0</airsyncbase:AllOrNone>
</airsyncbase:BodyPreference>
</Options>
</Fetch>
</ItemOperations>
OUTPUT:
XML Response:
<?xml version="1.0" encoding="utf-8"?>
<itemoperations:ItemOperations xmlns:itemoperations="ItemOperations:">
<itemoperations:Status>1</itemoperations:Status>
<itemoperations:Response>
<itemoperations:Fetch>
<itemoperations:Status>1</itemoperations:Status>
<airsync:CollectionId xmlns:airsync="AirSync:">6</airsync:CollectionId>
<airsync:ServerId xmlns:airsync="AirSync:">6:1</airsync:ServerId>
<airsync:Class xmlns:airsync="AirSync:">Email</airsync:Class>
<itemoperations:Properties>
<email:To xmlns:email="Email:">"pat2 pm. mol" <pat2.test#dhmars.loc&g
t;</email:To>
<email:From xmlns:email="Email:">"pat2 pm. mol" <pat2.test#dhmars.loc
></email:From>
<email:Subject xmlns:email="Email:">TESTMAIL</email:Subject>
<email:DateReceived xmlns:email="Email:">2011-12-06T15:22:24.613Z</email
:DateReceived>
<email:DisplayTo xmlns:email="Email:">pat2 pm. mol</email:DisplayTo>
<email:ThreadTopic xmlns:email="Email:">TESTMAIL</email:ThreadTopic>
<email:Importance xmlns:email="Email:">1</email:Importance>
<email:Read xmlns:email="Email:">1</email:Read>
<airsyncbase:Body xmlns:airsyncbase="AirSyncBase:">
<airsyncbase:Type>2</airsyncbase:Type>
<airsyncbase:EstimatedDataSize>1627</airsyncbase:EstimatedDataSize>
<airsyncbase:Data><html>
<head>
<style>
<!--
#font-face
{font-family:"Cambria Math"}
#font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
span.EmailStyle17
{font-family:"Calibri","sans-serif";
color:windowtext}
.MsoChpDefault
{font-family:"Calibri","sans-serif"}
#page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
{}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"> </p>
</div>
</body>
</html>
</airsyncbase:Data>
</airsyncbase:Body>
<email:MessageClass xmlns:email="Email:">IPM.Note</email:MessageClass>
<email:InternetCPID xmlns:email="Email:">20127</email:InternetCPID>
<email:Flag xmlns:email="Email:" />
<email:ContentClass xmlns:email="Email:">urn:content-classes:message</em
ail:ContentClass>
<airsyncbase:NativeBodyType xmlns:airsyncbase="AirSyncBase:">2</airsyncb
ase:NativeBodyType>
</itemoperations:Properties>
</itemoperations:Fetch>
</itemoperations:Response>
</itemoperations:ItemOperations>
You have set airsyncbase:Type = 2. This gives you an HTML response.
You need to set Type = 4 if you want a full MIME response. That will have all the headers that you need.
See 2.2.2.22 Type of [MS-ASAIRS]: Exchange ActiveSync: AirSyncBase Namespace Protocol at http://msdn.microsoft.com/en-us/library/hh475675(v=exchg.80).aspx.
Seems ok, but, first of all, you have to check if the request support a ASAcceptMultiPart:
http://msdn.microsoft.com/en-us/library/ee159875%28v=EXCHG.80%29.aspx
An html template is compiled into the application as a resource. A fragment of the HTML template looks like:
<A href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR>
%CAPTIONTEXT%
i like it like this because the larger resource HTML file contains styling, no-quirks mode, etc.
But as is always the case, they now want the option that the Anchor tag should be omitted if there is no link. Also if there is no caption, then the BR tag should be omitted.
Considered Technique Nº1
Given that i don't want to have to build entire HTML fragments in C# code, i considered something like:
%ANCHORSTARTTAGPREFIX%<A href="%PANELLINK%" target="_blank">%ANCHORSTARTTAGPOSTFIX%
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
%ANCHORENDTAGPREFIX%</A>%ANCHORENDTAGPOSTFIX%CAPTIONPREFIX%<BR>
%CAPTIONTEXT%%CAPTIONPOSTFIX%
with the idea that i could use the pre and postfixes to turn the HTML code into:
<!--<A href="%PANELLINK%" target="_blank">-->
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
<!--</A>--><!--<BR>
%CAPTIONTEXT%-->
But that is just rediculous, plus one answerer reminds us that it wastes bandwith, and can be buggy.
Considered Technique Nº2
Wholesale replacement of tags:
%AnchorStartTag%
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
%AnchorEndTag%%CaptionStuff%
and doing a find-replace to change
%AnchorStartTag%
with
"<A href=\"foo\" target=\"blank\""
Considered Technique Nº3
i considered giving an ID to the important HTML elements:
<A id="anchor" href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR id="captionBreak">
%CAPTIONTEXT%
and then using an HTML DOM parser to programatically delete nodes. But there is no easy access to a trustworthy HTML DOM parser. If the HTML was instead xhtml i would use various built-in/nativly available xml DOM parsers.
Considered Technique Nº4
What i actually have so far is:
private const String htmlEmptyTemplate =
#"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN\"""+Environment.NewLine+
#" ""http://www.w3.org/TR/html4/strict.dtd"">"+Environment.NewLine+
#"<HTML>"+Environment.NewLine+
#"<HEAD>"+Environment.NewLine+
#" <TITLE>New Document</TITLE>"+Environment.NewLine+
#" <META http-equiv=""X-UA-Compatible"" content=""IE=edge"">"""+Environment.NewLine+
#" <META http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"">"+Environment.NewLine+
#"</HEAD>"+Environment.NewLine+
#""+Environment.NewLine+
#"<BODY style=""margin: 0 auto"">"+Environment.NewLine+
#" <DIV style=""text-align:center;"">"+Environment.NewLine+
#" %ContentArea%"+Environment.NewLine+
#" </DIV>" + Environment.NewLine +
#"</BODY>" + Environment.NewLine +
#"</HTML>";
private const String htmlAnchorStartTag =
#"<A href=""%PANELLINK%"" target=""_blank"">";
//Image is forbidden from having end tag
private const String htmlImageTag =
#"<IMG border=""0"" src=""%PANELIMAGE%"" style=""%IMAGESTYLE%"">";
private const String htmlCaptionArea =
#"<BR>%CAPTIONTEXT%";
And i already want to gouge my eyeballs out. Building HTML in code is a nightmare. It's a nightmare to write, a nightmare to debug, and a nightmare to maintain - and it will makes things difficult on the next guy. i'm hoping for another solution - since i am the next guy.
My reputation points in this game already being low gives me the freedom to tell you quite plainly that you, sir or madame, are in serious need of XSLT. Failing this (and you probably will) you need to look at XML literals in VB.NET (which provides you with the template-based solution you are looking for...). Since I prefer to stay in C# (even though I was born and raised on VBA), I use XSLT.
Both of my unwelcome recommendations require the use of XHTML instead of HTML. This requirement alone is quite a turn off to many traditional developers. I can already see through your use of capital letters for HTML elements that you will find my remarks utterly useless. So I should stop writing now.
What about this: Store XML as your fragment:
<fragment type="link_img_caption">
<link href="%PANELLINK%" />
<img src="%PANELIMAGE%" style="%IMAGESTYLE%" />
<caption text="%CAPTIONTEXT%" />
</fragment>
Pull it out, replace the placeholders with the "real" strings (that you have carefully XML-escaped of course),
...and use a simple XML transformation to produce HTML output:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="fragment" />
</xsl:template>
<xsl:template match="fragment[#type = 'link_img_caption']">
<xsl:choose>
<xsl:when test="link[#href != '']">
<a href="{link/#href}" target="_blank">
<img src="{img/#src}" style="{img/#style}" border="0" />
</a>
</xsl:when>
<xsl:otherwise>
<img src="{img/#src}" style="{img/#style}" border="0" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="caption[#text !='']">
<br />
<xsl:value-of select="caption/#text" />
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Other fragment types could be added because of the type attribute. There is much room to improve this, so look at it as an example of how it could be done.
Output:
<a href="%PANELLINK%" target="_blank">
<img src="%PANELIMAGE%" style="%IMAGESTYLE%" border="0">
</a>
<br>
%CAPTIONTEXT%
and, if the link href is empty in the XML:
<img src="%PANELIMAGE%" style="%IMAGESTYLE%" border="0">
<br>
%CAPTIONTEXT%
Use a templating engine, like one of these.
1.) Don't use comments, you'll send useless data to the browser wasting bandwidth and encountering BUGs in IE.
2.) Would this not be better as some sort of method? (I'm not familiar with C#) but something like this makes more sense to me.
//using PHP in this example
function HTMLImage($imageData, $linkData){
var str = '';
//if there is link data, start <a> tag
$str .= '<a '.{expand any attributes}.'>';
//add image tag and attributes from $imageData
$str .= '<img '.{expand any attributes}.'/>';
//if there is link data, close <a> tag
$str .= '</a>';
return $str;
}
I would use Template Toolkit, unfortunately it is currently only implemented in Perl and Python.
test.pl:
use Template;
my $template = Template->new({
VARIABLES => {
ImageStyle => "default",
CaptionText => "Place Caption Here"
},
});
$template->process( 'test.tt', {
panel => {
link => "http://Stackoverflow.com/",
image => "/Content/Img/stackoverflow-logo-250.png",
alt => "logo link to homepage"
}
} );
test.tt:
[% IF panel.link -%]
<A href="[% panel.link %]" alt="[% panel.alt %]" target="_blank">
[%- END -%]
[%- IF panel.image -%]
<IMG border="0" src="[% panel.image %]" style="[% ImageStyle %]">
[%- END -%]
[%- IF panel.link %]</A>[% END %]<BR>
[% CaptionText %]
Outputs:
<A href="http://Stackoverflow.com/" alt="logo link to homepage" target="_blank">
<IMG border="0" src="/Content/Img/stackoverflow-logo-250.png" style="default">
</A><BR>
Place Caption Here
If the variable panel.link isn't defined it skips the anchor tags.
<IMG border="0" src="/Content/Img/stackoverflow-logo-250.png" style="default">
<BR>
Place Caption Here
Templates are a serious code smell. Take a look at how Seaside generates html.
[Edit] Another one where someone without a clue downvoted.