Sunday, May 8, 2022

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


How to always run/refresh datatables?

Posted: 08 May 2022 09:54 AM PDT

When I do some action in my react application like, update or delete, the data tables cannot run, the data tables only run when refreshing the page How can I get it to refresh automatically?

//Datatable Modules  import "datatables.net-dt/js/dataTables.dataTables"  import "datatables.net-dt/css/jquery.dataTables.min.css"  import $ from 'jquery';     import { useEffect } from "react";    //initialize datatable  $(document).ready(function () {    setTimeout(function(){    $('#example').DataTable();     } ,100);  });    useEffect(() => {      init();    },[])      const init = () => {      employeeService.getAll()      .then(response => {        setEmployees(response.data);      })      .catch(error => {        console.log('Something wrong', error);      })    }  

the return container

    <table id="example" className="table table-bordered table-striped">        ...      </table>  

Issue trying to programmatically post messages to a private Facebook group using Graph API

Posted: 08 May 2022 09:54 AM PDT

I am trying to programmatically post messages to a private Facebook group. I plan to write the code to do this in Python. I would like to run the code from my laptop. I have seen multiple articles demonstrating how to write this code. I don't need help with that.

I am an Admin user in the private FB group.

The issue I have is the techniques described all depend on creating an app. This seems like overkill to me. I don't need a general-purpose app. I'd prefer not to go through the burden of getting an app approved.

Thus far, the only way I have seen to enable the required permissions to write messages to a group is by creating an app and adding that app to a group.

Is there a simpler way, that does not require writing an app, that then must be approved, when I don't need an approved general purpose app?

Thus far, I have not been able to post this question to the Facebook community. The webpage is throwing a cryptic error when I try to post.

Expand embedded list of dictionnaries in a DataFrame as new columns of the DataFrame

Posted: 08 May 2022 09:54 AM PDT

I have a Pandas DataFrame looking like:

