Jump to content

Hello everyone, 

 

I am doing a school project and one of the use cases is to have BeanShell (a scripting language thing) Integration. 

I have already an extension running able to write and launch the sripts but I am confused as to what I have to do in the second part of the use case. It says this:

 

Quote

It should now be possible to invoke Beanshell scripts from macros and formulas using a new function. The new function should be able to execute Beanshell scripts synchronously or asynchronously. If the execution mode is synchronous, then the function should wait for the script to end its execution. In this case the return value of the function should be the value of the last expression of the Beanshell script. If the execution mode is asynchronous then the function should return immediately after launching the execution of the script: the script and the formula/macro will execute in parallel. Existing variables in the macro or formula that executes the script should be accessible inside the Beanshell script.

 

What should I do?

Link to post
Share on other sites

12 minutes ago, ShatteredPsycho said:

Hello everyone, 

 

I am doing a school project and one of the use cases is to have BeanShell (a scripting language thing) Integration. 

I have already an extension running able to write and launch the sripts but I am confused as to what I have to do in the second part of the use case. It says this:

 

 

What should I do?

How long does the normal formula take?

if it's a split second, you can just go synchronously.

If the calculation takes a touch longer (> 1.5 secs or so), I'd advise to go Async. This because while your function is running NO OTHER WORK can be performed on that same thread. Therefor your application would hang for a bit if it's taking some time to do the calculation. The main idea behind programming async is to simply spawn another thread (already seems to be handled), give it the work that needs to be done and then also instructing it to update the ui when it has done the work. In the meantime the original thread is there to handle any input / redraw

That time I saved Linus' WiFi pass from appearing on YouTube: 

A sudden Linus re-appears : http://linustechtips.com/main/topic/390793-important-dailymotion-account-still-active/

Link to post
Share on other sites

1 hour ago, MrKickkiller said:

How long does the normal formula take?

if it's a split second, you can just go synchronously.

If the calculation takes a touch longer (> 1.5 secs or so), I'd advise to go Async. This because while your function is running NO OTHER WORK can be performed on that same thread. Therefor your application would hang for a bit if it's taking some time to do the calculation. The main idea behind programming async is to simply spawn another thread (already seems to be handled), give it the work that needs to be done and then also instructing it to update the ui when it has done the work. In the meantime the original thread is there to handle any input / redraw

Hm I see, it should be almost instantaneously

So, for me to do it synchronously, what does that entail actually?

Link to post
Share on other sites

14 minutes ago, ShatteredPsycho said:

Hm I see, it should be almost instantaneously

So, for me to do it synchronously, what does that entail actually?

synchronous is easy it's like a batch file it reads line by line, basically your script will wait for the line above to finish before moving on.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to post
Share on other sites

A good thing to remember:

Everything where you can't predict how long it is gonna take (like a network request or file reading) should be async. Also a server application which serves to multiple people should be async.

PC: Case: Cooler Master CM690 II - PSU: Cooler Master G650M - RAM: Transcend 4x 8Gb DDR3 1333Mhz - MoBo: Gigabyte Z87x-D3H - CPU: i5 4670K @ 4.5Ghz - GPU: MSI GTX1060 ARMOR OC - Hard disks: 4x 500Gb Seagate enterprise in RAID 0 - SSD: Crucial M4 128Gb

Phone: Samsung Galaxy S6

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×