How to display simple mathematical formulas in a rich internet application - rich-internet-application

I have some mathematical formulas of the type
p = (l + m + n) / (i+j*2)
Note: This is just an example. The real equations are more complicated with several variables participating in the equations.
I want to display these formulas in a tree like structure in an interactive, rich web component.
Initially the screen should display
p = x/y
with p, x and y as boxes. The user can click on the box labeled x which will "unfold" the box to expand and display
x = (l + m + n) and so on.
Since this is a J2EE based application, I can use any RIA library compatible with J2EE.
Are there any 3rd party RIA libraries out there that can help me render these formulas?

Looks like MathOverflow has this down... check it out.

please see the below links:
http://www.math.union.edu/~dpvc/jsMath/examples/Henrici.html
http://www.myphysicslab.com/web_math.html
http://amaya.software.informer.com/11.1/
http://en.wikipedia.org/wiki/MathML

Related

WebXR: how to migrate from Oculus Go to Quest?

I'm using Oculus Go controls (touchpad + trigger) in my WebXR molecular viewer (pure JavaScript + WebGL + WebXR) at https://www.ibiblio.org/e-notes/webxr/mini.htm. To migrate from Go to Quest I'd like to know, what corresponds to "selectend event" and "xrSession.inputSources[0].gamepad.axes[0/1] on Quest?
On the Quest thumbstick is exposed as
xrSession.inputSources[0/1].gamepad.axes[touchpad X, touchpad Y, thumbstick X, thumbstick Y]
where 0/1 correspond to the right/left hands. Therefore axes[2,3] should be used (instead axes[0,1] on the Go) to get X,Y coordinates.
See e.g. https://www.ibiblio.org/e-notes/webxr/mini/micro3q.htm.

pine script with two indicators one overlaid on the chart and another on its own?

I am trying to write a pine script with two indicators one overlaid on the chart (EMA) and another on its own?(Stoch) I cannot seem to find any info on how to separate these (Visually) but keep them within 1 pine script, ie to be able to take trading decisions based on these.
The earlier answer from Luc is right, unfortunately. Each script can either create plots that are overlaid on the default price chart, or shown in a different pane, but not both. But there is a workaround.
Suppose you've made some non-trivial calculation in your script and you'd like to put it in different pane. E.g. the next code:
//#version=4
study(title="Stochastic", shorttitle="Stoch", format=format.price, precision=2)
periodK = input(14, title="K", minval=1)
periodD = input(3, title="D", minval=1)
smoothK = input(3, title="Smooth", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
plot(k, title="%K", color=color.blue)
plot(d, title="%D", color=color.orange)
h0 = hline(80)
h1 = hline(20)
fill(h0, h1, color=color.purple, transp=75)
// This next plot would work best in a separate pane
someNonTrivialCalculatedSeries = close
plot(ema(someNonTrivialCalculatedSeries, 25), title="Exporting Plot")
Because they have different scale, one of them most likely will break another indicator's scale.
So you'd like show Stoch in different pine, whereas ema() should be overlayed with the main chart. For that you should make the next steps:
Turn off in the study's the extra plot to return scale to normal:
Apply to the chart the next script:
//#version=4
study("NonOverlayIndicator", overlay=true)
src = input(defval=close, type=input.source)
plot(src)
Choose in the second's script inputs source required plot from the first script:
And voilĂ  - you got the plots in different pines:
But if you want split the plots because you have retrictions on amount of studies you allowed to apply (e.g. 3 for free-account) - that won't help you.
It cannot be done. A script runs either in overlay=true mode on the chart, in which case it cannot direct plots elsewhere, or in a separate pane when overlay=false (the default).
When the script is running in a pane, it can change the color of the chart bars using barcolor(), but that's the only way it can modify the chart.
It is possible to rescale signals so that multiple bounded (e.g., 0-100, -1 to +1) signals generated by one script appear one on top of the other, but this is typically impossible in overlay mode, as the vertical scale varies with the bars on the chart. The only way for an overlay script to work with its own scale is when it uses No scale, but this prevents the indicator's plots to plot relative to price, and so the chart's bars.
Nice workaround from Michael.
Unfortunately, this only seems to work to pass data for one plot.
I would like to pass data for 3 different plots to the stock price graph.
If I try this, for 'input.source' I can only select the standard sources: "open, high, low, close ...". I can not select the data from other indicators.
If I remove plots 2 and 3, it works as Michael described.
Anybody has a workaround for the workaround..? ;-)

Selenium - Kendo UI Line Graph

I'm working on a Test Automation framework using Selenium and most of the testing is done on Kendo UI pages. One of the problems I'm having is the graph testing, there are two types of graphs on the page, bar chart and line graph. I have no trouble testing the bar chart, I simply get the < g > and < path > elements and find the one I need etc. But it's different with the line chart. Both < g > and < path > elements are generated when I hover over the graph, when the page loads the paths are simply not created. There's only a single object with all of the positions eg.
M57.295 40.425 L 59.885 40.425 62.475 40.425 65.066 40.425
... and a bunch of numbers after this. Unfortunately I cannot provide the URL to the website. Any suggestion is appreciated.

