how to use scrollToIndex with infiniteLoader? - react-virtualized

I use the List+InfiniteLoader combination and I'd like to specify the index at which the list should start rendering at load time. I tried setting the scrollToIndex property on the List component without success.
What would be the proper way to set the start index to render with InfiniteLoader+List ?

setting scrollToIndex to the line number and scrollToAlignment to "start" on the list did the trick.

Related

How to properly use .itemconfigure() in tkinter

I am trying to remove the underline from the items in my list box when i select it. I tried giving the entire list box the "activestyle=None" but i learned that you need to use the "itemconfigure". What i am lost on is what i should be putting for index. I have my .insert index as 'end' and it works properly but when i do that for the item configure it says its out of range. Here is the code if anyone can assist me here.
taskList = Listbox(setBox, bg="#1B2834",fg="white")
taskList.configure(width=183,height=39, activestyle=None, fg="#4299E9", selectbackground="#061523",
selectforeground="#4299E9")
taskList.itemconfigure('end', activestyle=None)
taskList.insert('end', taskIDnum)
You don't use itemconfigure to set the activestyle attribute. You should use the configure method of the listbox. The documented value to turn off the ring around active item (or underline, depending on platform) is the string "none", not the python value None.
taskList.configure(activestyle="none")

How to save value of found document in mongoose as a variable?

Let's say I use findbyID{} to find a specific document in my collection, and this document has the value totalMedals to which I want to add the local variable medalsWonSinceLastUpdate. I would need a function along the lines of totalMedals = previousTotalMedals + medalsWonSinceLastUpdate, which would mean I need to capture the previous totalMedals in a variable. How would this be possible?
I have experimented with an ejs file that contains the value I want to access and then tried to access it through req.body.value, but this throws an error. I can run queries that find the documents, but I run into a brick wall when it comes to taking the variables to a wider scope.

NodeJS simple horizontal line on console.log

I'm making a simple Node JS app.
It logs a lots of informations on console. I would like to know if it's possible to add a horizontal lines in Node JS command line without using any extra packages or dependencies.
If command prompt supports HTML elements, then I could use something like console.log("<hr>"); for adding a horizontal line but it does not support HTML.
Is there any way ?
To create the string for the horizontal line:
const line = '-'.repeat(process.stdout.columns)
.repeat() method repeats the string.
process.stdout.columns returns the number of columns.
To use it:
console.log(line)
The console does not support rendering HTML elements.
That does not prevent you from making a custom line however!
const lineBreak = '----------------------'
console.log(lineBreak)
Of course, customize the linebreak however you'd like:
______ //Underscores!
----- //Hyphens!
====== //Equals!
For grouping related data, refer to the docs here: console reference
Example:
function name(obj) {
console.group('name');
console.log('first: ', obj.first);
console.log('middle: ', obj.middle);
console.log('last: ', obj.last);
console.groupEnd();
}
name({"first":"Wile","middle":"E","last":"Coyote"});
Will output grouped data to the console, visually giving it a line break & arrow to collapse the group. I think this would work well for your use case.
Working off on the same vane as #sergey above:
If your output has a header of a determinable length you can use the .length method.
const header="This is my header";
console.log(header);
console.log('-'.repeat(header.length);

Reverting a str_replace for GET in PHP

I am dynamically displaying sermons from a MYSQL database, and I want to create a dynamic page for each sermon series. Because the series titles have spaces in them, and I want to avoid that in my URLs, I have done str_replace:
(Series name)
That works great. But then of course on the dynamically-created page, I need a way to revert back to the original series name in order to fetch the actual sermon data, and I haven't figured out to how to accomplish that. I've tried this:
$series = $_GET['series'];
$str = $series;
$str = str_replace("-"," ",$str);
... ahead of my prepare & execute statements (I'm using PDO), but that doesn't really look right, and in any case doesn't work.
Is there actually a way to this?
I just needed to change one variable. The lead variable of the third line needed to be $series, not $str:
$series = $_GET['series'];
$str = $series;
$series = str_replace("-"," ",$str);

modx ditto filtering

I have this line of code:
[[Ditto? &depth=3 &tpl=#FILEweb_assets/chunks/x/x.html &parents=3 &filter=template,7|endDate,[+now+],3]]
The above line displays all items which using template 7. Now I want to make a change so that it will display all items with template 7 and 10. What should I do??
thanks
According to the documentation you can simply add another clause as follows
[[Ditto? &depth=3 &tpl=#FILEweb_assets/chunks/x/x.html &parents=3 &filter=template,7|template,10|endDate,[+now+],3]]
Ditto provides parameter &where, which accept a valid MySQL WHERE statement. I guess it should help.
&filter=endDate,[+now+],3
&where=`template!=7 AND template!=10`

Resources