Skip to main content

Posts

Showing posts from June, 2022

How to Get Count Vectorization of Dataframe of Arrays of Strings

I have a dataframe df1 as follows: words_separated 0 [lorem, ipsum] 1 [dolor, sit, amet] 2 [lorem, ipsum, dolor, sit, lorem] So each row contains an array of words. I would like to get something like this dataframe df2 : lorem, ipsum, dolor, sit, amet 0 1, 1, 0, 0, 0 1 0, 0, 1, 1, 1 2 2, 1, 1, 1, 1 So df2 would have a column for each unique word that appeared in df1 . The rows of df2 would correspond to the rows in df1 and record the number of times a word appeared in the corresponding row of df1 . This is referred to as Count Vectorization . I thought about using MultiLabelBinarizer like this: from sklearn.preprocessing import MultiLabelBinarizer count_vec = MultiLabelBinarizer() mlb = count_vec.fit(df["comment text"]) pd.DataFrame(mlb.transform(df["comment text"]), columns=[mlb.classes_]) lorem, ipsum, dolor, sit, amet 0 1, 1, 0, 0, 0 1 0, 0, 1, 1, 1 2 ...

Why doesn't the opacity of the image increase according to the following description?

The following code snippet is supposed to increase the opacity of a certain image(its id is 'img') by 0.01 per every 10 milliseconds until its opacity is set to 1. ```var t; var frontimage=document.getElementById('img'); frontimage.style.top=200+'px'; frontimage.style.opacity=0; //line x frontimage.style.left=200+'px'; frontimage.style.width=500+'px'; frontimage.style.height=300+'px'; function right(){ if(frontimage.style.opacity>=0 && frontimage.style.opacity<1){ //condition frontimage.style.opacity=frontimage.style.opacity+0.01; //first statement console.log(frontimage.style.opacity); }else{ window.clearInterval(t); } } t= window.setInterval(right,10);``` I believe that the 1st statement after the if condition(lets just call it as the first statement for now) gets executed...

Is it possible to use environment variables from .env package in the npm scripts

I have dotenv installed in my cypress project and variables in .env file, which looks like this: USER=Admin Is there a way for me to use my env variable USER inside of the npm scripts? "scripts": { "cypress:open": "npx cypress open --env grepTags=USER" }, Via Active questions tagged javascript - Stack Overflow https://ift.tt/YJ4cKdB

Iframe CDN not responding to postMessage()

I have a iFrame which has CDN source. but CDN'S html is not responding to postMessage API of JS. As far as I know, postMessage API is suppose to work cross domain. Here is my code: Main App: <iframe ref={elemRef} style= id={'myIframe'} src='http://d34gxw3jqlasaag.cloudfront.net/sampletemplate2.html' frameBorder="0"></iframe> const elemRef = useCallback((node) => { console.log("node: ", node); frame = document.getElementById("myIframe"); console.log("frame: ", frame) if (node !== null) { // frame.contentWindow.postMessage({call:'sendValue', value: {task: {input: taskInput}}}); setTimeout(() => { frame.contentWindow.postMessage({call:'sendValue', value: {task: {input: taskInput}}}); }, 500); } sampletemplate2.html <!DOCTYPE html> <html> <...

Updating Cookie from Form Post

FileOne.php is housing a <form> posting to FileTwo.php, which has roughly a 20s loading time. FileOne.php is setting a cookie, setCookie('currentStep', 0) , and I need FileTwo.php to update the cookie every time its own function updateStep() is called. The function and cookie are executing and updating correctly, but even if call the function immediately after the initial <?php at the top of my file, it still takes the full 20s for my cookie to update in the client. FileTwo.php - Function function updateStep() { setcookie("currentStep", ++$_COOKIE['currentStep']); } I've tried using ob_start() and ob_flush() to force a JavaScript cookie update to the client, but it's also taking the full 20s. FileTwo.php - Alternative Attempt <?php ob_start(); echo "<script>document.cookie = 'currentStep=" . ++$_COOKIE['currentStep']) . "'<script>"; ob_flush(); What I'm attempting to do...

JS Object width FormData convert zu in String [duplicate]

How do I get it to convert the individual data from the object back into a string. When I display the object with console.log, it only says "FormData { }". And when I search in it, I can't find my data. formData = new FormData(); formData.append('name1', 'value1'); console.log(formData); Via Active questions tagged javascript - Stack Overflow https://ift.tt/YJ4cKdB

I am reading an Excel spreadsheet with SheetJS & JS-XLSX but I'm losing the subheadings, Is there a way to keep subheadings?

I recently started working with SheetJS and JS-XLSX and when I read in the file, I am losing some of the sub-headings as a key value. The file looks like this: Excel File Example My line of code that brings in the data is: var data = xlsx.utils.sheet_to_json(workbook.Sheets[sheetName], {range:1}); I'm using range because the first row is instructions, not headings. The object that's returned will have the job titles as the key for the values (for salaries only) and the bonus column has __empty_1: , __empty_2: , etc. What I need to have the object return is JobTitle.Salary.amount and JobTitle.Bonus.amount Is there a way to do this with SheetJs or is there a better tool to receive and parse the data? Thanks for any help! Via Active questions tagged javascript - Stack Overflow https://ift.tt/YJ4cKdB

Use webpack to inject custom bootstrap using a Link tag

I want to customize bootstrap to my needs, and I'm trying to use webpack to inject my CSS as a link tag. I've installed: webpack mini-css-extract-plugin sass node-sass sass-loader css-loader And this is what I have tried so far: // I want to take the content of custom-bootstrap, and inject it as a link tag. { include: resolve('src/scss/custom-bootstrap.scss'), use: [ MiniCssExtractPlugin.loader, // 3. Injects the styles into a link tag. //"style-loader", // 3. Injects styles into the DOM. "css-loader", // 2. Turns css into js. "sass-loader", // 1. Turns sass into css. ] } The contents of custom-bootstrap.scss looks like this: @import "~bootstrap/scss/bootstrap"; I also have another webpack rule ( /\.(sc|c)ss$/i ) very similar to the one above with is to handle every other style in the app. It looks like this: { test: /\.(sc|c)ss$/i, exclude: resolve('src/scss/custom-bootstrap.scss'...

