Skip to main content

Posts

SortableJS ascending descending sort

I use bootstrap and sortable.js, the created table works very well for moving items with the mouse I want to sort a table with buttons How do I implement a sort on the buttons that will sort the list by Ascending/Descending ? // sort: true Sortable.create(sortTrue, { group: "sorting", sort: true }); // sort: false Sortable.create(sortFalse, { group: "sorting", sort: false }); body { padding: 20px; } #sortTrue{ margin-top:10px; } .list-group-item { cursor: move; cursor: -webkit-grabbing; } <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/> <!-- Latest Sortable --> <script src="https://raw.githack.com/SortableJS/Sortable/master/Sortable.js"></script> <button>ascending</button> <button>descending</button> <!-- sort: true --> <div id=&qu

Iterate trough json dict until entry is found or pass error with python

I have a python dict with nested entries, like this: [{ "id": "lorem", "name": "lorem", "info": "lorem", "system": { "0": {"0": "initial question", "1": "lorem", "2": "lorem"}, "A": {"n":"lorem", "n":"lorem"} }, "result": {"n":"lorem", "n":"lorem"} }] Via an input from the console I want to find the id of my dict and continue from there my code so far: query = input("Type in the id: ", ) while True: for i in range(len(data)): if query in data[i]["id"]: print(" ") print("You have selected:", data[i]["name"]) break if query:

i try to delete Label but i can't delete & my code a lot of line need somebody to advice

I'm writing a Tkinter Application. I'm trying to delete a Label by using destroy() but it is not working correctly. What would be the correct way to delete (or remove) the Label . Base code: typeimport tkinter from tkinter import * from tkinter import ttk window=Tk() window.minsize(300,200) window.title("COMBO 3 PIECE 1 SODA") Label(text="UFC make fight",font=20,pady=10 ,padx=10).grid(row=0,column=0,sticky=W) opponet=StringVar(value="คู่ต่อสู้ของคุณ") combo2=ttk.Combobox(textvariable=opponet) combo2["value"]=("Conor Mcgregor","Jorge Masvidal","Colby Covington","Tony Ferguson","Sean O malley") combo2.grid(row=0,column=2) choice = StringVar(value="เลือกนักสู้ของคุณ") combo=ttk.Combobox(textvariable=choice) combo["value"]=("Conor Mcgregor","Jorge Masvidal","Colby Covington","Tony Ferguson","Sean O malley") combo.gri

url-loader with Webpack 5. Images are not loaded

For a small front-end vanilla JS project, I am using Webpack 5. I will only have one HTML page with text and some small icons, so I would like to use url-loader for these icons. I installed the necessary modules with this command: npm install url-loader file-loader --save-dev I configured the Webpack rule in the following way: { test: /\.(png|jpe?g|gif)$/i, loader: 'url-loader', options: { limit: 8192, // in bytes name: '[name].[hash:7].[ext]', fallback: 'file-loader', outputPath: 'images', publicPath: 'images', }, }, Finally, I added this image to the index.html page: <img src="/images/image1.png" alt="Image 1"> Here's the structure of my src folder: src/ ├── index.html └── images/ ├── image1.jpg ├── image2.png └── image3.gif It seems that the url-loader is not working because I am not able to see the images on the browser, and the HTML related to these images does no

Can't make array of arrays

I'm trying to make an array of coordinate arrays, but I'm blanking out on how to doing. How do I make this happen? Code - targetLocations() { const data = [] const timer = setInterval(() => { for (let i = 0; i<store.state.location.locations.length; i++) { const coordinates = [store.state.location.locations[i]["longitude"]+","+store.state.location.locations[i]["latitude"]] data.push(coordinates) console.log("this is the data "+data) } }, 1000); }, I've tried making coordinates an array and it still didn't work Via Active questions tagged javascript - Stack Overflow https://ift.tt/5hpkbGf

Grabbing reCAPTCHA text via BeautifulSoup

I'm trying to grab the text of whatever the captcha is wanting you to solve for. So for example, if the captcha is asking for you to select all the "Cars" then I want to select that value with Beautifulsoup (or another library). https://www.google.com/recaptcha/api2/demo is the website I'm referencing. Captcha Picture So for this one, I want to grab the following line: <strong style="font-size: 22px;">cars</strong> I cannot figure this one out. This is my current version of code: driver = webdriver.Chrome(path) captcha_url = 'https://www.google.com/recaptcha/api2/demo' driver.get(captcha_url) xpath_captch = '//*[@id="recaptcha-demo"]/div/div/iframe' wait = WebDriverWait(driver, 20) time.sleep(3) driver.find_element(By.XPATH, xpath_captch).click() time.sleep(5) soup = BeautifulSoup(driver.page_source, "html.parser") divs = soup.find_all('div') source https://stackoverflow.com/questions/758149

How to download chromedriver instead of webpage with python requests library

Today I'm creating a Python script to find a specific version of chromedriver here . My intention is to make a request to the URL containing the specific version of chromedriver I need to download and save it to the same directory as the script. However, each time I run my code to install a file, say chromedriver_win32.zip in this folder , I end up downloading the webpage it is stored on instead of the file itself. Here's my script: #Get the exact folder name containing the version we need to download chromedriverVersionUrl = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_100" response = requests.get(chromedriverVersionUrl) latestVersionNumber = response.text #Target the folder of the exact version we need to download and download it! downloadUrl = "https://chromedriver.storage.googleapis.com/index.html?path=" + latestVersionNumber + "/chromedriver_win32.zip" #Make the request and write the response to a file r = requests.get(downl