Tuesday, June 29, 2021

Posts from Recent Questions - Stack Overflow for 06/29/2021

View this email in your browser
Updates from https://stackoverflow.com/questions

Recent Questions - Stack Overflow



In the 06/29/2021 edition:

PyQt Frame for BoxLayout

By Superabsolutme on Jun 29, 2021 04:02 am

i've now been stucked more than 2 hours, trying to put a frame/border around my Boxlayout.

MainWindow:

class Fenster(QWidget):        def __init__(self):          super().__init__()            self.top = 100          self.left = 100          self.width = 900          self.height = 1200    

I add some buttons and some other widgets, see picture, then the code below.

          DisplayVBox = QVBoxLayout()            frame = QFrame()          frame.setFrameShape(QFrame.StyledPanel)          frame.setStyleSheet("background-color: blue")          frame.setLineWidth(3)            DisplayVBox.addWidget(frame)          DisplayVBox.addLayout(MiddleBox)          DisplayVBox.addLayout(BottomLabelRow)  

putting the DisplayVbox and some other BoxLayouts into the FinalBox Ending with:

        self.setLayout(FinalBox)            self.setGeometry(self.top, self.left, self.width, self.height)          self.setWindowTitle("ACDI Simulator")          self.show()            self.setStyleSheet("background : black;")    app = QApplication(sys.argv)  app.setStyle("fuison")  w = Fenster()  sys.exit(app.exec_())    

This is what i end up with and there is no frame, the frame should be around the 2 Circles and the labes

I also tried something like:

self.frame = QFrame()  DisplayVBox = QVBoxLayout(self.frame)    

But it would always end up in the top right corner and deleated my Circle Widget.


Read in browser »
share on Twitter

Typo3 show every user his specific files

By user3852729 on Jun 29, 2021 04:02 am

i want to show any logged in user, his specific uploaded files like contracts an so on. Is there any way without extensions?


Read in browser »
share on Twitter

How to link syscall traces to java source code

By ERIC on Jun 29, 2021 04:02 am

I'm using strace in linux to get the system call traces of a java program. However, I don't know how to link the trace to the source code (which piece of code produce corresponding trace).

I use -k option but it seems not help in java (which is useful for C and C++ program). I can only link the traces to .so file.

