Can a Cypress script be written a way that it simulate 2 users working on the same HTML canvas? - html5-canvas

Lets say we have two instances of Cypress running in parallel and basically simulate two users working on the same Canvas. So user A adds an objects to the canvas, User B validates that the object was added to the canvas.
Don't know how to start please help.

I actually achieved this by using node js concurrent module along with wait-on and some combinational logic of cypress-wait-until library.

Related

LabVIEW: how to display different Images from different sources to one Image indicator

I am working on an application on LabVIEW where I need to display a live camera and start saving images, in the other hand I want to visualize images from the folder (by clicking on "select images") to start going through images, I want to display what the camera captures and then what is saved in the folder from the same image indicator. is it possible with two while loops?
here's the front Panel and Block diagram.
You could do this using a single while loop with an Event structure to handle all the events.
Adding events to this main Event structure, including a Timeout event (don't forget to wire the Timeout terminal) would allow you to enable or disable the camera capture calls provided they return within a few 100 ms. If the capture takes longer you would want to run a seperate loop that you can could enable/disable, possibly using a message queue.
Please check out the NI documentation on event structures and message handlers if these are not familiar to you.

How would I go about getting the orientation of my current screen in Windows using Ruby?

I am using Ruby 3.0 and I would like to know how to check if the users screen is portrait-flipped (or upside down) assuming the user only has 1 screen.
I would say that since Ruby is a server-side language, you will need to rely on a browser-side tech first, such as JavaScript, as getting the size and orientation of a screen would be done browser-side.
There are probably JS libraries for that if you prefer, but here are some docs to detect device orientation on some browsers:
https://developer.mozilla.org/en-US/docs/Web/Events/Detecting_device_orientation
https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation
With the value obtained in JS, you would then do some AJAX call to your ruby code to send the value to the backend. (you would create a API controller that receive orientation data and update your ruby objects, or whatever you want to do with the orientation)
I hope this is helping you go in the right direction!

Animating Multi-Part Object

I've got a model of a car imported into Unity. It's got multiple parts, and these have been organized into a hierarchy in the project explorer window.
I want to be able to "explode" the model - move each part outwards, so that each individual part can be seen.
Do you know how I can do this in one script? So far, I can use a translate function call to move individual parts, and I've had to make separate scripts for each part.
Any guidance on how I could do this would be great.
i dont know what you really want to do. if you want to make an car exlosion that you want to do it with a simple code you can use addForce function. it receives a paramter as a direction. you can use this code to throw parts of your car to diffrent directions and trigger the code in some event, but if you want something cinematic and controlled you should just start animating.

How to approach game level switching

What is the best approach to switch to different scenes/areas in a 3D game from the render area?
Say you have a character and he moves into a new area, how would you go about unloading the area and loading the new area. Would you just load the render function up with different loading calls and only load them if they fell within certain parameters or would you create enumerators for each area and use something like a switch statement to switch to the new area after unloading your data for the current area?
I have always created REALLY bad transitions on small games I have made for a hobby and it usually kills my performance at some point or time.
Using enum or/and switch/case is not very flexible.
You can simply use a function, example load_area(i), to unload a previous level/area then load level i instead (it could use a smart resource manager as suggested by
Andon M. Coleman).
You should separate the resource handling from the game logic and the engine. Example, the rendering system should display currently loaded drawable resources rather than looping through enums and select which scene to render.
You should minimize the unloading/loading phases; depending on the game, you can completely avoid discrete transitions by using an LOD-like (level of detail) manager that updates resources dynamically depending on the current state of the game.

The basic framework behind a simple web app, what to use where

okay so i have basic skills in html, css, javascript.
im still in the learning phases but just need a little help on where to go in regards to creating a web app.
i can figure out all the code, so thats fine, i just need some pointers as to what to use where.
So basically ill have a webpage with a few simple buttons, when clicked they'll send a message to the server and the server will hold a count for each button clicked using a php script.
1) - would it be best to hold that information in a JSON file?
then from there, there'll be another webpage which will have div tags stretching 100% across the page, with an element inside it which will move across the page according to the count held on the server.
2) - what should i use to animate it moving?. would i use javascript? or css3 or something?
the front end will need to continuously update on the count held by the server.
3) - would AJAX methods be best using javascript?
any advice would be great thanks.
And one last thing.
With Javascript animating, if i wanted to animate a div moving horizontal, is the best way to do it by animating the margin size? or am i stuck in the dark days..
1: i would store it in a database, if you store it in a file make sure that you are handling writes in a safe way(multiple writes to the same file)
2:you could use javascript to animate the css properties of a html element(preferable the width)
3: Ajax would work but then you need to continuously poll the server for changes alternativly use longpoling http://en.wikipedia.org/wiki/Push_technology#Long_polling
an alternative if you only support modern browsers and your hosting company allows it is to use websockets
If you're trying to save information server side (which you seem to be), I would recommend using a database (such as MySQL).
If your animation is dependent on the value from the server, I would use javascript to animate it. Note that you will have to poll the server in order to actually get this information (lets say, every second). When you get the information, simply update the div you want to animate with the new information. I don't quite understand what you want your display to look like, so I can't really give you anything more specific here.
Yes. I would recommend using jQuery to handle your AJAX calls as it makes it much easier and deals with cross-browser weird-ities.
To your update:
One option could definately be to adjust the (left) margin size, but you could also use the relative position. It will basically push the element however many pixels in whatever position from where it would typically be displayed. So if your box is by default right along the left border, you could relatively position it 100px to the right. You can read more about position here.

Resources