Monday, June 21, 2021

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


Getting intersection in a grouped dataset in pandas

Posted: 21 Jun 2021 07:54 AM PDT

So I have a pandas dataframe which has two columns. The first one is key and the other one is called value whose datatype is set. What i want to do is get groupby the key and get an intersection (set operation) of the value column.

looking for some operation akin to

df.groupby("key")["values"].agg("intersection")

Events on Slot for Components in Svelte

Posted: 21 Jun 2021 07:54 AM PDT

I make a Wrapper Component with Edit Cancel and Update buttons and a slot for an input to be updated.

I'm looking for a clean way to enable the update button on the Wrapper only when the internal edit field has been changed and to save the value then as well.

It's a bit hard to explain so I created a REPL

https://svelte.dev/repl/ad9dc5954f60487d9a9e01f81a1bccc7?version=3.38.2

Trying to read data with excel pandas... and getting a consistent error across multiple files

Posted: 21 Jun 2021 07:54 AM PDT

Here is my test code, that gives my error:

import pandas    file = 'KBART EDINA.xlsx'  data = list()    with open(file, 'r') as xl_file:      df = pandas.read_excel(xl_file)  

When I run it, I get the following error:

❯ python hack.py  Traceback (most recent call last):    File "hack.py", line 11, in <module>      df = pandas.read_excel(xl_file)    File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/util/_decorators.py", line 299, in wrapper      return func(*args, **kwargs)    File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 336, in read_excel      io = ExcelFile(io, storage_options=storage_options, engine=engine)    File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 1072, in __init__      content=path_or_buffer, storage_options=storage_options    File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 954, in inspect_excel_format      buf = stream.read(PEEK_SIZE)    File "/another/obscured/path/miniconda3/lib/python3.7/codecs.py", line 322, in decode      (result, consumed) = self._buffer_decode(data, self.errors, final)  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 16: invalid start byte  

I've tried with 6 different xls, xlsx, and ods files..... and they all return the same error

I have the following (relevant) libraries installed:

openpyxl          3.0.7  pandas            1.2.4  xlrd              2.0.1  

I know the file(s) are readable (I had a if not os.path.isfile(file): print("####") clause to prove that)

.... what am I missing?

Error when running a Shiny app with log in form (shinyauthr package): 'data' must be 2-dimensional (e.g. data frame or matrix)

Posted: 21 Jun 2021 07:54 AM PDT

I have a rather simple Shiny app that consists of a table that reacts to three filters and it works just fine. However, I need it to have at least a mild layer of security, so I added a Login module with the Shinyauthr package adapting my app code to the one posted in https://github.com/PaulC91/shinyauthr.

The problem is that when I run the app the filters appear, but no the table and I get the following error: "'data' must be 2-dimensional (e.g. data frame or matrix)".

I've looked at many posts online but since I'm new to Shiny, I'm still unable to figure out what is wrong with my code. Any help solving this issue would be great!

Here is the code for the app with the login form, I used the nycflights13' flights data as a sample dataframe.

library(nycflights13)   library(DT)  library(shiny)  library(shinythemes)   library(dplyr)   library(shinyjs)    my_data <- flights  my_data$time_hour <- as.Date(substr(my_data$time_hour,1,10), format = "%Y-%m-%d")  mydata <- my_data[,-(1:11)]     # dataframe that holds usernames, passwords and other user data  user_base <- tibble::tibble(      user = c("user1", "user2"),      password = c("pass1", "pass2"),      permissions = c("admin", "standard"),      name = c("User One", "User Two"))      ui <- navbarPage(      title = "Title1",      theme = shinytheme("cosmo"),              tabPanel(title = "Title2",               useShinyjs(),                div(class = "container",                    div(class = "pull-right", shinyauthr::logoutUI(id = "logout")),               shinyauthr::loginUI(id = "login")),               uiOutput(outputId = "row_input"),               DTOutput('table_final')))      server <- function(input, output, session) {        # call the logout module with reactive trigger to hide/show      logout_init <- callModule(          shinyauthr::logout,          id = "logout",          active = reactive(credentials()$user_auth))       # call login module supplying data frame, user and password colsmand reactive trigger      credentials <- callModule(          shinyauthr::login,          id = "login",          data = user_base,          user_col = user,          pwd_col = password,          log_out = reactive(logout_init()))        conditional <- function(condition, success) {          if (condition) success else TRUE}        reactiveDf <- reactive({          mydata %>%          dplyr::filter(                  conditional(input$selector_origin != '', origin == input$selector_origin),                  conditional(input$selector_destiny != '', dest == input$selector_destiny),                   time_hour >= input$dateRange[1] & time_hour <= input$dateRange[2]              )      })     output$table_final <- renderDT({             req(credentials()$user_auth)            reactiveDf()      style = 'bootstrap'      colnames = c(                   'Tail Number',                   'Origin',                   'Destiny',                   'Air Time',                   'Distance',                   'Hour',                   'Minute',                   'Date')                   server = TRUE                   class = 'cell-border stripe'                   filter = "none"                   options = list(                            columnDefs = list(list(className = 'dt-center', targets = 0:8)),                                         lengthMenu = c(5, 10, 15, 30, 50, 100),                                         pageLength = 5,                                         dom = "ltipr")  })        output$row_input <- renderUI({        req(credentials()$user_auth)        fluidRow( column(width = 4,                       selectInput("selector_origin",                                    label = "Origin",                                   choices = c('', sort(unique(unlist(mydata$origin)))),                                   multiple = FALSE)),                 column(width = 4,                       selectInput("selector_destiny",                                  label = "Destiny",                                  choices = c('',sort(unique(unlist(mydata$dest)))),                                  multiple = FALSE,                                   selectize = TRUE)),                column(width= 4,                      dateRangeInput('dateRange',                                      label = 'Fecha',                                      start = as.Date('2020-01-24') ,                                       end = as.Date('2021-06-09'),                                      language = 'es',                                      separator = '-',                                      width = '1500%')))                })   }    shinyApp(ui = ui, server = server)   

How to fix the error --->Property 'name' does not exist on type 'DeepMap'

Posted: 21 Jun 2021 07:54 AM PDT

Below, I show my code that shows the error in name. How can I fix it?

This is the interface I use in my code.

