How do I insert a line break using Google Sheets API? - unicode

I am trying to use a line break in Google Sheets. If I want a cell to show this:
OverUnder
What do I put inside the set.Value() method?
I am trying this:
function myFunction(cell){
cell.setValue('Over
Under')
}
Does not work....
UPDATE:
I have also tried this
cell.setValue(otherCell.getValue());
This seems to work as long as otherCell is the value I want. I can't figure out how to inspect this element though.

I've been using "\n", to insert a new line into a text cell.
and example would be:
cell.setValue("Over"+"\n"+"Under");
Yields:
Over
Under
It works pretty well for situations where you are appending the contents of a cell:
cell.setValue(cell.getValue()+"\n"+"Updated info");

I figured it out by using String.charCodeAt(), it seems that the 'line break' has a unicode value of 10.
cell.setValue('Over'+String.fromCharCode(10)+'Under')
yields a single cell with
OverUnder

Related

How to add form elements from an array in Colab

I have trouble trying to use an array as elements of drop-down list. I tried to google it, but it only leaded me to the official document which list all the options, but my variables will dynamically change when you rerun the code. Thx in advance.
btw, I converted it to a list only because I saw one post saying a list works... but it doesn't work on my end...
Here's my simple code. The last line need some fix.

Correctly generate an HTML table with a forEach loop in EJS while using a MongoDB cursor object?

I'm new to the MEAN stack and I'm having trouble printing out an HTML table using EJS.
Basically, I have an EJS tag that stays white inside of VS Code and I have no idea why (line 14).
I have two forEach loops, the first one on line 6 outputs my mongoDB cursor results correctly. However, the second forEach loop with the HTML does not work because I cannot close my EJS tag for some reason and it breaks everything from that place down.
How do you correctly generate an HTML table with a forEach loop in EJS while using a MongoDB cursor object?
Just in case you want to see how I am getting my data (the console.logs can be seen in the first image):
I changed the app.get block of code to:
I think the main difference is that I put the response.render code inside of the .find() method ? I believe the comment Jeff made has the truth behind it. I don't fully understand it yet, but I know now that you want to pass the query object inside of the .find() method now. I also still don't know why I could console.log, but not embed HTML before the fix. That is strange, however, by putting the response in the .find(), I can do both now. Go figure.
One note, the syntax highlighting is still messed up in the ejs on the right panel, but it comes out clean in the browser now. Here is the rest of the code and some screen shots:

Create absolute link with specific value of cell in table view

I want to render a absolute link in table from value of cell but I got a relative link instead.
Here is my configuration:
What I got when click on cell:
http://10.93.9.209:3000/http%3A%2F%2F10.131.227.253%2Fjob%2FPerformance%20Testing%20Pipeline%2Fjob%2Fstable%2F21%2F
In Grafana 7 (new table panel) it's ${__data.fields[2]} where number is column index.
This is a change introduced in one of the new Grafana versions. If you want an absolute URL, you must use ${__cell:raw} instead of ${__cell}. Reference
If you want to reference another column when clicking:
This is possible, I am using 9.1.7 and originally used the old table; however, after migrating noticed the same issue. That said, I found a way to make this work:
Add the ID column that you want to hide; example simID
If the column is the first column, say 0; then use:
var-whatever=${__data.fields[0]}
Now, override the column, field with name: simID Add option ‘Hide in Table’ and turn on
I also had to format the number, e.g. remove decimals & set unit to standard
Hope that helps someone… took me a good 2 hours to figure.
Btw, it also works on graphs and you do not have to hide; aka reference your original query in the datasource and add a data link with the same options.
What result do you get if you try $__cell_2?
The syntax above no longer works. The value is now ${__value:raw}
$__cell_2 above solution worked for me.
With the new table panel introduced in Grafana either ${__cell} or ${__cell:raw} do not work for this now.
You must use ${__value:raw}

Modify all text output by TYPO3

I would like to create a "cleanup" extension that replaces various characters (quotes by guillemets) in all kinds of textfields in TYPO3.
I thought about extending <f:format.html> or parseFunc, but I don't know where to "plug in" so I get to replace output content easily before it's cached.
Any ideas, can you give me an example?
If you don't mind regexing, try this:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['cleanUpQuotes'][] = \NAMESPACE\Your\Extension::class;
Insert it into ext_localconf.php and this part is done.
The next step is the class itself:
public function cleanUpQuotes(TypoScriptFrontendController $parentObject)
{
$parentObject->content = DO_YOUR_THING_HERE
}
There also is another possibility which could replace any strings in the whole page - as it operates on the rendered page (and not only on single fields).
You even can use regular expressions.
Look at my answer -> here

Need to print out all links on a sidebar in selenium (xpath?)

I need to find any extra links and print them out. I started by doing:
get_xpath_count('//li/a')
and comparing it to the size of an array that holds the name of all the links for the sidebar. When the count is too high/low, I need to print out all the extra/missing links. I would like to make a list of the names so I can compare it to the array. I've tried a few things like get_text('//li/a'), which returns the name of the first. get_text('//li/a[1]) does the same, but any other index returns nothing.
Any ideas? Also, I need the name that's displayed on the link, not the actual href.
Edit* Also, i'm pretty new to selenium and Xpath. Please let me know if there's info I let out that is needed, or just any suggestions towards thew way I'm going about this.
I have been able to get this to work using CSS element locators. Since I use CSS selectors far more often than Xpath, I find it easier to always use them with Selenium as well.
$selenium->get_text("css=li a:nth-child(1)")
$selenium->get_text("css=li a:nth-child(2)")
$selenium->get_text("css=li a:nth-child(...)")
$selenium->get_text("css=li a:nth-child(n)")
Use:
(//li/a)[$someNumber]
this will get you the text of $someNumber-th //li/a in the XML document.
In order to know what values to use to substitute the $someNumber with, you need to know the total count of these elements:
count(//li/a)
This is in JAVA. You can use the same concept in perl
int totCountInPage=selenium.getXpathCount(//li/a);
for(int count=1;count<=totCountInPage;count++)
System.out.println(selenium.getText("xpath=//li[count]/a"));
This should print text inside the anchor links under all li tag.