mmap(0x7fcd168a9000, 12288, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fcd168a9000   > /lib/x86_64-linux-gnu/libc-2.23.so(mmap64+0x3a) [0x1017ba]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(os::pd_uncommit_memory(char*, unsigned long)+0x19) [0x919799]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(os::uncommit_memory(char*, unsigned long)+0x8b) [0x91016b]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(JavaThread::exit(bool, JavaThread::ExitType)+0xb99) [0xa87029]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(JavaThread::thread_main_inner()+0x27) [0xa87297]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(JavaThread::run()+0x2d1) [0xa87651]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(java_start(Thread*)+0x102) [0x915cd2]   > /lib/x86_64-linux-gnu/libpthread-2.23.so(start_thread+0xca) [0x76ba]   > /lib/x86_64-linux-gnu/libc-2.23.so(clone+0x6d) [0x10751d]  rt_sigprocmask(SIG_SETMASK, [QUIT], NULL, 8) = 0   > /lib/x86_64-linux-gnu/libpthread-2.23.so(pthread_sigmask+0x2f) [0xe49f]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(os::free_thread(OSThread*)+0xb4) [0x916134]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(Thread::~Thread()+0x19a) [0xa8395a]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(JavaThread::~JavaThread()+0x11) [0xa83d11]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(JavaThread::thread_main_inner()+0x35) [0xa872a5]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(JavaThread::run()+0x2d1) [0xa87651]   > /home/xxxxxx/Desktop/jdk1.8.0_271/jre/lib/amd64/server/libjvm.so(java_start(Thread*)+0x102) [0x915cd2]   > /lib/x86_64-linux-gnu/libpthread-2.23.so(start_thread+0xca) [0x76ba]   > /lib/x86_64-linux-gnu/libc-2.23.so(clone+0x6d) [0x10751d]  

Is there any solution here? Or I should use some other tools rather than strace?


Read in browser »
share on Twitter

EnableEvents= True . Does not work with Worksheet_Activate ! Vba

By Waleed_wwm on Jun 29, 2021 04:01 am

I have workbook (1) with many codes depend on events to be enabled to run, by chance I opened workbook (2) and disabled events in it but I surprised that events also disabled in Workbook (1) . So , I tried to to put this code Application.enableEvents= True in Workbook_Activate but does not work even Window_Activate and Worksheet_Activate . Any help please


Read in browser »
share on Twitter

Boost::spirit::qi extract parameters values from the line

By Валентин Никин on Jun 29, 2021 04:01 am

I need to parse parameters values from the next line:

#EXT-X-KEY:METHOD=AES-128,URI="http://example.ru/123.key",IV=0x07a6ed33e15beca7f64e57e5137f7fde,KEYFORMAT="identity",KEYFORMATVERSIONS="1/2/3/4/5"  

Parameters description:

METHOD (REQUIRED PARAMETER) could contain: NONE, AES-128, SAMPLE-AES values

URI (REQUIRED PARAMETER) is quoted string URL

IV (OPTIONAL PARAMETER) is hexadecimal-sequence, an unquoted string of characters from the set [0..9] and [A..F] that is prefixed with 0x or 0X. The length of IV is 32 symbols except of 0x prefix.

KEYFORMAT (OPTIONAL PARAMETER) is quoted string

KEYFORMATVERSIONS (OPTIONAL PARAMETER) is quoted string containing one or more positive integers separated by the "/" character (for example, "1", "1/2", or "1/2/5")

Also the order of the arguments is not important, i.e the line can take the following form

#EXT-X-KEY:URI="http://example.ru/123.key",IV=0x07a6ed33e15beca7f64e57e5137f7fde,METHOD=AES-128,KEYFORMAT="identity"  

I wrote the following code to parse this line, but I'm newest in boost and I understand that this code unefficient, I didn't take into account all the requirements for the IV and KEYFORMATVERSIONS parameters. Also I don't know how to take into account the rule: "the order of the arguments is not important".

Should I inherit from qi::grammar, to wrote separate parser?

If you have any ideas how I can improve this code or how I can take into account all conditions please help me.

enum class KeyMethod {      NONE,      AES_128,      SAMPLE_AES  };    struct KEY_METHOD_ : boost::spirit::qi::symbols<char, KeyMethod> {      KEY_METHOD_() {          add              ("NONE", KeyMethod::NONE)              ("AES-128", KeyMethod::AES_128)              ("SAMPLE-AES", KeyMethod::SAMPLE_AES)          ;      }  };    // #EXT-X-KEY:<attribute-list>  bool PARSE_EXT_X_KEY(const std::string& line, ParserState& stateObj) {      stateObj.isMediaPlaylist = true;        namespace qi = boost::spirit::qi;      KEY_METHOD_ keyMethod;        KeyMethod method;      std::string uri;      std::string iv;      std::string keyformat;      std::string keyformatVersion;        if (!qi::parse(begin(line), end(line),          ( "#EXT-X-KEY:" >>          ("METHOD=" >> keyMethod) >>          (",URI=\"" >> +(qi::char_ - '"') >> '"') >>          -(",IV=" >> (qi::string("0x") | qi::string("0X")) >> +(qi::char_ - ',')) >>          -(",KEYFORMAT=\"" >> +(qi::alnum - '"') >> '"') >>          -(",KEYFORMATVERSIONS=\"" >> +(qi::char_ - '"') >> '"') >>          qi::eoi ),          method,          uri,          iv,          keyformat,          keyformatVersion)      ) {          return false;      }        return true;  }  

Read in browser »
share on Twitter

Need to take backup of log files and zip it when the last log file is overwritten by FileHandler

By Neha on Jun 29, 2021 04:01 am

My log file creation code is as follows:

public static final int FILE_SIZE = 512 * 1024;    public static void setup() throws SecurityException, IOException {      Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);      logger.setLevel(Level.INFO);      try {          FileHandler handler = new FileHandler("/data/mcmlog", FILE_SIZE, 10, true);          handler.setFormatter(new LogFormatter());          logger.addHandler(handler);          logger.setUseParentHandlers(false);      } catch (IOException e) {          logger.warning("Failed to initialize logger handler.");      }  }  

It creates log file from mcmlog.0 to mcmlog.9 in cyclic manner. I have to zip these log files when mcmlog.9 is about to be overwritten by mcmlog.8 . How to find when mcmlog.9 is about to be overwritten.


Read in browser »
share on Twitter

Xamarin Android Bottom tab bar title word cutting

By Aswathy on Jun 29, 2021 04:01 am

I have a page with bottom tab bar, When I select a long title , the title is cutting at the end. How to prevent this, I tried with reducing the size, but in that case the title is become too small.How to add a trail truncation to this .


Read in browser »
share on Twitter

checking api with golang for changes in data continuously