interface ContactInformation{      name: string;      phone: string;      email: string;      address: string;  }       <Form.Group controlId="name">                              <Form.Label>Full Name</Form.Label>                              {errors?.name?.type === "required" && <FormError message={'This field is required.'}/>}                              {errors?.name?.type === "maxLength" &&                              <FormError message={'Name cannot exceed 25 characters.'}/>}                              <Form.Control                                  type="text"                                  {...register(                                      "name",                                      {                                          required: true,                                          maxLength: 25                                      })}/>                          </Form.Group>  

Google Fit REST API steps results doesn't match the App numbers when using multiple Sensors

Posted: 21 Jun 2021 07:54 AM PDT

I'm using Google REST API to get Daily Steps count from Google Fit. The results match, except when the person uses more than one sensor (Ex: The Cellphone and a Smart watch). If a get the steps in the same day, I see results, but one day after, if I do the same request, Google Fit returns less steps tan before.

That's the documentation I've been following: Google Fit - Read the Daily Step Total

Is there any other request that would return me ALL the data from that day? Does anyone face this issue?

Azure Blob Storage SDK v12 - BlobClient DownloadAsync gone?

Posted: 21 Jun 2021 07:54 AM PDT

I have production code that uses the BlobClient.DownloadAsync() method to download a file from Azure Blob Storage using the Azure.Storage.Blobs nuget package v12.8, and it seems to be working just fine. However, I upgraded the nuget package and was about to write some new code to deal with zip files, that also relies on downloading in order to extract the zip...but noticed some changes in the latest APIs of the Storage SDK.

Apart from nearly EVERY sample from Microsoft, as well as from the interwebs, being slightly incorrect since that method wraps the returned BlobDownloadInfo into a Response<T> object - forcing you to do a call to .Value first, they also seem to use the above method to download blob files - BUT I can no longer find that method via Intellisense.

When I looked at the source which takes me to BlobBaseClient.DownloadAsync() method, I see that it is decorated with [EditorBrowsable(EditorBrowsableState.Never)], implying that this API might slowly be taken away via hiding it from devs, but without breaking existing code or marking as Obsolete. But I can't find any articles/issues/docs that point to that for sure. Here's what that looks like:

decompiled BlobBaseClient.DownloadAsync()

With that being said.....what is THE way someone should be downloading files from Azure Blob Storage (block blobs) using the .NET SDK as of v12.9, in an asynchronous fashion, if the goal is to "stream" it down thru an ASP.NET controller action (REST endpoint) to a client like a browser, etc. (NOT save to a local file on server)?

There seems to be several available "download" APIs on the BlobClient, but their docs are somewhat vague or ambiguous and the MS Docs don't seem to clarify any further:

  • DownloadAsync() - marked as not browsable, but de facto way, based on all samples/blogs
  • DownloadStreamingAsync()
  • DownloadContentAsync()
  • DownloadToAsync()
  • OpenReadAsync()

Additionally, if trying to do some other operation that is not downloading to a browser client via a REST API, for example, if you're unzipping a blob file and the extracted files are also going into blob storage, would one be better not downloading but instead opening it via OpenReadAsync()?

How to Exchange Authorization code to get access-code and refresh-token from Android?

Posted: 21 Jun 2021 07:54 AM PDT

I'm using GooglesignInClient in my android app to authenticate users and simultaneously requesting to access Blogger with Scope and Authorization code.

here is the code

 GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)                  .requestEmail()                  .requestServerAuthCode(getString(R.string.web_client_id))                  .requestScopes(new Scope("https://www.googleapis.com/auth/blogger"))                  .build();              mGoogleSignInClient = GoogleSignIn.getClient(this, gso);            signInButton = findViewById(R.id.sign_in_button);          signInButton.setSize(SignInButton.SIZE_STANDARD);          signInButton.setOnClickListener(new View.OnClickListener() {              @Override              public void onClick(View view) {                  Intent signInIntent = mGoogleSignInClient.getSignInIntent();                  startActivityForResult(signInIntent, RC_SIGN_IN);              }          });  

After the user successfully signed in, I'm getting an Authorization code

 GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(getApplicationContext());   String auth_code = acct.getServerAuthCode(); // it gives code like 4/0Ay0e-g5p.....  

Still now there is no problem. But now how can I use this Authorization code to exchange for access-token and refresh-token?

I had seen some Stackoverflow code and did this.

String TOKEN_URL = "http://www.googleapis.com/oauth2/v4/token";      OkHttpClient client = new OkHttpClient();              RequestBody requestBody = new FormEncodingBuilder()                      .add("grant_type", "authorization_code")                      .add("client_id", String.valueOf(R.string.web_client_id))                      .add("client_secret", "[my client serect code]")                      .add("code",auth_code)                        .add("redirect_uri","")      //which uri should I give here since it is an android app?                      .add("id_token",idToken)                      .build();              Log.e(TAG, "requestbody is setted");                    final com.squareup.okhttp.Request  request = new com.squareup.okhttp.Request .Builder().header("content-type","application/x-www-from-urlencoded").url(TOKEN_URL).post(requestBody).build();              client.newCall(request).enqueue(new Callback() {                  @Override                  public void onFailure(Request request, IOException e) {                      Log.e(TAG, "onFailure: " + e.toString());                  }                        @Override                  public void onResponse(Response response) throws IOException {                      Log.e(TAG, "onResponse: " + response.toString());                  }              });   

when I run this app I'm getting a 403 error. This is my error log

