My Typoscript is:
page.headerData.10 = TEXT
page.headerData.10.value (
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
)
The HTML output is:
document.write('<scr' iptsrc="" src=""></scr' + 'ipt>');
Why is it different? Am I missing an escape character?
I'm not sure, but it seems to be a bug.
In fact, it works without the spaces before and after the "+".
page.headerData.10 = TEXT
page.headerData.10.value (
document.write('<scr'+'ipt src="'+src+'"></scr'+'ipt>');
)
Related
I need to make the first string in this formula bold, can anyone help with this?
I am posting below a single fragment of the formula first and after the full formula including the fragment, appreciate all the help.
string in question:
if ({IIS_EPC_EML_MDOC.cardname}) <> "" then
InvAddr:=InvAddr + chr(13) + {IIS_EPC_EML_MDOC.cardname} + ChrW(13) ;
full formula:
WhilePrintingRecords;
Local StringVar InvAddr;
InvAddr:="";
if ({IIS_EPC_EML_MDOC.cardname}) <> "" then
InvAddr:=InvAddr + chr(13) + {IIS_EPC_EML_MDOC.cardname} + ChrW(13) ;
if not isnull({IIS_EPC_EML_MDOC.address}) then
InvAddr:=InvAddr + {IIS_EPC_EML_MDOC.address} + ChrW(13);
//if not isnull({IIS_EPC_EML_MDOC.VatNo}) then
// InvAddr:=InvAddr + 'VAT No:'+{IIS_EPC_EML_MDOC.VatNo};
//Add EORI Number
if ({IIS_EPC_EML_MDOC.BPEORINumber}) <> "" then
InvAddr:=InvAddr + chr(13) + "EORI No.: " + {IIS_EPC_EML_MDOC.BPEORINumber};
//Add VAT Number
if ({IIS_EPC_EML_MDOC.vatno}) <> "" then
InvAddr:=InvAddr + chr(13) + "VAT No.: " + {IIS_EPC_EML_MDOC.vatno};
//Strip out trailing blank spaces from address block
while instr(InvAddr," "+Chr(13)) > 0 do
(
InvAddr:=Replace(InvAddr," "+Chr(13),Chr(13));
);
//Strip out blank lines from address block
while instr(InvAddr,Chr(13)+Chr(13)) > 0 do
(
InvAddr:=Replace(InvAddr,Chr(13)+Chr(13),Chr(13));
);
InvAddr
best Regards,
Daniel
One option is to construct the text as HTML with bold text where you desire.
Then, right-click the formula,
select Format Field...
Select 'Paragraph' tab
and set 'Text Interpretation' to 'HTML text'.
element.textContent = value + "%"
I'm new to coffee script and I'm trying to multiply a value. I've tried the following and none of them work. Not sure what I'm doing wrong here?
element.textContent = {value*100} + "%"
element.textContent = (value*100) + "%"
element.textContent = value*100 + "%"
Simple. Just change your code to this:
element.textContent = String(value * 100) + "%"
Hope this helped!
I'm using the Foundation 5 framework and trying to use the accordion.
If I use the sample code all ok: http://foundation.zurb.com/docs/components/accordion.html
If I try to use div tags and / or sectin in place of tag dl and dd does not work
Why?
Because the accordion code is with hardcoded tag names :) ... and you can't even configure them.
This is part of the accordion code:
........
.on('click.fndtn.accordion', '[' + this.attr_name() + '] dd > a', function (e) {
var accordion = S(this).closest('[' + self.attr_name() + ']'),
target = S('#' + this.href.split('#')[1]),
siblings = S('dd > .content', accordion),
aunts = $('> dd', accordion),
settings = accordion.data(self.attr_name(true) + '-init'),
active_content = S('dd > .content.' + settings.active_class, accordion),
active_parent = S('dd.' + settings.active_class, accordion);
........
You can see the dd and dl tag names inside :) ... but - of course - you can make them configurable :) ...
I need to remove carriage return and linefeed characters that are present in Webspeed URL containing name-value pairs..How can that be done? any ideas please!
To replace characters you can use the REPLACE function
REPLACE function
Returns a string with specified substring replacements.
Syntax
REPLACE ( source-string , from-string , to-string )
Example:
DEFINE VARIABLE cTxt AS CHARACTER NO-UNDO FORMAT "x(20)".
DEFINE VARIABLE cNewTxt AS CHARACTER NO-UNDO FORMAT "x(20)".
cTxt = "abc123abc123abc123".
cNewTxt = REPLACE(cTxt, "a", "-").
DISPLAY cNewTxt .
You could target new lines using the control code ~n
REPLACE(cString, "~n", "replacing character").
Or target the individual %0d (decimal ascii code 13) and %0a's (decimal ascii code 10).
REPLACE(cString, CHR(13), "replacing character").
REPLACE(cString, CHR(10), "replacing character").
I have recently had a need to do something like this and found the following to be quite handy. This might be a bit drastic -- it removes all control codes and anything higher than ascii 126. But you can adjust those limits easily enough. (My usage is to populate text fields -- so all of that stuff is illegal input for me.)
define variable hd as character no-undo initial "0123456789ABCDEF".
function hex2char returns character ( h as character ):
define variable i as integer no-undo.
if length( h ) <> 2 or index( hd, substring( h, 1, 1 )) < 0 or index( hd, substring( h, 2, 1 )) < 0 then
return "".
i = ((( index( hd, substring( h, 1, 1 )) - 1 ) * 16 ) +
index( hd, substring( h, 2, 1 )) - 1
).
if i < 32 or i >= 127 then
return "".
else
return chr( i ).
end.
function url-decode returns character ( input url as character ):
define variable xurl as character no-undo.
define variable zurl as character no-undo.
define variable pct as integer no-undo.
/* fix known trouble makers
*/
assign
xurl = replace( url, "+", " " )
xurl = replace( xurl, "%0A%0D", "~n" ) /* <LF><CR> */
xurl = replace( xurl, "%0D%0A", "~n" ) /* <CR><LF> */
xurl = replace( xurl, "%0D", "~n" ) /* <CR> */
.
pct = index( xurl, "%" ).
do while pct > 0 and xurl > "":
assign
zurl = zurl + substring( xurl, 1, pct - 1 ) + hex2char( substring( xurl, pct + 1, 2 ))
xurl = substring( xurl, pct + 3 )
pct = index( xurl, "%" )
.
end.
return zurl + xurl.
end.
display url-decode( sampleUrl ) view-as editor size 60 by 25.
By default when viewing watches/variables of objects in Netbeans, it shows its address instead of its value. This is quite tiresome since I have to expand the variable to see its real value (e.g. for Double, Integer, Date, etc). As it turns out, Netbeans has "Variable formatters" but there is hardly any documentation that i can find for it.
How would I go about displaying e.g. a simple Date variable in a human readable format in the Watches/Variables window? I don't fully understand the "Edit Variable Formatter" dialog.
I was able to properly do it for Double and Integer by using the following code snippet:
toString()
So the code seems to run in the context of the Double/Integer class. How would I refer to the actual variable if I need to do something more advanced such as:
return DateHelpers.formatDate(dateVariableName??, "yyyy-MM-dd");
In the variables view, you have a small $ icon (at the top left) which tooltip says :"Show variable value as toString() or formatted value".
Just click that, it will show you the "value" of those variables.
EDIT: If you want to add a variable formatter, it's very simple. On the variable formatter view, just click the "Add ..." button then:
In "Formatter Name" put the name of you formatter eg. "My Date formatter"
"Class Types" put your complete class name eg. java.util.Date
Select "Value formatted as a result of code snippet" and type the code to apply. For instance:
toString()
but if you want to manipulate the data or display some other thing you can. For instance:
toString() + " (" + getTime() + ")"
Which will display the time in human readable format plus the time as a long.
Don't forget to select the $ icon on the view to apply your formatter.
My answer won't solve the question. It will rather echo the previous answers. First, I haven't seen the $ sign in the variables-panel in NetBeans. Seems it was replaced with a context menu in current versions.
I haven't found the answer to the actual question, as of how you would reference the variable to debug, within the "Variable Formatters" Dialog. Something like "this" or "$1" isn't working definitely. Also the facility does not seem to know about Standard Java JRE classes like SimpleDateFormatter.
So when debugging Java JRE classes, I guess you have to live with what they're offering in terms of public methods.
Here's a workaround for the especially user friendly Date class, if you're stuck with a JDK below version 8 (as me). Just create a new Variable Formatter in NetBeans via
Tools > Options > Java > Variable Formatters > Add
Then in the "Class Types" editfield enter:
java.util.Date
Under "Value formatted as a result of code snippet" use one of the next snippets.
// German format - "dd.MM.yyyy hh:mm"
((getDate() < 10) ? ("0" + getDate()) : getDate()) + "." + ((getMonth() < 9) ? ("0" + (getMonth() + 1)) : (getMonth() + 1) ) + "." + (getYear() + 1900) + " " + ((getHours() < 10) ? "0" + getHours() : getHours()) + ":" + ((getMinutes() < 10) ? "0" + getMinutes() : getMinutes()) + ":" + ((getSeconds() < 10) ? "0" + getSeconds() : getSeconds())
// US format - "MM/dd/yyyy hh:mm"
((getMonth() < 9) ? ("0" + (getMonth() + 1)) : (getMonth() + 1) ) + "/" + ((getDate() < 10) ? ("0" + getDate()) : getDate()) + "/" + (getYear() + 1900) + " " + ((getHours() < 10) ? "0" + getHours() : getHours()) + ":" + ((getMinutes() < 10) ? "0" + getMinutes() : getMinutes()) + ":" + ((getSeconds() < 10) ? "0" + getSeconds() : getSeconds())
// ISO-8601 - "yyyy-MM-dd hh:mm"
(getYear() + 1900) + "-" + ((getMonth() < 9) ? ("0" + (getMonth() + 1)) : (getMonth() + 1) ) + "-" + ((getDate() < 10) ? ("0" + getDate()) : getDate()) + " " + ((getHours() < 10) ? ("0" + getHours()) : getHours()) + ":" + ((getMinutes() < 10) ? ("0" + getMinutes()) : getMinutes()) + ":" + ((getSeconds() < 10) ? ("0" + getSeconds()) : getSeconds())
The next snippet could also come in handy, when your lost in the the debug-output overkill of an instance of java.util.Calendar:
// German format - "dd.MM.yyyy hh:mm"
((get(5) < 10) ? ("0" + get(5)) : get(5)) + "." + ((get(2) < 9) ? ("0" + (get(2) + 1)) : (get(2) + 1) ) + "." + (get(1)) + " " + ((get(10) < 10) ? "0" + get(10) : get(10)) + ":" + ((get(12) < 10) ? "0" + get(12) : get(12)) + ":" + ((get(13) < 10) ? "0" + get(13) : get(13))
You can even put a much more complex code in the variable formatter, as long as you return a string. For example, if I have a class with two string members, name and surname I can paste the follwing code in the "Value formatted.." box:
String result;
if (name != null) {
result = name + " " + surname;
} else {
result = "<null>";
}
return result;
.. and for displaying as children the name and surname separately you can paste a code in the "Children displayed as.." box to return a String[], for example:
String[] results = new String[2];
results[0] = "name: " + name;
results[1] = "surname: " + surname;
return results;
This will display two nodes as children in the variables debug window with the name and surname
The variable itself can be referenced by this (at least it works in Netbeans 8.1).
So, let's say we want the identityHashCode of our Collection after its size:
"size = " +size() + " #" + System.identityHashCode(this)