By LeCoda on Jun 29, 2021 04:01 am

I'm trying to poll an API to keep a time series of traffic data, and save that data to postgres when there has been a change.

At the moment I've got an implementation sort of like this

//this needs to check the api for new information every X seconds  func Poll(req *http.Request, client *http.Client) (byte, error) {      r := rand.New(rand.NewSource(99))      c := time.Tick(10 * time.Second)      for _ = range c {          //Download the current contents of the URL and do something with it          response, err := client.Do(req)          data, _ := io.ReadAll(response.Body)            if err != nil {              return nil, err          }          return data, nil          // add a bit of jitter          jitter := time.Duration(r.Int31n(5000)) * time.Millisecond          time.Sleep(jitter)      }    }        func main() {        client := &http.Client{          Timeout: time.Second * 60 * 60 * 600,      }      url := "https://data-exchange-api.vicroads.vic.gov.au/bluetooth_data/links"      req, err := http.NewRequest("GET", url, nil)      if err != nil {          return err      }      req.Header.Set("Ocp-Apim-Subscription-Key", "xx")        // response, err := client.Do(req)      data, err := Poll(req, client)      fmt.Println(string(data))    }  

I will do a comparison function next.

Basically, I'm trying to work out how to ensure the loop calls the query in the first place and returns an appropriate value.

I think this implementation is probably not very good and I'm just not sure how to really properly implement it. Could I get some pointers?


Read in browser »
share on Twitter

Is there any risk in using your kiubernetes masters as ingress nodes

By ITChap on Jun 29, 2021 04:01 am

By default most people seem to avoid running anything on the masters. These nodes are less likely to be reprovisioned or moved around than the rest of the cluster. It would make them a perfect fit for ingress controllers.

Is there any security and/or management implications/risks in using the masters as ingress nodes?


Read in browser »
share on Twitter

Using cbind for explanatory variables in glmer in R

By rschen on Jun 29, 2021 04:01 am

I am trying to create a model in R where I want to estimate the variance of a particular ratio (in this example, nC:nT) of an individual that can be explained by the ratio of these values of its parents. In the model, I am using cbind for both the dependent and independent variables. The current generalised linear mixed effect model looks similar to this:

glmer(cbind(nC_offspring,nT_offspring) ~ cbind(nC_mother, nT_mother) + cbind(nC_father, nT_father) + (1|variable1) + (1|variable2), family = binomial)  

The problem I am running into is that the results of the model of the cbind fixed effects, such as the estimates and p-values, are split up between nC and nT. i.e. I am getting estimates of nC_mother, nT_mother, nC_father and nT_father separately. In an ideal situation, I want the cbind ratio to be treated as a single factor, giving me the estimates of the cbind of the mother and of the father. I have been browsing around and cannot find a way to change the data so that the output of the glmer gives me these desired estimates. Does anybody have an idea how I can work around this? Any help would be greatly appreciated!


Read in browser »
share on Twitter

Please help me "TypeError: Cannot read property 'map' of undefined"

By Jones on Jun 29, 2021 04:01 am

I don't know where I have made mistaken.

import React from 'react';