Response{protocol=http/1.1, code=403, message=Forbidden, url=http://www.googleapis.com/oauth2/v4/token}  

Here I'm using webserver type OAuth 2.0 Client ID since I need a client-secret, but also created OAuth 2.0 Client ID for android and given package name and SHA-1 key. Now my doubt is

  1. How can I get refresh token and access token from android?
  2. Since it is an android app which redirect_uri should I give if needed?
  3. Is there any library for android to achieve this solution?

Please help me someone... Thanks in advance.

Connection with salesforce is slow from Talend

Posted: 21 Jun 2021 07:53 AM PDT

I am using the tSalesforceOutputBulkExec component in Talend to push records to salesforce. It is taking too much time to send 10 records to salesforce (more than 50 seconds). I tried the same thing with the data loader but couldn't see any issue there.

Parallel Execution of testcases not working with pytest-html-reporter reporting

Posted: 21 Jun 2021 07:53 AM PDT

This is my simple command to run few testcases using pytest: py.test -S www -m "now" -n=5 --html-report=./report/RegressionReport.html --self-contained-html

Here, --html-report is command line argument for a plugin pytest-html-reporter

After I have started to use this plugin for beautifying my basic pytest report, my parallel execution seems to work fine but the output.json in such case only shows result for the last instance and the report also shows incomplete data of only the last instance of the parallel execution.

Earlier, with pytest-html plugin and --html command line argument, parallel execution was working fine.

Any suggestions?? Thanks in advance.

JSF f:websocket throws NPE when it's located in ui:composition or in ui:include respectively

Posted: 21 Jun 2021 07:53 AM PDT

I have noticed a strange behaviour in my JSF-application that I just don't understand.

I am developing a web application with mojarra 2.3.15 and the latest release of tomcat (V9.0.48). What I am trying to do is using websockets to send certain push messages to the client. The important factor here is, that the project I am working on is a Single-Page-Application. That means, that I have one "master" xhtml-file and all other xhtml-Files can be included in it, depending on where the user navigates. For that I obviously use ui:include and ui:composition. The master page is then updated via ajax on every navigation-event.

The problem is, that whenever I try to put a websocket-tag inside a "child" xhtml, I navigate to the page and try leaving that page again by clicking on another link in my navbar, A NullpointerException is thrown. As an annoying side-effect, I need to click the nav-link twice to get to another page again.

Unfortunately, I can't put the websocket in the master xhtml due to architectural reasons.

Here is the stacktrace (And yes, it is really that short):

java.lang.NullPointerException  at com.sun.faces.push.WebsocketFacesListener.processEvent(WebsocketFacesListener.java:100)  at javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)  at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:110)  at com.sun.faces.application.applicationimpl.Events.processListenersAccountingForAdds(Events.java:295)  at com.sun.faces.application.applicationimpl.Events.invokeViewListenersFor(Events.java:210)  at com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:109)  at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)  at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:119)  at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:776)  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:89)  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)  at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at de.bsdwest.basweb.core.common.UTFFilter.doFilter(UTFFilter.java:31)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)  at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  at java.base/java.lang.Thread.run(Thread.java:834)  

I tried to keep the implementation as simple as possible. It looks like this:

xhtml:

<f:websocket channel="test"></f:websocket>  

Java CDI Bean:

@Named(value = "beispiel")  @SessionScoped  public class BeispielMB implements Serializable  {      @Inject      @Push(channel = "test")      private PushContext pushChannel;      ...  

Just to simplfiy things a little bit, here is a summary of the problem:

  1. I put the websocket inside a xhtml file, which is being included into another "master" xhtml file. Loading of the included page happens via ajax.
  2. I navigate to the page where I put the <f:websocket> tag using the navbar. Everything seems fine so far.
  3. I try to navigate to another page by clicking on a link in my navbar. Said page won't load. However, it will load after clicking the same link a second time. Or if I press any other navlink as the second time, it will load the correct page of that specific navlink too.

I also checked the ajax call in chrome developer console. In the first AJAX-call, the preview and response section is completely empty. Second call looks fine.

Is anyone able to provide a hint in the right direction? I'll appreciate every suggestion.

Kind thanks for your time.

Is there to be a successor to the books "The Java EE 7 Tutorial : Volume 1 and The Java EE 7 Tutorial :Volume 2". For Jakarta EE 8/9?

Posted: 21 Jun 2021 07:53 AM PDT

The excellent looking texts "Java EE 7 Tutorial, The: Volume 1" and "Java EE 7 Tutorial, The: Volume 2" have been available covering Java EE 7.

I have not found an existing successor, or any news of such a publication. Thus I was wondering whether anyone knew of an expected upcoming release of a successor for Jakarta 8/ Jakarta 9?

How to concatenate a href in a go html template

Posted: 21 Jun 2021 07:53 AM PDT

I'd really appreciate if somebody could help me out with this. I've been going through similar questions asked but none seem to help with my problem.

I have a User table in a go template. In the right most column I have two buttons to update and delete a user. I want these buttons to point to a url that will update and delete that specific user. So I need to have the user id in the url.

This is the code:

<table class="table table-striped">      <thead>        <tr>          <th>Id</th>          <th>Name</th>          <th>Date Of Birth</th>          <th>County</th>          <th>Books</th>          <th>Perform Action</th>        </tr>      </thead>      <tbody>        {{ range .Users}}        <tr>            <td>{{ .Id }}</td>            <td>{{ .Name }}</td>            <td>{{ .DateOfBirth }}</td>            <td>{{ .County }}</td>            <td>              {{if .Books}}                {{ range $id, $book := .Books }}                  <li>{{ $book.Title }}</li>                {{ end }}              {{else}}              No Books              {{end}}            </td>            {{ $updateUrl := "http://localhost:8080/library/updateuser/" + .Id }}            <td><a href="http://localhost:8080/library/deleteuser/"+{{ .Id }} class="btn btn-outline-dark ml-3">Update User</a><a href="http://localhost:8080/library/deleteuser/"+{{ .Id }} class="btn btn-outline-dark ml-3">Delete User</a></td>        </tr>        {{ end}}      </tbody>    </table>  

In the 5th line up from the bottom you'll see my incorrect attempt at concatenating the href with the id.

Expression expected exception with Unity Framework

Posted: 21 Jun 2021 07:54 AM PDT

I am attempting to use Unity Framework for dependency injection. When mapping from the interface to the concrete class Unity displays the "BC30201: Expression expected" message in the MappedTo property of the container. I have spent hours searching Google/Stack Exchange for an answer.

Here is the code :