How to display multiplication result in a textbox using Selenium WebDriver?

I am a manual tester and want to switch to automation testing. I've learnt Selenium WebDriver recently. While practicing, I came across a webpage where I was asked to automate the following thing in a web form:
In the form, they have provided two double numbers and have asked us to display the multiplication of thosenumbers in the textbox. Please guide me how can I display the result in the textbox using selenium webdriver.
Screenshot of the xpath
Add screen shot using below steps-
Click "Edit" to your question.
On upper side you can find Image icon or press "Ctrl + G".
Drag & drop the image or attach by providing the path.
[Note: I have added this as an answer because I don't have 50 points yet to add a comment. Forgive me for that.. :)]
If the two double numbers are in separate input field (any other place except input filed) get the data as follows:
double number01 = Double.parseDouble(driver.findElement(By.cssSelector("your selector for element")).getText());
double number02 = Double.parseDouble(driver.findElement(By.cssSelector("your selector for element2")).getText());
Then perform multiplication and use sendkeys to input into the output field:
driver.findElement(By.cssSelector("your selector for element2")).sendKeys((number01 * number02) + "");
Note:
Above answer is based on assumption according to your question.
Edit:
String terms = driver.findElement(By.cssSelector(("#form > form > label:nth-child(89)"))).getText().replaceAll("=", "");//get the expression for multiplication and remove the '=' sign at the end
String [] temp_xy = terms.split("X"); // split the string into multiplicand and multiplier parts
double multiplicand = Double.parseDouble(temp_xy[0].trim());
double multiplier = Double.parseDouble(temp_xy[1].trim());
double product = multiplicand * multiplier;
Now, you put your product in the desired filed. Similarly, you can find the quotient.

What is the functioning of fireevent() in HP QTP / UFT?

I am learning HP UFT.
Recently I came across fireevent and I tried to implement it on the website of Flipkart. I was trying to use firevent("onmouseover") for the link Men on the homepage of the website.
I used ChildObjects to find out the Link and WebElement (in two different tests), first Highlighted it and then used object.fireevent("onmouseover") as well as object.fireevent("OnClick"). The OnClick is working and it is showing the link as selected (i.e. the dotted box covering the link when we press tab), but it is not showing the Menu Under Men Section.
I had googled and bingged a lot. But was unable to find the exact working of FireEvent in QTP/UFT.
Please Help me solving the above problem as well as some tutorials on FireEvent.
EDIT: I am using IE 11 for testing.
Motti has already answered the technical definition, but I shall attempt to give you a solution to your functional issue.
In my experience .FireEvent often doesn't work as you would expect. An alternative for something like onmouseover is to simulate user behaviour a bit more closely by actually moving the mouse to the desired location. In our framework we have a little extension function to do just that, a pared-down version of which is shown here:
Sub My_MouseOver(objSender)
Dim absX : absX = objSender.GetROProperty("abs_x")
Dim absY : absY = objSender.GetROProperty("abs_y")
Dim width : width = objSender.GetROProperty("width")
Dim height : height = objSender.GetROProperty("height")
Dim x : x = (absX + (width / 2))
Dim y : y = (absY + (height / 2))
Dim deviceReplay : Set deviceReplay = CreateObject("Mercury.DeviceReplay")
deviceReplay.MouseMove x, y
Reporter.ReportEvent micDone, "A step name", "A useful step description"
End Sub
RegisterUserFunc "Link", "MouseOver", "My_MouseOver"
RegisterUserFunc "WebButton", "MouseOver", "My_MouseOver"
RegisterUserFunc "WebElement", "MouseOver", "My_MouseOver"
As an example you can then do as follows to bring up the "ELECTRONICS" menu overlay on flipkart.com (obviously substitute your own Browser and Page definitions):
Browser("Flipkart").Page("Main Nav").Link("xpath:=//a[#data-tracking-id='electronics']").MouseOver
In the original version there's various extra bits of error handling and custom reporting so it tells you what you clicked on, but the essence is the same. It locates the object on screen, calculates the centre and moves the mouse there. You might want to wait a small amount of time for the menu overlay to appear after doing so before calling .Click on one of the newly-displayed sub-elements.
I found a solution to my problem and it is working perfectly.
Setting.WebPackage("ReplayType") = 2
object.FireEvent "onmouseover"
Setting.WebPackage("ReplayType") = 1
In this case, the object will be:
Browser("name:=Online Shopping.*").Page("name:=Online Shopping.*").Link("innertext:=Men")
I have tried this and it is working fine. I guess, we do not need any alternatives. But I really don't know is, Ctrl+Space is not working for this in UFT. Don't know the reason.
This actually depends on what browser you're using.
Warning: There are exceptions to the information presented in this answer and it also may change in the future. The answer is meant to give a basic understanding but don't depend on it to be true without checking the behaviour for your specific version/use-case.
Originally QTP's FireEvent was supposed to call IE's non-standard fireEvent method.
On Firefox and Chrome this is implemented using the standard dispatchEvent. You should check which events the web site expects to get.
Things get complicated if you mix the event models (the standard DOM level 2 and Microsofts) as explained in this blog post.