I am getting problem with FILEs concept in C language.
My problem is I have a html file , and that was opened in read mode.
I need to get the data from that file. The acurate is i between the two strings.
The strings are "<Response>" and "</Response>".
The text file is shown below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
<form name="form1" method="post" action="pos_fis_transactions.aspx?trans=14%7c35381192%7c10-10-2011%7c1000.0%7c10-10-2011%7cCASH%7cCREDIT%7cc%7cGCC" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE3NDI1ODEyMjhkZKgy7LmL8WTr+VEeDUOifRqzISfa" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLEypqSAQKez72pDln9yKosD6kd+LvgBmdrWkYoLk2u" />
<div>
<textarea name="txtTransAck" rows="2" cols="20" id="txtTransAck">**<Response>14|245</Response>**</textarea>
</div>
</form>
</body>
</html>
In the above html file, I need to pick the data 14|25.
First of all you are not looking for <Response> and </Response> but <Resonse> and </Resonse> .
If the file is not too big, load it into memory and do a
strnstr( loadedFileContent, "<Response>", lengthOfLoadedFileContent );
This gives you a char pointer to the first & - now add strlen( "<Response>" ) to that, and you arive at your content.
Now either you know the length of your content and read it, or search from that position on for the nest & and take the string in between.
hth
Mario
Related
i am using angular-cli, followed angular-io to generate in Spanish language.
app.component.html
<h2 i18n="header">Login form</h2>
<div>
<span i18n>Email</span>
<input type="text" placeholder="Your email" i18n-placeholder>
</div>
<div>
<span i18n>Password</span>
<input type="password" placeholder="Password" i18n-placeholder>
</div>
<hr>
<div i18n>If you want to search something, go to Google</div>
message.es.xlf
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template">
<body>
</body>
</file>
</xliff>
getting generated message.es.xlf file once completing ./node_modules/.bin/ng-xi18n,but not able to find target tag in that file.
please help me
A little late but may help someone. Had the same problem, I resolved it by specifying the output file:
./node_modules/.bin/ng-xi18n --i18nFormat=xmb --outFile=messages.xmb
It is 2019, when I come back to Angular, and I found this same issue. The problem is that your XLF file must have a pair of target tags for every pair of source tags. You may add those tags manually, probably by copying and pasting and renaming the source tags, or you may use this script:
https://github.com/geocarlos/angular-i18n-target-tagger
I have a variable imageUrl which I'm splitting wrt . and storing in an array imageUrlParts as follows:
<c:set var="imageUrlParts" value="${fn:split(imageUrl, '.')}" />
Now, I just want to append something more to the second last token of that. For instance if the URL is a.b.c.d then I want to make it a.b.cSOMETHINGADDED.d. So I am doing the following:
<c:set var="len" value="${fn:length(imageUrlParts)}" />
<c:set var="imageUrlParts[len-2]" value="${imageUrlParts[len-2]}SOMETHINGADDED" />
<c:set var="imageUrl" value="${fn:join(imageUrlParts, '.')}" />
But it is not working, as in, it is reconstructing it as a.b.c.d itself and NOT a.b.cSOMETHINGADDED.d, which means that the following line
<c:set var="imageUrlParts[len-2]" value="${imageUrlParts[len-2]}SOMETHINGADDED" />
is not working (of course). Can you tell me how I should achieve what I want to do?
Any kind of help would be highly appreciated.
Here is demonstration code. If you don't want to use the first line, then you will have to put the forEach tag code on one line. That would avoid spaces within output String.
<%# page trimDirectiveWhitespaces="true" %>
<%# taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<%# taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions" %>
<c:set var="imageUrl" value="a.b.c.d" />
<c:set var="imageUrlParts" value="${fn:split(imageUrl, '.')}" />
<c:set var="len" value="${fn:length(imageUrlParts)}" />
<c:forEach var="part" items="${imageUrlParts}" varStatus="status">
${part}
<c:if test="${(len -1) == status.count}">SOMETHINGADDED</c:if>
<c:if test="${!status.last}">.</c:if>
</c:forEach>
I am new with schematron and I have the following problem. This is the snippet from xhtml file:
<div class="provision">
<!-- provision (SECTION) -->
<header>
<!-- headers -->
<div class="desig">
<!-- if provision then header/div#class=desig/span#class=num required -->
<span class="num">1.</span>
</div>
<h1 class="title">prov-title</h1>
</header>
<p class="prov">para-prov-level</p>
<p class="prov">para-prov-level</p>
<div class="glossary">
<!-- glossary -->
<!-- glossary requires dl -->
<dl>
<!-- dl should have dt, and at least one dd -->
<dt> term </dt>
<dd>definition</dd>
<dt> term </dt>
<dd>definition</dd>
</dl>
</div>
<div class="level-1-grp">
<!-- SUBSECTION -->
<header>
<div class="desig">
<span class="num">(1)</span>
</div>
</header>
<p class="level-1">para-level-1</p>
<div class="level-2-grp">
<header>
<div class="desig">
<span class="num">(a)</span>
</div>
</header>
<p class="level-2">para-level-2</p>
</div>
<div class="level-2-grp">
<header>
<div class="desig">
<span class="num">(b)</span>
</div>
</header>
<p class="level-2">para-level-2</p>
</div>
<p class="level-1">para-level-1</p>
</div>
<p class="prov">para-prov-level</p>
</div>
and I would like to create a rule to check
if there is a provision then header/div#class=desig/span#class=num required and glossary requires dl. I have been trying like this but it does not work:
<iso:pattern id="structure-provision">
<iso:title>Testing for Provision structure...</iso:title>
<iso:rule context="*:div[#class='provision']">
<iso:assert test="self::*:header/div[#class ='desig']/*:span[#class='num']">if provision then header/div#class=desig/span#class=num required</iso:assert>
</iso:rule>
</iso:pattern>
<!--glossory structure -->
<iso:pattern id="structure-glossory">
<iso:title>Testing for Provision structure...</iso:title>
<iso:rule context="*:div[#class='glossory']">
<iso:assert test="self::*:dl">glossary requires dl</iso:assert>
<iso:assert test="self::*:dl/dt">dl should have a dt</iso:assert>
</iso:rule>
</iso:pattern>
Any help would be appreciated. Thanks
You were missing a namespace on the div element in your first iso:assert.
The English language is not very precise, so I interpreted your requirements in 2 ways.
1) if there is a provision then (header/div#class=desig/span#class=num required AND glossary requires dl). "If X, then A and B". If this is the case, then only a single pattern should be used.
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<sch:pattern id="structure-provision">
<sch:title>Provisioning structure</sch:title>
<sch:rule context="*:div[#class='provision']">
<sch:assert test="*:header/*:div[#class ='desig']/*:span[#class='num']">
The provision structure requires header/div#class=desig/span#class=num
</sch:assert>
<sch:assert test="*:div[#class='glossary']/*:dl">
Glossary requires dl
</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>
2) (if there is a provision then header/div#class=desig/span#class=num required) AND (glossary requires dl). "If X, then A. Also, if Y, then B." If this is the case, then two patterns should be used.
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<sch:pattern id="provision-structure">
<sch:title>Provisioning structure</sch:title>
<sch:rule context="*:div[#class='provision']">
<sch:assert test="*:header/*:div[#class ='desig']/*:span[#class='num']">
The provision structure requires header/div#class=desig/span#class=num
</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern id="glossary-structure">
<sch:title>Provisioning structure</sch:title>
<sch:rule context="*:div[#class='glossary']">
<sch:assert test="*:dl">
Glossary requires dl
</sch:assert>
<sch:assert test="*:dl/*:dt">
dl requires dt
</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>
I would recommend splitting your requirements up into several rules/patterns to make things more robust and organized. For example, have all of your rules related to provisioning structure within a single pattern. If glossary rules should be enforced regardless of whether the glossary is within a provisioning structure, then glossary should have its own pattern.
Also, I would define and use a namespace for the elements and use that within the schematron rules. I assume it is xhtml or similar? The xpath expressions would become something like:
<sch:rule context="xhtml:div[#class='provision']">
<sch:assert test="xhtml:header/xhtml:div[#class ='desig']/xhtml:span[#class='num']">
Rule text here
</sch:assert>
</sch:rule>
If I place inside an include file, the action will not call back bean.
Main File:
<h:form id="ifLogin">
<h:panelGrid
rendered="#{userSession.isLogin}"
columns="2" columnClasses="columnAlignLeft, columnAlignRight"
border="0" cellpadding="0">
<ui:include src="\test.xhtml" />
...
</h:panelGrid>
</h:form>
Include file (test.xhtml)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:panelGrid border="0" columns="4">
<h:graphicImage value="#{msg.urlImageHome}"
style="height:26px;width:26px;" />
<f:subview>
<h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"
action="#{pageNavigationBean.updateCeaAppName}">
<f:param name="requestName" value="CEA_MAIN_PAGE" />
<f:param name="ceaAppName" value="" />
</h:commandLink>
</f:subview>
</h:panelGrid>
</ui:composition>
The workaround is take out include file, directly place the code to main file as below:
Main file (without using include)
<h:form id="ifLogin">
<h:panelGrid
rendered="#{userSession.isLogin}"
columns="2" columnClasses="columnAlignLeft, columnAlignRight"
border="0" cellpadding="0">
<h:panelGrid border="0" columns="4">
<h:graphicImage value="#{msg.urlImageHome}"
style="height:26px;width:26px;" />
<f:subview>
<h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"
action="#{pageNavigationBean.updateCeaAppName}">
<f:param name="requestName" value="CEA_MAIN_PAGE" />
<f:param name="ceaAppName" value="" />
</h:commandLink>
</f:subview>
</h:panelGrid>
...
</h:panelGrid>
</h:form>
I use richface 4.3.1 Odd is this problem not happen when I run from local GAE. After deploy online to GAE, problem occour (i.e if using include then action will not trigger.
Is that a bug in jsf? or richface implementation or GAE? Any help?
Problem identify
It is not cause by using <ui:include>
The problem came out when the include file is dynamic generate from back bean, for example:
<ui:include src="#{pageNavigationBean.appDropDownMenuUrl}" />
If explicit mention the url, it work, for example:
<ui:include src="\test.xhtml" />
Well, if running from my local GAE, both way are working but when deploy online, I need use explicit location instead generate from bean. May be that is due to GAE problem where state is save at Client side (javax.faces.STATE_SAVING_METHOD).
I can't reproduce the problem with exactly the same included code (test.xhtml), but here are some recommendation:
Escape '>' characters (replace >>> by >>>)
Specify id attribute for f:subview (it is required according to tld)
Change backslash ('\') to slash ('/'). So inclusion would be <ui:include src="/test.xhtml" />
I have a Facelets Composite component that includes, among other things, a commandButton:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<ui:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:nc="http://compositecomps.sss.evla.nrao.edu/jsf"
xmlns:opt="http://java.sun.com/jsf/composite/components/opt"
xmlns:undo="http://undo.sss.evla.nrao.edu/jsf"
xmlns:n="http://sss.evla.nrao.edu/jsf"
xmlns:f="http://java.sun.com/jsf/core">
<cc:interface>
<cc:attribute name="value" type="edu.nrao.sss.tools.obsprep.bulkedit.BulkEditor" required="true"/>
<cc:attribute name="loop" type="edu.nrao.sss.tools.obsprep.uiactions.project.scan.ScanLoopUIActions" required="true"/>
</cc:interface>
<cc:implementation>
<ui:param name="loop" value="#{cc.attrs.loop}"/>
<ui:param name="val" value="#{cc.attrs.value}"/>
<ice:panelGroup id="wizStep1"
rendered="#{val.readyToSelect}">
<nc:header value="select fields to filter on"/>
<ice:commandButton value="#{val.nameField.value}" action="#{val.select}"/>
<table cellpadding="5">
<thead>
<tr>
<th></th><th>Field</th><th>Search For</th><th></th>
</tr>
</thead>
<tbody>
<opt:bulkEditField value="#{val.nameField}">
<f:facet name="summary">
<ice:inputText value="#{val.nameField.value}"/>
</f:facet>
</opt:bulkEditField>
</tbody>
</table>
<ice:commandButton value="Select" action="#{val.select}"/>
</ice:panelGroup>
</cc:implementation>
</ui:component>
I've changed the code to use val.nameField.value as the label for the first command button to demonstrate the problem.
When I use this component in a page, it renders the button and a list of searchable fields below it. If I change the value of the name field, the button label changes.
However, if I click the button, I get a target unreachable exception:
Caused by: javax.el.PropertyNotFoundException: /resources/components /opt/bulkEdit.xhtml #25,79 action="#{val.select}": Target Unreachable, identifier 'val' resolved to null
I feel like I must be missing something fundamental to how these composite components work. This worked fine as a tag file under facelets/JSF 1.2. In the process of upgrading to JSF 2.0, I wanted to move on to using composite components so I can have a defined interface.
If I stop using <ui:param/> and put cc.attrs.value in directly, it tells me that cc is null.
I thought this could be a bug in icefaces, but switching to plain <h:commandButton/> does the same thing.
Thanks for any advice you may have.
This is a bug in ICEfaces 2.0. You have a UISeries (panelTabSet or dataTable) that contains the composite component. See http://jira.icesoft.org/browse/ICE-7142. It's fixed in 3.0.