  Dim container As UnityContainer = New UnityContainer    container.RegisterType(Of DataAccessBase.IMailMerge, AdoDataAccess.MailMergeDataAccess)("connectionString", New Injection.InjectionConstructor(connectionString))    GlobalConfiguration.Configuration.DependencyResolver = New UnityApiDependencyResolver(container)  

Here's a screenshot : Code and message

How to search for string if it contains whitespace in Swift?

Posted: 21 Jun 2021 07:54 AM PDT

Currently, in search, I am looking for a string that contains some characters:

func search(for keyword: String?) {      self.keyword = keyword      guard let keyword = keyword?          .folding(options: .diacriticInsensitive, locale: nil)          .lowercased(),          !keyword.isEmpty else {          filteredNames = names          return      }      filteredNames = names          .filter { $0.title.lowercased()              .folding(options: .diacriticInsensitive, locale: nil)              .contains(keyword)          }  }  

The problem is that when the list is bigger, it shows more than expected. I would use not .contain(keyword), but .starts(with: keywoard), but then it would miss some results.

let's say I have an array of: let myArray = ["name", "my name", "some name", "else string", "string", "stringname"] so when looking for 'ame' not it shows all that contains the string, and what I want is to shown only if the word in an array starts with that. So when typing 'name' it should return me "name", "some name" but NOT the "stringname"

JS How to allow only digits to be typed in input with 'onKeyPress'

Posted: 21 Jun 2021 07:53 AM PDT

I'm working on my ReactJS new website and I want the input to allow the user to type only digits for mobile number.

  onlyNumberKey = (event) => {      let ASCIICode = event.which ? event.which : event.keyCode;      if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57))       return false;      return true;    };     <div>      <input type='text' onKeyPress='return {this.onlyNumberKey}' />      </div>  

I use the "onlyNumberKey" function I found in many sites I discovered for my question.
This fuction is working and will well return true or false as needed,
but I probably don't understad, how to prevent letters and special chars from being insert by the user ?

This wont work and gives an error -

 onKeyPress='return this.onlyNumberKey'   

"Warning: Expected onKeyPress listener to be a function, instead got a value of string type."
And I know why, just to clear that I tried many solutions.

Thanks for the helpers

Not able to send an axios post to a node js server - net::ERR_CONNECTION_REFUSED on localhost

Posted: 21 Jun 2021 07:54 AM PDT

I'm trying to send a form from a react/node/axios website on my localhost:3000 and a node/nodemailer server running on localhost: 4000, when a submit the form/axios.post it take some seconds then i receive this error on clg:

Error: Network Error at createError (createError.js:16) at XMLHttpRequest.handleError   (xhr.js:84) xhr.js:177 POST http://localhost:4000/send_mail net::ERR_CONNECTION_REFUSED  

I have tried a lot of things on code and also on my machine like, disabling firewall/protections... nothing worked.

This is the react component i'm using:

