Sunday, May 22, 2022

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


Is it php or perl?

Posted: 22 May 2022 12:35 AM PDT

I want to integrate an API from a partner, but from the example of the code given I can't figure out if it's php or perl. Because in php it could not work. Thank you in advance for your help.

my $secret    = 'xxxxxxxx';   my $path      = '/api/v1/order';  my $content   = '{"partner_order_id":"xxxxx-xxxxx-xxxx1"}';  my $signature = hmac_sha512_base64( sha256($path.$content), $secret );  

Spring boot starter webflux with TCP server

Posted: 22 May 2022 12:34 AM PDT

By default when importing spring webflux

    <dependency>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-webflux</artifactId>      </dependency>  

a HTTP server is created.

Which bean could I declare or override to use TCP server (https://projectreactor.io/docs/netty/release/api/reactor/netty/tcp/TcpServer.html) instead?

Best Regards

Passing argument to canvas function in reportlab

Posted: 22 May 2022 12:34 AM PDT

I am referencing to the sample code here to create a document with reportlab, particularly the following chunk of code:

"""  examples of reportlab document using  BaseDocTemplate with  2 PageTemplate (one and two columns)    """  import os  from reportlab.platypus import BaseDocTemplate, Frame, Paragraph, NextPageTemplate, PageBreak, PageTemplate  from reportlab.lib.units import inch  from reportlab.lib.styles import getSampleStyleSheet      styles=getSampleStyleSheet()  Elements=[]    doc = BaseDocTemplate('basedoc.pdf',showBoundary=1)    def foot1(canvas,doc):      canvas.saveState()      canvas.setFont('Times-Roman',19)      canvas.drawString(inch, 0.75 * inch, "Page %d" % doc.page)      canvas.restoreState()  def foot2(canvas,doc):      canvas.saveState()      canvas.setFont('Times-Roman',9)      canvas.drawString(inch, 0.75 * inch, "Page %d" % doc.page)      canvas.restoreState()    #normal frame as for SimpleFlowDocument  frameT = Frame(doc.leftMargin, doc.bottomMargin, doc.width, doc.height, id='normal')    #Two Columns  frame1 = Frame(doc.leftMargin, doc.bottomMargin, doc.width/2-6, doc.height, id='col1')  frame2 = Frame(doc.leftMargin+doc.width/2+6, doc.bottomMargin, doc.width/2-6,                 doc.height, id='col2')    Elements.append(Paragraph("Frame one column, "*500,styles['Normal']))  Elements.append(NextPageTemplate('TwoCol'))  Elements.append(PageBreak())  Elements.append(Paragraph("Frame two columns,  "*500,styles['Normal']))  Elements.append(NextPageTemplate('OneCol'))  Elements.append(PageBreak())  Elements.append(Paragraph("Une colonne",styles['Normal']))  doc.addPageTemplates([PageTemplate(id='OneCol',frames=frameT,onPage=foot1),                                              PageTemplate(id='TwoCol',frames=[frame1,frame2],onPage=foot2),                        ])  #start the construction of the pdf  doc.build(Elements)  

In functions foot1 and foot2, I want to pass arguments into to customize the canvas setup. For eg.:

def foot1(canvas,doc, page_width, page_height):      canvas.saveState()      canvas.setPageSize((page_width, page_height))      canvas.setFont('Times-Roman',19)      canvas.drawString(inch, 0.05 * page_width, "Page %d" % doc.page)      canvas.restoreState()  

I then modify the last few lines as following:

...    from reportlab.lib.pagesizes import letter  pW, pH = letter  pW, pH = pH,pW #basically switch to landscape size  doc.addPageTemplates([PageTemplate(id='OneCol',frames=frameT,onPage=foot1(pW,pH),                                              PageTemplate(id='TwoCol',frames=[frame1,frame2],onPage=foot2),                        ])    

This gives me the following error:

TypeError: foot1() missing 2 required positional arguments: 'page_width' and 'page_height'    If someone could help explain how this ```addPageTemplates``` calls the ```foot1``` function and how to pass additional arguments besides ```canvas``` and ```doc```? The ```report_lab``` user guide [here](https://www.reportlab.com/docs/reportlab-userguide.pdf) does not have detailed source on this.      

Actions must be plain objects. Use custom middleware for async actions. by using middleware

Posted: 22 May 2022 12:34 AM PDT

this is the store.js file

import { Provider } from 'react-redux'  import thunk from 'redux-thunk'    import rootReducers from './reducers/index'    import { composeWithDevTools } from 'redux-devtools-extension'    const store = createStore(      rootReducers, composeWithDevTools(applyMiddleware(thunk))             )    const DataProvider = ({children}) => {      return(          <Provider store={store}>              {children}          </Provider>      )  }    export default DataProvider  

this is the app.js file

import {BrowserRouter as Router, Routes, Route} from 'react-router-dom'  import PageRender from './PageRender';  import Home from './pages/home'  import Login from './pages/login'  import Register from './pages/register'    function App() {    return (            <Router>        <input type="checkbox" id= "theme" />      <div className="App">        <div className="main">         <Routes>         <Route exact path="/" element={<Home/>} />         <Route exact path="/" element={<Register/>} />         <Route exact path="/" element={<Login/>} />          <Route exact path="/:page" element={<PageRender/>} />          <Route exact path="/:page/:id" element={<PageRender/>} />          </Routes>        <h1>Hello Client</h1>        </div>            </div>      </Router>          );  }    export default App;  

src/index.js file

import ReactDOMClient from 'react-dom/client';  import './index.css'    import App from './App';  import reportWebVitals from './reportWebVitals';  import DataProvider from './redux/store';        const root = ReactDOMClient.createRoot( document.getElementById('root'))    root.render(    <React.StrictMode>           <DataProvider store={'./redux/store'}>        <App />        </DataProvider>    </React.StrictMode>,     );      reportWebVitals();  

login.js file

import { Link } from 'react-router-dom'  import { login } from '../redux/actions/authAction'  import { useDispatch } from 'react-redux'    const Login = () => {      const initialState = { email: '', password: '' }      const [userData, setUserData] = useState(initialState)  const { email, password } = userData    const dispatch = useDispatch()      const handleChangeInput = e => {      const {name, value} = e.target      setUserData({...userData, [name]: value})  }    const handleSubmit = e => {      e.preventDefault()      dispatch(login(userData))  }        return (          <div className="auth_path">  <form onSubmit={handleSubmit}>      <h3 className='text-uppercase'>MediaGen</h3>    <div className="form-group">      <label htmlFor="exampleInputEmail1">Email address</label>      <input type="email" className="form-control" id="exampleInputEmail1"       aria-describedby="emailHelp" onChange={handleChangeInput} value={email} name="email"/>      <small id="emailHelp" className="form-text text-muted">We'll never share your email with anyone else.</small>    </div>    <div className="form-group">      <label htmlFor="exampleInputPassword1">Password</label>      <input type="password" className="form-control" id="exampleInputPassword1"       onChange={handleChangeInput} value={password} name="password"/>    </div>        <button type="submit" className="btn btn-dark w-100"    disabled={email && password ? false : true}>        Login        </button>        <p className="my-2">                      You don't have an account? <Link to="/register" style={{color: "crimson"}}>Register Now</Link>                  </p>  </form>          </div>      )  }    export default Login    

I am trying to make a social media app. But it says "Actions must be plain objects. Use custom middleware for async actions." This is the error There is a problem with this. Please help me to find out. I cannot understand what is the problem here. please help me. I am a beginner. it says to use middleware

Can anyone help me with a 'compile error' in React.js?

Posted: 22 May 2022 12:34 AM PDT

Good day. Can anyone help me with 'compile error'? I would like to load API data into the component and then import it into App.js I don't know how to solve this error :( I don't know where the problem is.

  1. app.js
  2. react component
  3. error message

DSP FFT Function causes USART Error on STM32H750

Posted: 22 May 2022 12:34 AM PDT

huart1.gState value was changed to 0xBA53340 after the arm_cfft_f32,and if i makes it to be ready,the HAL_UART_Transmit_DMA will return HAL_Error while the pData and Size isn't 0.enter image description here

Spring app connects to in-memory H2 db instead of file based

Posted: 22 May 2022 12:34 AM PDT

I am trying to create a local database in disk and connect to it. This is how I set up the application.properties.file

spring.jpa.hibernate.ddl-auto = none  spring.datasource.url:jdbc:h2:file:~/test  spring.datasource.driverClassName:org.h2.Driver  spring.datasource.username:sa  spring.datasource.password:  spring.jpa.show-sql=true  spring.h2.console.path=/h2-console  spring.h2.console.enabled=true  spring.flyway.url:jdbc:h2:file:~/test  spring.flyway.user:sa  spring.flyway.password:  spring.jpa.database-platform=org.hibernate.dialect.H2Dialect  spring.flyway.locations=filesystem:./src/main/resources/db/migration  

Spring log looks like this:

2022-05-22 13:21:34.094  INFO 46252 --- [           main] com.zhandos.SOLIDBankApp.Main            : No active profile set, falling back to 1 default profile: "default"  2022-05-22 13:21:34.408  INFO 46252 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.  2022-05-22 13:21:34.416  INFO 46252 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5 ms. Found 0 JPA repository interfaces.  2022-05-22 13:21:34.651  INFO 46252 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)  2022-05-22 13:21:34.655  INFO 46252 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]  2022-05-22 13:21:34.655  INFO 46252 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/10.0.18]  2022-05-22 13:21:34.706  INFO 46252 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext  2022-05-22 13:21:34.708  INFO 46252 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 586 ms  2022-05-22 13:21:34.775  INFO 46252 --- [           main] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 8.5.11 by Redgate  2022-05-22 13:21:34.775  INFO 46252 --- [           main] o.f.c.internal.license.VersionPrinter    : See what's new here: https://flywaydb.org/documentation/learnmore/releaseNotes#8.5.11  2022-05-22 13:21:34.775  INFO 46252 --- [           main] o.f.c.internal.license.VersionPrinter    :   2022-05-22 13:21:34.780  INFO 46252 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...  2022-05-22 13:21:34.831  INFO 46252 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:d2716439-cb1c-4995-bb7a-1e672e3d7a42 user=SA  2022-05-22 13:21:34.832  INFO 46252 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.  2022-05-22 13:21:34.838  INFO 46252 --- [           main] o.f.c.i.database.base.BaseDatabaseType   : Database: jdbc:h2:mem:d2716439-cb1c-4995-bb7a-1e672e3d7a42 (H2 2.1)  2022-05-22 13:21:34.869  INFO 46252 --- [           main] o.f.core.internal.command.DbValidate     : Successfully validated 2 migrations (execution time 00:00.007s)  2022-05-22 13:21:34.872  INFO 46252 --- [           main] o.f.c.i.s.JdbcTableSchemaHistory         : Creating Schema History table "PUBLIC"."flyway_schema_history" ...  2022-05-22 13:21:34.895  INFO 46252 --- [           main] o.f.core.internal.command.DbMigrate      : Current version of schema "PUBLIC": << Empty Schema >>  2022-05-22 13:21:34.898  INFO 46252 --- [           main] o.f.core.internal.command.DbMigrate      : Migrating schema "PUBLIC" to version "1.1 - Add transaction table"  2022-05-22 13:21:34.904  INFO 46252 --- [           main] o.f.core.internal.command.DbMigrate      : Migrating schema "PUBLIC" to version "1.2 - Add account table"  2022-05-22 13:21:34.908  INFO 46252 --- [           main] o.f.core.internal.command.DbMigrate      : Successfully applied 2 migrations to schema "PUBLIC", now at version v1.2 (execution time 00:00.015s)  2022-05-22 13:21:34.969  INFO 46252 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]  2022-05-22 13:21:34.985  INFO 46252 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.7.Final  2022-05-22 13:21:35.031  INFO 46252 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}  2022-05-22 13:21:35.066  INFO 46252 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect  2022-05-22 13:21:35.126  INFO 46252 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]  2022-05-22 13:21:35.132  INFO 46252 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'  2022-05-22 13:21:35.169  WARN 46252 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning  2022-05-22 13:21:35.330  INFO 46252 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''  2022-05-22 13:21:35.337  INFO 46252 --- [           main] com.zhandos.SOLIDBankApp.Main            : Started Main in 1.434 seconds (JVM running for 1.771)   