df0  Out[414]:         0     1                                        2  0    12  None  [{'dst': '925', 'object': 'Lok. Cert...  1    13  wXB   [{'dst': '987', 'object': 'Lok. Fral...  

Each of the list in the column 2 is having the exact same keys (dst, object and admin):

[    {'dst': '925', 'object': 'Lok. Certification', 'admin': 'valid'},    {'dst': '935', 'object': 'Lok. Administration', 'admin': 'true'},    {'dst': '944', 'object': 'Lok. Customer', 'admin': 'false'},    ...  ]  

I wish I could expand the df0 DataFrame to look like this:

columns = ['id', 'name', 'dst', 'object', 'admin']    df_wanted  Out[416]:        id name  dst  object                admin      12  None  925 'Lok. Certification'   'valid'      12  None  935 'Lok. Administration'  'true'      12  None  944 'Lok. Customer'        'false'      12  None  945 'Lok. Customer'        'false'      12  None  955 'Lok. Certification-C' 'invalid'      12  None  956 'Lok. Certification'   'valid'      13   wXB  987 'Lok. Fral_heater'     'valid'      13   wXB  986 'Lok. Fral_cond.'      'valid'      ...  

Notice that the two first columns, id and name, are replicated along the rows to fit the number of elements within their list.

(The dst column must be cast to an int using .astype(int) at the end.)

How could I achieve that?

Info:

Python 3.10.4  pd.__version__  '1.4.2'  

Git branch locally and remotely can any one please tell me this is my first question?

Posted: 08 May 2022 09:54 AM PDT

The best way (actually the only way*) to simulate an actual click event using only CSS (rather than just hovering on an element or making an element active, where you don't have mouseUp) is to use the checkbox hack. It works by attaching a label to an element via the label's for="" attribute.

Telegram bot Error - AttributeError: 'int' object has no attribute 'chat'

Posted: 08 May 2022 09:54 AM PDT

What does this error mean and what do I need to do to make my code work?

This bot is a random number generator with customizable number range. It gets the first digit of the range, then the second digit of the range, and after that it inserts these numbers into the random range.

import telebot  import random  from telebot import types    bot = telebot.TeleBot('TOKEN')      # Start  @bot.message_handler(commands=['start'])  def welcome(message):      markup = types.ReplyKeyboardMarkup(resize_keyboard=True)      random_sender = types.KeyboardButton("Send me Random Number")      markup.add(random_sender)      bot.send_message(message.chat.id, '<b>Random Generator activated</b>', parse_mode='html',                       reply_markup=markup)      # Button  @bot.message_handler(content_types=['text'])    # Getting the first number of range  def first_number_ask(message):      if message.text == 'Send me Random Number':          msg = bot.send_message(message.chat.id, 'Enter the first number of range')          bot.register_next_step_handler(msg, second_number_get)    def first_number_get(message):      global NUM_first      NUM_first = int(message.text)      bot.register_next_step_handler(NUM_first, second_number_ask)      # Getting the second number of range  def second_number_ask(message):      msg = bot.send_message(message.chat.id, 'Enter the second number of range')      bot.register_next_step_handler(msg, second_number_get)    def second_number_get(message):      global NUM_second      NUM_second = int(message.text)      bot.register_next_step_handler(NUM_second, result)      # Result  def result(message):      bot.send_message(message.chat.id, str(random.randint(NUM_first, NUM_second)))    #Run  bot.polling(none_stop=True)  

Programmatically navigate using React router v6

Posted: 08 May 2022 09:54 AM PDT

With react-router I can use the Link element to create links which are natively handled by react router.

I see internally it calls this.context.transitionTo(...).

I want to do a navigation. Not from a link, but from a dropdown selection (as an example). How can I do this in code? What is this.context?

I saw the Navigation mixin, but can I do this without mixins?

How to load spinner in react component while data is loading

Posted: 08 May 2022 09:54 AM PDT

I am trying to add a loading spinner using react hooks use state. I want to what is the easiest way to add a loading spinner in react component when my data is fetching. It needs to look fancy. If there is lightweight npm please suggest it's with an example.

How can i get my buttons working for Android Studio?

Posted: 08 May 2022 09:53 AM PDT

I have an Activity which has two buttons on it. The first button adds the user data to a database and the second takes us to a different activity. The buttons in my main activity are working but not in the activity.

Activity:

    EditText addName, addAge, addWeight;      Button addDatatoDB, goToCalcIntake;      personInfo personInfodDB;      final int ltrPerKg = 30;      @Override      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.add_data);            addName = (EditText) findViewById(R.id.addName);          addWeight = (EditText) findViewById(R.id.addWeight);          addAge = (EditText) findViewById(R.id.addAge);            addDatatoDB = (Button) findViewById(R.id.addDatatoDatabase);          goToCalcIntake = (Button) findViewById(R.id.goTo);          personInfodDB = new personInfo(getApplicationContext());               addDatatoDB.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View view) {                 String name = addName.getText().toString().trim();                 int weight = Integer.valueOf(addWeight.getText().toString().trim());                 int age = Integer.valueOf(addAge.getText().toString().trim());                 int intake = weight/ltrPerKg;                 personInfodDB.addInfo(name,weight,age,intake);             }         });            goToCalcIntake.setOnClickListener(new View.OnClickListener() {              @Override              public void onClick(View v)              {                  setContentView(R.layout.show_intake);              }          });;      }    }    
<Button      android:id="@+id/goTo"      android:layout_width="168dp"      android:layout_height="77dp"      android:layout_alignParentEnd="true"      android:layout_alignParentBottom="true"      android:layout_marginEnd="16dp"      android:layout_marginBottom="22dp"      android:text="Calculate your intake here" />  

How to soft delete a selected row in a DataGrid View using a button

Posted: 08 May 2022 09:53 AM PDT

So I have a DataGridView called MyMovieDataDrid which is connected to a sql server, and I already have my IsDeleted property, and a delete repository which is shown below, by the way my IsDeleted property automatically shows up as a checkbox so if the checkbox is checked it's true if not it's false

public bool DeleteMovie(Guid id)  {         bool isDeleted = false;         var movie =  _context.Movie.FirstOrDefault(m => m.Id == id);         if (movie != null)         {              movie.IsDeleted = true;              _context.SaveChanges();              isDeleted = true;                  }           return isDeleted;  }  

and here is my Delete button method so when I press it, it runs my logic and soft deletes a row from the DataGridView I've tried multiple solutions like using the selected row event handler to get the selected rows then running the repository method but none have worked so far.

    private void DeleteButton_Click(object sender, EventArgs e)      {          Movie movie = new Movie();                    if(MovieDataGrid)          {            _movieRepo.DeleteMovie(movie.Id);          }      }  

and my all of my properties

    Movie movie = new Movie()      {          Id = Guid.NewGuid(),          IsDeleted = false,          MovieNames = MovieNameBox.Text;             }             

