I'm using HttpContext.Current.Cache. I want to store data in my cache for a minute and after that minute, delete the cache so I can put the data again whether it has changed or not. I want to do it every minute, no just in the next minute.
Don't know if I've been clear enough. If not, please tell me what is not clear and I'll try to explain it better.
Thanks in advance.
I think I found the solution. First, instead of using insert, we use add.
My Line should be this:
HttpContext.Current.Cache.Add("string", lstStr, null, Cache.NoAbsoluteExpiration, new TimeSpan(0,1,0), CacheItemPriority.Normal, null);
I think this solves the problem. If I missed something, please tell me.
Related
I'm trying to figure out how to check whether the page has fully loaded in Playwright. await page.waitForLoadState('networkidle'); doesn't always work for me on Javascript-heavy sites. I've resorted to taking a screenshot base64, waiting 100 ms, taking a new screenshot, and comparing whether those are the same. However this doesn't seem ideal, is there any way to ask Playwright when the last animation frame was redrawn?
There are several options that may help you.
1. Solution 1:
First, you can maybe determine which element is loading last, and then go with
page.waitForSelector('yourselector')
or even wait for multiple selectors to appear
page.waitForSelector('yourselector1','yourselector2')
2. Solution 2
page.waitForLoadState('domcontentloaded')
Because
page.waitForLoadState('networkidle')
by default will wait for network event and if 0.5 seconds nothing is network trafficking it will say, I am no longer need to wait. And that is why you maybe have stohastic beh.
If the given solution doesn't work for you, you can try with locator.
page.locator(selector[, options])
It has multiple api like locator.isDisabled or locator.waitFor([options]) or locator.isVisible([options]) or locator.frameLocator(selector) ....... a lot more.
see the below link here:
https://playwright.dev/docs/api/class-locator
Thanks in advance for your assistance here. I really appreciate it!!
I have built a script using the template here: https://developers.google.com/workspace/solutions/mail-merge
...And it's awesome. Working perfectly and solving a big problem for me!!
I have 2 problems I need to fix, and I need your help, please!!
Problem 1: Can I use a column (or cell reference) as a default "subjectLine" rather than it be user input each time the script is run?
Problem 2: Once Problem 1 (above) is solved, I'd like to trigger the script to automatically run every 15 minutes, continuously.
Any tips/scripts/pointers would be awesome. I am quite new to coding so have tried to dig up how to replace the user input piece of code with a default value for the subject line, but I can't figure it out. And only once this is done, can I then start to try and get code working for the second problem - so I'm stuck on both counts.
Thanks again!! Kind regards, Tom
I know you can give specific expiry time by using System.Web.HttpRuntime.Cache.Add() but I'm curious what the default expiry time is when you add a cache item by doing System.Web.HttpRuntime.Cache["a"] = "b"
Thanks :)
Never mind I take my question back :) Apparently it's noAbsoluteExpiration
I wonder how you can change the lifetime of the url when fe-user requests to change his password.
Does anyone know where to find these option?
I already looked it up at the internet and also tried to search for it in the typo3 global conf. No success.
Thanks in advance and for your hints.
As you can read in the manual, there is a configuration called forgetLinkHashValidTime where you can set the lifetime in hours.
For example, if you want a lifetime of 1 hour, just place in your Setup the Typoscript:
plugin.tx_felogin_pi1.forgetLinkHashValidTime = 1
Edit: There seems to be a typo in the manual, as far as I know it should be forgotLinkHashValidTime you should also try
plugin.tx_felogin_pi1.forgotLinkHashValidTime = 1
I have a ListView:TListview on my form ,and, I add many values(approximately 25k TListViewItem) ,which works quite fast,but when I call Listview.Clear,the program freezes.I checked it with debugger,it won't step that line.
My question is: how do I solve my problem? If creating so many items in less than a second is possible,why deleting them takes forever(I waited over 5 minutes)?
Have you tried enclosing your call to Clear in a BeginUpdate/EndUpdate block:
listview.Items.BeginUpdate;
try
listview.Items.Clear;
finally
listview.Items.EndUpdate;
end;
Adding/Removing items in a listview (or various other controls, e.g. listbox) triggers a GUI update of the control for each and every item that is added/removed. For a listview in particular, this can be quite expensive and for 25,000 items the overhead would be significant.
Admittedly 5 minutes does sound excessive, but this would be the first thing I would try.
The first thing I'd try is wrap your call to Clear with BeginUpdate/EndUpdate.
ListView1.Items.BeginUpdate;
ListView1.Clear;
ListView1.Items.EndUpdate;
Do you have any events attached to the ListView, and are they firing as the list is being cleared?
as the others noted a BeginUpdate .... EndUpdate will greatly increase performance, however I would really suggest you move your code to use VirtualTreeView. It's a hybrit tree/ListView which will add up to 1m nodes in less than a second (actually that depends on the processor, but you get the idea).
It's a bit harder to learn in the beginning but once you get used to it you'll find it "easy" to work with. I personally whenever I need many rows in a ListView or TreeView look no further than VirtualTreeView. Oh, and forgot to mention that on top of it, it's free. Try it from : http://soft-gems.net/
John, it should not be longer to clear than to add the 25k items.
I wonder if you load it while it is not visible (automatically disabling updates), but clear it when it is visible where each item deletion triggers an update.
I don't know whether I should delete this question or not,I believe it's not going to be in any use to anyone else,but I prefer to keep it for awhile at least for you,who answered.
The problem was that I used a component inheriting from TListView,I thought It wouldn't be a problem so I decided to say TListView,but I was wrong.
I upvoted all your answers, please excuse my ignorance - I'm new.