However, I do not want the database to be in-memory. I tried all the suggestions to similar questions over the web, tried different combinations in application.properties but the efforts were futile. It seems like the in-memory (mem) database is set as default and cannot be changed

Is there a way to shorten nested for loops?

Posted: 22 May 2022 12:33 AM PDT

I have this:

for mesh in meshes:      for primitive in mesh.primitives:          print(accessors[primitive.attributes.POSITION])    

Are there any ways to shorten this? I'm trying to make my code more compact and reduce the number of lines. I'm just wondering if there's a way to make this shorter.

Can't find the system library folder, Maven dependencies folder and other system folder in Project explrorer panel

Posted: 22 May 2022 12:33 AM PDT

I've created a maven project and can start the project using tomcat server. But I can't see the necessary system folders to change or edit in the project explorer panel. I can see only the source folder Suppose I want to add mysql connector in maven dependencies but I can't find the folder.

Invalid argument while writing a file

Posted: 22 May 2022 12:33 AM PDT

This code works :

f = open('Report\\StatusReport.csv', 'w', newline='')  

I need to add timestamp to the filename, something similar to :

time_stamp = time.strftime("%d-%m-%y_%H:%M:%S")  f = open(f'Report\\StatusReport_{time_stamp}.csv', 'w', newline='')  