so my question is how do I make my Datagrid know when to run my repository method and I feel like I have to somehow make write some code to where if the IsDeleted property is true it selects the whole row then I run my DeleteMovie Method but no solutions have worked.

Extra white space on page when it is in small device

Posted: 08 May 2022 09:53 AM PDT

Hello I have a question how to delete this white space on the right. Overflow-x: hidden is not a solution because when I use 100% width for the element it takes the width from the white space too which is not what I want.enter image description here. I also checked if elements has margins and it does not.

Why my page is not loading elements when i host it on github

Posted: 08 May 2022 09:53 AM PDT

I just used React frontend for the website I hosted with all procedures correctly and then when I open the link I get only the background color of the enter image description here website. means the website is not loaded fully Pls help me.

Github Repo- https://github.com/Sudhanshu-0907/TodoList-React

Website link- https://sudhanshu-0907.github.io/TodoList-React/ TodoList

Dynamic Input fields

Posted: 08 May 2022 09:53 AM PDT

I want to make input fields dynamic. According to the user-selected option in one dropdown, I have to change to another select option, and also user can add more input fields and delete them. I'm able to change according to users selection but now how I add more fields and delete it dynamically. --- script ----

<script>      $(document).ready(function() {        $("#standardone").change(function() {          $(this).find("option:selected").each(function() {            var optionValue = $(this).attr("value");            if (optionValue == "ss") {              $("#select1").show();              $("#select2").hide();              $("#select3").hide();              $("#select4").hide();              $("#select5").hide();              $("#medium1").show();              $("#board1").show();            }            if (optionValue == "C_1-4" || optionValue == "C_5-8" || optionValue == "C_9" || optionValue == "C_10" || optionValue == "C_9-10" || optionValue == "11-12_C") {              $("#select1").show();              $("#select2").hide();              $("#select3").hide();              $("#select4").hide();              $("#select5").hide();              $("#medium1").show();              $("#board1").show();            }            if (optionValue == "11-12_S") {              $("#select1").hide();              $("#select2").hide();              $("#select3").hide();              $("#select4").show();              $("#select5").hide();              $("#medium1").show();              $("#board1").show();            }            if (optionValue == "IIT-JEE") {              $("#select1").hide();              $("#select2").show();              $("#select3").hide();              $("#select4").hide();              $("#select5").hide();              $("#medium1").show();              $("#board1").show();            }            if (optionValue == "NEET") {              $("#select1").hide();              $("#select2").hide();              $("#select3").show();              $("#select4").hide();              $("#select5").hide();              $("#medium1").show();              $("#board1").show();            }            if (optionValue == "For_lang") {              $("#select1").hide();              $("#select2").hide();              $("#select3").hide();              $("#select4").hide();              $("#medium1").hide();              $("#board1").hide();              $("#select5").show();            }          });        }).change();          });   </script>  

---- body ----

<div class="col-sm-6 mb-3 ">                    <div class="form-group">                      <label for="name_of_business" class="font-weight-bold coac fw-bold">Standard</label>                      <br>                        <select name="std1" class="font-weight-bold" id="standardone">                        <option value="ss">Select Standard</option>                        <option value="C_1-4">Class 1-4</option>                        <option value="C_5-8">Class 5-8</option>                        <option value="C_9">Class 9</option>                        <option value="C_10">Class 10</option>                        <option value="11-12_C">11th-12th Commerce</option>                        <option value="11-12_S">11th-12th Science</option>                        <option value="IIT-JEE">IIT-JEE</option>                        <option value="NEET">NEET</option>                        <option value="For_lang">Foreign Langauges</option>                      </select>                    </div>                  </div>                    <div class="col-sm-6 mb-3">                    <div class="form-group">                      <label class="font-weight-bold fw-bold">Subjects</label>                      <br>                      <select name="sub11" class="font-weight-bold" id="select1">                        <option value="ss">Select Subject</option>                        <option value="all_sub">All Subjects</option>                      </select>                      <select name="sub12" class="font-weight-bold" id="select2">                        <option value="ss">Select Subject</option>                        <option value="all_sub">All Subjects</option>                        <option value="Physics">Physics</option>                        <option value="Chemistry">Chemistry</option>                        <option value="Maths">Maths</option>                      </select>                      <select name="sub13" class="font-weight-bold" id="select3">                        <option value="ss">Select Subject</option>                        <option value="all_sub">All Subjects</option>                        <option value="Physics">Physics</option>                        <option value="Chemistry">Chemistry</option>                        <option value="Biology">Biology</option>                      </select>                      <select name="sub14" class="font-weight-bold" id="select4">                        <option value="ss">Select Subject</option>                        <option value="all_sub">All Subjects</option>                        <option value="Physics">Physics</option>                        <option value="Chemistry">Chemistry</option>                        <option value="Maths">Maths</option>                        <option value="Biology">Biology</option>                      </select>                      <select name="sub15" class="font-weight-bold" id="select5">                        <option value="ss">Select Languge</option>                        <option value="Spoken_English">Spoken English</option>                        <option value="German">German</option>                        <option value="French">French</option>                        <option value="Spanish">Spanish</option>                      </select>                    </div>                  </div>  