import React from 'react';  import { Link } from 'react-router-dom';  import ReCAPTCHA from 'react-google-recaptcha';  import axios from 'axios';    import './style.css';    const ContactForms = () => {      const [isWork, setIsWork] = React.useState(false);        const [name, setName] = React.useState('');      const [telephone, setTelephone] = React.useState('');      const [email, setEmail] = React.useState('');      const [file, setFile] = React.useState();      const [message, setMessage] = React.useState('');        const [sent, setSent] = React.useState(false);      const [msg, setMsg] = React.useState('');      const recaptchaRef = React.createRef();        console.log(sent);      console.log(name);        const handleSand = async (e) => {          e.preventDefault();            const token = await recaptchaRef.current.executeAsync();            // const formData = new FormData();          // formData.append('name', name);          // formData.append('telephone', telephone);          // formData.append('email', email);          // formData.append('token', token);          // formData.append('file', file);          // formData.append('message', message);            axios              .post('http://localhost:4000/send_mail', {                  name,                  telephone,                  email,                  token,                  file,              })              .then((r) => {                  setSent(true);                  setMsg(r.data.message);              })              .catch((e) => {                  console.log(e);              });      };        console.log(file);        if (sent) return <div>{msg}</div>;      return (          <>              {!sent ? (                  <section className="faleConosco" id="forms">                      <div className="faleConosco__background"></div>                      <div className="faleConosco__formulario">                          <div className="faleConosco__buttons">                              <button                                  className="button--amarelo amarelo"                                  onClick={() => setIsWork(false)}                              >                                  Fale conosco                              </button>                          </div>                          <div className="faleConosco__info">                              <h2 className="faleConosco__title title--style">                                  Faça parte do nosso time                              </h2>                              <span className="faleConosco__subtitle">                                  E transforme a gestão de telecom com a gente                              </span>                                <form className="formularioContato" onSubmit={handleSand}>                                  <input                                      type="text"                                      placeholder="Nome completo"                                      value={name}                                      onChange={(e) => setName(e.target.value)}                                      required                                  />                                  <button type="submit" className="button--azul">                                      Enviar                                  </button>                                    <label>                                      <input type="checkbox" required />                                      Eu li, estou ciente das condições de tratamento dos meus dados                                      pessoais e dou meu consentimento, quando aplicável, conforme                                      descrito nesta política de privacidade                                  </label>                                    <ReCAPTCHA                                      sitekey="6Lf3EpAaAAAAAOaWFeNFGhqaQk0Fab4gMfDclxx0"                                      size="invisible"                                      ref={recaptchaRef}                                  />                              </form>                          </div>                      </div>                  </section>              ) : (                  <section className="faleConosco" id="forms">                      <div className="faleConosco__background"></div>                      <div className="faleConosco__formulario">                          <h1>enviado</h1>                      </div>                  </section>              )}          </>      );  };    export default ContactForms;  

This is my server code:

const express = require('express');  const app = express();    require('dotenv').config();    const bodyParser = require('body-parser');  const cors = require('cors');  const nodemailer = require('nodemailer');    app.use(express.urlencoded({ extended: true }));  app.use(express.json());    app.use(cors());    app.post('/send_mail', cors(), async (req, res) => {      let { text } = req.body;      const transport = nodemailer.createTransport({          service: process.env.MAIL_SERVICE,          auth: {              user: process.env.MAIL_USER,              pass: process.env.MAIL_PASS,          },          tls: {              rejectUnauthorized: false,          },      });        await transport.sendMail({          from: `Leads Tel&Com <${process.env.MAIL_USER}>`,          to: `${process.env.MAIL_USER}`,          subject: 'teste',          text: 'teste',      });  });    app.listen(      (process.env.PORT || 4000,      () => {          console.log('Server is listening on port 4000');      })  );  

Gmail summarization using Gmail API in python

Posted: 21 Jun 2021 07:54 AM PDT

How to do gmail summarization using gmail API in python. Like access the gmail and create text summarization of the mails and show to it.

How to set minimum value of the text box based on the combobox value in excel vba?

Posted: 21 Jun 2021 07:55 AM PDT

I have tried a writing the code to set the limit of the textbox means if somebody enters the value 8 and if the limit in the code is set to the 10 then it should give message that pl. increase the entered value but adding to this its value of the limit also gets changed as per the value getting changed in the combo box means i have list of 5 to 7 numbers and there respective list if somebody selects the specific limit then the program should consider that adjacent cell value as respectively as shown in the image

For Eg: If someone selects the number 4456 then the minimum value of entering in the textbox is more than 50 same as if someone selects the 5566 number then minimum value entering in the textbox is more than 150 respectively if someone enters the value below that then it should show message that pl. increase the value with showing that minimum value requirement is 50 for 4456 eg.

Pl. help in getting solution of this Any positive response are welcomed. Pl. find the images of the userform and the sheet layout containing value in the attached document.

Private Sub ComboBox1_Change()  Dim t As Long, LastRow As Long, ws As Worksheet  Set ws = Sheets("Sheet1")  LastRow = ws.Range("H" & Rows.Count).End(xlUp).Row    For t = 2 To LastRow  If Val(Me.ComboBox1.Value) = ws.Cells(t, "H").Value Then  Me.TextBox1 = ws.Cells(t, "I").Value    If Val(Me.ComboBox1.Value) = ws.Cells(t, "H").Value Then  If Val(Me.TextBox2.Value) < ws.Cells(t, "J").Value Then      MsgBox ("Has to be greater than")            End If      End If      End If     Next t     End Sub  

[User form Image the limit of value should be given to second textbox][1] [Limits value ][2]

Regards, Shubham Mehta

Display description of a component in Dymola

Posted: 21 Jun 2021 07:53 AM PDT

In Dymola, I can display the name of a component in a TextBox by using the syntax %name. I can also display its class (%class), its path (%path) and any of its parameter (%name_of_parameter).

But I can't find how to display the "Comment" field. %comment does work on Wolfram, but doesn't seem to work in my version of Dymola. Is there any way to do that, or do I need to create a custom "DisplayedName" parameter?

Use of class template std::unique_ptr requires template arguments with MariaDB Connector C++

Posted: 21 Jun 2021 07:54 AM PDT

I'm having an issue with this. It keeps throwing the error:

use of class template 'std::unique_ptr' requires template arguments  

I've searched for an hour. I've tried compiling using c++17, and still didn't work. How can I get the MariaDB Connector to work? I installed the MariaDB Connector. I am on Debian 10. And using clang++ v7 to compile. I tried adding a <template> option in the header, and still didn't work.

I'm compiling using this: clang++ -I/usr/include/mariadb/concpp/compat -O3 -Wall -o ./getUsers ./getUsers.cpp -lmariadbcpp

#include <iostream>   #include <cstring>  #include <mariadb/conncpp.hpp>    using namespace std;    // Main Process  int main(){      try {          // Instantiate Driver          sql::Driver* driver = sql::mariadb::get_driver_instance();            // Configure Connection          sql::SQLString url("jdbc:mariadb://x.x.x.x:3306/todo");          sql::Properties properties({{"user", "xxxx"}, {"password", "xxxx"}});            // Establish Connection          std::unique_ptr conn(driver->connect(url, properties));            // Create a new Statement          std::unique_ptr stmnt(conn->createStatement());          // Execute query          sql::ResultSet *res = stmnt->executeQuery("SELECT id, username FROM accounts");          // Loop through and print results          while (res->next()) {              std::cout << res->getInt("id") << ") ";              std::cout << res->getString("username");          }      }      catch(sql::SQLException& e){        std::cerr << "Error selecting tasks: " << e.what() << std::endl;     }       delete res;     delete stmnt;     delete conn;       // Exit (Success)     return 0;  }  

Im working on a makefile which should build a library and then also include that library when building the entire program

Posted: 21 Jun 2021 07:53 AM PDT

INC_DIR = ./include  SRC_DIR = ./src  OBJ_DIR = ./obj  SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp))  H_FILES = $(wildcard $(INC_DIR)/*.cpp)  OBJ_FILES=$(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/%.o,$(SRC_FILES)  TARGET = PT3  CC = g++  CFLAGS = - fPIC -c -Wall -Werror -pedantic -std=c++11 -Wno-c++11-extensions  CPPFLAGS = $(addprefix -I, $(INC_DIR))      clean:      rm -f $(OBJECTS) $(TARGET)    all: $(TARGET)    $(TARGET): $(OBJECTS)      $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^    %.o: %.cc      $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<    g++ -shared -fPIC -o libtest.so $(OBJECTS)    main.o: main.cc      $(CC) $(CFLAGS) $(CPPFLAGS) -L/pt3/lib -o maintest main.cc -libtest   

this is currently what I have and i know its not syntactically right or remotely working but Im getting stuck on creating the shared library so I dont even know what else wouldnt compile.**

why Form.useForm did not load the Component in react

Posted: 21 Jun 2021 07:53 AM PDT

Now I am using this code to load a Login form, this is my code of the Login component:

class Login extends Component {            render() {          return (             <div>dddddd</div>          )      }  }    export default withRouter(Form.useForm()(Login))  

and this is my router define:

class App extends React.Component {      render() {          return (<Router>              <Switch>                  <Route path='/login' render={(props) => <Login user={this.props.user} />}/>                  <Route path='/404' component={View404} />              </Switch>          </Router>)      }  }  

the antd version is 4.0.0 and the react version is 16.10.1. why did not show the Login page? Am I missing something?

Delphi ADO.Command named parameters

Posted: 21 Jun 2021 07:54 AM PDT

I trying simple code on Delphi:

  Connection := CreateOleObject('ADODB.Connection');    Connection.ConnectionString := 'dsn=rollcontrol_im';    Connection.Open;      Command := CreateOleObject('ADODB.Command');    Command.CommandText := 'SELECT * FROM log where log.id = :id';    Command.ActiveConnection := Connection;    Command.Parameters.Append( Command.CreateParameter('id', adInteger, adParamInput, 4 {size}, 5 {value}) );      RecordSet := Command.Execute();  

And I got an error:

[ODBC Firebird Driver][Firebird]Dynamic SQL Error SQL error code = -206 Column unknown ID At line 1, column 35.

If I change param name to ? its working fine:

  Connection := CreateOleObject('ADODB.Connection');    Connection.ConnectionString := 'dsn=rollcontrol_im';    Connection.Open;      Command := CreateOleObject('ADODB.Command');    Command.CommandText := 'SELECT * FROM log where log.id = ?';    Command.ActiveConnection := Connection;    Command.Parameters.Append( Command.CreateParameter('?', adInteger, adParamInput, 4 {size}, 5 {value}) );      RecordSet := Command.Execute();  

How I can use named parameters with OLE ADO.Commanad ? Whats wrong ?

Tnx

Attribute AttributeError: module 'tensorflow.compat.v2' has no attribute '_internal_'

Posted: 21 Jun 2021 07:54 AM PDT

Following the CARLA tutorials, I created a file to train my model; however, whenever I try to run it using Command prompt, this error shows up:

2021-06-20 19:39:30.429984: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found  2021-06-20 19:39:30.430242: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.  Using TensorFlow backend.  Traceback (most recent call last):    File "CARtut5.py", line 10, in <module>      from keras.applications.xception import Xception    File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\_init_.py", line 12, in <module>      from . import initializers    File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\initializers\_init_.py", line 124, in <module>      populate_deserializable_objects()    File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\initializers\_init_.py", line 49, in populate_deserializable_objects      LOCAL.GENERATED_WITH_V2 = tf._internal_.tf2.enabled()  AttributeError: module 'tensorflow.compat.v2' has no attribute '_internal_'  

I tried to uninstall Keras and TensorFlow and reinstall them, but the error persists.

Spring Integration getting stuck in gateway channel and not returning to polling channel

Posted: 21 Jun 2021 07:53 AM PDT

I have a requirement where I read from an sftp location to the local machine. Process and post-process the file, then move it to an Archive folder in the sftp location:

I have used Spring integration as follows:

I have an InboundChannelAdapter which will have a cron poller looking into sftp location and pulls file to local for processing.

I have a corresponding serviceActivator that invokes processing service. Then I invoke gateway method which calls another ServiceActivator that archives the file

Flow is:

InboundChannelAdapter (with cron polling to pull every 10 seconds)  ServiceAdaptor       processes file       Invokes Messaginggateway method to archive       deletes file from local  ServiceAdaptor(Archiving)  

FileWatcher:

@Configuration  class FileWatcher {      Logger logger = LoggerFactory.getLogger(FileWatcher.class)        @Autowired      XmlParserService xmlParserService        @Autowired      UploadGateway gateway        @Value("\${ssftp-server}")      String sftpHost        @Value("\${sftp-user}")      String sftpUser        @Value("\${sftp-password}")      String sftpPassword        @Value("\${sftp-filter}")      String sftpFileFilter        @Value("\${sftp-port}")      Integer sftpPort        @Value("\${sftp-source-path}")      String sourcePath        @Value("\${sftp-local-path}")      String localPath        @Value("\${sftp-archive-path}")      String archivePath        @Value("\${sftp-error-path}")      String errorPath        @Value("\${cron.expression}")      String cronPoller        @Value("\${sessionTimeout}")      String sftpSessionTimeOut        @Value("\${channelTimeout}")      String sftpChannelTimeOut        @Bean      SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(){          def factory = new DefaultSftpSessionFactory(false)          factory.setHost(sftpHost)          factory.setPort(sftpPort)          factory.setUser(sftpUser)          factory.setPassword(sftpPassword)          factory.setAllowUnknownKeys(true)          return new CachingSessionFactory<ChannelSftp.LsEntry>(factory)      }        @Bean      SftpInboundFileSynchronizer sftpInboundFileSynchronizer(){          def fileSynchronizer = new SftpInboundFileSynchronizer(sftpSessionFactory())          fileSynchronizer.setDeleteRemoteFiles(true)          fileSynchronizer.setRemoteDirectory(sourcePath)          fileSynchronizer.setFilter(new SftpSimplePatternFileListFilter(sftpFileFilter))          return fileSynchronizer      }        @Bean      @InboundChannelAdapter(channel = "inputChannel",poller = [@Poller(cron="*/10 * * * * *")])      MessageSource<File> source(){          def source = new SftpInboundFileSynchronizingMessageSource(sftpInboundFileSynchronizer())          source.setLocalDirectory(new File(localPath))          source.setAutoCreateLocalDirectory(true)          source.setLocalFilter(new AcceptOnceFileListFilter())          source.maxFetchSize = 1          return source      }        @Bean      @ServiceActivator(inputChannel = "inputChannel")      MessageHandler messageHandler(){          def message = new MessageHandler() {              @Override              void handleMessage(org.springframework.messaging.Message<?> message) throws MessagingException {                  def messageFile = message.payload as File                  try{                      if (messageFile.name.endsWith(".xml")){                          logger.info("processing the file: " + messageFile.name)                          xmlParserService.process(messageFile)                          if(messageFile.exists()){                              println("to archive the file")                              gateway.archiveSpsAsnFile(messageFile)                              println("archived the file successfully")                              messageFile.delete()                          }                      }                  }catch (IOException ioe){                      logger.error("file could not be processed: " + messageFile.name)                  }              }          }          return message      }        @Bean      @ServiceActivator(inputChannel = "toArchiveLocation")      MessageHandler moveFileToArchive(){          SftpMessageHandler sftpHandler = new SftpMessageHandler(sftpSessionFactory())          sftpHandler.setRemoteDirectoryExpression(new LiteralExpression(archivePath))          sftpHandler.setFileNameGenerator(new FileNameGenerator() {              @Override              String generateFileName(org.springframework.messaging.Message<?> message) {                     if(((File)message.getPayload()).exists()){                         println("message: " + message.getPayload())                         println("message: " + ((File)message.getPayload()).getAbsolutePath())                         println("message: " + ((File)message.getPayload()).getName())                       ((File)(message.getPayload())).getName()                     }else{                         throw new IllegalArgumentException("file expected as payload")                     }              }          })          return sftpHandler      }  }  

Gateway:

@MessagingGateway  interface UploadGateway {          @Gateway(requestChannel ="toArchiveLocation")      archiveSpsAsnFile(File file)  }  
2021-06-18 12:11:00.788  INFO 15653 --- [ask-scheduler-1] com.jcraft.jsch                          : Authentication succeeded (keyboard-interactive).  2021-06-18 12:11:00.862 DEBUG 15653 --- [ask-scheduler-1] o.s.integration.util.SimplePool          : Obtained new org.springframework.integration.sftp.session.SftpSession@6dd7b63a.  2021-06-18 12:11:01.123 DEBUG 15653 --- [ask-scheduler-1] o.s.i.s.i.SftpInboundFileSynchronizer    : deleted remote file: //856POMRMN00407684_24100158471_202106140820.xml  2021-06-18 12:11:01.124 DEBUG 15653 --- [ask-scheduler-1] o.s.i.f.r.session.CachingSessionFactory  : Releasing Session org.springframework.integration.sftp.session.SftpSession@6dd7b63a back to the pool.  2021-06-18 12:11:01.124 DEBUG 15653 --- [ask-scheduler-1] o.s.integration.util.SimplePool          : Releasing org.springframework.integration.sftp.session.SftpSession@6dd7b63a back to the pool  2021-06-18 12:11:01.124 DEBUG 15653 --- [ask-scheduler-1] o.s.i.s.i.SftpInboundFileSynchronizer    : 1 files transferred from '/'  2021-06-18 12:11:01.125 DEBUG 15653 --- [ask-scheduler-1] sageSource$LocalFileReadingMessageSource : Added to queue: [/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml]  2021-06-18 12:11:01.131 DEBUG 15653 --- [ask-scheduler-1] o.s.i.e.SourcePollingChannelAdapter      : Poll resulted in Message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={file_remoteHostPort=xfer2.fingerhut.com:22, file_name=856POMRMN00407684_24100158471_202106140820.xml, file_remoteDirectory=//, file_originalFile=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, id=766bb7de-3bed-698b-f683-ccccdb6ff6fb, file_relativePath=856POMRMN00407684_24100158471_202106140820.xml, file_remoteFile=856POMRMN00407684_24100158471_202106140820.xml, timestamp=1624036261130}]  2021-06-18 12:11:01.133 DEBUG 15653 --- [ask-scheduler-1] o.s.integration.channel.DirectChannel    : preSend on channel 'bean 'inputChannel'', message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={file_remoteHostPort=xfer2.fingerhut.com:22, file_name=856POMRMN00407684_24100158471_202106140820.xml, file_remoteDirectory=//, file_originalFile=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, id=766bb7de-3bed-698b-f683-ccccdb6ff6fb, file_relativePath=856POMRMN00407684_24100158471_202106140820.xml, file_remoteFile=856POMRMN00407684_24100158471_202106140820.xml, timestamp=1624036261130}]  2021-06-18 12:11:01.134 DEBUG 15653 --- [ask-scheduler-1] .i.h.ReplyProducingMessageHandlerWrapper : bean 'fileWatcher.messageHandler.serviceActivator.handler' received message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={file_remoteHostPort=xfer2.fingerhut.com:22, file_name=856POMRMN00407684_24100158471_202106140820.xml, file_remoteDirectory=//, file_originalFile=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, id=766bb7de-3bed-698b-f683-ccccdb6ff6fb, file_relativePath=856POMRMN00407684_24100158471_202106140820.xml, file_remoteFile=856POMRMN00407684_24100158471_202106140820.xml, timestamp=1624036261130}]  2021-06-18 12:11:01.158  INFO 15653 --- [ask-scheduler-1] c.b.f.s.watcher.FileWatcher              : processing the file: 856POMRMN00407684_24100158471_202106140820.xml  to archive the file  2021-06-18 12:11:01.191 DEBUG 15653 --- [ask-scheduler-1] o.s.integration.channel.DirectChannel    : preSend on channel 'bean 'toArchiveLocation'', message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, id=ceee7c55-2a76-3335-7df2-7270d3273ac3, timestamp=1624036261191}]  2021-06-18 12:11:01.192 DEBUG 15653 --- [ask-scheduler-1] .i.h.ReplyProducingMessageHandlerWrapper : bean 'fileWatcher.moveFileToArchive.serviceActivator.handler' received message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, id=ceee7c55-2a76-3335-7df2-7270d3273ac3, timestamp=1624036261191}]  2021-06-18 12:11:01.192 DEBUG 15653 --- [ask-scheduler-1] o.s.i.sftp.outbound.SftpMessageHandler   : bean 'moveFileToArchive'; defined in: 'class path resource [com/bsb/fms/spsasnprocessor/watcher/FileWatcher.class]'; from source: 'org.springframework.core.type.classreading.SimpleMethodMetadata@3047254d' received message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, id=ceee7c55-2a76-3335-7df2-7270d3273ac3, timestamp=1624036261191}]  2021-06-18 12:11:01.194 DEBUG 15653 --- [ask-scheduler-1] o.s.integration.util.SimplePool          : Obtained org.springframework.integration.sftp.session.SftpSession@6dd7b63a from pool.  message: /Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml  message: /Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml  message: 856POMRMN00407684_24100158471_202106140820.xml  2021-06-18 12:11:01.326 DEBUG 15653 --- [ask-scheduler-1] o.s.i.sftp.session.SftpSession           : File: /Archive/856POMRMN00407684_24100158471_202106140820.xml.writing was successfully renamed to /Archive/856POMRMN00407684_24100158471_202106140820.xml  2021-06-18 12:11:01.326 DEBUG 15653 --- [ask-scheduler-1] o.s.i.f.r.session.CachingSessionFactory  : Releasing Session org.springframework.integration.sftp.session.SftpSession@6dd7b63a back to the pool.  2021-06-18 12:11:01.326 DEBUG 15653 --- [ask-scheduler-1] o.s.integration.util.SimplePool          : Releasing org.springframework.integration.sftp.session.SftpSession@6dd7b63a back to the pool  2021-06-18 12:11:01.327 DEBUG 15653 --- [ask-scheduler-1] .i.h.ReplyProducingMessageHandlerWrapper : handler 'bean 'fileWatcher.moveFileToArchive.serviceActivator.handler'' produced no reply for request Message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, id=ceee7c55-2a76-3335-7df2-7270d3273ac3, timestamp=1624036261191}]  2021-06-18 12:11:01.327 DEBUG 15653 --- [ask-scheduler-1] o.s.integration.channel.DirectChannel    : postSend (sent=true) on channel 'bean 'toArchiveLocation'', message: GenericMessage [payload=/Users/user.name/New/856POMRMN00407684_24100158471_202106140820.xml, headers={replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@2e34aad9, id=ceee7c55-2a76-3335-7df2-7270d3273ac3, timestamp=1624036261191}]'''  

One activity, onboarding + multiple backStacks fragments with bottom navigation

Posted: 21 Jun 2021 07:53 AM PDT

Just visited the google repo on the last alpha realease of navigation library, version 2.4.0-alpha02. I have a big doubt on what will be the right approach to show a onBoarding graph and then load the navgraph of multiple stacks, all that in just one activity.

If I understand correctly, the FragmentContainerView, in the last update, it needs a navGraph with the <include>of the sections we want to have inside our app, and a startDestination of one of that includes.

The doubt on navigation:

What would be the right implementation? I mean, I looked at the docs and the part of conditional navigation, but this part does not seems to fit inside.

What I tried:

  1. I inflate inside the FragmentContainerView the navGraph of the onboarding, then after the onboarding its done, I inflate inside the same FragmentContainer another navgraph, the one for the multiple backStack, this aproach seems to have a visual impact, because the view when the FragmentContainerView gets his navGraph inflated inside, the view goes white...
  2. I used the fragmentManager of activity as the NavHost, to load first the onBoarding graph and then the FragmentContainerView with his navGraph, this option improve the visual problem mentioned in 1. but the multiple backstack stopped working, my guess is that FragmentContainerView, needs to be the navHost.

Using PrimeVue's Calendar component gives 'Unhandled error during execution of render function ' Vue 3

Posted: 21 Jun 2021 07:54 AM PDT

I'm getting an error when I use the Calendar component provided by VuePrime(version ^3.5.0). The error occurs when I click the input that will then display the calendar itself.

The error that Vue(version 3) is giving is the following: enter image description here

This error is thrown when I click the input element that will fire the event to display the calendar UI element. The error is also thrown when I click outside the same input element, so I think is something related with the show/hide calendar's element.

This is the input element that gets rendered by the Calendar component that once clicked will actually open the calendar UI, so I can select days and so on:

enter image description here

I don't know if this is a Vue' issue or Prime's.

Here is the code of the component that uses the Calendar component. I'm using Options API.

<template>    <div class="flow-content">      <h1 class="a-component-title">        Formulario para registrar evento      </h1>      <form @click.prevent>           <!-- Fields para datos del Evento -->           <div class="flow-content  p-mt-3">              <h2 class="form-title p-text-bold">Datos del evento</h2>              <div class="p-fluid p-formgrid p-grid">                  <div class="p-field p-col-12 p-md-4">                      <label for="eventoTipo">Tipo/s</label>                      <MultiSelect    v-model="evento.seleccionadosTipo"                                       :options="evento.tipos"                                      optionLabel="name"                                      placeholder="Selecciona el tipo"                                      id="eventoTipo"                                      display="chip"                                      :showToggleAll="false"                                      :filter="true"/>                  </div>                  <div class="p-field p-col-12 p-md-4">                      <label for="eventoUbicacion">Ubicación</label>                      <InputText id="eventoUbicacion" type="text" />                  </div>                  <div class="p-field p-col-12 p-md-4">                      <label for="eventoFecha">Fecha</label>                      <!--HERE IS THE CALENDAR-->                      <Calendar v-model="evento.dateCalendar"/>                  </div>              </div>           </div>                </form>    </div>  </template>    <script>  export default {      data() {          return {              denunciante: {                  esAnonimo: false              },              evento: {                  seleccionadosTipo: null,                  tipos: [                      {name: 'Ciudado Inresponsable', id: 450},                      {name: 'Perra Preñada', id: 55},                      {name: 'Moquillo', id: 15},                      {name: 'Perro en vía pública', id: 789}                  ],                  dateCalendar: null              }                        }      }  }  </script>    

By the way, here is the list of dependencies and their versions of my current project:

"dependencies": {      "@vuelidate/core": "^2.0.0-alpha.19",      "@vuelidate/validators": "^2.0.0-alpha.16",      "axios": "^0.21.1",      "core-js": "^3.6.5",      "moment": "^2.29.1",      "primeflex": "^2.0.0",      "primeicons": "^4.1.0",      "primevue": "^3.5.0",      "vue": "^3.0.0",      "vue-router": "^4.0.0-0",      "vuex": "^4.0.0-0"    },    "devDependencies": {      "@vue/cli-plugin-babel": "~4.5.0",      "@vue/cli-plugin-eslint": "~4.5.0",      "@vue/cli-plugin-router": "~4.5.0",      "@vue/cli-plugin-vuex": "~4.5.0",      "@vue/cli-service": "~4.5.0",      "@vue/compiler-sfc": "^3.0.0",      "babel-eslint": "^10.1.0",      "eslint": "^6.7.2",      "eslint-plugin-vue": "^7.0.0",      "node-sass": "^4.12.0",      "sass-loader": "^8.0.2",      "style-resources-loader": "^1.4.1"    }  

multiple condition in ternary operator in jsx

Posted: 21 Jun 2021 07:53 AM PDT

<div style={{'backgroundColor': status === 'approved' ? 'blue' : 'black'}}>  </div>  

black is the default color but what if I want to add the 3rd condition?

status can be 'approved', 'rejected', 'pending' or more.

Adding two columns in VBA

Posted: 21 Jun 2021 07:53 AM PDT

I have two columns in an excel sheet called numOne and numTwo as follows:

numOne  numTwo  1       2  2       3  3       6  4       7  

Now I want to write a VBA macro(automate) to add these columns and create a third column numSum How can I achive that? The output should look like this :

 numOne  numTwo  numSum  1       2        3  2       3        5  3       6        9  4       7        11  

Thanks in advance

No comments:

Post a Comment