Calculate time difference between records where the value changes KDB+/q

Advertisements I have a table like the below, with timestamps and values. show t:([]time:2022.10.10D12:30:00.100000000 2022.10.10D12:30:00.200000000 2022.10.10D12:30:00.300000000 2022.10.10D12:30:00.400000000 2022.10.10D12:30:00.500000000 2022.10.10D12:30:00.600000000;values: 1 1 1 2 2 3;duration: 300 200 100 200 100 0N) time values duration ——————————————— 2022.10.10D12:30:00.100000000 1 300 2022.10.10D12:30:00.200000000 1 200 2022.10.10D12:30:00.300000000 1 100 2022.10.10D12:30:00.400000000 2 200 2022.10.10D12:30:00.500000000 2 100 2022.10.10D12:30:00.600000000 3 The third column,… Read More Calculate time difference between records where the value changes KDB+/q

GetX Throwing TypeError when try to build with Obx

Advertisements I have controller call MenuController class MenuController extends GetxController { var currentCategory = Rx<int>(0); @override void onReady() async { await Future.delayed(const Duration(milliseconds: 2000)); } void setMenuByIndex(int index) { currentCategory.value = index; } } And I’m trying to check selected index from simple Widget like this Obx(() => Text(controller.currentCategory.value.toString())) Getting controller like here final controller… Read More GetX Throwing TypeError when try to build with Obx

How do I animate changes one at a time in SwiftUI on a button tap?

Advertisements I have a loop where I update a value that changes the view. In this example I want the updates to happen one at a time so you see it ripple across the row, but they all happen at once. struct AnimationQuestion: View { @State var colors = "🟪🟨🟧🟦🟥🟫⬛️🟩⬜️".map { String($0) } @State var… Read More How do I animate changes one at a time in SwiftUI on a button tap?

unsupported operand type(s) for -: 'DateField' and 'DateField'

Advertisements I am working on creating a contract model with Django and I came cross on how to get the time duration from the start_date to the end_date?? class Contract(models.Model): name = models.CharField(max_length=100) price = models.IntegerField(max_length=10) start_date = models.DateField(auto_now_add=True) end_date = models.DateField(auto_now_add=True) duration = models.IntegerField(end_date – start_date) # how get the duration by hours created_at… Read More unsupported operand type(s) for -: 'DateField' and 'DateField'

React JW player how to get current duration of video?

Advertisements I am using React JW player. My component <ReactJWPlayer playerId="id" playerScript="https://content.jwplatform.com/libraries/xxxx.js&quot; playlist={{"My JSON"}} /> This is working well. I need to get the current duration of the playing video. How can I do that in reactjs? >Solution : You can access "raw" JW player by doing <ReactJWPlayer playerId="id" … let playerInstance = window.jwplayer(‘id’); To… Read More React JW player how to get current duration of video?

Why when fading out list of materials each material fade out in another time and not all the materials fade at the same time?

Advertisements using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class FadeInOut : MonoBehaviour { List<Material> mats = new List<Material>(); private void Start() { foreach (Transform g in transform.GetComponentsInChildren<Transform>()) { if (g.GetComponent<SkinnedMeshRenderer>() != null) { var l = g.GetComponent<SkinnedMeshRenderer>().sharedMaterials.ToList(); foreach(Material mat in l) { mats.Add(mat); } } } } private void Update() { if(Input.GetKeyDown(KeyCode.G)) {… Read More Why when fading out list of materials each material fade out in another time and not all the materials fade at the same time?