How to create a chart using MPAndroidChart and getting data from Realtime Firebase

Posted: 08 May 2022 09:52 AM PDT

am developing an application, where users are able to record and track weight by seeing an chart. I am using Android Studio and coding in Java. The app lets users enter enter weight and the date using date picker dialog. I created a model class that stores the date, time and weight as strings. I had errors when I wanted to store the data as different types. After user enters weight and data and clicks save. The data is saved inside Realtime Firebase. Now in a different activity I want to retrieve these data and show them via a Line chart. I have implemented MPAndroidChart, I know how to retrieve data from the Realtime Firebase by:

reference.addValueEventListener(new ValueEventListener() {              @Override              public void onDataChange(@NonNull DataSnapshot snapshot) {                             }                @Override              public void onCancelled(@NonNull DatabaseError error) {                }          });  

But after this I am stuck on what to do. Can anyone please give me guidance on what to do next

How do I fix py2app and webvoew?

Posted: 08 May 2022 09:52 AM PDT

Im using py2app and webview but when I run the app I get the error ModuleNotFoundError: No module named 'ctypes.macholib' but when I run the file using python3 it works fine any help?

No suitable driver found for jdbc:mysql//localhost:3306/sys [duplicate]

Posted: 08 May 2022 09:53 AM PDT

I have downloaded mysql-connector jar file and added it to module library, added dependency to maven. When I try to import classes from the lib IntelliJ shows that it's possible, but mistake comes up.

code of the method and libs

maven dependency

How to make sure that the bot automatically puts the specified reaction on each message in a specific channel?

Posted: 08 May 2022 09:53 AM PDT

def green_check(reaction, user):          return str(reaction.emoji) == '🟢' and user != bot.user        try:          reaction, user = await bot.wait_for('reaction_add', timeout=3600.0, check=green_check)      except asyncio.TimeoutError:          await concept_msg.delete()          await ctx.author.send("No moderator responded, wait some time and try again.")          return      else:          concept_embed_dict = concept_embed.to_dict()  

3gp file not playing audio in chrome

Posted: 08 May 2022 09:54 AM PDT

I have a 3gp file I'm trying to display and play in chrome browser. It seems to play the video fine but the audio is not playing...When I download the file on my machine the audio and video plays fine..When I open the video in a standalone chrome tab it plays the video but does not play the audio. In the image note how the audio button is greyed out.

html code:

<video src="/media/somefilesentfrommyiphone.3gp" style="max-width:400px;" controls=""></video>  

Note how the audio is not present

note the video and audio seem to play just fine in safari

problem with regex for surnames not allow german names

Posted: 08 May 2022 09:54 AM PDT

can somone help me with surnames regex

i use /^[a-zA-Z-]+$/ for validate my surname input but if a user put a german name with Ü ö or other it comes error and not allow the user put the name.... i want to allow all chars in the world, i only dont want allow numbers and special chars only - and ' and `

thank you i already surch so much but i dont find nothing.

How can I get react to find my Header module?

Posted: 08 May 2022 09:54 AM PDT

In the following segment of code I call the Header module and React automatically adds the import to the Header module.

import Head from 'next/head'  import Header from '../components/Header'    export default function Home() {    return (      <div className={styles.container}>        <Head>          <title>Create Next App</title>          <meta name="description" content="Generated by create next app" />          <link rel="icon" href="/favicon.ico" />        </Head>          <Header/>          <main className={styles.main}>       </main>      </div>    )  }  

But at compile time React tells me it cannot resolve the Header module:

error - ./pages/index.tsx:3:0  Module not found: Can't resolve '../components/Header'   

Header.jsx