const Tags = ( {tags} ) => {      return (          <>              теги: {tags.map((tag) => {              return <button key={tag}>                  #{tag}</button>;              })}          </>      );  };    export default Tags;  

enter image description here


Read in browser »
share on Twitter

If I can develop app for apple smartwatch to get raw PPG data and implement my own algorithm for hear rate detection

By Prayagwasi on Jun 29, 2021 04:01 am

Can I develop my own app for apple smartwatch through which I can get raw data from the PPG sensor of smartwatch and implement my own heart rate detection algorithm?


Read in browser »
share on Twitter

How to put condition on a batch input to train only specific samples from batch and not the complete batch in pytorch?

By Razor on Jun 29, 2021 04:01 am

I have a batch size of say 24. In this batch size I have an attribute say 'key' that takes a single value tensor [0], [1] and [2]. in my forward method I want that samples that have attribute = [0] train a specific part of network and does not touch any other part. Similarly for samples with [1] and [2].

I put a condition like

key = batch['key']    if key.item() == 0:     Do Something on branch_1  if key.item() == 1:     Do Something on branch_2  if key.item() == 2:     Do Something on branch_3  

I get an error that key.item() can only be used for a single value input. When I reduce my batch size to just 1 then the code works. I was wondering if there is a way to do it for a batch size greater then one?


Read in browser »
share on Twitter

Filtering dataframe using index

By Ankita on Jun 29, 2021 03:56 am

df1 is the entire dataset. m is the selection criteria that is used to determine at from where onwards we need the list.

update_df1 = df1.drop (index=m), used this code but it omits only the index that is m (which is 4th index here). However, I want to remove all the rows and columns above the 4th index.


Read in browser »
share on Twitter

Get InnertText from event click button (for GTM)

By Nicolas Goedert on Jun 29, 2021 03:54 am

I tried to get innerText from a click button with js event for exemple :

<label class="sc-AxirZ haYsgf"><span>Moins de 25 ans</span><span></span><input type="radio" name="BAS110Q" value="BAS110R01"></label>  <label class="sc-AxirZ haYsgf"><span>Moins de 20 ans</span><span></span><input type="radio" name="BAS110Q" value="BAS110R01"></label>  <label class="sc-AxirZ haYsgf"><span>Moins de 29 ans</span><span></span><input type="radio" name="BAS110Q" value="BAS110R01"></label>  

I would like to get the value of the button when i clicked on it. (get "moins de 20 ans" if i clicked on it) The only one prob it's, i've more than one button with the same class

Can you help me please ? I try to do this for Google Tag Manager to get values.

Thanks a lot


Read in browser »
share on Twitter

I have to compare /verify the values from the user input with the previous one that was saved in the database in a login form . Has to display a msg

By user14656865 on Jun 29, 2021 03:53 am

Hi there guys I'm trying to create a form wich will display a error message if the input data does not match with the one saved in the memory. The input field has to display a SVG icon(X) and a red border if the credentials are wrong, and a green border with a SVG (V) icon, if it matches the one all ready saved in the system. This is what I did so far. Can you help me with an advice, and tell me what I'm doing wrong? Thanks, I would appreciate

var form = document.getElementById("form"),    userField = form.querySelector(".user"),    user = userField.querySelector("input"),    passwordField = document.querySelector(".pass"),    pass = passwordField.querySelector("input"),    messages = form.querySelector(".msg__display"),    botton = form.querySelector("#btn");    var validUser = "new_user"  var validPassword = 123456789    form.addEventListener("submit", function () {      if (user.value == validUser && pass.value == validPassword) {      userField.classList.add("success");      userField.classList.remove("fail");      passwordField.classList.add("success");      passwordField.classList.remove("fail");      messages.classList.add("display_user");      messages.textContent = "Succesfully Login";        return true;      } else {        checkInputs();      return false;    }    })          function checkInputs() {      if (user.value.length < 1 || user.value == null) {      userField.classList.add("fail");      userField.classList.remove("success");      messages.classList.add("display_user");      messages.classList.remove("display_password");      messages.textContent = "Please insert a username";    } else {      userField.classList.add("fail");      userField.classList.remove("success");      messages.classList.add("display_user");      messages.classList.remove("display_password");      messages.textContent = "Please insert a valid username";    }      if (pass.value.length < 1 || pass.value == null) {      passwordField.classList.add("fail");      passwordField.classList.remove("success");      messages.classList.add("display_password");      messages.classList.remove("display_user");      messages.textContent = "Please insert a password";    } else {      passwordField.classList.add("fail");      passwordField.classList.remove("success");      messages.classList.add("display_password");      messages.classList.remove("display_user");      messages.textContent = "Please insert a valid password";    }      if (user.value != validUser && pass.value != validPassword) {      userField.classList.add("fail");      userField.classList.remove("success");      passwordField.classList.add("fail");      passwordField.classList.remove("success");      messages.classList.add("display_user");      messages.textContent = "Please insert a valid user or a valid password";    }    }
* {    box-sizing: border-box;    font-family: sans-serif;  }    body {    height: 100vh;    width: 100vw;    display: flex;    justify-content: center;    align-items: center;  }    #login-container {    width: 45%;    margin: 0 auto;    border-radius: .5em;    position: relative;    background: linear-gradient(to right, rgb(88, 167, 236), rgb(180, 198, 214), rgb(180, 198, 214));    padding: 3em 2.5em;    box-shadow: 0px 5px 4px #424241;    text-align: justify;  }      .input-field{    margin-bottom: .5em;  }      input[type="text"],  input[type="password"] {    width: 100%;    display: inline-block;    outline: none;    font-size: 18px;    padding: .5em 1.5em .5em .5em;    border-radius: .5em;  }      .form-control {    position: relative;  }    .input-field i{    position: absolute;    top: 55%;    right: .8em;    display: none;  }    .fa-check {    color: green;  }    .fa-times{    color: red;  }    form label {    font-weight: bold;    display: inline-block;    font-size: 18px;    margin-bottom: .2em;  }    form input[type="submit"] {    background: rgb(112, 112, 112);    border-radius: .5em;    margin: 1em 0 .2em 0;    padding: .5em 0;    display: block;    font-size: 18px;    font-weight: 700;    width: 100%;    position: relative;    text-transform: uppercase;    border: none;  }    form input[type="submit"]:hover{    background-color: #70db70;    color: white;  }    .message .msg__display {    margin: 0;    padding: 0;    font-size: 16px;    display: none;  }        /*Message  classes*/    .form-control.success input {    border: 3px solid green;    }  .form-control.fail input {    border: 3px solid red;  }    .form-control.success i.fa-check {    display: block;  }  .form-control.fail i.fa-times {    display: block;  }      .message .msg__display.display_user {   display: block;  }  .message .msg__display.display_password {   display: block;  }
 <div id="login-container">        <form id="form" action="#">          <div class="input-field">            <div class="form-control user">            <label for="username">Username:</label>            <input id="username" class="input" type="text">            <i class="fas fa-check u_check"></i>            <i class="fas fa-times u_decline"></i>          </div>          </div>          <div class="input-field">            <div class="form-control pass">            <label for="password">Password:</label>            <input id="password" class="input" type="password">            <i class="fas fa-check p_check"></i>            <i class="fas fa-times p_decline"></i>            </div>          </div>          <input type="submit" value="submit" id="btn">          <div id="msg" class="message">          <p class="msg__display">fail</p>          </div>      </div>        </form>      </div>


Read in browser »
share on Twitter

java.nio.file.NoSuchFileException for exisiting file in windows using Li Haoyi's os.read

By MrMuppet on Jun 29, 2021 03:51 am

I am trying to learn to use Li Haoyi's os-lib library, however, when I try to read an exisiting file in Windows (C:\Users\myUser\IdeaProjects\readJsons\metadata.json), it throws:

Exception in thread "main" java.nio.file.NoSuchFileException:C:\Users\myUser\IdeaProjects\readJsons\metadata.json.  

This is the (simple) code I am using:

object readSomeJson extends App{    val j = os.read(os.pwd/"metadata.json")  }  

Of course, the file does exist.

Can anybody help me here?

Thanks so much in advance!


Read in browser »
share on Twitter

JavaScript - Checking if input value is empty - but won't delete the last char

By Sunny on Jun 29, 2021 03:47 am

I'm having a problem with my if statement. I'm using React Hooks.
When I'm deleteing the input, the last number will stay no matter what.

enter image description here

This is the function called from the input's onChange-

    const onChangeHandler =((event) => {       const isDigits = event.target.value.replace(/\D/g, '');        if (isDigits === '') {         console.log('Deleting message');         setMessage('');         return;       }      setNumber(isDigits);     });  
  <input            className='inputStyle'            maxLength='9'            type='text'            autoComplete='off'            value={idNumber}            id='idNum'            onChange={(event) => onChangeHandler(event)}          />  

Without the return it will delete the last number but will also continue with the code.
If this condtion is true I want it to setMessage('') and return from the function.


Read in browser »
share on Twitter

Cosmos db null value

By sam on Jun 29, 2021 03:29 am

I have two kind of record mention below in my table staudentdetail of cosmosDb.In below example previousSchooldetail is nullable filed and it can be present for student or not.

sample record below :-

{      "empid": "1234",      "empname": "ram",      "schoolname": "high school ,bankur",      "class": "10",      "previousSchooldetail": {          "prevSchoolName": "1763440",          "YearLeft": "2001"      } --(Nullable)  }    {      "empid": "12345",      "empname": "shyam",      "schoolname": "high school",      "class": "10"  }  

I am trying to access the above record from azure databricks using pyspark or scala code .But when we are building the dataframe reading it from cosmos db it does not bring previousSchooldetail detail in the data frame.But when we change the query including id for which the previousSchooldetail show in the data frame .

Case 1:-        val Query = "SELECT * FROM c "        Result when query fired directly      empid      empname      schoolname      class    Case2:-      val Query = "SELECT * FROM c where c.empid=1234"        Result when query fired with where clause.      empid      empname      school name      class      previousSchooldetail      prevSchoolName      YearLeft  

Could you please tell me why i am not able to get previousSchooldetail in case 1 and how should i proceed.


Read in browser »
share on Twitter

How to apply custom styles to the HTML element of input type range for different browsers?

By Shivraj Nag on Jun 29, 2021 03:18 am

range design

I want to achieve this design, where I want different color on left and right of the thumb and also thumb should be like a hollow circle, after searching for the answer I figured out it's really straight forward for Firefox and IE but I am not able to do the same for Chrome and Edge.

::-moz-range-progress and ::-moz-range-track

and aslo IE has

::-ms-fill-lower and ::-ms-fill-upper

to apply different style on left and right side of the thumb. This is my code

  input[type=range] {      width: 100%;      margin: 3px 0;      background-color: transparent;      -webkit-appearance: none;    }    input[type=range]:focus {      outline: none;    }    input[type=range]::-webkit-slider-runnable-track {      background: #0075b0;      border: 0;      width: 100%;      height: 6px;      cursor: pointer;      border-radius: 3px    }    input[type=range]::-webkit-slider-thumb {      margin-top: -8px;      width: 20px;      height: 20px;      background: #ffffff;      border: 5px solid #0075b0;      border-radius: 50%;      cursor: pointer;      -webkit-appearance: none;    }    input[type="range"]::-moz-range-thumb {      width: 12px;      height: 12px;      background: #ffffff;      border: 5px solid #0075b0;      border-radius: 50%;      cursor: pointer;    }    input[type=range]::-moz-range-track {      background-color: #F4F4F4;      border: 0;      width: 100%;      height: 6px;      cursor: pointer;      border-radius: 3px    }    input[type="range"]::-moz-range-progress {      background-color: #0075b0;      height: 6px;      border-radius: 3px    }    input[type="range"]::-ms-thumb {      width: 16px;      height: 16px;      background: #ffffff;      border: 3px solid #0075b0;      border-radius: 50%;      cursor: pointer;      margin-top: 0px;      /*Needed to keep the Edge thumb centred*/    }    input[type="range"]::-ms-track {      background: transparent;      border-color: transparent;      border-width: 4px 0;      color: transparent;      width: 100%;      height: 6px;      cursor: pointer;      border-radius: 3px    }    input[type="range"]::-ms-fill-lower {      background-color: #0075b0;      border: 0;      border-radius: 3px    }    input[type="range"]::-ms-fill-upper {      background-color: #F4F4F4;      border: 0;      border-radius: 3px    }    input[type="range"]:focus::-ms-fill-lower {      background-color: #0075b0;      border-radius: 3px    }    input[type="range"]:focus::-ms-fill-upper {      background-color: #F4F4F4;      border-radius: 3px    }    @supports (-ms-ime-align:auto) {      input[type=range] {        margin: 0;      }    }
<input type="range">


Read in browser »
share on Twitter

How to focusout an html array?

By tarakei on Jun 29, 2021 03:05 am

I want to add a focusout function to this html array.

Array:

echo '<td><input name="codemf" type="text" id ="codemf'.$indexofid.'" class="form-control form-control-sm" required></td>';  

Focusout function:

$('#codemf').focusout(function ()                  {                      if ($('#codemf').val() !== '')                      {                          $.get("req.php?mf=", function (data)                          {                              var is=0;                              var info = data.split('|');                              for(let i=0;i<info.length;++i)                              {                                  if($('#codemf').val()==info[i])                                  {                                        is=1;                                  }                              }                              if(is==0)                              {                                  $('#codemf').addClass("is-invalid");                                  $('#command').attr('disabled', true);                              } else {                                  $('#codemf').removeClass("is-invalid");                                  $('#command').attr('disabled', false);                              }                          });                      }                      else                      {                          $('#codemf').removeClass("is-invalid");                          $('#command').attr('disabled', false);                      }                  });  

I tried a lot of things but nothing works... If anyone has an idea, it would save me.


Read in browser »
share on Twitter

Select all indexes in database custom table, aggregate data based on the index in Oracle

By Marco Carolo on Jun 29, 2021 02:49 am

I'm using Oracle as database for a CRM.

I was requested to generate a complete list of indexes based on certain condition for the table names to be checked.

I've found and elaborated the following query:

select ind.index_name,         ind_col.column_name,         tab_cols.DATA_DEFAULT,         ind.table_name  from sys.all_indexes ind  inner join sys.all_ind_columns ind_col on      ind.owner = ind_col.index_owner and ind.index_name = ind_col.index_name  left outer join sys.DBA_TAB_COLS tab_cols on      ind_col.COLUMN_NAME = tab_cols.COLUMN_NAME      and INDEX_TYPE='FUNCTION-BASED NORMAL'      and tab_cols.OWNER = ind.owner and ind_col.COLUMN_NAME like 'SYS_NC%'  where [list of custom conditions]  order by INDEX_NAME;  

This query is generating something like 2.600 rows, most of them are repeated values of INDEX_NAME, since if the index has more than one parameter, I've the field repeated.

What I want to do is the following:

  1. Group all the values of one index as defined inside ind_col.column_name inside one single column, comma separated
  2. (if possible) have the value of tab_cols.DATA_DEFAULT (long) instead of ind_col.column_name in case the first value is not null.

Can I have you help about this?

Thanks a lot for any reply!


Read in browser »
share on Twitter

While sending AT commands to ESP8266 (esp-01) I get ERROR

By john7 on Jun 29, 2021 01:30 am

Some of it is OK

ATE0  OK    AT+GMR  AT version:0.21.0.0  SDK version:0.9.5  OK  

But most of the commands return ERROR. For example

AT+CWMODE_CUR=?  ERROR  

What can be a problem?


Read in browser »
share on Twitter

Can we change the Java version in wso2/wso2mi Docker image?

By Subodh Joshi on Jun 29, 2021 12:31 am

In wso2/wso2mi Docker image currently using ENV JAVA_VERSION=jdk-11.0.10+9 ,Is this possible to Downgrade or upgrade this java version ?

Why i am looking this ?

I am facing a weird problem with ENV JAVA_VERSION=jdk-11.0.10+9 in my application our SOAP web services throwing

{      "httpCode": 502,      "userMessage": "Invalid response from remote host",      "developerMessage": "The creation time is ahead of the current time.",      "details": {          "detail": "wsse:InvalidSecurityToken"      },      "errorCode": "S:Sender",      "timeStamp": 1624875331996,      "transactionId": "CIP-urn:uuid:b813c0a1-da6a-4dfe-8647-7237f39de941"  }  

While same code is working fine when we are using lower[1.2.0-centos7] version of wso2/wso2mi so i want to test wso2/wso2mi with different java version .

Not sure if this code doing some magic for different java version .

 private void addSecurityHeader(MessageContext mc, String username, String password) throws Exception {          SecureRandom rand = SecureRandom.getInstance("SHA1PRNG");          rand.setSeed(System.currentTimeMillis());          byte nonceBytes = new byte[16];          rand.nextBytes(nonceBytes);            String createdDate = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("UTC")).format(Instant.now());          byte createdDateBytes = createdDate.getBytes();            ByteArrayOutputStream stream = new ByteArrayOutputStream();          stream.write(nonceBytes);          stream.write(createdDateBytes);          stream.write(password.getBytes(StandardCharsets.UTF_8));          MessageDigest md = MessageDigest.getInstance("SHA-1");          byte passwordDigest = md.digest(stream.toByteArray());            SOAPEnvelope envelope = mc.getEnvelope();          OMFactory factory = envelope.getOMFactory();            OMNamespace securityNamespace = factory.createOMNamespace(              "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "wsse");            SOAPHeaderBlock securityBlock = envelope.getHeader().addHeaderBlock("Security", securityNamespace);          securityBlock.setMustUnderstand(true);            OMElement usernameTokenElement = factory.createOMElement("UsernameToken", securityNamespace);          OMNamespace namespaceWSU = factory.createOMNamespace(              "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "wsu");            OMAttribute attribute = factory.createOMAttribute("Id", namespaceWSU, "SOAI_req_SOAI");          usernameTokenElement.addAttribute(attribute);          securityBlock.addChild(usernameTokenElement);            OMElement usernameElement = factory.createOMElement("Username", securityNamespace);          usernameElement.setText(username);          usernameTokenElement.addChild(usernameElement);            OMElement passwordElement = factory.createOMElement("Password", securityNamespace);            attribute = factory.createOMAttribute("Type", null,              "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest");          passwordElement.addAttribute(attribute);          passwordElement.setText(new String(Base64.encodeBase64(passwordDigest), StandardCharsets.UTF_8));          usernameTokenElement.addChild(passwordElement);            OMElement nonceElement = factory.createOMElement("Nonce", securityNamespace);          attribute = factory.createOMAttribute("EncodingType", null,              "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary");          nonceElement.addAttribute(attribute);          nonceElement.setText(new String(Base64.encodeBase64(nonceBytes), StandardCharsets.UTF_8));          usernameTokenElement.addChild(nonceElement);            OMElement createdElement = factory.createOMElement("Created", securityNamespace);          createdElement.setText(createdDate);          usernameTokenElement.addChild(createdElement);      }  

Read in browser »
share on Twitter

Two Y-Axes for Violin Plots? - R

By user16337533 on Jun 28, 2021 05:36 pm

I am trying to visualize my data of biomass for various size classes at different sampling depths - depths are used multiple times for each size class.

I would like to use a violin plot or something similar, as I think it would be good to show the average Biomass at varying depths. However, I am unsure if that is possible with two continuous variables (depth, biomass).

Is there a possible way to visualize this data in violin plots? I have been trying to modify the below chunk of code with no luck. I have attempted grouping by SizeBin, coloring by SizeBin, etc. Any insight on code or alternatives is appreciated.

             y=Biomass,               fill=SizeBin)) + geom_violin()  
Depth Biomass SizeBin
1.5 6.86 A
2.5 3.51 A
2.5 2.45 A
1.5 0.80 B
2.5 1.34 B

Read in browser »
share on Twitter

spring boot jpa is updating my database when I am using find by query

By Jay Prakash on Jun 28, 2021 02:10 pm

Here is the code for all 3 entities. Whenever I make repo.findByUserJavaIDAndCohortIdAndStatusInOrderByLastUpdatedDesc() This updates the last_updated column in my database as well.

public abstract class BaseEntity     {            @Id          @GeneratedValue(strategy = GenerationType.IDENTITY)          @Column(unique = true)          protected Long id;            @Column(unique = true, updatable = false, nullable = false)          protected UUID uuid;            @Builder.Default          @Column(name = "is_deleted", nullable = false, columnDefinition = "bool default false")          @JsonIgnore          protected Boolean isDeleted=false;            @Column(name = "created", nullable = false, updatable = false)          @CreationTimestamp          @JsonIgnore          @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)          protected Date created;            @Column(name = "last_updated", nullable = false)          @UpdateTimestamp          @JsonIgnore          @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)          protected Date lastUpdated;            public BaseEntity() {              this.uuid = UUID.randomUUID();              this.isDeleted = false;          }      }          @Table(name = "task")      public class Task extends BaseEntity {            @NotNull          @Column(nullable = false)          private String title;            @NotNull          @Column(nullable = false)          @Enumerated(EnumType.STRING)          private Source source;            @NotNull          @Column(name="remote_id", nullable = false)          @JsonIgnore          private String remoteId;            @NotNull          @Column(name = "cohort_id", nullable = false)          private Long cohortId;            @Builder.Default          @Column(nullable = false)          @Enumerated(EnumType.STRING)          @NotNull          private TaskState state = TaskState.UPCOMING;            @Column(nullable = false)          @Enumerated(EnumType.STRING)          @NotNull          private EventType type;            @NotNull          @Length(max = 5000)          @Column(nullable = false, columnDefinition ="LONGTEXT" )          private String agenda;            @Type(type = "TaskExtraDataType")          @Column(name = "extra_data", columnDefinition = "jsonb")          private TaskExtraData extraData;            @Column(name = "schedule_time")          @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)          protected Date scheduleTime;            @Column(name = "start_time")          @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)          protected Date startTime;            @Column(name = "end_time")          @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)          protected Date endTime;        }          @Table(name = "user_task",      public class UserTask extends BaseEntity {            @ManyToOne          @JoinColumn(name = "task_id")          Task task;            @NotNull          @Column(name = "user_java_id", nullable = false)          Long userJavaID;            @NotNull          @Column(name = "cohort_id", nullable = false)          private Long cohortId;            @Builder.Default          @Column(nullable = false)          @Enumerated(EnumType.STRING)          UserTaskStatus status = UserTaskStatus.PENDING;            @Type(type = "UserTaskExtraDataType")          @Column(name = "extra_data", columnDefinition = "jsonb")          private UserTaskExtraData userTaskExtraData;      }        public interface UserTaskRepository extends JpaRepository<UserTask, Long> {          List<UserTask> findByUserJavaIDAndCohortIdAndStatusInOrderByLastUpdatedDesc(long userJavaId, long cohortId, List<UserTaskStatus> status);        }  

Read in browser »
share on Twitter




Recent Articles:

Why does webpack compile successfully but my source code does not exist in the compiled output?
Connecting Frontend application with Backend via AWS ECS Service Discovery
Ubuntu 18.04 on WSL2: "Logon failure: the user has not been granted the requested logon type at this computer."
Error in spring application context schema
Twitter
Facebook
Website
Copyright © 2021 reader, All rights reserved.
You are receiving this email because you opted in via our website.

Our mailing address is:
reader
88 CELICA STREET
Davao 8000
Philippines

Add us to your address book


Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list.

Email Marketing Powered by Mailchimp

No comments:

Post a Comment