which gives the error :

OSError: [Errno 22] Invalid argument:  

فى مشكلة أثناء run servlet in netbeans 8.2

Posted: 22 May 2022 12:32 AM PDT

انا لسه فى بداية تعلمى ل servlet وما بعدت لما سطبت tomcat server وعملت new web project and new->servlet ثم عملت run file ظهرت ليه الرسالة التالية The module has not been deployed. See the server log for details.

What is this format in javascript or typescript?

Posted: 22 May 2022 12:32 AM PDT

What is this format in javascript or typescript? I couldn't find any info.

  1. export type XXX<> = | true (= |)

  2. $ReadOnly (meanings)

  3. <{| ... |}>

export type AttributeType<T, V> =    | true    | $ReadOnly<{|        diff?: (arg1: T, arg2: T) => boolean,        process?: (arg1: V) => T,      |}>;  

OOP classes and variables python turtle graphics?

Posted: 22 May 2022 12:32 AM PDT

We're trying to make the turtle color be coral and came across this.

from turtle import Turtle, Screen    # case 1: assign variable  foo = Turtle()  foo.shape("turtle")  foo.color("coral")  Screen().exitonclick()    # case 2: use it w/o assign  Turtle().shape("turtle")  Turtle().color("coral")  Screen().exitonclick()    # case 3: methods directly in the module  from turtle import *    shape("turtle")  color("coral")  exitonclick()    