import Image from 'next/image'  import { useEffect, useState } from 'react'  import Link from 'next/link'    const Header = () => {      const [isScrolled, setIsScrolled] = useState(false);        useEffect(() => {          const handleScroll = () => {              if(window.scrollY > 0) {                  setIsScrolled(true);              } else {                  setIsScrolled(false);              }          }            window.addEventListener('scroll', handleScroll)            return () => {              window.removeEventListener('scroll', handleScroll)          }      }, [])      return (      <header>Header</header>    )  }    export default Header  

Relative paths of index.jsx and Header.jsx:

\react\netflix-tailwind\components\Header.tsx  \react\netflix-tailwind\pages\index.tsx  

How do I change an image and text by clicking on a button?

Posted: 08 May 2022 09:54 AM PDT

Very new to all of this so might be a simple question but I'd appreciate some advice.

I'm trying to change the image in head to another image when a button is clicked and also change the text in h1.

The first button would revert back to the orignal image so currently trying things out on the second one.

=================================================

<!DOCTYPE html>  <html>      <style>          body {          background-color: rgb(224, 221, 26);          }          .dark-mode {          background-color: rgb(49, 163, 93);          }          </style>  <head>      <img src= "http://www.outgrabe.net/bird00.jpg">  </head>  <body>      <h1>          Pardalote by fir0002 (CC-by-NC)      </h1>      <h2>      <button>Pardalote</button>      <button onclick="myfunction01()">Purple Swamp Hen</button>      <script>          function myfunction01() {              var element = document.head;                        }      </script>      <button>White-headed Stilt</button>      <button>Inland Thornbill</button>      <button>Rose Robin</button>      </h2>            <h3>          <button onclick="myFunction()">Change Theme</button>          <script>          function myFunction() {             var element = document.body;             element.classList.toggle("dark-mode");          }          </script>      </h3>        </body>  </html>  

MongoDB aggregation: concatenation strings in pipeline

Posted: 08 May 2022 09:53 AM PDT

I am new to MongoDB and faced an issue. In my aggregation pipeline I have such data structure:

  {      "_id": 1,      "letter": "b"    },    {      "_id": 2,      "letter": "b"    },    {      "_id": 3,      "letter": "a"    }  ]  

I desire to merge all of these items by letter property in order to have "bba" string in the end(so basically just a concatenation of those letters).

I did try reading about mergeObjects which failed because string is not an object as well as reading about other possible approaches. It just looks like I'm missing something here.

Is there a possibility to return such result and maybe somebody can help me to understand how?

Thanks a lot in advance and have a nice day!

Django debugger does not start by VS Code launch.json

Posted: 08 May 2022 09:55 AM PDT

Until recently my Django projects would debug fine using launch.json file. But it stopped working today and I have no idea about it.

Changes made by me in system were:

  1. Clean-Installing Windows
  2. Installing python in default path just for current user and not all users

Problem Description:

  1. As soon as I click F5 key the debugger starts for some milliseconds and stops automatically without any prompt. As it does not shows any error I tried to log errors by nothing in it. It does not even load terminal to run commands.

The added configuration in launch.json file is as below:

{      "configurations": [          {              "name": "Python: Django",              "type": "python",              "request": "launch",              "program": "${workspaceFolder}\\manage.py",              "args": [                  "runserver"              ],              "django": true,              "justMyCode": true,              "logToFile": true,              "console": "integratedTerminal",              "cwd": "${workspaceFolder}",              "host": "localhost"          }      ]  }  

Can someone help to troubleshoot this, I have already tried:

  1. Creating new projects
  2. Reinstalling Python
  3. Creating new environment
  4. Resetting VS Code Sync Settings
  5. Run other dubug configurations {they are working fine)
  6. Changing django debug configuration

My current options are:

  1. Research more (Already spent a hours would take more)
  2. Wait for solution by someone
  3. Clean Install Windows and all software's (Would be like BhramaAstra)

getting data of certain candles on binance

Posted: 08 May 2022 09:53 AM PDT

I want to get the prices and volume of the candle immediately when this candle closes, as well as get the prices of the previous candle after it

My code

