Aspose.words. Range.replace() ignores timeSpan - timespan

I have such problem:
A use aspose.words.range.replace with regex with timespan.FromSeconds(7).
So I expect that replace method throws exption when it can not find match in 7 sec.
But in that case program freezes.
So, maybe there are any ideas how to fix that?

The requested feature is supported starting from 22.3 version of Aspose.Words.

Related

Why do we need the question mark in Immediate Window of VS?

So, reading this documentation:
https://learn.microsoft.com/en-us/visualstudio/ide/reference/immediate-window?view=vs-2022
It looks like the question mark (?) is an alias for the command >Debug.Print, which basically, will evaluate the expression and show the result.
So, in debug mode, instead of running this:
>Debug.Print DoSomething()
I can run this:
? DoSomething()
This is even better because I'm getting the autocomplete suggestions.
Now, the issue is that I can run the same line without a command at all, and it does exactly the same:
DoSomething()
So far looks like there is no need for the command >Debug.Print or the alias ?.
At first, I suspected that using ? will only print the result without changing the values, but this is not the case (When I assign a value to a variable using ? it is assigned and the new value is printed)
So, am I missing something here? Are there any other differences between these 3 options?
According to the documentation, if you want to use Visual Studio command, you need to add greater than sign before the command. If you run 'Debug.Print' without adding greater than sign, you will get an error.
My point is that the question mark ('?') is unnecessary if you in the Immediate Window, it is used to distinguish the typed expression from the result.

VBScript - RANDOMIZE (Cbyte(Left(Right(Time(),5),2))) throws 500 for ES locales

Using a standard VBScript Randomize statement (below) which works fine -- most of the time.
...RANDOMIZE (Cbyte(Left(Right(Time(),5),2)))
RANDOMIZE...
It took a bit, but in digging thru log files, I've noticed that it throws this 500 error:
Type mismatch: 'Cbyte'
when the users' languages are non-English.
I tried changing the Session.LCID (I'm using Classic ASP) in a test page but no effect.
Any suggestions for fixing or a work-around? Thank you...
It appears you're trying to randomise based on the seconds-within-the-minute value:
12:34:56 AM
|---|
56 AM (right(5))
||
56 (left(2))
Now I have no idea of the top of my head what Time() would return in a Spanish locale, but it may well be something like 12:34:56 de la mañana.
What I do know is that relying on a specific presentation format in a globalised world is a bad idea. In your case, it may involve trying to convert left(right("12:34:56 de la mañana",5),2), or "añ", into a numeric value, something it's not going to be happy with.
If you want a true root cause analysis, I'd suggest catching the conversion error and actually logging what Time() is presenting itself as when it errors.
If you just want to fix it, find a way to get the seconds that doesn't depend on locale, for example:
secs = Second(Time())
As an aside, I'm not sure why you think this is even needed. The documentation for the VBScript Randomise function states that, if an argument is not given, the value returned by the system timer is used as the new seed value. Hence it's already based on the current time.

Web Audio API Firefox setValueCurveAtTime()

I am crossfading some audio and I have a equal power curve stored in a table. I'm calling this function to start the fadeout. The fade parameter is a GainNode made with createGain()
fade.gain.setValueCurveAtTime(epCurveOut, context.currentTime, fadeTime);
In Chrome and Safari all goes well, but Firefox (v30) complains:
SyntaxError: An invalid or illegal string was specified
Instead of context.currentTime I've tried 0 and 0.01. Is this method not implemented maybe? If so how would I alternatively schedule a cosine equal power ramp over time?
This seems to be a bug on our end indeed, I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1069825 to track this.
Firefox seems to give that error whenever it doesn't like the parameters to setValueCurveAtTime. For example, if epCurveOut is an empty Float32Array, or if there is already a parameter change scheduled at the same time. I suspect the latter, because Chrome doesn't throw an error under the same circumstances. For example:
curve = new Float32Array([0.5, 0.5]);
node.gain.setValueCurveAtTime(curve, 5, 1);
node.gain.setValueCurveAtTime(curve, 5, 1);
Firefox throws the error the second time. Chrome doesn't throw an error. If you call node.gain.cancelScheduledValues(5) in between the calls to setValueCurveAtTime, Firefox allows it.
EDIT: Oh, hmm, Chrome doesn't complain about an empty Float32Array either. Well, anyway, Firefox seems to be much less forgiving, and gives that error when the arguments' types are correct but the values aren't allowed.

FreeTextBox (FTB) is not working in FF 17

FreeTextBox (http://www.freetextbox.com/demos/) does not work in Firefox 17. What has changed?
FTB works correctly in previous Firefox versions and in all versions of other browsers.
(FreeTextBox develop has been terminated: "Please note that FreeTextBox has been discontinued. You may still purchase the software, but it is considered unsupported.")
Any idea?
Thanks.
Resolved. Problem was, the FTB anticipates value in the userAgent string part "Gecko/date", which then parses, creates a date object and compares if the returned date is greater than that which is permitted. However, because the value that Firefox now 17 uses, is changed to "Gecko/17.0", an exception occurs and the variable isMozillaEditor is not assigned value to true (this is done in the file BrowserInfo.cs). Therefore, the FTB does not start.

EOF with Nokogiri

I have the following line in a long loop
page = Nokogiri::HTML(open(topic[:url].first)).xpath('//ul[#class = "pages"]//li').first
Sometimes my Ruby application crashes raising the "End of file reached " exception in this line.
How can I resolve this problem? Just a begin;raise;end block?
Is a script that performs a forum backup, so is important that doesn't skip any thread.
Thanks in advance.
In addition to #Phrogz's excellent advice (in particular about at_css with the simpler expression), I would pull the raw xml [content] separately:
page = if (content = open(topic[:url].first)).strip.length > 0
Nokogiri::HTML(content).xpath('//ul[#class = "pages"]//li').first
end
I would suggest that you should first to fix the underlying issue so that you do not get this error.
Does the same URL always cause the problem? (Output it in your log files.) If so, perhaps you need to URI encode the URL.
Is it random, and therefor likely related to a connection hiccup or server problem? If so, you should rescue the specific error and then retry one or more times to get the crucial data.
Secondarily, you should know that the CSS syntax for that query is far simpler:
page = Nokogiri.HTML(...).at_css('ul.pages li')
Not only is this less than half the bytes, it allows for cases like <ul class="foo pages"> that the XPath would miss.
Using at_css (or at_xpath) is the same as .css(...).first, but is faster and simpler.

Resources