Skip to main content

Posts

Changing notes position based on new bpm

I have a .mboy json file that are build with bpm 128 which is the audio original bpm. have a look below at the file. export default { "editor": "mboy-editor-2.1.1", "format_version": "2.0", "audio": { "artist": "test", "title": "NO COPYRIGHT SHORT MUSIC (SOLO RECORD)", "album": "", "subgenre": "", "date": "", "download_link": "https://www.youtube.com/watch?v=Atv-zwhSyFE", "comments": "", "genre": "Other" }, "author": "<zx<zx", "date": "2022-11-17", "tempo": 128, "start_pos": 0, "tracks": [{ "instrument": "bass", "name": "", "color": "ff009fff", "bars": [{ "index": 0

Vue3 element not displaying

I'm new to vue and i'm starting a project where i want to use a library https://github.com/tochoromero/vuejs-smart-table . At the moment i have a simple app: <template> <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" /> <v-table :data="users"> <thead slot="head"> <th>Name</th> <th>Age</th> </thead> <tbody slot="body" slot-scope="{displayData}"> <tr v-for="row in displayData" :key="row.id"> <td></td> <td></td> </tr> </tbody> </v-table> </template> <script> import users from './data/karaoke.json' export default { name: 'users', data: () => ({ users }) } </script> That sh

Confusion between commands.Bot and discord.Client | Which one should I use?

Whenever you look at YouTube tutorials or code from this website there is a real variation. Some developers use client = discord.Client(intents=intents) while the others use bot = commands.Bot(command_prefix="something", intents=intents) . Now I know slightly about the difference but I get errors from different places from my code when I use either of them and its confusing. Especially since there has a few changes over the years in discord.py it is hard to find the real difference. I tried sticking to discord.Client then I found that there are more features in commands.Bot . Then I found errors when using commands.Bot . An example of this is: When I try to use commands.Bot client = commands.Bot(command_prefix=">",intents=intents) async def load(): for filename in os.listdir("./Cogs"): if filename.endswith(".py"): client.load_extension(f"Cogs.{filename[:-3]}") The above doesnt giveany response from my Cogs

Flask POST is not working even with method=["POST"] [closed]

I'm trying to do a web-app using Flask, basically 2 html and 1 python files. After doing an input/submit of a value in html#1, the web-app is supposed to go to html#2 with that value and display it, but instead it throws the 501 error. Python code (the function that receives the value is predict) from flask import Flask, render_template, request app = Flask(__name__) import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow import keras @app.route("/") def home(): #CODE return render_template('home.html') @app.route('/predict', methods=["POST", "GET"]) def predict(): #CODE return render_template('result.html', result_1 = np.round(pred[0][0]*100,4), result_2 = np.round(pred[0] [1]*100,4)) Html code (where i do the input) <form action="/predict" method="post"> <--!CODE--> I have read several forums on Stack Overflow about this problem but th

Python Inserting a string

I need to insert a string (character by character) into another string at every 3rd position For example:- string_1:-wwwaabkccgkll String_2:- toadhp Now I need to insert string2 char by char into string1 at every third position So the output must be wwtaaobkaccdgkhllp Need in Python.. even Java is ok So i tried this Test_str="hiimdumbiknow" challenge="toadh" new_st=challenge [k] Last=list(test_str) K=0 For i in range(Len(test_str)): if(i%3==0): last.insert(i,new_st) K+=1 and the output i get thitimtdutmbtiknow source https://stackoverflow.com/questions/74499534/python-inserting-a-string

turn a two-column dataframe into three columns, by matching the items in each row

I have a dataframe like below, and it's like a search result. There are six items in total (a2, b3, b7, b9, c6, and c8), and the dataframe presents the pairwise search results. For example, line a2 b3 presents that a2 finds b3 in the search. So from the dataframe, we know that a2 finds b3, c6 finds both a2 and b3. So a2, b3, and c6 are good friends, and good friends need to be output in the same line of a new dataframe as a2 b3 c6 . The same logic for b7 and c8 case. For b9, as it only has one friend (a2), we could left it out from this step. The logic to generate the output is easy to think, but I don't know how to make it into codes. I thought, firstly we could subset all the lines only has a and b . Then for each a and b line, we could compare the c results with the a and b line. But I have been thinking for a while now, and still have no a clear idea how to do it. dataframe: G1 G2 # header a2 b3 c6 a2 c6 b3 b7 a2 c8 b7 c8 a2 b9 a2 expected result: G1 G2 G3 # h

Peerjs call.on "stream" event isn't firing but peer.on "call" is

I am trying to create a node+socket.io+express+peerjs application for voice chat. The problem I am facing is that I cannot access the stream of the connected peer since the call.on("stream") is not firing for some reason. I have tried to manipulate the .on events, but I'm still not able to get it to work. It's not giving me any errors. I am new to peerjs so any help is appreciated a lot, I already spent countless hours trying to fix this. Client-side call creation and connection: if(peerid!=-1 && peer){ if(!window.localStream){ window.localStream=new MediaStream(); } //peer.listAllPeers((peers) => { // console.log(peers); //}); peerConn = peer.connect(peerid); peerConn.on("open", ()=>{ // THIS IS FIRING call = peer.call(peerid, window.localStream); console.log("Connecting to: "+ peerid); call.on("stream", (stream)=>{ // THIS IS