from binance.client import  Client    class CurrentCandle():    def __init__(self, API_KEY, SECRET_KEY, symbol):      self.API_KEY = API_KEY      self.SECRET_KEY = SECRET_KEY      self.symbol = symbol      self.client = Client(self.API_KEY, self.SECRET_KEY)        candle = self.client.get_klines(symbol = self.symbol, interval=Client.KLINE_INTERVAL_5MINUTE)[-2]        # price initialize      self.open_price = candle[1]      self.close_price = candle[4]      self.high_price = candle[2]      self.low_price = candle[3]      self.volume = candle[5]      self.open_time = candle[0]      def get_candle_prices(self):      '''Get current price'''      return {"time": self.open_time, "open_price": self.open_price, "close": self.close_price, "high": self.high_price, "low": self.low_price, "volume": self.volume, "time": self.open_time}  

it seems to me that I got the prices of the candle, in front of her. Please tell me the best way to solve this problem.

Thanks

I looked at the question Python: Get data from Binance when the current candle is finished - and corrected my code

while True:      current_candle = CurrentCandle(API_KEY, SECRET_KEY, crypto_symbol, interval)        current_candle_prices = current_candle.get_candle_prices()      timestamp = current_candle_prices["open time"]        if interval == "1m":          seconds = 60      elif interval == "5m":          seconds = 300      elif interval == "1h":          seconds = 3600      elif interval == "4h":          seconds = 14400      elif interval == "1d":          seconds = 24 * 3600      else:          print("Interval error!")        current_time = time.time()      needed_timestamp = timestamp + seconds      seconds_left = needed_timestamp - current_time  

but the seconds output seconds_left is wrong

1650376751240.106 1650376751239.3013 1650376751238.7021 1650376751238.1284 1650376751237.5493

Discord.py : You can't have duplicate SlashCommand instances

Posted: 08 May 2022 09:53 AM PDT

I copied my bot to another project and didn't change any code, when I startup my bot it shows:

 Traceback (most recent call last):    File "main.py", line 15, in <module>      slash = SlashCommand(bot, sync_commands=True)    File "/home/runner/dcbot-Jiang-Ying/venv/lib/python3.8/site-packages/discord_slash/client.py", line 96, in __init__      raise error.DuplicateSlashClient("You can't have duplicate SlashCommand instances!")  discord_slash.error.DuplicateSlashClient: You can't have duplicate SlashCommand instances!  

and this is my line 15:

bot = commands.Bot(command_prefix='sl')  slash = SlashCommand(bot, sync_commands=True)  

How can I solve this problem?

Fill parent container and reduce image resolution with next/image

Posted: 08 May 2022 09:54 AM PDT

I'm trying to fill a fixed-size container with an image. layout="fill" works like a charm, but even though container is only 125x125, the original image gets downloaded that has a resolution much higher than that and hence weights much more. I'm able to get reduced resolution with layout="fixed", but I lose the "fill" behaviour this way.

Is there a way to take the best of those 2 worlds with next/image - fill parent container, and at the same time reduce the size of files downloaded to client device?

Cannot install spacy in pycharm

Posted: 08 May 2022 09:53 AM PDT

I've tried installing spacy numerous times. At first I was getting an error noting that C++ needed to be upgraded to version 14. Now I'm getting a number of errors below that seem to indicate that there are numerous errors with portions of the install throughout the package.