case 1 = case 3

case 2

In case 2 the color() method only fills part of the turtle.

In a more general scope,

class Object():        def __init__(self):          print("object created")        def introduce(self):          print("I am an object")        def sleep(self):          print("I am sleeping")      # case 1  foo = Object()  foo.introduce()    # case 2  Object().introduce()  

Here, case 1 & 2 are the same.

Trying to make a button put a random alert using javascript and html, i am really new to programming

Posted: 22 May 2022 12:32 AM PDT

I am new to programming and i cant figure out how to make an alert with a random answer out of a preset list, does anyone know how using javascript and html.

SQL query for inventory management

Posted: 22 May 2022 12:34 AM PDT

Hope I can explain the problem I'm having trouble with.

I have to write a stepwise methodology using pseudocode/SQL query to auto generate a list of products/items with low stock/expiry from the inventory database.The list must be updated at 12 a.m. daily.

I tried this

select products   from inventory   where stocks < required_stock.  

Thanks in advance.

how to uninstall autoprefixer@10.4.7 --save-exact and download autoprefixer@10.4.5--save-exact

Posted: 22 May 2022 12:33 AM PDT

I'm trying to uninstall/remove autoprefixer@10.4.7 and download autoprefixer@10.4.5 instead but I keep getting this error message on my vscode terminal, any tips.

npm ERR! code EOVERRIDE  npm ERR! Override for autoprefixer@10.4.7 conflicts with direct dependency  