Using beautiful soup and scrapy error give me that error refer before assignment

I am trying to scrape data but they give me error UnboundLocalError: local variable 'd3' referenced before assignment how I can solve these error any solution please suggest me I search many solution but I cannot find any solution that help me if you have any solution then suggest me these is page link https://rejestradwokatow.pl/adwokat/abaewicz-agnieszka-51004 import scrapy from scrapy.http import Request from scrapy.crawler import CrawlerProcess from bs4 import BeautifulSoup class TestSpider(scrapy.Spider): name = 'test' start_urls = ['https://rejestradwokatow.pl/adwokat/list/strona/1/sta/2,3,9'] custom_settings = { 'CONCURRENT_REQUESTS_PER_DOMAIN': 1, 'DOWNLOAD_DELAY': 1, 'USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36' } def parse(self, response): soup=BeautifulSoup(response.text, 'html.par...

How to run a backend script on Django from html page

I'm trying to process apple pay payments on my Django site. While I understand that this is better off in the back end, I currently am running the scripts in a JS static file, which means that that info is public. How can I set up my project to run a back-end python script when the apple pay button is clicked? Please discuss file organization in your answer. (For simplicity, you can just assume I am trying to run a script that loads another website instead of going through the whole apple pay process.) I came across this resource and it looked like it could be along the right track, but I think it might be overcomplicating things. https://github.com/Jason-Oleana/How-to-run-a-python-script-by-clicking-on-an-html-button Via Active questions tagged javascript - Stack Overflow https://ift.tt/kr5SftR

ROS - MoveIT move_group/display_planned_path subscription callback on connection

I'm having a very weird problem with the /move_group/display_planned_path ROS (not ROS2) message from MoveIt! . The problem is I'm notified of the last planned path as soon as a node subscribes to this topic, even if the publisher (which is internal to MoveIt) has been turned off. This looks like a retained message which, as far as I know, doesn't exists on ROS, it as been introduced with ROS2 only, is that correct? This behavior happens also if I subscribe to the topic with a simple topic echo from a shell, even in this case I suddenly receive last published message. Since I don't think could be done asking to the message a specific QoS, is anyone aware of any kind on "re-transmission" once a client (new node) connects and asks to receive that specific topic? If so, could you please point me out to the source code of the "ghost" or to any available configuration to avoid it? source https://stackoverflow.com/questions/72804364/ros-moveit-move-...

useForm data is not showing in the console

I am developing gmail-clone, I am using useForm for validating data. When I enter data in the form and print it to the console, nothing happens const onSubmit = (data) => { console.log(data); }; <form onSubmit={handleSubmit(onSubmit)}> <input name='to' placeholder='To' type='text' {...register('to', { required: true })} /> <input name='subject' placeholder='Subject' type='text' {...register('subject', { required: true })} /> <input name='message' placeholder='Type your message here...' type='text' className='sendMail_message' {...register('message', { required: true })} /> <div className='sendMail_options'> <Button className='sendMail_send'>Send</Button> </div> </form> Via Active questions tagged javascript - ...

How can I put navbar tags in a row? [duplicate]

