How to show the + symbol in an equation that is generated by https://render.githubusercontent.com for github-pages? - github-pages

I can't seem to get the "+" symbol to appear:
<img src="https://render.githubusercontent.com/render/math?math={\color{black} \large \sigma = f(\mu) = a\mu^2 + b\mu + c} "> Eqn(2)
It is giving me this wrong result. The appearance I desire is this correct appearance.

Quoting a comment by #Jishan in this answer
Anyone using this method, because + is an escape character in URI, use %2B to render +.

Related

Regex (re2 googlesheets) multiple values in multiline cell

Getting stuck on how to read and pretty up these values from a multiline cell via arrayformula.
Im using regex as preceding line can vary.
just formulas please, no custom code
The first column looks like a set of these:
```
[config]
name = the_name
texture = blah.dds
cost = 1000
[effect0]
value = 1000
type = ATTR_A
[effect1]
value = 8
type = ATTR_B
[feature0]
name = feature_blah
[components]
0 = comp_one,1
[resources]
res_one = 1
res_five = 1
res_four = 1
<br/>
Where to be useful elsewhere, at minimum it needs each [tag] set ([effect\d], [feature\d], ect) to be in one column each, for example the 'effects' column would look like:
ATTR_A:1000,ATTR_B:8
and so on.
Desired output can also be seen in the included spreadsheet
<br/>
<b>Here is the example spreadsheet:</b>
https://docs.google.com/spreadsheets/d/1arMaaT56S_STTvRr2OxCINTyF-VvZ95Pm3mljju8Cxw/edit?usp=sharing
**Current REGEXREPLACE**
Kinda works, finds each 'type' and 'value' great, just cant figure out how to extract just that from the rest, tried capture (and non-capturing) groups before and after but didnt work
=ARRAYFORMULA(REGEXREPLACE($A3:$A,"[\n.][effect\d][\n.](.)\n(.)","1:$1 2:$2"))
**Current SUBSTITUTE + REGEXEXTRACT + REGEXREPLACE**
A different approach entirely, also kinda works, longer form though and left with having to parse the values out of that string, where got stuck again. Idea was to use this to simplify, then regexreplace like above. Getting stuck removing content around the final matches though, and if can do that then above approach is fine too.
// First ran a substitute
=ARRAYFORMULA(SUBSTITUTE(SUBSTITUTE($A3:$A,char(10),";"),";;",char(10)))
// Then variation of this (gave up on single line 'effect/d' so broke it up to try and get it working)
=ARRAYFORMULA(IF(A3:A<>"",IFERROR(REGEXEXTRACT(A3:A,"(?m)^(?:[effect0]);(.)$")&";;")&""&IFERROR(REGEXEXTRACT(A3:A,"(?m)^(?:[effect1]);(.)$")&";;")&""&IFERROR(REGEXEXTRACT(A3:A,"(?m)^(?:[effect2]);(.)$")&";;"),""))
// Then use regexreplace like above
=ARRAYFORMULA(REGEXREPLACE($B3:$B,"value = (.);type = (.);;","1:$1 2:$2"))
**--EDIT--**
Also, as my updated 'Desired Output' sheet shows (see timestamped comment below), bonus kudos if you can also extract just the values of matching 'type's to those extra columns (see spreadsheet).
All good if you cant though, just realized would need that too for lookups.
**--END OF EDIT--**
<br/>
Ive tried dozens of things, discarding each in turn, had a quick look in version history to grab out two promising attempts and shared them in separate sheets.
One of these also used SUBSTITUTE to simplify input column, im happy for a solution using either RAW or the SUBSTITUTE results.
<br/>
**Potentially Useful links:**
https://github.com/google/re2/wiki/Syntax
<br/>
<b>Just some more words:</b>
I also have looked at dozens of stackoverflow and google support pages, so tried both REGEXEXTRACT and REGEXREPLACE, both promising but missing that final tweak. And i tried dozens of tweaks already on both.
Any help would be great, and hopefully help others in future since examples with spreadsheets are great since every new REGEX seems to be a new adventure ;)
<br/>
P.S. if we can think of better title for OP, please say in comment or your answer :)
paste in B3:
=ARRAYFORMULA(SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
IF(C3:E<>"", C2:E2&":"&C3:E, )),,999^99))), " ", ", "))
paste in C3:
=ARRAYFORMULA(IFNA(REGEXEXTRACT($A3:$A, "(\d+)\ntype = "&C2)))
paste in D3:
=ARRAYFORMULA(IFNA(REGEXEXTRACT($A3:$A, "(\d+)\ntype = "&D2)))
paste in E3:
=ARRAYFORMULA(IFNA(REGEXEXTRACT($A3:$A, "(\d+)\ntype = "&E2)))
paste in F3:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A3:A, "\[feature\d+\]\nname = (.*)")))
paste in G3:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A3:A, "\[components\]\n\d+ = (.*)")))
paste in H3:
=ARRAYFORMULA(IFNA(REGEXREPLACE(INDEX(SPLIT(REGEXEXTRACT(
REGEXREPLACE(A3:A, "\n", ", "), "\[resources\], (.*)"), "["),,1), ", , $", )))
spreadsheet demo
This was a fun exercise. :-)
Caveat first: I have added some "input data". Examples:
[feature1]
name = feature_active_spoiler2
[components]
0 = spoiler,1
1 = spoilerA, 2
So the output has "extra" output.
See the tab ADW's Solution.

How to remove "-" from a column in DB2 table

If Phone has "918-435-0000" and want to remove"-" result should be - 9184350000, I can use substring with position 4 and 8? or shall I be using replace function ?
here in my example are special characters like - or sometimes +1(505) 000-2798
You should provide more details on your attempts instead of statements like just its not working.
Does the following work for you?
with t(phone1) as (values
'+1(505) 000-2798'
, '918-435-0000'
, '9184350000'
)
select phone1, REGEXP_REPLACE(phone1, '[^\d]', '') phone1_replaced
from t
where REGEXP_LIKE(phone1, '[^\d]');

How to decode the URL with encoded Query String

say, I have below Encoded URL:
let urlString = "https://www.sky.com/api/v1/rest/level2/in-in/?q=a%23+nunit+mac&q=c%23+nunit+mac&ap=裕坊%20邻坊
Problem:
let decodedString = urlString.removingPercentEncoding!
But this method removing % but not decode it.
For above example: a%23+nunit, after decode , it should be: a# nunit but it show : a#+nunit
Please help.
Thanks
The result is correct. %23 percent decodes to # and that's what you got. There is nothing about percent decoding that promises to treat + in a special way, so it remains. If you want to do something special with +, go ahead.

allowHtml in setCell google charts table visualization

Please explain this: setCell(rowIndex, columnIndex [, value [, formattedValue [, properties]]])
I want to allowHtml in table cell values.
My version of setcell is
data.setCell(0, 0, facebook.video_title, '<a href=' + "http://www.facebook.com/" + facebook.video_id + '>' + facebook.video_title + '</a>');
My aim is to open a video link on click of video title. So I am putting an a tag there. And I am calling the draw method like this: google.charts.setOnLoadCallback(drawTable(story_data, {allowHtml:true}));
By running this sample, I am getting whole HTML tag syntax as it is in my visualized table.
hard to say without seeing drawTable
but I don't think the arguments are being passed properly, try it like this...
google.charts.setOnLoadCallback(function () {
drawTable(story_data, {allowHtml:true});
});

How to query Sitecore SOLR using special characters?

I want to be able to build a site search page and allow users to include special Solr characters in their query (using Sitecore 7.5 and SOLR 4.7). For example I would like for users to be able to search for "f(x)". I have some code that seems to work sometimes. Basically it escapes the special characters. If I search for "f(x)" it works fine. However if I want to have 2 terms in my query and search for "f(x) green" it doesn't work. It seems to just search for the EXACT phrase "f(x) green". Regular queries work fine. If I search for "green yellow" it returns all documents with either green or yellow in them and if I search for "yellow green" I get the same results which is fine. If I search for "f(x)" I get the results I would expect. But if I search for "f(x) green" I get no results which is not what I would expect. My search code is below.
var specialSOLRChars = #"\+\-\&\|\!\(\)\{\}\[\]\^\""\~\*\?\:\\";
using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) {
var query = context.GetQueryable<GeneralSearchResultItem>().Where(x => !x.IsStandardValue && x.Language == Sitecore.Context.Language.Name);
var isSpecialMatch = Regex.IsMatch(searchTerm, "[" + specialSOLRChars + "]");
if (isSpecialMatch) {
var wildcardText = string.Format("\"*{0}*\"", Regex.Replace(searchTerm, "([" + specialSOLRChars + "])", #"\$1"));
query = query.Where(i => (i.Content.MatchWildcard(wildcardText) || i.Name.MatchWildcard(wildcardText));
}
else {
query = query.Where(i => (i.Content.Contains(searchTerm) || i.Name.Contains(searchTerm));
}
var results = query.GetResults();
return results;
}
It seems you intend to get search results that contain both f(x) and green, and also containing either of them.
To imitate this behavior you should split the search term using the whitespace and check Content.Contains() for both of them separated by an || condition. This will give you results when you search for f(x) green.