I've since done that and now I'm getting separate errors. Below is the entire error:

  Using cached spacy-3.3.0.tar.gz (1.1 MB)    Installing build dependencies: started    Installing build dependencies: still running...    Installing build dependencies: finished with status 'error'      error: subprocess-exited-with-error        pip subprocess to install build dependencies did not run successfully.    exit code: 1        [130 lines of output]    Collecting setuptools      Using cached setuptools-62.1.0-py3-none-any.whl (1.1 MB)    Collecting cython<3.0,>=0.25      Using cached Cython-0.29.28-py2.py3-none-any.whl (983 kB)    Collecting cymem<2.1.0,>=2.0.2      Using cached cymem-2.0.6.tar.gz (8.2 kB)      Installing build dependencies: started      Installing build dependencies: finished with status 'done'      Getting requirements to build wheel: started      Getting requirements to build wheel: finished with status 'done'      Installing backend dependencies: started      Installing backend dependencies: finished with status 'done'      Preparing metadata (pyproject.toml): started      Preparing metadata (pyproject.toml): finished with status 'done'    Collecting preshed<3.1.0,>=3.0.2      Using cached preshed-3.0.6.tar.gz (14 kB)      Installing build dependencies: started      Installing build dependencies: still running...      Installing build dependencies: finished with status 'error'      error: subprocess-exited-with-error          pip subprocess to install build dependencies did not run successfully.      exit code: 1          [94 lines of output]      Collecting setuptools        Using cached setuptools-62.1.0-py3-none-any.whl (1.1 MB)      Collecting cython>=0.28        Using cached Cython-0.29.28-py2.py3-none-any.whl (983 kB)      Collecting cymem<2.1.0,>=2.0.2        Using cached cymem-2.0.6.tar.gz (8.2 kB)        Installing build dependencies: started        Installing build dependencies: finished with status 'done'        Getting requirements to build wheel: started        Getting requirements to build wheel: finished with status 'done'        Installing backend dependencies: started        Installing backend dependencies: finished with status 'done'        Preparing metadata (pyproject.toml): started        Preparing metadata (pyproject.toml): finished with status 'done'      Collecting murmurhash<1.1.0,>=0.28.0        Using cached murmurhash-1.0.7.tar.gz (12 kB)        Installing build dependencies: started        Installing build dependencies: finished with status 'done'        Getting requirements to build wheel: started        Getting requirements to build wheel: finished with status 'done'        Installing backend dependencies: started        Installing backend dependencies: finished with status 'done'        Preparing metadata (pyproject.toml): started        Preparing metadata (pyproject.toml): finished with status 'done'      Building wheels for collected packages: cymem, murmurhash        Building wheel for cymem (pyproject.toml): started        Building wheel for cymem (pyproject.toml): finished with status 'error'        error: subprocess-exited-with-error            Building wheel for cymem (pyproject.toml) did not run successfully.        exit code: 1            [19 lines of output]        running bdist_wheel        running build        running build_py        creating build        creating build\lib.win32-cpython-38        creating build\lib.win32-cpython-38\cymem        copying cymem\about.py -> build\lib.win32-cpython-38\cymem        copying cymem\__init__.py -> build\lib.win32-cpython-38\cymem        package init file 'cymem\tests\__init__.py' not found (or not a regular file)        creating build\lib.win32-cpython-38\cymem\tests        copying cymem\tests\test_import.py -> build\lib.win32-cpython-38\cymem\tests        copying cymem\cymem.pyx -> build\lib.win32-cpython-38\cymem        copying cymem\cymem.pxd -> build\lib.win32-cpython-38\cymem        copying cymem\__init__.pxd -> build\lib.win32-cpython-38\cymem        warning: build_py: byte-compiling is disabled, skipping.            running build_ext        building 'cymem.cymem' extension        error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build T: enter code here`https://visualstudio.microsoft.com/visual-cpp-build-tools/        [end of output]            note: This error originates from a subprocess, and is likely not a problem with pip.        ERROR: Failed building wheel for cymem        Building wheel for murmurhash (pyproject.toml): started        Building wheel for murmurhash (pyproject.toml): finished with status 'error'        error: subprocess-exited-with-error            Building wheel for murmurhash (pyproject.toml) did not run successfully.        exit code: 1            [24 lines of output]        running bdist_wheel        running build        running build_py        creating build        creating build\lib.win32-cpython-38        creating build\lib.win32-cpython-38\murmurhash        copying murmurhash\about.py -> build\lib.win32-cpython-38\murmurhash        copying murmurhash\__init__.py -> build\lib.win32-cpython-38\murmurhash        creating build\lib.win32-cpython-38\murmurhash\tests        copying murmurhash\tests\test_against_mmh3.py -> build\lib.win32-cpython-38\murmurhash\tests        copying murmurhash\tests\test_import.py -> build\lib.win32-cpython-38\murmurhash\tests        copying murmurhash\tests\__init__.py -> build\lib.win32-cpython-38\murmurhash\tests        copying murmurhash\mrmr.pyx -> build\lib.win32-cpython-38\murmurhash        copying murmurhash\mrmr.pxd -> build\lib.win32-cpython-38\murmurhash        copying murmurhash\__init__.pxd -> build\lib.win32-cpython-38\murmurhash        creating build\lib.win32-cpython-38\murmurhash\include        creating build\lib.win32-cpython-38\murmurhash\include\murmurhash        copying murmurhash\include\murmurhash\MurmurHash2.h -> build\lib.win32-cpython-38\murmurhash\include\murmurhash        copying murmurhash\include\murmurhash\MurmurHash3.h -> build\lib.win32-cpython-38\murmurhash\include\murmurhash        warning: build_py: byte-compiling is disabled, skipping.            running build_ext        building 'murmurhash.mrmr' extension        error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/        [end of output]            note: This error originates from a subprocess, and is likely not a problem with pip.        ERROR: Failed building wheel for murmurhash      Failed to build cymem murmurhash      ERROR: Could not build wheels for cymem, murmurhash, which is required to install pyproject.toml-based projects      [end of output]          note: This error originates from a subprocess, and is likely not a problem with pip.    error: subprocess-exited-with-error        pip subprocess to install build dependencies did not run successfully.    exit code: 1        See above for output.        note: This error originates from a subprocess, and is likely not a problem with pip.    [end of output]        note: This error originates from a subprocess, and is likely not a problem with pip.  error: subprocess-exited-with-error    pip subprocess to install build dependencies did not run successfully.  exit code: 1    See above for output.    note: This error originates from a subprocess, and is likely not a problem with pip.```  

