mardi 27 juillet 2021

How to paste text in a DIV text area using SELENIUM and Python

I am trying to send some text to the text box. The problem is that when the text is short(small) it works, but when the text is long(big) it doesn't work. Please, I have pasted my code below. Let me know what I am doing wrong

from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()
driver.get("https://editor.swagger.io/")


# when we read swagger file from excel will put it here

swagger = '{"swagger":"2.0","info":{"title":"test api *************************************}'

#fetch the box for the swagger input
editor = driver.find_element_by_class_name("ace_text-input")
#
# #clear it
editor.clear()
# #send the swagger we want to convert
editor.send_keys(swagger)```



MongoDB :Auth mechanism not specified Error for specific Project

We running 2 web .net project on same Pc and connecting to same Mongod server . first and second project connect to same database.

First project with authorization connection string working fine without connection issue but Second project with same authorization string giving Auth mechanism not specified error if I specified any auth mechanism then it giving Unsupported MongoAuthenticationMechanism SCRAM-SHA-1 error

This is happen only for second project , not issue with first project I am sure that

  1. both mongod server and shell version match
  2. same connection string for both

but why it giving issue for second project only. what would be possible project level issue? any idea.

Please help for this




JSOUP: Not catching the tag

Not catching the tag img inside four div tags. This is issue in details here at github




Spring - alternative way to have request context in child thread

In java application using spring I'm facing situation when I need to create asynchronous REST endpoint for some small data processing.

I.e. current idea is:

  • we got request for processing
  • as soon as we verify it could be processed we return 200 OK
  • at the same time we create child thread in which processing will run

Child process is used because we need to have Request / Session in that processing thread (because current user should be checked and recorded during processing - due to legacy code it's hard to do before).

I use solution found on StackOverflow and it works like a charm.

However some of colleagues on review regard it "insecure" to enable inherited request context on all thread. Thus I'm looking for other possible approach.

What I tried is to share request attributes to child thread manually:

    var attrs = RequestContextHolder.getRequestAttributes();
    new Thread(() -> {
        RequestContextHolder.setRequestAttributes(attrs);
        // ...
    });

This partly works, but only till response is sent in parent thread. After this I get exception with explanation Cannot ask for request attribute - request is not active anymore!

I tried to specify that parent's attributes are inheritable - but this doesn't help:

    var attrs = RequestContextHolder.getRequestAttributes();
    RequestContextHolder.setRequestAttributes(attrs, true);  // inheritable
    new Thread(() -> {
        RequestContextHolder.setRequestAttributes(attrs);
        // ...
    });

(I got error saying that I have no active request, If I'm not wrong - tried few more similar variations)

So any further hints are welcome (or explanations of my mistakes). Thanks in advance!




Convert a JSON file to an array in javascript to visualize the data in ChartsJS

I have a JSON file with a lot of temperatur data meassured every quarter hour and saved into a object in the file.

{"Temp_12:0": "26",
"Temp_12:15": "20",
"Temp_12:30": "25",
"Temp_12:45": "25",
"Temp_13:0": "26",
"Temp_13:15": "25",
"Temp_13:30": "26",
"Temp_13:45": "26"}

This is how the data is structurised in the file. I want to display the display the data on a webserver in my local network with ChartsJS. The Problem is that I don't have an idea of how to parse the data so that I can display it.

I want to parse the JSON Objects into an 1D array so it would be easy for me to visualise them.

I would be hapy if anyone here can help me with my problem because I'am relatively new to JavaScript.




send message from website to messaging platform like telegram,gmail,or whatsapp

I want to send messages to messaging apps from my website. For example when user x clicked the place order button then my website needed to send some text message to the given deliverer’s number or id. I can use messenger telegram gmail viber whatsapp as my messaging platform. And i like to use MEVN stack or LAMP stack for this website.is that possible and how can i do it.




How to bring correct result from my data frame on R shiny?

I want to have properly working search button on my shiny app which bring data from my data frame (table1).here is my data frame;

table1 = data_frame = ( 
Ciliopathy = c("Acrocallosal Syndrome" ,"Alström Syndrome" , "Ataxia- 
telangiectasia-like Disorder" ,"Ataxia-telangiectasia-like Disorder" , 
"Autosomal Dominant Polycystic Kidney Disease (ADPK)" ,"Autosomal 
Dominant Polycystic Kidney Disease (ADPK)" , "Autosomal Dominant 
Polycystic Kidney Disease (ADPK)", "Autosomal Dominant Polycystic Kidney 
Disease (ADPK)","Autosomal Dominant Polycystic Kidney Disease (ADPK)"),

OMIM Phenotype Number = 
c(200990,203800,604391,615919,173900,613095,613095,600666,600666),

Human Gene Name = 
c("KIF7","ALMS1","MRE11","PCNA","PKD1","PKD2","PKD2","GANAB","GANAB"))

But when i search a spesific word it doesnt bring desired result. I think problematic part is here;

generow = reactive({

table1 %>% filter (Human.Gene.Name == "a" )

})  

output$tablom <- renderTable({ 

generow()

})

but still i can't figure out how to solve, here is my full code;

 ui <- fluidPage(
tags$h1("Search Input"),
br(),
searchInput(
  inputId = "a", label = "Enter your text",
  placeholder = "A placeholder",
  btnSearch = icon("search"),
  btnReset = icon("remove"),
  width = "450px"
),
br(),
(outputId = "tablom"), tableOutput("tablom")
)

server <- function(input, output, session) {

generow = reactive({

 table1 %>% filter (Human.Gene.Name == "a" )

  })  

output$tablom <- renderTable({ 
  
  generow()

  })
 }

shinyApp(ui = ui, server = server) 

I need your suggestions