Get the selected checkbox names from Child to Parent React

Posted: 22 May 2022 12:35 AM PDT

I have a function that collects the selected names of the checkboxes. Now I need to pass the names to the parent component to use in future functions. Following is my code. the parent is a class component & child is a functional component.

Parent

<SandLite />  

Child

const handleOnChange = (e) => {          let isChecked = e.target.checked;          seats.push(e.target.name)          if(isChecked){              alert(seats);          }else{              seats = seats.filter((name) => e.target.name !== name);              alert("removed",e.target.name)          }      console.log(seats)  }  

now I want to pass the seats array to my parent called

How to group 'N' no of elements in an array in Scala

Posted: 22 May 2022 12:32 AM PDT

Array[String] = Array(28,Female,Hubert Oliveras,DB,02984,59,Annika Hoffman_Naoma Fritts@OOP.com, 29,Female,Toshiko Hillyard,Cloud,12899,62,Margene Moores_Marylee Capasso@DB.com) --> Given array

Array(Array(28,Female,Hubert Oliveras,DB,02984,59,Annika Hoffman_Naoma Fritts@OOP.com), Array(29,Female,Toshiko Hillyard,Cloud,12899,62,Margene Moores_Marylee Capasso@DB.com) --> Needed result.

val text=textFile.grouped(7).toArray ---> code

value grouped is not a member of org.apache.spark.sql.Dataset[String] -->Error

Can anyone find the solution for this?

disable save password popup in python selenium

Posted: 22 May 2022 12:32 AM PDT

here is my code

def __init__(self,username,password):      self.options = webdriver.ChromeOptions()      self.options.add_argument("--no-sandbox")      self.options.page_load_strategy = 'eager'      self.options.add_experimental_option("excludeSwitches", ['enable-automation'])      self.options.add_argument("--disable-blink-features=AutomationControlled")      #self.options.add_argument('--headless')      self.options.add_argument('--disable-gpu')      self.options.add_argument('window-size=1280,720')          #lchrome = webdriver.Chrome(driver,options=options)          #lchrome.minimize_window()            #un = username          #up = password      time.sleep(3)      self.lchrome = webdriver.Chrome(driver,options=self.options,)  

how do i disable the annoying save password popup? please help. thank you

Clocking block input signal can not be driven

Posted: 22 May 2022 12:32 AM PDT

Clocking block input signal 'data_rvalid_i' can not be driven.

CB_CODE:

  default clocking response_driver_cb @(posedge clk);            input   reset;                     output  data_req_o;      input   data_gnt_i;      output  data_addr_o;      output  data_we_o;      output  data_be_o;      input   data_rvalid_i;      output  data_wdata_o;      input   data_rdata_i;      input   data_err_i;        endclocking  

Driver Patch Code:

  task reset_signals();        `DRIVER_IF.data_rvalid_i  <= 1'b0;      `DRIVER_IF.data_gnt_i     <= 1'b0;      `DRIVER_IF.data_rdata_i   <= 'b0;      `DRIVER_IF.data_err_i     <= 1'b0;    endtask : reset_signals  

Is there a python equivalent to Stata’s statsby command?

Posted: 22 May 2022 12:33 AM PDT

For example,

statsby e(r2) saving(results, replace): reg a b

Looking for ideas to substitute Stata's statsby command. It is really useful but cannot seem to figure out a python equivalent.

Regualr expression for google Sheet Find and Replace

Posted: 22 May 2022 12:33 AM PDT

I have some rows in some columns contains something like

  • #Invalid Ref: 234566
  • #Invalid Ref: 123445
  • #Invalid Ref: 235678

I am trying to use find and replace by regular expression to find any row that contains any of the above and replace it with empty

what is the best regular expression I can use?

Rails passing integer value from view to controller

Posted: 22 May 2022 12:32 AM PDT

I have to add a view where user will enter a number and we will respond according to that number. Here I am asking a number from user and if he submit it we will generate number of paragraph for that.

How to write controller method, html and routes for it.

Application Controller

class ApplicationController < ActionController::Base  private      def baconipsum          @baconipsum ||= Faraday.new("https://baconipsum.com/") do |f|            f.response :json          end        end  end  

Articles Controller.rb

def showData      @value = params[:value]   @bacon = baconipsum.get("api/", type: 'all-meat',paras: @value).body    end  

_formData.html.erb

<%= form_for:article do %>      <label for="value">Value</label>      <%= text_field_tag :value %>      <%= submit_tag "Submit" %>  <% end %>  

showData.html.erb

<% @bacon.each do |meat| %>    <p>       <%= meat %>    </p>  <% end %>  

Wait for NgOnInit to complete inside ngAfterViewInit

Posted: 22 May 2022 12:35 AM PDT

I am loading some data in ngOnInit that I need to access inside of ngAfterViewInit. Specifically, Google Maps API, where I'm loading GPS coordinates from the database, then I need to add them to the map upon creation. I'm creating the map itself in ngAfterViewInit.

I guess I could move the whole thing to AfterViewInit, but I thought I'd ask if there's a good way to wait for ngOnInit to finish before using the data in AfterViewInit, in case I need it in the future for other projects.

ngOnInit() {    this.loadGpsCoordinates();  }    ngAfterViewInit() {      var elem = document.getElementById('map');      if (elem != null) {      this.map = new google.maps.Map(elem, {        center: { lat: -32.3881373, lng: 55.4343223 },        zoom: 17,        disableDefaultUI: true      });        // Now loop through GPSCoordinates to add Markers      // But wait! What if the coords aren't loaded yet?!      ...  }  

Pyplot 3d, customize colors

Posted: 22 May 2022 12:35 AM PDT

I'm plotting the spread using pyplot:

fig = plt.figure(figsize = (12, 12))  ax = fig.add_subplot(projection = '3d')    x = dataframe.AGE # X  y = dataframe.BMI # Y  z = dataframe.BP # Z    ax.scatter(x, y, z)    ax.set_xlabel("AGE")  ax.set_ylabel("BMI")  ax.set_zlabel("Bermuda plan (BP)")    plt.show()  

How can I specify the color for these parameters? So x is red, y is blue, z is green

MudTextField sends HTTP request at every keystroke

Posted: 22 May 2022 12:35 AM PDT

I use MudTextField for a login form. Whenever a user types something into the text field the application sends the current state to the server.

Example:

<MudTextField Label="Username" Class="mt-3" @bind-Value="user.username" />  

It should only send the state when a user klicks on the login button.

Any ideas on how to disable it?

Thank you.

EDIT: Added more information for clarification.

This only happens when using a MudTextField component. Using a custom component with a HTML input field and vanilla razor two-way binding will not display the same behavior.

E.g:

<div class="form-floating mb-1">      <input type="text" class="form-control" id="username" @bind="@user.username" placeholder="name@example.com">      <label for="username">Username</label>  </div>  

Pic related is the output from the network panel with long-polling enabled as a transport mechanism

After browsing the MudBlazor website for information it seems that the Immidiate attribute would be the right option for it but I can't make it work.

Create a large table with ordertypes as column or using separate tables [closed]

Posted: 22 May 2022 12:34 AM PDT

Background

I work at a distribution center from which we deliver goods to about 150 stores on a daily basis. Each store places two orders (each order has different storing conditions) a day with a quantity varying from 500 to 3500 products. All stores have fixed delivery times with a margin of one hour.

I started creating a production forecasting and control tool in MS Access which will be used to create a forecast per working hour for order picking, so the warehouse manager can distribute his employees over the day to have each order ready in time for transport.

The database should hold up to 6 weeks of history per store per storage condition per day from which I can calculate a forecast. Besides that every day the store gets an order advisory which is used as an starting point for the store when placing the order. I also want to store these advisory, so I can use this to update my forecasting method. After that the store confirms the order and we start to work.

I have a table with all the delivery times for each store and from there a calculated time when the order should be ready on dock. Besides that I've a table with productivities per storage condition. With the combination of these two tables and the forecast I should be able to calculate how late an order should be released for production and what production capacity (= employees) should be available at what hour of the day.

Question

What is the best way of arranging these different types of orders?

I'm looking at three different scenarios, where I'm thinking of using the first one:

Scenario 1: One table
Week WeekDay StoreID StorageCondition Ordertype SumOfProducts
20 1 101 No Condition Forecast 1400
20 1 101 Max. 7 degrees Forecast 1200
20 1 101 No Condition Advice 1100
20 1 101 Max. 7 degrees Advice 1300
20 1 101 No Condition Order 1250
20 1 101 Max. 7 degrees Order 1150

This table would contain 6 weeks of 7 days for 150 stores with 6 records a day = 38K records. With this structure I can only add and delete records and don't have to update records.

Scenario 2: One table with different columns
Week WeekDay StoreID StorageCondition ForecastSOP AdviceSOP OrderSOP
20 1 101 No Condition 1400 1100 1250
20 1 101 Max. 7 degrees 1200 1300 1150

This table would only contain 12K records, but besides adding and deleting I should also be updating records.

Scenario 3: Three tables

tblOrderForecast

Week WeekDay StoreID StorageCondition SumOfProducts
20 1 101 No Condition 1400
20 1 101 Max. 7 degrees 1200

tblOrderAdvice

Week WeekDay StoreID StorageCondition SumOfProducts
20 1 101 No Condition 1100
20 1 101 Max. 7 degrees 1300

tblOrderRealization

Week WeekDay StoreID StorageCondition SumOfProducts
20 1 101 No Condition 1250
20 1 101 Max. 7 degrees 1150

With this scenario I would have three tables with 12K records, but I'm able to only add and delete records.

Can't able to perform two actions in a javascript on select box

Posted: 22 May 2022 12:32 AM PDT

Can't able to perform two actions (i.e,I need to disable and need to unselect the selected option from the select)

  1. I have two select boxes i.e, select_one box is ('1','2','3') & select_two box is ('please select', 'test1', 'test2','test3'...etc)
  2. and i have written onchange on the select_one box
  3. when i selected option 1 or 3 from select_box dropdown then i need to unselect the current value from select_two box and need to display the 'please select' option and also i need to disable the select_two box.

const checkFun = ( value ) => {                              if( value == '1' || value == '3' )                              {                                  document.getElementById("select_two").disabled = true;                                  document.getElementById("select_two").options[0].selected = "selected";                              } else                              {                                  document.getElementById("select_two").disabled= false                              }                              }
 Select One: <select name="testOne" id="select_one" onchange="checkFun( this.value )"><option value="1">1</option><option value="2">2</option><option value="3">3</option></select>     Select Two: <select name="testTwo" id="select_two"><option value=""> - please select - </option><option value="test1">test1</option><option value="test2">test2</option><option value="test3">test3</option></select>      

Thanks, KK

Android Studio: “Execution failed for task ':app:mergeDebugResources'” if project is created on drive C:

Posted: 22 May 2022 12:33 AM PDT

I added Google Play services as a dependency in my current project. If I save the project on the C: drive, I get the following error while syncing up the project:

Error: Execution failed for task ':app:mergeDebugResources'.         > Error: Failed to run command:         C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4.2\aapt.exe s -i C:\Users\ashokp\Desktop\Studio\AndroidV2SDK_AndroidStudioFormat\Google Play         Services\SampleApplication\AndroidV2SDKSampleApp_GooglePlayServices\app\build\exploded-aar\com.google.android.gms\play-services\4.3.23\res\drawable-hdpi\common_signin_btn_text_focus_light.9.png -o         C:\Users\ashokp\Desktop\Studio\AndroidV2SDK_AndroidStudioFormat\Google Play         Services\SampleApplication\AndroidV2SDKSampleApp_GooglePlayServices\app\build\res\all\debug\drawable-hdpi\common_signin_btn_text_focus_light.9.png         Error Code:         42  

This only happens if the project is saved on the C: drive. If I save it to some other drive, it works perfectly.

Does anyone else face this issue? What causes this? How can I fix/circumvent this?

enter image description here

Merge PDF files

Posted: 22 May 2022 12:32 AM PDT

Is it possible, using Python, to merge separate PDF files?

Assuming so, I need to extend this a little further. I am hoping to loop through folders in a directory and repeat this procedure.

And I may be pushing my luck, but is it possible to exclude a page that is contained in each of the PDFs (my report generation always creates an extra blank page).

No comments:

Post a Comment