Classes with property referencing other classes

Posted: 08 May 2022 09:54 AM PDT

I'm creating a library, and one part of it requires a structured model.

Let's say we have sections, and each section can have subsections (categories). All of them fit this model:

class Section:      sec_property = ""    class Category:      sub_property = ""    class General:      sec_property = ""      sub_property = ""  

Now, I want to have multiple sections, and each one should have custom categories, or even other sections, which would reference the specific one. Each category inherits from its section, so it has access to the sec_property of the parent.

This is what I have right now, but I'm facing some issues with it.

class CARS(General):      sec_property = "car"        CAR1 = None    class CAR1(CARS):      sub_property = "car1"    CARS.CAR1 = CAR1  

I want to be able to access CAR1 only through CARS -> CARS.CAR1. The issue right now is, that it acts as a property of the class, not a class itself, meaning the IDE doesn't recognize it properly.

Why I want the inheritance, and General class: I want to be able do anyClass.sub_property, and it should either return the empty string or the property itself. I also want to be able to do anyCategory.sec_property, and it should have the property of the parent class (hence the inheritance).

I want to avoid duplicating data and other bad practices.

The goal

# sections.py    class MOTOR(PARTS):      sub_property = "motor"    class PARTS(General):      sec_property = "parts"        MOTOR = MOTOR      class CAR1(CARS):      sub_property = "car1"    class CARS(General):      sec_property = "car"        CAR1 = CAR1      PARTS = PARTS  

In this example, the CAR1 is an alias to the class itself, not a property, constant or anything. The issue is, that it can't inherit from CARS in this case, which I would very much like to do.

I want to be able to access all categories (sub-sections) from the sections themselves, and be able to access the parent attributes (unless they are overridden, where a section would have another section as reference).

I also don't want to create duplicates (instead of inheriting the attribute sec_property assign it to each category), as that's not really a great practise.

# some other .py    import sections    sections.CARS.CAR1.sec_property  sections.CARS.CAR1.sub_property  sections.CARS.PARTS.MOTOR.sec_property  sections.CARS.PARTS.MOTOR.sub_property  sections.PARTS.MOTOR.sec_property  # etc etc  

I also don't want to be able to access the categories (CAR1, MOTOR) directly, but I've already figured that one out - create __init__.py and include the stuff I want, and don't include the rest.

Specific file in question

https://github.com/Mahrkeenerh/apbi/blob/4d7bce2f297594e8d9a2798833c628bc9cd7c1f3/apbi/models/sections.py

Relying upon circular reference is discouraged and they are prohibited by default in spring boot apolication

Posted: 08 May 2022 09:53 AM PDT

I am getting below error message when I am running my spring boot application.

Description:    The dependencies of some of the beans in the application context form a cycle:    ┌─────┐  |  securityConfiguration (field private com.prity.springbootdemo1.service.UserService com.prity.springbootdemo1.config.SecurityConfiguration.userService)  ↑     ↓  |  userServiceImpl (field private org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder com.prity.springbootdemo1.service.UserServiceImpl.passwordEncoder)  └─────┘      Action:    Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.  

In Oracle Apex, is there a set of hot keys to activate the Run Command?

Posted: 08 May 2022 09:53 AM PDT

In Oracle Apex SQL Workshop, is there a set of hot keys to activate the Run Command? I've researched this online and have not found an answer. It seems laborious to have to type out my query and then have to use my mouse to click on Run, when hot keys can help keep my hands on the keyboard. I'm using a Mac and typically through Firefox. Thank you.

What's the purpose of the LEA instruction?

Posted: 08 May 2022 09:54 AM PDT

For me, it just seems like a funky MOV. What's its purpose and when should I use it?

No comments:

Post a Comment