I use display: flex; and i need to put <li> s in a row. Here's the HTML <nav id='menu'> <ul> <li><a href='index.html'>Main</a></li> <li><a href='galery.html'>Galery</a></li> <li><a href="service.html">Service</a> </ul> </nav> These <li> tags are under each other. I don't know how to put them in a row (i need to ensure compability between all browsers including mobile, so I use CSS' display: flex; ). Via Active questions tagged javascript - Stack Overflow https://ift.tt/lx4YVC6

i want to remove all duplicate words from the sentences in the 'Word ' column in my dataframe in python. I am new learner

As you can see in the image, i want the data like in iloc[3,1] "do you have to ned ten is too young to see such things all these years and i still feel like an outsider when i come here i wonder if the old gods agree i am so sorry my love gods but they grow fast how many times have i told you no climbing i want you to promise me no more climbing your grace my queen" to remove all duplicates and want to view each unique word in a separate line as output eg- do you have to ned ten is too young see such things all these years and i still feel like an outsider when come here wonder.......etc , so only unique words should be present. source https://stackoverflow.com/questions/72792077/i-want-to-remove-all-duplicate-words-from-the-sentences-in-the-word-column-in

How can i make a custom audioplayer

So I want to make a custom audioplayer in js. I know how i can do it in html its pretty easy but this project requires it in js and i need some help. Im trying to create a simple one with just a play button that plays the audio. Via Active questions tagged javascript - Stack Overflow https://ift.tt/lx4YVC6

Initialize an AudioDecoder for "vorbis" and "opus", description is required - what is it exactly?

I'm using the WebCodecs AudioDecoder to decode OGG files (vorbis and opus). The codec string setting in the AudioDecoder configuration is vorbis and opus , respectively. I have the container parsed into pages, and the AudioDecoder is almost ready for work. However, I'm unable to figure out the description field it's expecting. I've read up on Vorbis WebCodecs Registration , but I'm still lost. That is: let decoder = new AudioDecoder({ ... }); decoder.configure({ description: "", // <----- What do I put here? codec: "vorbis", sampleRate: 44100, numberOfChannels: 2, }); Edit: I understand it's expecting key information about how the OGG file is structured. What I don't understand is what goes there exactly. How does the string even look? Is it a dot-separated string of arguments? Via Active questions tagged javascript - Stack Overflow https://ift.tt/lx4YVC6

Bot online time and server count discord.py

Hey guys im trying to make a bot online time and servers count command but im having some trouble Code: import discord import datetime as dt from discord.ext import commands class Support(commands.Cog): def __init__(self, client): self.client = client client.launch_time = dt.datetime.utcnow() @commands.command() async def stats(self, ctx): delta_uptime = dt.datetime.utcnow() - client.launch_time hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600) minutes, seconds = divmod(remainder, 60) days, hours = divmod(hours, 24) embed = discord.Embed( title = "Roumy's Stats", description = f"Online Time: {days}d, {hours}h, {minutes}m, {seconds}s\n" + "Servers: " +str(len(client.guilds)), colour = 0xeeffee) await ctx.send(embed = embed) def setup(client): client.add_cog(Support(client)) The error i get is the lunch time from this code client.launch_time = dt.datetime.utcnow() The error is (undefine...

is there a simpler way to complete the following exercise? I am adding elements to a string, depending on three conditions

From Google Python Class D. Verbing : Given a string, if its length is at least 3, add 'ing' to its end. Unless it already ends in 'ing', in which case add 'ly' instead. If the string length is less than 3, leave it unchanged. Return the resulting string. def verbing(s): if len(s) < 3: return s if len(s) >= 3 and s[-3:] == 'ing': s = s + 'ly' return s elif s[:-3] != 'ing': s = s + 'ing' return s Test Cases print 'verbing' test(verbing('hail'), 'hailing') test(verbing('runt'), 'runting') test(verbing('swiming'), 'swimingly') test(verbing('do'), 'do') test(verbing('hi'), 'hi') source https://stackoverflow.com/questions/72791792/is-there-a-simpler-way-to-complete-the-following-exercise-i-am-adding-elements

Open one accordion section at a time. (Svelte)

I'd like to ask someone who can figure out how to allow this accordion component to open only one section at a time. It means that if a new accordion is open the previous one has to close automatically. In the ideal situation, this function could be optional for specific accordions. Thank you for your time. Accordion.svelte <script> import { linear } from 'svelte/easing'; import { slide} from 'svelte/transition'; export let open = false; function handleClick() { open = !open } </script> <div class="accordion"> <div class="header" on:click={handleClick}> <div class="text"> <slot name="head"></slot> </div> </div> {#if open} <div class="details" transition:slide="" > <slot name="details"> </slot> ...

Efficiently use Dense layers in parallel

I need to implement a layer in Tensorflow for a dataset of size N where each sample has a set of M independent features (each feature is represented by a tensor of dimension L). I want to train M dense layers in parallel, then concatenate the outputted tensors. I could implement a layer using for loop as below: class MyParallelDenseLayer(tf.keras.layers.Layer): def __init__(self, dense_kwargs, **kwargs): super().__init__(**kwargs) self.dense_kwargs = dense_kwargs def build(self, input_shape): self.N, self.M, self.L = input_shape list_dense_layers = [tf.keras.layers.Dense(**self.dense_kwargs) for a_m in range(self.M)] super().build(input_shape) def call(self, inputs): parallel_output = [list_dense_layers[i](inputs[:, i]) for i in range(self.M)] return tf.keras.layers.Concatenate()(parallel_output ) But the for loop in the 'call' function makes my layer extremely slow. Is there a faster way ...

making a game that includes only one player and the rolling of a dice and scoring the values

In this game, the player scores points based on the face values of the dice, and also on some decisions the player has to make during the game. The game consists of six rounds. During each round, the player will roll some or all of their five dice three times. At the conclusion of each round, the player must choose how their dice are to be scored by choosing which die value to score. Each matching die is worth the number of points shown on its face. For instance, if the dice values are 5, 3, 2, 3, 4, and the player chooses to score the 3s, the player will earn six points (0 + 3 + 0 + 3 + 0 = 6). What makes the game tricky is that the player must choose how to score one round’s set of dice before starting the next round, and they can’t change this choice later. If the player scored the 3s from Round 1, and Round 2’s dice are 3, 3, 3, 2, 3, the player can not elect to score the 3s from this round. However, the player may choose to help themselves out during a round by choosing to “keep” ...

How to stack numpy array along an axis

I have two numpy arrays, one with shape let's say (10, 5, 200), and another one with the shape (1, 200), how can I stack them so I get as a result an array of dimensions (10, 6, 200)? Basically by stacking it to each 2-d array iterating along the first dimension a = np.random.random((10, 5, 200)) b = np.zeros((1, 200)) I'v tried with hstack and vstack but I get an error in incorrect number of axis source https://stackoverflow.com/questions/72777319/how-to-stack-numpy-array-along-an-axis

Order javascript array of numbers with ranges [closed]

I'm building an array by passing in individual numbers and ranges of numbers as strings and I want to be able to perform a function on this array and return a comma separated string, firstly by order of the numbers and also grouped if they exist. For example I have ['13','2','1','7-9','14','3','15-16','20'] And I'd like to be able to get the following result from it: '1-3,7-9,13-16,20' This is what I have attempted so far: function getRangeValues(range) { var start = Number(range.split('-')[0]); var end = Number(range.split('-')[1]); return Array(end - start + 1).fill().map((_, idx) => start + idx) } var splitArray = []; var originalArray = ['13','2','1','7-9','14','3','15-16','20'] originalArray.forEach(e => { e.includes('-') ? splitArray.push(...getRangeValues(e)) : split...

Conditionally update values in a pandas dataframe while moving across successive columns

I have a pandas DataFrame of membership records that contains some entry errors (see table below for a few examples). Some members were incorrectly identified as "Joined" when they were in fact "Renewal" and/or listed as "Joined" multiple times. I want to correct these errors by turning "Joined" into "Renewal" and vice-verse as appropirate based on the column year. MemTransType2009 MemTransType2010 MemTransType2011 MemTransType2012 MemTransType2013 MemTransType2014 MemTransType2015 NaN NaN Joined Renewal Renewal Joined Renewal NaN Joined Renewal NaN Joined Renewal Renewal Joined Renewal Renewal Renewal Renewal Renewal Renewal NaN NaN Renewal Joined Renewal Renewal NaN Using np.where and a loop that updates the row I can make corrections column by column. For example: Years = ['MemTransType2009', 'MemTransType2010', 'MemTransType2011', 'MemTransType2012...

How to perform cv2.bitwise_and() on cv2.inRange() mask and image?

I'm trying to perform a bitwise_and between a mask and the input image but the output of cv2.inRange() is a single channel matrix and the image is a three channel matrix. Thus, the cv2.bitwise_and() throws an error. Is there a way to convert cv2.inRange() output to an image format to perform the bitwise_and? Here's what I have so far: image = np.array(Image.open('im.png')) lower_bound = np.array([0, 0, 40], np.uint8) upper_bound = np.array([40, 255, 255], np.uint8) hsv_img = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv_img, lower_bound, upper_bound) res = cv2.bitwise_and(mask, image, mask=None) Error: cv2.error: OpenCV(4.5.4) /tmp/pip-req-build-3129w7z7/opencv/modules/core/src/arithm.cpp:212: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op array' in function 'binary_op' source https://s...

generate response time and save it in mongo

good morning, afternoon or evening. I want to save the response time (from the time a request is sent, until it returns) in mongo db, I am not an expert on the subject, and I would like you to please shake my hand on this topic. query: async (params = []) => { const startTime = new Date().getTime(); let result = null; let error = null; try { result = await mongoose.query(params); const executionTime = (new Date().getTime() - startTime) / 1000; logger.info(`${executionTime} s`); } catch (err) { error = err; const executionTime = (new Date().getTime() - startTime) / 1000; logger.info(`${executionTime} s`); } if (result !== null) { return result; } throw error; } }; ``` this is what it returns: ```(node:48160) UnhandledPromiseRejectionWarning: TypeError: mongoose.query is not a function previously working with postgres and where it says query placed pol, it was more intuitive. I would appreciate any help. thanks...

Keep the status of a ProgressBar

im new on Javascript and PHP, im coding some timers on cards, but this timers need go displayed with his own progressbar this is what i just got <progress class="timer1" value="0" max="100"> </progress> <script src="jQuery.js"> </script> <script> var ar; $(document).ready(function(){ var _sI=[]; $.ii=function(){ ar=arguments; if(ar.length==3){ if(_sI[ar[0]]==undefined){ _sI[ar[0]]={}; }else{ clearInterval(_sI[ar[0]].reg); } _sI[ar[0]].fn=ar[2]; _sI[ar[0]].t=ar[1]; _sI[ar[0]].reg=setInterval(ar[2],ar[1]); }else if(ar.length==1){ clearInterval(_sI[ar[0]].reg); ...

TypeError: __init__() takes from 4 to 9 positional arguments but 10 were given

I am a running a classification program. While I am running this code I am getting this error: TypeError ---> 19 = GaborNN().to(device) /opt/conda/lib/python3.6/site-packages/GaborNet/GaborLayer.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, groups, bias, padding_mode) 33 groups, 34 bias, ---> 35 padding_mode, 36 ) 37 self.kernel_size = self.conv_layer.kernel_size TypeError: __init__() takes from 4 to 9 positional arguments but 10 were given where as my code is this: class GaborNN(nn.Module): def __init__(self): super(GaborNN, self).__init__() self.g0 = GaborConv2d(in_channels=1, out_channels=96, kernel_size=(11,11)) self.c1 = nn.Conv2d(96, 384, (3,3)) self.fc1 = nn.Linear(384*3*3, 64) self.fc2 = nn.Linear(64, 7) def forward(self, x): x = F.leaky_relu(se...

Use BigNumber.js with Typescript

I'm trying to use bignumber.js with typescript, and everything is fine if I just run react-scripts start , typescript picks up the correct library when I wite import { BigNumber } from "bignumber.js"; . However, once I build the project by running tsc && react-scripts build , the built version doesn't use my desired BigNumber class from bignumber.js. Instead, it picks up the BigNumber class from ether.js/bignumber.ts (I also need ether.js in my project). Any idea about why this happens? My compiler option is the following { "compilerOptions": { "target": "ESNext", "useDefineForClassFields": true, "lib": [ "DOM", "DOM.Iterable", "ESNext" ], "types": [ "node", "webpack-env" // here ], "baseUrl": ".", "allowJs": true, "skipLibCheck": true, ...

How to input specific row value, with row number output

I've struggled with understanding functions and the task that I am trying to accomplish is creating a function that takes the input from a row-value and outputs the row number. An example dataset import pandas as pd data = [['tom', 10], ['nick', 15], ['juli', 14]] df = pd.DataFrame(data, columns=['Name', 'Age']) The hope is that I can call any name using a function and the output would be the row number. Example of what I'm looking for is using the input - "Nick", output would be 1. source https://stackoverflow.com/questions/72757343/how-to-input-specific-row-value-with-row-number-output

handle image error gracefully w/ SVG element & react hooks

I’m trying to load a placeholder image gracefully when the original image path/url is undefined or null. I have a onError method that handles events of this type however the onError method I am using particularly takes in an HTMLImageElement . I would like the placeholder image to be of a SVG (imported from a S3 bucket and stored, then called to the application). How can I display an SVG element when my original image path is null or undefined? code in question here Via Active questions tagged javascript - Stack Overflow https://ift.tt/KjX7o82

Unable to webscrape, can't get the search function to work

I am trying to make a webscraper in order to have a user search for characters, comics and other things related to their search from https://www.marvel.com/search however, no matter what I do I can't figure out how to get the search function to work. I have two codes on my github, below is my most recent attempt that I found from stackoverflow. from selenium import webdriver from selenium.webdriver import Keys from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC user_input = input("character: ") options = Options() options.headless = True options.add_argument("--window-size=1920,1080") driver = webdriver.Chrome("C:\Program Files (x86)\chromedriver.exe") driver.get("https://www.marvel.com/search") WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ...

React - setting value for all array of objects

I'm creating a simple tracker that has a state checking if the button is either false (not checked) or true (checked). The structure of my data is something like this: const [test, setTest] = useState([ { character: 1, two: [ { name: "one", id: 1, check: false }, { name: "two", id: 2, check: true }, ], }, { character: 2, two: [ { name: "one", id: 1, check: true }, { name: "two", id: 2, check: false }, ], }, ]) I tried creating a function that resets all of the check values back to false. The user can delete a character or add more so I need to reset all character checks at the same time. I managed to do this but I'm not sure if the method I used is acceptable or not. The only way I could solve this is to create a variable which has the value of my test state then make changes to the array and at the end; set my test state to equal the array. let array = test array.forEach(...

how do i can fixt this problem of indented block?

Hello this code not work need help i whant re-sent a especific menssage @events.register(events.NewMessage(chats='AAAAA')) async def me_handler(event): client = event.client if 'AAAAAAAA' in event.raw_text: async def main(event): await event.forward_to('AAAAA') expected an indented block source https://stackoverflow.com/questions/72748989/how-do-i-can-fixt-this-problem-of-indented-block

Playsound gives me an error when I start the executable (packaged by PyInstaller)

I am having a problem with my code. On Visual Studio everything is fine, but after PyInstaller packaging it is not. The directory of the file that Playsound wants to open does not correspond to the right one! Would anyone know a solution? Traceback (most recent call last): File "main.py", line 55, in <module> File "playsound.py", line 35, in _playsoundWin File "playsound.py", line 31, in winCommand playsound.PlaysoundException: Error 275 for command: open "C:\Users\*****\AppData\Local\Temp\_ME181442\Sounds\startup.wav" alis playsound_0.5158534024163396 Cannot find the specified file. Make sure the path and filename are correct. [9788] Failed to execute script 'main' due to unhandled exception! source https://stackoverflow.com/questions/72748984/playsound-gives-me-an-error-when-i-start-the-executable-packaged-by-pyinstaller

Lodash typescript - Combining multiple arrays into a single one and perform calculation on each

I have a Record<string, number[][]> and trying to perform calculation over these values. An example input: const input1 = { key1: [ [2002, 10], [2003, 50], ], }; const input2 = { key1: [ [2002, 20], [2003, 70], ], }; const input3 = { key1: [ [2002, 5], [2003, 60], ], }; For each key, and for the specific year I want to do the following year => input1 + input2 - input3 // output: 2002 => 25, 2003 => 60 For this I have been playing around with lodash/fp. map(a => a.map(nth(1)))(map('asset1')([input1, input2])) // [[10, 50], [20, 70], [5, 60]] is there a way to somehow pass the inputs and iterate over them, and somehow get a callback function to get the values to perform the calculation. I tried zip , zipWith but didn’t get to anywhere with them. Any clue what I can do in this instance? Thank you for your help. Via Active questions tagged javascr...

Multicolumn Explode

I am trying to turn multiple columns into a single column, without the "null" ones and keep the identifier of each row Identifier Column1 Column2 Column3 Column4 1 Dog Cow Sheep Dinosaur 2 Dog Pig 3 Bull Cow Elephant I want the new 2 columns like this, the original dataframe might have lots of columns, 20, 30, maybe more. Identifier Var 1 Dog 1 Cow 1 Sheep 1 Dinosaur 2 Dog 2 Pig 3 Bull 3 Cow 3 Elephant source https://stackoverflow.com/questions/72748489/multicolumn-explode

sending email to distribution list using python

I'm trying to send emails to people in a distribution list in my company using python. My company uses outlook. When I send to individual users specifying their email, it works perfectly. However I need to use the distribution list, since the recipients are updated by my IT department and I cant keep updating the email list whenever it changes. Whomever has used outlook, you might recall that the distribution list starts with an exclamation mark like so: !groupdept@company.com I am using the following method to send emails using python: from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from smtplib import SMTP import smtplib import sys subject = "Group Email" fromm = 'me@company.com' recipients = ['someone@company.com, someonelse@company.com'] emaillist = [elem.strip().split(',') for elem in recipients] msg = MIMEMultipart() msg['Subject'] = subject ...

Why is this console error showing after this Vuex mutation commit?

I'm quite new with Vue and Vuex, I'm having this console error after committing a declared Mutation in the store, which by the way, besides from the console error is doing its job . The error which is: ReferenceError: ADD_EVENT is not defined at eval (EventCreate.vue?89e7:82:1) , it's pretty much self-explanatory. I'm probably missing one step or calling something in the wrong place but it all seems to be in place, so here's my code: the store: import { createStore } from 'vuex' export default createStore({ state: { user: 'TommyDemian', events: [] }, mutations: { ADD_EVENT(state, event){ state.events.push(event); } }, getters: { }, actions: { }, modules: { } }) The component committing the mutation: export default { name:'EventCreate', setup () { const store = useStore(); const onSubmit = () => { event.organizer = store.state.user; event.id = uuidv4(); apiClient...

move function out of jsx

Sorry in advance if this question seems inappropriate. Just tell me, I'll explain everything. So my question is I would like to move the function (code below) from jsx and wrap it in useCallback. Since at the moment a new function is created for each element on each render. ...... {suggestedTags.length ? ( <div className={classes.tagSuggestionWrapper}> {suggestedTags.map((tag) => { return (<div key={tag} className={classes.tagSuggestion} onClick={() => { selectTag(tag) }}>{tag}</div> ); })} </div> ) : null } ...... Whole code export default function TagsInput(props) { const {tags, setTags, tagSuggestions} = props; const [input, setInput] = useState(""); const [suggestedTags, setSuggestedTags] = useState([]); const [isValid, setIsValid] = useState(true); con...

i have created z table with plotly now i want to highlights probability with red color for z=1.56 i.e 0.94062 can some one please help me

import streamlit as st import plotly.graph_objects as go import plotly.express as px def rejection_region(): vals = [[0.50000, 0.53983, 0.57926, 0.61791, 0.65542, 0.69146, 0.72575, 0.75804, 0.78814, 0.81594, 0.84134, 0.86433, 0.88493, 0.90320, 0.91924, 0.93319, 0.94520, 0.95543, 0.96407, 0.97128, 0.97725, 0.98214, 0.98610, 0.98928, 0.99180, 0.99379, 0.99534, 0.99653, 0.99744, 0.99813, 0.99865, 0.99903, 0.99931, 0.99952, 0.99966, 0.99977, 0.99984, 0.99989, 0.99993, 0.99995 ], [0.50399, 0.54380, 0.58317, 0.62172, 0.65910, 0.69497, 0.72907, 0.76115, 0.79103, 0.81859, 0.84375, 0.86650, 0.88686, 0.90490, 0.92073, 0.93448, 0.94630, 0.95637, 0.96485, 0.97193, 0.97778, 0.98257, 0.98645, 0.98956, 0.99202, 0.99396, 0.99547, 0.99664, 0.99752, 0.99819, 0.99869, 0.99906, 0.99934, 0.99953, 0.99968, 0.99978, 0.99985, 0.99990, 0.99993, 0.99995 ], [0.50798, 0.54776, 0.58706, 0.62552, 0.66276, 0.69847, 0.73237, 0.76424, 0.79389, 0.82121, 0.84614, 0.86864, 0.88877, 0.90658, 0.92220, 0.93574, 0.9473...

Referring JSON keys that are numbers [duplicate]

My JSON data stored in dataTest.json data goes as follows : "1":"value1", "2":"value2" } The above gives positive results in a validator. Now if I want to use this data in a javascript program like var data = require('./dataTest.json'); console.log(data.1) I get an error saying console.log(data.1) ^^^^^^^^^ SyntaxError: missing ) after argument list But simply changing the first key to something like a1 instead of simply 1 and calling it like data.a1 fixes it. For several reasons, I'd like to keep the keys as simple numbers. Is there any way to refer to such keys with numerical values? Via Active questions tagged javascript - Stack Overflow https://ift.tt/E6cCouG

How to add css property to a span tag of an innerhtml

I have a innerhtml Lets say <p> <span>8218819999</span> <span>hello</span> </p> I want add css property for first span tag How can I do that ?? Using jquery or javascript. This whole html is coming from AEM Label which I don’t have control over. Using ngafterviewinit I’m getting the innerhtml But not sure how to update the css. Via Active questions tagged javascript - Stack Overflow https://ift.tt/E6cCouG

can i access sequelize from outside the database provider writing raw query in nestjs using sequelize

export const databaseProviders = [ { provide: 'Sequelize', useFactory: async () => { const sequelize = new Sequelize({ dialect: 'postgres', host: process.env.PG_HOST, port: Number(process.env.PG_PORT), database: process.env.PG_DATABASE, username: process.env.PG_USERNAME, password: process.env.PG_PASSWORD, }); sequelize.addModels([OrderModule]); await sequelize.sync(); return sequelize; }, }, ]; Can I access the sequelize outside the file, so that i can use raw queries? Is there decorator or something which i can use to access the sequelize to write the raw queries. Via Active questions tagged javascript - Stack Overflow https://ift.tt/E6cCouG

Automatically download file after load page php

I'm trying to implement a script on an html template where after loading the template, the file download starts automatically. My files in question are txt, csv and xlsx. After 2 seconds, as per setTimeout, the script is activated but it does not download the file, but opens a new page as the content of it. Another question I wanted to ask was whether it is possible to put the absolute path of the file as the folder containing them is nested at a higher level than $ _SERVER ["DOCUMENT_ROOT"] . $file = '/var/www/.........../file.txt'; echo "<script> \$(function() { \$('a[data-auto-download]').each(function(){ var \$this = \$(this); setTimeout(function() { window.location.href = \$this.attr('href'); }, 2000); }); }); </script> <a data-...

Raise exception as e in if statement

I have come up with some code to send a file's exceptions as an email, and update a .txt log file. This method works for the following example: from send_mail import send_error_email from datetime import datetime import logging logging.basicConfig(filename='log.txt', level=logging.DEBUG, format='%(asctime)s %(levelname)s %(name)s %(message)s') logger=logging.getLogger(__name__) now = datetime.now() date = now.strftime("%m/%d/%Y") time = now.strftime("%H:%M:%S") try: a = 2 + 'seven' except Exception as e: print(e) send_error_email(exception=e, message="Can't add string and int") logging.exception('Oh no! Error on {} at {} Here is the traceback info:'.format(date, time)) However, the functions I want to apply it to have a lot of if/else syntax where exceptions are raised in the if or else block. Here are two examples: def is_empty(test_df): if(test_df.empty): raise Exception("T...

child hooks not rerendering after changing state in parent hooks

Below are parent component and child component, I just want to update child component once changing state in parent component. I am creating one table which is child component and passing data from parent to child, and triggering delete function from child to parent. Data is getting deleted in parent but not sending same to child. Any help is appreciable!! Parent import React, { useState } from "react"; import Pagination from "./components/Pagination.js"; import { Table } from "./components/Table.js"; import { useEffect } from "react"; import "./App.css"; function App() { const [tableData, setTableData] = useState([]); useEffect(() => { fetch("https://jsonplaceholder.typicode.com/posts") .then(response => response.json()) .then(data => setTableData(data)) }, []) const deleteRowData = (id) => { tableData.map((row, ind) => { if (id === row.id) { console.log(id); ...

Hash Join Algorithm from MySQL in Python

Assume I want to write the following SQL Query: SELECT Employee.Name, Employee.ID, InvitedToParty.Name, InvitedToParty.FavoriteFood FROM Employee, InvitedToParty WHERE Employee.ID = InvitedToParty.ID given the required tables : Employee ID Name Birthday 1 Heiny 01.01.2000 2 Peter 10.10.1990 3 Sabrina 12.10. 2015 . . InvitedToParty Name FavoriteFood Michael Pizza Heiny Pizza Sabrina Burger George Pasta . . . Assume I have this information as two lists in Python inside a dictionary: tables['Employee'].id = [1, 2, 3 ..] tables['Employee'].Name = [Heiny, Peter, Sabrina ...] I hope you get the idea. These keys of the dictionary have attributes, because I created a class for each table. How can I write this query in Python? My initial idea was (pseudo): match_counter = 0 for i, value in enumerate(table1.column): for j in range(len(table2.column)): if table2.column[j] == value: table2.column[j], table2.column[i] = ...

Emitted number from Angular Element turns into string when reaching javascript event listener

I have created a web component in Angular Elements which defines and emits events like this: @Input() groupId: number = -1; @Output('group_change') groupChange!: EventEmitter<number>; ... this.groupChange.emit(groupId); I have added the web component to a JavaScript application with an event listener: this.myAngularElement.addEventListener('group_change', evt => { console.log(evt); }); What is unexpected is that the number has been converted to a string in the event listener. Is there an explanation for why this happens, and maybe even a way to prevent it? Via Active questions tagged javascript - Stack Overflow https://ift.tt/yAMKqGJ

web scraping with BS4 returning None

I have a list of movies that I want to scrap the genres from Google. I've built this code: list=['Psychological thriller','Mystery','Crime film','Neo-noir','Drama','Crime Thriller','Indie film'] gen2 = {} for i in list: user_query = i +'movie genre' URL = 'https://www.google.co.in/search?q=' + user_query headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36'} page = requests.get(URL, headers=headers) soup = BeautifulSoup(page.content, 'html.parser') c = soup.find(class_='EDblX DAVP1') print(c) if c != None: genres = c.findAll('a') gen2[i]= genres But it returns an empty dict, so I checked one by one and it worked, for example: user_query = 'Se7en movie genre' URL = "https://www.google.co.in/search?q=" + user_query headers = {'User-Agent...

How can the expansion of 'users.data.object.email' to object be implemented in javascript

Say I have this string/array: 'users.data.object.email' / [users, data, object, email] How can I convert this string/array to a javascript object? For example from the above string/array, the object would look like so: {user: { data: { object: { email: {} } } } Via Active questions tagged javascript - Stack Overflow https://stackoverflow.com/questions/tagged/?tagnames=javascript&sort=active

Changing the Values of a Multi-Index Dataframe

I have a multi-index dataframe that is set up as follows: index = pd.MultiIndex.from_product([['A','B','C'], ['x','y', 'z']]) multi_index = pd.DataFrame(np.nan, index=np.arange(10), columns=index) Which produces the following output: A B C x y z x y z x y z 0 NaN NaN NaN NaN NaN NaN NaN NaN NaN 1 NaN NaN NaN NaN NaN NaN NaN NaN NaN 2 NaN NaN NaN NaN NaN NaN NaN NaN NaN 3 NaN NaN NaN NaN NaN NaN NaN NaN NaN 4 NaN NaN NaN NaN NaN NaN NaN NaN NaN 5 NaN NaN NaN NaN NaN NaN NaN NaN NaN 6 NaN NaN NaN NaN NaN NaN NaN NaN NaN 7 NaN NaN NaN NaN NaN NaN NaN NaN NaN 8 NaN NaN NaN NaN NaN NaN NaN NaN NaN 9 NaN NaN NaN NaN NaN NaN NaN NaN NaN I am trying to fill the values of the multi-index data frame with values. As a toy example, what I've tried to do is change the value of ['A','x',0] as follows: multi_index['A']['x'].loc[0] = 65.2 However, I receive a 'S...

How to stop chrome.webRequest.onAuthRequired from infinite loop when wrong authCredentials is given?

I want to authenticate a web request using the chrome extension. Below code is working perfectly for that. But the problem is that when the given credentials is wrong, the below code will retry indefinitely. Question How to stop the infinite loop when wrong authCredentials is given? My ideal situation will be that when the auth fails then it should fall back to default behavior which in this case will be an Authentication Popup by the browser itself since it is an NTLM authentication type. chrome.webRequest.onAuthRequired.addListener( function (details, callback) { if (callback) { callback({ authCredentials: {username: 'SampleUsername', password: 'SamplePassword'} }); } }, {urls: ['https://www.example.com/*']}, ['asyncBlocking'] ); Via Active questions tagged javascript - Stack Overflow https://ift.tt/JZcIChS

Javascript Email Checker in ASP.NET

Basically I am trying to have a text box that upon change it checks if a valid email is in place and if so the form is submitted for the user. I would like to improve the regex too to only allow a specific domain but I can't get any regex to work due to every time I use a @ sign it thinks I am trying to use C# code I looked it up and supposedly adding a : fixes it but it hasn't for me and I tried a ; too. document.getElementById("txtCallerID").onchange = function () { var temp = document.getElementById("txtCallerID").value if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(temp)) { this.document.submit(); } } and here is a picture with the error. Have now also tried adding a backslash before the @ to no avail. Via Active questions tagged javascript - Stack Overflow https://ift.tt/JZcIChS

how can i prevent from clicking twice in the same tile?

Im making a game and im trying to figure out how to prevent my X to be deleted when clicking twice in the same tile right now i can move my "X" around but it get's deleted if i click twice. ive tried boolean but im terrible with them . is there a way to do it with boolean or anything else ? Im a beginner at school. var clique1fois = false; var clique = null; var aClique = false; function deplacerPion(x) { if (aClique == true) { x.innerHTML = clique.innerHTML; clique.innerHTML = ""; aClique = false; clique.style.border = "1px solid black"; clique.style.height = "80px"; clique.style.width = "80px"; } else { x.style.border = "3px solid red"; x.style.width = "76px"; x.style.height = "76px"; clique = x; aClique = true; } } td { height: 80px; width: 80px; text-align: center; font-size: 300%; } table { margin-left: auto; margin-right: auto; } ...

how to fix ReferenceError: document is not defined? [duplicate]

js code const inputEl = document.getElementById("input-el") for this code console is showing error about document not defined, can anyone help how to solve this? html code: <input type="text" id="input-el"> ReferenceError: document is not defined at Object. (c:\Users\User\Desktop\Counter js\ChromeExtension\index.js:2:17) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 Via Active questions tagged javascript - Stack Overflow https://ift.tt/yKeT96C

"No Exports Main Defined In" Error Node.js

I'm trying to make a simple api with js. But i keep getting this stupid error. NOTE: This is my first time programming in js. Code: const express = require('express') const app = express() const { Canvas } = require('canvas-constructor') const canvas = require('canvas') app.get('/:feed', async (req, res) => { const img = await canvas.loadImage('https://i.pinimg.com/originals/30/82/b0/3082b0354572c4d37af6994b4e8baa43.png') let image = new Canvas(670, 435) .printImage(img, 0, 0, 670, 435) .setTextFont('28px Impact') .printText(req.params.feed, 40, 150) .toBuffer(); res.set({'Content-Type': 'image/png'}) res.send(image)//sending the image! }) app.listen(8080) Error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/runner/ScarceExcellentVariables/node_modules/canvas-constructor/package.json at new NodeError (node:internal/errors:371:5) ...

How to get the level of a node in binary tree using python?

I tried to implement the binary tree program in python. I want to add one more function to get the level of a specific node. eg:- 10 # level 0 / \ 5 15 # level 1 / \ 3 7 # level 2 if we search the level of node 3, it should return class BinaryTree: def __init__(self, data): self.left = None self.right = None self.data = data def insert(self, data): if self.data == data: return if self.data<data: if self.left: self.left.insert(data) else: self.left = BinaryTree(data) else: if self.right: self.right.insert(data) else: self.right = BinaryTree(data) def print_tree(self): if self: print(self.data) if self.left: self.left.print_tree() elif self.right: self.right.print_tree() de...

generate 1D tensor as unique index of rows of an 2D tensor (keeping the order and the original index)

This question is an updated version of generate 1D tensor as unique index of rows of an 2D tensor Let's say we transform a 2D tensor to a 1D tensor by giving each, different row a different index, from 0 to the number of rows - 1 . [[1,4],[1,3],[1,2]] -> [0,1,2] But if there are same rows, we repeat the index, like this below, the "original" index is k-1 for the k -th row [[1,4],[1,2],[1,2]] -> [0,1,1] Also if there is no repeat for the row (like the third row below), its index should be its original index, which is k-1 for the k -th row (for example 2 for [1,4]). [[1,3],[1,3],[1,4]] -> [0,0,2] A longer example: [[1,2],[4,3],[1,4],[1,4],[4,3],[1,2],[5,6],[7,8]] -> [0,1,2,2,1,0,6,7] How to implement this on PyTorch? source https://stackoverflow.com/questions/72689843/generate-1d-tensor-as-unique-index-of-rows-of-an-2d-tensor-keeping-the-order-an

Remove or replace +1 from the string : JavaScript

I am applying phone number masking on a phone number. I want to make sure that there is no +1 in the beginning and if there is remove it. What would be the best way to do that? self.phoneNumberMasking = function (data) { if (data != "" && data != null) { var x = data.replace(/\D/g, '').match(/(\d{3})(\d{3})(\d{4})/); data = '+1(' + x[1] + ')' + x[2] + '-' + x[3]; return data; } return data; } Since I am not removing or replacing +1 in the above code, it is adding another 1 when I try to apply the mask on a number that already has +1 in it. Via Active questions tagged javascript - Stack Overflow https://ift.tt/yKeT96C

Can I loop through an array while declaring a function

const students = ['John', 'Mark']; const weight = [92, 85] const height = [1.88, 1.76] function yourBodyMass(name, funct, mass, height) { console.log(`${name} your BMI is ${funct(mass, height)}.`) } function bodyMass(mass, height) { const BMI = mass / height ** 2; return BMI; } function loopData() { for (let i of students) { return yourBodymass(students[i], bodyMass) } } Now I want to loop through students so that I don't have to declare the yourBodyMass function again and again. Plz tell IF this is even possible. Via Active questions tagged javascript - Stack Overflow https://ift.tt/yKeT96C

How to use insertBefore and appendChild with a jQuery AJAX server side rendered html result

I basically need to use insertBefore and appendChild with a Server Side rendered HTML page jQuery AJAX result. I get the error: "Failed to execute 'inserBefore' on 'Node': parameter 1 is not of type 'Node'." var parent_elem = $('#parent_elem'); $.ajax({ type:'POST', url:'example.com/my_ajax_call', data: {"my_data":my_data}, success:function(data){ parent_elem.prepend(data); //THIS IS THE JQUERY SOLUTION BUT I NEED PURE JS WHILE USING JQUERY AJAX REQUEST }, fail:function(data){ console.log(data); console.log('failed to load page'); } }); what I am trying to do is this: var parent_elem = document.getElementById('parent_elem'); $.ajax({ type:'POST', url:'example.com/my_ajax_call', data: {"my_data":my_data}, success:function(data){ parent_elem.inserBefore(data, parent_elem.firstChild); //THIS IS WHAT I N...

I need one async function to wait for another one

I have 2 async functions - one gets ids of towns, and the second one takes these ids and gets {towns} objects. I am importing an API which is also async. The first function works fine, but the second one returns LOG catchTowns [Error: Not found] code: import { getTown, getTownIds } from "./api/towns" //getting IDs from API const getTownIdsAsync = async () => { const asyncids = await getTownIds() return(asyncids.ids) } let idcka = new Promise((resolve, reject) => { resolve(getTownIdsAsync()) }) .then(result => { idcka = result for(i=0; i < idcka.length; i++){ } }) .catch(err => { console.log('catchIdcka', err) }) //getting Towns from API const getTownsByIdsAsync = async (ajdycka) => { const asyncTowns = await getTown(ajdycka) return(asyncTowns) } let towns = new Promise((resolve, reject) => { resolve(getTownsByIdsAsync()) }) .then(result => { towns = result console.log(towns) }) .catch(err => { console.lo...

how to keep state of elements inside a map function in react [closed]

I'm making a react quiz app and so far its going good but I been struggling on how I would keep state of the answers to the questions. I'm using the map function to render the question with the 4 options *or two if its a true false question. any help would be much appreciated!! Via Active questions tagged javascript - Stack Overflow https://ift.tt/FoRM2K3

All my columns are indexes in pandas. How to solve that and 'reset' the index?

So, When i do print(mydf.columns) with my one of my dataframes, i get this result: Index([ 'facility', '2022-01-01', '2022-02-01', '2022-03-01', '2022-04-01', 'YTD', 'state_name' ], dtype='object' ) And because of that I can't join this dataframe with another one because i simply cannot specify which column i want to use as join parameter. To get that dataframe, i used this command: mydf = mydf[(mydf['facility'] != "Insert New ") & (mydf['facility'] != "Total")] How can i fix this? source https://stackoverflow.com/questions/72680042/all-my-columns-are-indexes-in-pandas-how-to-solve-that-and-reset-the-index

How to fix gettext() got an unexpected keyword argument 'null' in Django

I have a model, a serializer, and a view like below, model # get user model User = get_user_model() class Task(models.Model): "A task can be created by the user to save the task's details" COLOR_CHOICES = ( ("red", _("Red")), ("gre", _("Green")), ("blu", _("Blue")), ("yel", _("Yellow")), ("pur", _("Purple")), ("ora", _("Orange")), ("bla", _("Black")), ("whi", _("White")), ("ind", _("Indigo")), ("lim", _("Lime")), ("cya", _("Cyan")), ) title = models.CharField(max_length=150, blank=False, null=False, help_text=_("Enter your task's title"), verbose_name=_("title")) description = models.TextField(max_length=500, blank=True, nu...