Monday, March 28, 2022

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


How to write mysql query, where i need to put order by before group by

Posted: 27 Mar 2022 12:25 AM PDT

//I know that there are questions like this before, but I can't get this to work

So, I have 3 tables, seats(id, type_id, hall_id), seat_types(id(PK), type_name) and taken_seats(screening_id(PK), seat_id(PK), type_id). I need to write a query where I pass a screening ID and hall ID, and get back seat_id,type_name, and isTaken (if seat is taken or not). The problem I have is that I have a query that return a duplicate if I do ORDER BY, but if I do GROUP BY I don't get correct data back because I didn't ordered it.

My query:

USE cinema_app;  SELECT       seats.id,      seat_types.type_name,      taken_seats.screening_id,      CASE      WHEN taken_seats.screening_id = 3 THEN 'ATaken'          ELSE 'Not taken'      END AS isTaken  FROM seats  JOIN seat_types ON seats.type_id = seat_types.id  LEFT JOIN taken_seats ON taken_seats.seat_id = seats.id  WHERE seats.hall_id = 2  ORDER BY seats.id, isTaken;  

Table I'm getting back: https://imgur.com/tnmCIHi

I tried to add GROUP BY and it didn't work because i didn't get ordered first. Also I tried writing a subquery but I didn't succeed in that.

Faster algorithm for lexicographic comparison of DNA strings

Posted: 27 Mar 2022 12:25 AM PDT

I'm trying to find a faster way to do the following:

Given a list of DNA strings x = ([s1, s2, s3, s4...]) (where the strings can only consist of the letters 'A', 'T', 'C', and 'G') and a list of index pairs y = ([[i, j], [i, j], [i, j]....]) find a function that returns whether or not x[i] is lexicographically less than x[j] for each [i, j] index pair. That is, find an algorithm that does the same thing as:

def compare(x, y):     return [x[i]<x[j] for i, j in y]  

but with better time complexity than the example provided. Moreover, we should assume that if len(x[i]) < len(x[j]), then x[i]<x[j] evaluates to True.

Here's an example of what the algorithm takes in as input and what it provides as output:

>>> compare(x=["B", "BB", "BC"], y=[(0, 1), (1, 2), (2, 0)])  [True, True, False]  

'B' < 'BB' : True, because len('B') < len('BB')

'BB' < 'BC' : True because 'BB' comes before 'BC' in lexicographic order (the first position in both strings are the same, thus we need to compare second positions of both strings)

'BC' < 'B' : False because len('BC') > len('B')

I've already tried utilizing a tester function as follows:

def tester_2(x, y):      return [True if len(x[i])<len(x[j]) else False if len(x[i])>len(x[j]) else x[i]<x[j] for i, j in y]    

but for whatever reason, it runs slower than the reference example that we need to be faster than.

Any help would be greatly appreciated!

I'm wondering if there is a way to access Access 2007/97 dbs using C (not C++, or C#)?

Posted: 27 Mar 2022 12:25 AM PDT

I'm asking as I have been scouring the internet (but Google isn't as useful as it used to be) for any information concerning accessing access databases only using C and I can't find a single useful article, not a single useful reference... etc.

If anyone has any information regarding implementing a simple, connect, querying of a recordset and close that's all i need.

It's deeply frustrating that Microsoft no longer keeps most of their documentation for it, and we are working with legacy so it's not by choice that I need this.

how to do a count query when using rust diesel

Posted: 27 Mar 2022 12:25 AM PDT

I am doing a count query using rust 1.59.0 diesel diesel = { version = "1.4.8", features = ["postgres","64-column-tables","chrono"] } following this document, this is my code looks like right now:

use diesel::{ExpressionMethods, QueryDsl, QueryResult, RunQueryDsl};  use diesel::dsl::count;  use rocket::serde::json::Json;  use rust_wheel::config::db::config;    pub fn channel_fav_count(req_channel_id: &i64) -> i32 {      use crate::model::diesel::dolphin::dolphin_schema::article_favorites::dsl::*;      let connection = config::establish_connection();      let query = article_favorites          .filter(channel_id.eq(req_channel_id));      let query_result = query.select(count(id)).first(&connection);      return query_result.unwrap_or(0);  }  

when I compile the code, shows error like this:

error[E0277]: the trait bound `i32: FromSql<BigInt, Pg>` is not satisfied      --> src/service/app/cruise/article/article_fav_service.rs:11:48       |  11   |     let query_result = query.select(count(id)).first(&connection);       |                                                ^^^^^ the trait `FromSql<BigInt, Pg>` is not implemented for `i32`  

why did this happen? what should I do to fix this problem?

Undefined variable after using isset()function in PHP

Posted: 27 Mar 2022 12:24 AM PDT

I facing error undefined index:facilityId before using isset()function. But after using isset() function it shows error undefined variable:facilityId

function updateFacilityInformation()  {            $con = mysqli_connect("localhost", "xxxxxx", "xxxxxx", "xxxxxx");      if (mysqli_connect_errno()) {          echo "Failed to connect to MySQL: " . mysqli_connect_error();          exit;      }            if(isset($_POST['facilityId'])) {          $facilityId = $_POST['facilityId'];      }      $name = $_POST['name'];      $category = $_POST['category'];      $ratePerDay = $_POST['ratePerDay'];            $sql = 'update facility set ';          $sql .= 'name= "' . $name . '",model="' . $category . '", ratePerDay="' . $ratePerDay . '"';          $sql .= 'where facilityId = "' . $facilityId . '"';          $qry = mysqli_query($con, $sql);          return $qry;    }  

Please help me to solve this problem. Thank You

Collision detection and overlapping detection in same node? [part 2]

Posted: 27 Mar 2022 12:23 AM PDT

A continuation of the previous question

How exactly do we detect collision from body_set_force_integration_callback?

How to get rows from a dataframe that are not joined when merging with other dataframe in pandas

Posted: 27 Mar 2022 12:23 AM PDT

I am trying to make 2 new dataframes by using 2 given dataframe objects:

DF1 = id  feature_text    length         1  "example text"  12         2  "example text2" 13         ....         ....    DF2 = id  case_num         3         0         ....         ....  

As you could see, both df1 and df2 have column called "id". However, the df1 has all id values, where df2 only has some of them. I mean, df1 has 3200 rows, where each row has a unique id value (1~3200), however, df2 has only some of them (i.e. id=[3,7,20,...]).

What I want to do is 1) get a merged dataframe which contains all rows that have the id values which are included in both df1 and df2, and 2) get a dataframe, which contains the rows in the df1, which have id values that are not included in the df2.

I was able to find a solution for 1), however, have no idea how to do 2).

Thanks.

how to set up database

Posted: 27 Mar 2022 12:23 AM PDT

I'm creating an app that tracks attendance of players in amateur football teams. And I'm just not sure how to set up the database. A bit of info: every user has a team and should only see the events within his team per season.

These are the main things:

  • Users

  • Events

  • User stats (for later)

  • Events

    • Training / match / social
    • Date
    • Time
    • Subject / opponent
    • Attendance

Main questions:

  • Do I make an event table per team per season? Or do I put all events in one big table for every user?
  • What is the best way to handle the attendance? They should be able to choose from
    • Present
    • absent
    • Fan

Thanks in advance!

MapStruct mapping OneToMany collection - not create entity from null id

Posted: 27 Mar 2022 12:22 AM PDT

I have Student class with @OneToMany relationship to classes like below

public class Student {        @Id      @GeneratedValue      private Long id;        //fields        @ManyToOne(fetch=FetchType.EAGER)      @JoinColumn(name = "class_id")      private Class classEntity;  

And class entity:

public class Class {        @Id      @GeneratedValue      private Long id;        //fields           @EqualsAndHashCode.Exclude      @ToString.Exclude      @OneToMany(mappedBy = "classEntity", cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)      private Set<Student> students;  

I'm using MapStruct to convert dto to entity and entity to dto:

StudentMapper.java

@Mapper(componentModel = "spring", uses = {ClassMapper.class})  public interface StudentMapper extends EntityMapper<StudentDTO, Student> {        @Mapping(source = "classEntity.id", target="classId")      @Mapping(source = "classEntity.name", target="className")      StudentDTO toDto(Student student);        @Mapping(source = "classId", target="classEntity.id")      Student toEntity(StudentDTO studentDTO);          default Student fromId(Long id) {          if (id == null) {              return null;          }          Student entity = new Student();          entity.setId(id);          return entity;      }        default Long toId(Student student) {          if (student == null){              return null;          }          return student.getId();      }  

ClassMapper.java

@Mapper(componentModel = "spring")  public interface ClassMapper extends EntityMapper<ClassDTO, Class> {        @Mapping(target = "educatorId" , source = "educator.id")      ClassDTO toDto(Class classEntity);        @Mapping(target = "educator.id" , source = "educatorId")      Class toEntity(ClassDTO classDTO);        default Class fromId(Long id) {          if (id == null) {              return null;          }          Class entity = new Class();          entity.setId(id);          return entity;      }        default Long toId(Class classEntity) {          if (classEntity == null){              return null;          }          return classEntity.getId();      }    }  

These mappers extends simple EntityMapper interface

public interface EntityMapper <D, E> {        E toEntity (D dto);        D toDto(E entity);        List <E> toEntity (List<D> dtoList);        List<D> toDto (List<E> entityList);        Set <E> toEntity (Set<D> dtoSet);        Set<D> toDto (Set<E> entitySet);    

Generated StudentMapperImpl.class

public Student toEntity(StudentDTO studentDTO) {          if ( studentDTO == null ) {              return null;          }            StudentBuilder student = Student.builder();            student.classEntity( studentDTOToClass( studentDTO ) );          //fields          return student.build();      }     protected Class studentDTOToClass(StudentDTO studentDTO) {          if ( studentDTO == null ) {              return null;          }            Class class1 = new Class();            class1.setId( studentDTO.getClassId() );            return class1;      }  

Everything works fine when I'm trying to convert studentDTO to student entity with filled classId in studentDTO class. The problem starts when classId in studentDTO is null. Then mapper create new Class Objects and saving it into database....

And don't want this because not every student will have assigned class. I've tried everything with CascadeType in Student.class but I think the problem is in my MapStruct mapper.

Eventually I can write my own mappers without mapstruct but I'd rather avoid it. Please help me.

difference between pointing to the Strings and the reference of the String of the vector while iterating through the vector

Posted: 27 Mar 2022 12:21 AM PDT

let mut args: Vec<String>=env::args().collect();  let mut argument=String::new();  for indx in 0..args.len(){      argument+=args[indx]; //line no. 4    }  

line no. 4 shows error to use &args[indx] instead of args[indx]. please help me understand the reason behind it.

How to debug html/client side js with node server running - breakpoints greyed out

Posted: 27 Mar 2022 12:25 AM PDT

I've got a small app that uses Express. I want to debug some client side js code that calls my backend, but it seems that when I try to debug my app using localhost:8888, all my client side js breakpoints go grey.

I'm speculating it's something with the configuration, but I don't really know.

I'm currently debugging in VSCode using ctrl + shift + p -> debug open link.

With my server running, I try to debug "http://127.0.0.1:8888/frontend/frontend_3_26/web-api-auth-examples/authorization_code/public/index.html"

which hits my breakpoints in js.

But, when I try to debug "http://localhost:8888", my breakpoints are greyed out and my breakpoints don't get hit.

Not sure if this will help, but attached is what I see in Chrome developer tools.

So, maybe it's an issue that localhost can't locate the right files? I've been messing around with launch settings, but I'm lost.

Could someone please help me out here? I'd greatly appreciate it.

Thanks!

https://i.stack.imgur.com/Pkzee.png

Oracle duplicate record deletion

Posted: 27 Mar 2022 12:22 AM PDT

I have a table with main fields

ArticleNo,Barcode,UnitOfMeasure etc

How i can remove the duplicate records from the table if articleno and barcode and unitofmeasure are same

Trying to remove the duplicate records from oracle table

TFlite model.process() sometimes needs input data TensorImage and sometimes TensorBuffer? Are there two different TFlite models?

Posted: 27 Mar 2022 12:23 AM PDT

Some TFlite models model.process() seems to need TensorBuffer and other rather needs TensorImage . I don't know why?

First, I took a regular TensorFlow / Keras that was saved using:

model.save(keras_model_path,      include_optimizer=True,       save_format='tf')  

Then I compress and quantize this Keras model (300 MB) to a TFlite format using:

converter.optimizations = [tf.lite.Optimize.DEFAULT]  converter.representative_dataset = tf.keras.utils.image_dataset_from_directory(dir_val,      batch_size=batch_size,      image_size=(150,150))  converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]  tflite_model = converter.convert()  with open(tflite_model_path, 'wb') as file:      file.write(tflite_model)  

I've got a lot smaller TFlite model (40 Mo) which neds TensorBuffer <input_data> when calling model.process(<input_data>)

Second, I've trained and saved as TFLite model using TensorFlow Lite Model Maker and now I've got a TFLite model that needs TensorImage <input_data> when calling model.process(<input_data>).

Are there two different TFlite models depending on how you build and train it?

Remove the second number from each string in array

Posted: 27 Mar 2022 12:22 AM PDT

I have an array:

[    '9.18,50',  '108.78,5',    '80,2',     '9.18,10',    '108.78,8', '19.12,10',    '91.16,5',  '19.12,20'  ]  

and I would like to map through and create a new variable that will have only the first number in each string. Expected output would be:

[    '9.18',  '108.78',    '80',     '9.18',    '108.78', '19.12',    '91.16',  '19.12'  ]  

Why can't my phone scan the QR code generated by Whatsapp API

Posted: 27 Mar 2022 12:23 AM PDT

there are lots of advices on QR codes but I'm unable to find answers to my own problem. So I'm posting this question.

I'm trying to use Whatsapp-web.js, a WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app. Below is the code.

const fs = require('fs');  const { Client } = require('whatsapp-web.js');  const qrcode = require('qrcode-terminal');    // Path where the session data will be stored  const SESSION_FILE_PATH = './session.json';    // Load the session data if it has been previously saved  let sessionData;  if(fs.existsSync(SESSION_FILE_PATH)) {      sessionData = require(SESSION_FILE_PATH);  }    // Use the saved values  const client = new Client({      session: sessionData  });    // Save session values to the file upon successful auth  client.on('authenticated', (session) => {      sessionData = session;      fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), (err) => {          if (err) {              console.error(err);          }      });  });    client.on('qr', qr => {      console.log(qr);      qrcode.generate(qr, {small: true});  });    client.on('ready', () => {      console.log('Client is ready!');            // Number where you want to send the message.      const number = "+911234567890";            // Your message.      const text = "Hey john";            // Getting chatId from the number.       // we have to delete "+" from the beginning and add "@c.us" at the end of the number.      const chatId = number.substring(1) + "@c.us";           // Sending message.      client.sendMessage(chatId, text);  });    client.on('message', message => {      console.log(message.body);  });    client.initialize();  

The problem is that the QR code generated by the Whatsapp client is not recognized by my phone. I wondered if the QR image generator was wrong, so I logged the QR string and pasted it into a QR image generating tool to see if the images were identical. To me the images looked different. But I don't know if that's the problem at all.

I wish to know if there is an additional step I have overlooked before I can scan the QR image with my phone. Currently, I cannot login because phone doesn't recognize the QR image.

Edit

The QR code string is: 1@vFeiIVji3KTIwmxuzrWThEtLYAx1toBQ+gqPI/tpYwg7Nswvybj6z0XqIcKWAkIoQlaIG6+qAy3yfw==,EMaQav3hXijRWQ0Fo54Vi7xINEhOa8ffU1i5tqAzK1s=,cI/NK6CodxcSeyf9niE3Cg==

The QR code image generated by the code is: https://i.stack.imgur.com/LHU1N.png

How to translate values in a column to "yes" and "no" values for a multiple regression in R

Posted: 27 Mar 2022 12:25 AM PDT

I am doing a multiple linear regression with the following reproducible dataset (this is a small sample of my data):

structure(list(age = c(62.84998, 60.33899, 52.74698, 42.38498,    79.88495, 93.01599, 62.37097, 86.83899, 85.65594, 42.25897),        death = c(0, 1, 1, 1, 0, 1, 1, 1, 1, 1), sex = c("male",        "female", "female", "female", "female", "male", "male", "male",        "male", "female"), hospdead = c(0, 1, 0, 0, 0, 1, 0, 0, 0,        0), slos = c(5, 4, 17, 3, 16, 4, 9, 7, 12, 8), d.time = c(2029,        4, 47, 133, 2029, 4, 659, 142, 63, 370), dzgroup = c("Lung Cancer",        "Cirrhosis", "Cirrhosis", "Lung Cancer", "ARF/MOSF w/Sepsis",        "Coma", "CHF", "CHF", "Lung Cancer", "Colon Cancer"), dzclass = c("Cancer",        "COPD/CHF/Cirrhosis", "COPD/CHF/Cirrhosis", "Cancer", "ARF/MOSF",        "Coma", "COPD/CHF/Cirrhosis", "COPD/CHF/Cirrhosis", "Cancer",        "Cancer"), num.co = c(0, 2, 2, 2, 1, 1, 1, 3, 2, 0), edu = c(11,        12, 12, 11, NA, 14, 14, NA, 12, 11), income = c("$11-$25k",        "$11-$25k", "under $11k", "under $11k", NA, NA, "$25-$50k",        NA, NA, "$25-$50k"), scoma = c(0, 44, 0, 0, 26, 55, 0, 26,        26, 0), charges = c(9715, 34496, 41094, 3075, 50127, 6884,        30460, 30460, NA, 9914), totcst = c(NA_real_, NA_real_, NA_real_,        NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,        NA_real_), totmcst = c(NA_real_, NA_real_, NA_real_, NA_real_,        NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_       ), avtisst = c(7, 29, 13, 7, 18.666656, 5, 8, 6.5, 8.5, 8       ), race = c("other", "white", "white", "white", "white",        "white", "white", "white", "black", "hispanic"), sps = c(33.8984375,        52.6953125, 20.5, 20.0976562, 23.5, 19.3984375, 17.296875,        21.5976562, 15.8984375, 2.2998047), aps = c(20, 74, 45, 19,        30, 27, 46, 53, 17, 9), surv2m = c(0.262939453, 0.0009999275,        0.790893555, 0.698974609, 0.634887695, 0.284973145, 0.892944336,        0.670898438, 0.570922852, 0.952880859), surv6m = c(0.0369949341,        0, 0.664916992, 0.411987305, 0.532958984, 0.214996338, 0.820922852,        0.498962402, 0.24899292, 0.887939453), hday = c(1, 3, 4,        1, 3, 1, 1, 1, 1, 1), diabetes = c(0, 0, 0, 0, 0, 0, 0, 1,        0, 0), dementia = c(0, 0, 0, 0, 0, 0, 0, 0, 1, 0), ca = c("metastatic",        "no", "no", "metastatic", "no", "no", "no", "no", "metastatic",        "metastatic"), prg2m = c(0.5, 0, 0.75, 0.899999619, 0.899999619,        0, NA, 0.799999714, 0.049999982, NA), prg6m = c(0.25, 0,        0.5, 0.5, 0.8999996, 0, 0.6999998, 0.3999999, 0.0001249999,        NA), dnr = c("no dnr", NA, "no dnr", "no dnr", "no dnr",        "no dnr", "no dnr", "no dnr", "dnr after sadm", "no dnr"),        dnrday = c(5, NA, 17, 3, 16, 4, 9, 7, 2, 8), meanbp = c(97,        43, 70, 75, 59, 110, 78, 72, 97, 84), wblc = c(6, 17.0976562,        8.5, 9.09960938, 13.5, 10.3984375, 11.6992188, 13.5996094,        9.69921875, 11.2988281), hrt = c(69, 112, 88, 88, 112, 101,        120, 100, 56, 94), resp = c(22, 34, 28, 32, 20, 44, 28, 26,        20, 20), temp = c(36, 34.59375, 37.39844, 35, 37.89844, 38.39844,        37.39844, 37.59375, 36.59375, 38.19531), pafi = c(388, 98,        231.65625, NA, 173.3125, 266.625, 309.5, 404.75, 357.125,        NA), alb = c(1.7998047, NA, NA, NA, NA, NA, 4.7998047, NA,        NA, 4.6992188), bili = c(0.19998169, NA, 2.19970703, NA,        NA, NA, 0.39996338, NA, 0.39996338, 0.19998169), crea = c(1.19995117,        5.5, 2, 0.79992676, 0.79992676, 0.69995117, 1.59985352, 2,        1, 0.79992676), sod = c(141, 132, 134, 139, 143, 140, 132,        139, 143, 139), ph = c(7.459961, 7.25, 7.459961, NA, 7.509766,        7.65918, 7.479492, 7.509766, 7.449219, NA), glucose = c(NA_real_,        NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,        NA_real_, NA_real_, NA_real_), bun = c(NA_real_, NA_real_,        NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,        NA_real_, NA_real_), urine = c(NA_real_, NA_real_, NA_real_,        NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,        NA_real_), adlp = c(7, NA, 1, 0, NA, NA, 0, NA, NA, 0), adls = c(7,        1, 0, 0, 2, 1, 1, 0, 7, NA), sfdm2 = c(NA, "<2 mo. follow-up",        "<2 mo. follow-up", "no(M2 and SIP pres)", "no(M2 and SIP pres)",        "<2 mo. follow-up", "no(M2 and SIP pres)", NA, NA, NA), adlsc = c(7,        1, 0, 0, 2, 1, 1, 0, 7, 0.4947999)), row.names = c(NA, 10L   ), class = "data.frame")  

I have my formula for the regression here.

SB_xlsx13 = SB_xlsx13[!is.na(SB_xlsx13$dnrday), ]  SB_xlsx13 = SB_xlsx13[!is.na(SB_xlsx13$sps), ]  MLR_2 = lm(SB_xlsx13$hospdead ~ SB_xlsx13$dzclass_f + SB_xlsx13$age + SB_xlsx13$sex + SB_xlsx13$num.co + SB_xlsx13$sps)  summary(MLR_2)  ##   ## Call:  ## lm(formula = SB_xlsx13$hospdead ~ SB_xlsx13$dzclass_f + SB_xlsx13$age +   ##     SB_xlsx13$sex + SB_xlsx13$num.co + SB_xlsx13$sps)  ##   ## Residuals:  ##      Min       1Q   Median       3Q      Max   ## -1.26132 -0.25758 -0.08914  0.15412  1.14048   ##   ## Coefficients:  ##                                         Estimate Std. Error t value Pr(>|t|)  ## (Intercept)                           -0.3519553  0.0224017 -15.711  < 2e-16  ## SB_xlsx13$dzclass_fCancer             -0.0870012  0.0123327  -7.055 1.86e-12  ## SB_xlsx13$dzclass_fComa                0.2907825  0.0164644  17.661  < 2e-16  ## SB_xlsx13$dzclass_fCOPD/CHF/Cirrhosis -0.1378731  0.0104787 -13.157  < 2e-16  ## SB_xlsx13$age                          0.0027082  0.0002555  10.598  < 2e-16  ## SB_xlsx13$sexmale                      0.0022789  0.0079126   0.288    0.773  ## SB_xlsx13$num.co                       0.0028155  0.0032577   0.864    0.387  ## SB_xlsx13$sps                          0.0184986  0.0004393  42.105  < 2e-16  ##                                            ## (Intercept)                           ***  ## SB_xlsx13$dzclass_fCancer             ***  ## SB_xlsx13$dzclass_fComa               ***  ## SB_xlsx13$dzclass_fCOPD/CHF/Cirrhosis ***  ## SB_xlsx13$age                         ***  ## SB_xlsx13$sexmale                          ## SB_xlsx13$num.co                           ## SB_xlsx13$sps                         ***  ## ---  ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1  ##   ## Residual standard error: 0.3724 on 9067 degrees of freedom  ## Multiple R-squared:  0.2772, Adjusted R-squared:  0.2767   ## F-statistic: 496.8 on 7 and 9067 DF,  p-value: < 2.2e-16  

The regression comes out just fine; however, I want to add one more variable(s), which is dnr status at day three. If the value is 3 or less, there is a DNR and if the value is over 3, there is not a DNR. I previously subsetted these values for a previous task using this code:

YesDNR <- subset(SB_xlsx12, dnrday <= 3, na.rm=TRUE)  NoDNR <- subset(SB_xlsx12, dnrday > 3, na.rm=TRUE)  

This worked fine, but I can't really use these subsets in my regression model. I would assume to make the model work, I would need to translate every value of 3 or less (<=) in the "dnrday" column to "yes" and every value over 3 (>) to "no". Am I correct on this thinking, and if so, how would I accomplish changing those values.

How would I unzip a zip file in node [closed]

Posted: 27 Mar 2022 12:24 AM PDT

I would like to unzip a .zip file in node without any external libraries. How would i go about doing this?

I have tried using zlib but it returns incorrect header type

let zipfile = fs.readFileSync(fileinfomation.savelocation)     zlib.gunzipSync(zipfile)  

Edit I have also tried using

let zipfile = fs.readFileSync(fileinfomation.savelocation)     zlib.unzipSync(zipfile)  

And it returned i caused the following error Uncaught Error Error: incorrect header check

How to properly use inheritance and polymorphism - Queues implemented as arrays

Posted: 27 Mar 2022 12:25 AM PDT

I just needed a little help with inheritance and polymorphism. We're working on queues & stacks, and were asked to implement them as arrays so we understand them properly, instead of just using Java's methods.

The task is to implement a Shuffling and Circular queue as subclasses of a general Queue class.

I first implemented just the shuffling queue as a class of its own, and got it working properly. Here's the first section of code:

public class myQueue  {      //class fields      private Object[] queue;       private int rear, front, maxSize;        public static final int DefaultCap = 100;         //default constructor      public myQueue()      {          maxSize = DefaultCap;           queue = new Object[DefaultCap];           rear = 0;          front = 0;       }        //alternate Constructor      public myQueue(int maxCapacity)      {          if(maxCapacity < 0)          {              throw new IllegalArgumentException("Capacity cannot be negative");          }          else          {              queue = new Object[maxCapacity];              maxSize = maxCapacity;              rear = 0;              front = 0;           }      }  

I also have methods in there like enqueue() and dequeue() etc.

I understand how the above works, the problem is now implementing the Shuffling and Circular queues separately as sub-classes. I know they will both inherit "extends" from this general class, and can have their own methods, but I'm stuck in how to implement it.

Can't quite wrap my head around how I'm going to use the parameters like rear, front, capacity. Do they need to be public?

At the moment, I've got:

public class ShufflingQueue extends MyQueue   {        public ShufflingQueue(int Capacity)      {          super(Capacity);       }            public void enqueue(Object n)      {          super.enqueue(n);      }        public void dequeue()      {          super.dequeue();      }        public int getSize()      {          return super.getSize();       }  }  

At the moment, the above is fine and it works as I expect it to. However, this is because I still have enqueue() and dequeue() as part of the parent class. I'm supposed to change it so that my shuffling queue and circular queue have different methods for enqueue and dequeue. Not sure how I would go about this, do I need new classfields for rear, front and capacity in my subclasses as well?

Any help would be greatly appreciated, and I apologise for any problem with formatting, tags or anything regarding my question; I'm only just starting to use stack overflow.

Thank You!

Netfilter Kernel module doesn't get the ftp packets' data

Posted: 27 Mar 2022 12:25 AM PDT

Netfilter Kernel module doesn't get the ftp packets' data

Question

I've been trying to write a kernel module to read outgoing ftp packets' username , passwrod and cmd by netfilter.When I test my code ,I find the ftp packets' length is right,but all the data I get is 0x00 when check kernel module's output.

Code

Here is my code. And I wirte a pkt_hex_dump functioin to dump all my packets's bytes above the Internet layer(Include Internet layer) accroding to this Printing sk_buff data:

/* Sample code to install a Netfilter hook function */    #include <linux/module.h>  #include <linux/kernel.h>  #include <linux/skbuff.h>  #include <linux/in.h>  #include <linux/ip.h>  #include <linux/tcp.h>  #include <linux/icmp.h>  #include <linux/netdevice.h>  #include <linux/netfilter.h>  #include <linux/netfilter_ipv4.h>  #include <linux/if_arp.h>  #include <linux/if_ether.h>  #include <linux/if_packet.h>    MODULE_LICENSE("MIT");  MODULE_AUTHOR("1933");  MODULE_DESCRIPTION("An net sniff module for demonstration");  MODULE_VERSION("1.0");    /* Used to describe our Netfilter hooks */  static struct nf_hook_ops post_hook;    /* THESE values are used to keep the USERname and PASSword until   * they are queried. Only one USER/PASS pair will be held at one   * time   */    static char *username = NULL;  static char *password = NULL;  static unsigned short src_port = 0;   static int  have_pair = 0;   /* Marks if we already have a pair */    /* dump packet's data */  void pkt_hex_dump(struct sk_buff *skb){      size_t len;      int rowsize = 16;      int i, l, linelen, remaining;      int li = 0;      uint8_t *data, ch;       struct iphdr *ip = (struct iphdr *)skb_network_header(skb);        printk("Packet hex dump:\n");      data = (uint8_t *) skb_network_header(skb);        len=ntohs(ip->tot_len);        remaining = len;      for (i = 0; i < len; i += rowsize) {          printk("%06d\t", li);          linelen = min(remaining, rowsize);          remaining -= rowsize;          for (l = 0; l < linelen; l++) {              ch = data[l];              printk(KERN_CONT "%02X ", (uint32_t) ch);          }          data += linelen;          li += 10;             printk(KERN_CONT "\n");      }  }    /* This is the hook function itself */  unsigned int watch_out(void *priv,          struct sk_buff *skb,          const struct nf_hook_state *state)  {      struct iphdr *ip = NULL;      struct tcphdr *tcp = NULL;      unsigned char *data=NULL;        ip = (struct iphdr *)skb_network_header(skb);      if (ip->protocol != IPPROTO_TCP){          return NF_ACCEPT;      }        tcp = (struct tcphdr *)skb_transport_header(skb);        /* Now check to see if it's an FTP packet */      if (tcp->dest!= htons(21)){          return NF_ACCEPT;          }            pkt_hex_dump(skb);    /* Parse the FTP packet for relevant information if we don't already     * have a username and password pair. */        printk("hex : data[0-3] = 0x%02x%02x%02x%02x\n", data[0], data[1], data[2], data[3]);      printk("char: data[0-3] = %c%c%c%c\n", data[0], data[1], data[2], data[3]);      printk("--------------- findpkt_iwant ------------------\n");      return NF_ACCEPT;  }    /* Initialisation routine */  int init_module(){      /* Fill in our hook structure */      post_hook.hook = watch_out;         /* Handler function */      post_hook.hooknum  = NF_INET_POST_ROUTING;       post_hook.pf       = AF_INET;      post_hook.priority = NF_IP_PRI_FIRST;   /* Make our function first */        nf_register_net_hook(&init_net,&post_hook);        // Debug      printk("HELLO:  this is hello module speaking\n");      return 0;  }    /* Cleanup routine */  void cleanup_module(){      printk("HELLO : Goodbye!\n");      nf_unregister_net_hook(&init_net,&post_hook);  }  

Enviroment

  • Linux 5.13.0-37-generic x86_64 GNU/Linux
  • Ubuntu 20.04.4 LTS
  • Makefile:
    obj-m+=NetKernal.o    all:      make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules  

The Kernel module's Output and the Wireshark' capture:

  • This is the whole demsg output when I connected to ftp server and inputed my username and password on my Local area network.

  • And this is the whole wireshark packet after adding filter rule: tcp.dstport == 21.The Internet layer bytes start with the offset 0xe in the pcapng.

What wired is these ftp packets.Take the fourth packet for example.

  • This is Kernel module's log.(The /**/ which does not exist in the original data is comment I added for better understanding)
[ 4964.195893] Packet hex dump:  [ 4964.195904] 000000   45 10 00 42 D9 86 40 00 40 06 DD BC C0 A8 01 07     /* dump start from Internet layer */  [ 4964.195953] 000010   C0 A8 01 0B 93 E4 00 15 A5 63 17 A8 92 28 25 E3   [ 4964.195982] 000020   80 18 01 F6 83 97 00 00 01 01 08 0A C0 EC BD AB   [ 4964.196011] 000030   00 08 A7 2F 00 00 00 00 00 00 00 00 00 00 00 00     /* ftp content:0x00 */  [ 4964.196038] 000040   00 00   [ 4964.196045] hex : data[0-3] = 0x00000000  [ 4964.196049] char: data[0-3] =   [ 4964.196052] --------------- findpkt_iwant ------------------  
  • And this is the wireshark captured packet accroding to:
No.     Time           Source                Source Port Destination           Destination Port Protocol Length Info      132 14.635575358   192.168.1.7           37860       192.168.1.11          21               FTP      80     Request: USER ftpuser    Frame 132: 80 bytes on wire (640 bits), 80 bytes captured (640 bits) on interface wlp3s0, id 0  Ethernet II, Src: 58:a0:23:05:3b:2e, Dst: 1c:c1:de:65:e5:d4  Internet Protocol Version 4, Src: 192.168.1.7, Dst: 192.168.1.11  Transmission Control Protocol, Src Port: 37860, Dst Port: 21, Seq: 1, Ack: 28, Len: 14  File Transfer Protocol (FTP)  [Current working directory: ]    0000  1c c1 de 65 e5 d4 58 a0 23 05 3b 2e 08 00 45 10   ...e..X.#.;...E.    /* # Internet layer starts from the offset 0x0e */  0010  00 42 d9 86 40 00 40 06 dd bc c0 a8 01 07 c0 a8   .B..@.@.........  0020  01 0b 93 e4 00 15 a5 63 17 a8 92 28 25 e3 80 18   .......c...(%...  0030  01 f6 ab 01 00 00 01 01 08 0a c0 ec bd ab 00 08   ................  0040  a7 2f 55 53 45 52 20 66 74 70 75 73 65 72 0d 0a   ./USER ftpuser..  

As can be seen,the ftp packet's content is 0x00,but whole packet's length is right(above Internet layer).And all other ftp packets have same problem. It seems sk_buff don't get the ftp data.

As wireshark can get the correct packets, I don't think it's firewall's queseton.

My quesetons are :

  • Why ftp packets' content is all 0x00, packets' length is correct ?
  • Where is my ftp data in the struct sk_buff or it's stored in other place?
  • Is there anyone who have had the same problem?

Any help will be appreciated.

How to display months sorted in order in SQL Server?

Posted: 27 Mar 2022 12:24 AM PDT

Below is the table I have created and inserted values in it:

CREATE TABLE employees_list     (      employeeID int identity(1,1),         employeeName varchar(25)  )    GO         INSERT INTO employees_list VALUES ('Kevin'),('Charles')    GO          CREATE TABLE hourlyRates     (      employeeID int,         rate int,         rateDate date  )         INSERT INTO hourlyRates VALUES (1, 28, '2016-01-01'),                                    (1, 39, '2016-02-01'),                                   (2, 43, '2016-01-01'),                                   (2, 57, '2016-02-01')            CREATE TABLE workingHours     (      employeeID int,         startdate datetime,         enddate datetime  )    GO         INSERT INTO workingHours VALUES (1, '2016-01-01 09:00', '2016-01-01 17:00'),                                    (1, '2016-01-02 09:00', '2016-01-02 17:00'),                                    (1, '2016-02-01 10:00', '2016-02-01 16:00'),                                    (1, '2016-02-02 11:00', '2016-02-02 13:00'),                                    (2, '2016-01-01 10:00', '2016-01-01 16:00'),                                    (2, '2016-01-02 08:00', '2016-01-02 14:00'),                                    (2, '2016-02-01 14:00', '2016-02-01 19:00'),                                    (2, '2016-02-02 13:00', '2016-02-02 16:00')    GO    SELECT * FROM employees_list  SELECT * FROM hourlyRates  SELECT * FROM workingHours  

Then I ran a query to calculate salaries paid to Employees each month:

SELECT       employeeName,      DATENAME(MONTH, startdate) AS 'Month',      SUM(DATEDIFF(HOUR, startdate, enddate) * rate) AS 'Total Salary'  FROM       hourlyRates, workingHours, employees_list  WHERE       hourlyRates.employeeID = workingHours.employeeID      AND employees_list.employeeID = workingHours.employeeID      AND (hourlyRates.rateDate BETWEEN DATEFROMPARTS(DATEPART(YEAR, workingHours.startDate), DATEPART(MONTH, workingHours.startDate),1)                                     AND DATEFROMPARTS(DATEPART(YEAR, workingHours.endDate), DATEPART(MONTH, workingHours.endDate),1))   GROUP BY        employeeName, DATENAME(MONTH, startdate)  

And I got the following output:

enter image description here

As you can see from the screenshot above that I got the result I wanted.

But the only issue is the month is not being displayed in order.

I tried adding ORDER BY DATENAME(MONTH, startdate) and still the order of month is not being sorted.

I even tried ORDER BY DATEPART(MM, startdate) but it is showing error mentioning that it is not contained in an aggregate function or GROUP BY clause.

What minor change do I need to make in my query ?

JavaScript - Paste the values from a defined range to the first empty cell in another column

Posted: 27 Mar 2022 12:23 AM PDT

I am trying to write a macro that would copy the data from range H23:I32 to adjacent columns J23:K60. Assuming there are values in J23:K60, I wish to paste the data below the last cell with data.

The sheet I am working with is 'Loot'.

Unfortunately, my code doesn't search for the last cell with value and always pastes the data to J23. Thefore my list gets overwritten instead of values being added to it.

function UpdateGroup() {  var spreadsheet = SpreadsheetApp.getActive();  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Loot');  const lastRow = sheet.getLastRow();  sheet.getRange("H23:I23" + lastRow).copyTo(sheet.getRange("J23:K23" + (lastRow + 1)), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);    };  

How do I go about fixing my code so that I have a growing list in J23:K from H23:I values?

Many thanks in advance!

Cmake can't finde "XCB"

Posted: 27 Mar 2022 12:25 AM PDT

I am trying to install the Vulkan SDK on my Linux Mint Machine, but I have problems with building it.
When I type cmake .. -Wno-dev I get this output

-- Using cmake find_program to look for glslangValidator  CMake Error at CMakeLists.txt:60 (find_package):    By not providing "FindXCB.cmake" in CMAKE_MODULE_PATH this project has    asked CMake to find a package configuration file provided by "XCB", but    CMake did not find one.      Could not find a package configuration file provided by "XCB" with any of    the following names:        XCBConfig.cmake      xcb-config.cmake      Add the installation prefix of "XCB" to CMAKE_PREFIX_PATH or set "XCB_DIR"    to a directory containing one of the above files.  If "XCB" provides a    separate development package or SDK, be sure it has been installed.      -- Configuring incomplete, errors occurred!  See also "/home/heimchen/Downloads/1.3.204.1/source/Vulkan-Tools/cube/build/CmakeFiles/CmakeOutput.log"  
  • I already tried to remove libxcb1-dev and reinstall it.\
  • I already tried to removelibxcb-randr0-dev and reinstall it.

Edit:

It compiles at 1.3.204.1/source/Vulkan-Tools, but I still have some ERRORs with missing packages. CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message): A required package was not found Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal) cmake/FindWaylandProtocols.cmake:9 (pkg_check_modules) cube/CMakeLists.txt:70 (find_package)

Using IF Statements And Toggle to Clean Up TradingView Indicator?

Posted: 27 Mar 2022 12:23 AM PDT

I have a toggle at the top of my indicator where I determine if I'm using a Light or Dark Color Theme:

toggleDarkColors = input.bool(true, title = "Toggle Dark Colors", group=g2)  toggleLightColors = input.bool(false, title = "Toggle Light Colors", group=g2)  

Colors:

londonTradingWDColor = color.new(#66d9ef, 99) //  Dark  londonTradingWLColor = color.new(#66d9ef, 93) //  Light  

I use the colors above to display my trading window on my chart:

LondonTW = input(title='London Trading Window', defval=true, group=g6)  londonTradingWindow = toggleTradingWindow and is_session(londonTradingW)  bgcolor(toggleDarkColors and londonTradingWindow and LondonTW ? londonTradingWDColor : na)  bgcolor(toggleLightColors and londonTradingWindow and LondonTW ? londonTradingWLColor : na)  

The 2 issues I'm having is when I click on the "Style" menu in the indicator settings:

enter image description here

#01

I have 2 checkboxes with "Background Color" displaying because I have 2 bgcolor()'s above. Is there any way to dislay only 1 instead of 2 depending on which Color theme is toggled? I tried if statements:

LondonTW = input(title='London Trading Window', defval=true, group=g6)  londonTradingWindow = toggleTradingWindow and is_session(londonTradingW)    LOTWDark = bgcolor(londonTradingWindow and LondonTW ? londonTradingWDColor : na)  LOTWLight = bgcolor(londonTradingWindow and LondonTW ? londonTradingWLColor : na)    if toggleDarkColors      LOTWDark        if toggleLightColors          LOTWLight  

I got the error: line 551: Void expression cannot be assigned to a variable Line 551 is LOKZDark = bgcolor(londonOKillZone and LondonOKZ ? londonOpenKZDColor : na)

#02

How do I alter the bgcolor() above code to give it a title? I checked bgcolor() on tradingviews pinescript v5 page and I couldn't figure it out.

Any suggestions?

How to add Label inside correct "form group" in ruby on Rails form?

Posted: 27 Mar 2022 12:24 AM PDT

I'm using Rails 5.2 and have this rails form and a field for the IP address that looks like this:

<%= bootstrap_form_for(@asset,                     :url => asset_path(@asset.id),                     :as => :asset,                     :method => :patch,                     :layout => :horizontal,                     :label_col => "col-md-3",                     :control_col => "col-md-4") do |f| %>       <%= f.label :ip_address_locator, 'My NEW label', data: { "toggle"=> "tooltip",  "placement"=>"bottom", :title => "This is a tooltip text" } %>   <%= f.text_field :ip_address_locator %>    <% end %>  

I want to update the default label for:

My NEW label

but for some reason the default and new labels show up at the same time. Please see image:

enter image description here

and when I inspect the labels they seem to be in different divs. Please see image:

enter image description here

1) Does anybody know how to only show 'My NEW label' and not both labels?

2) Also, as you can see I have a tooltip that shows up under my NEW label, is it possible to add a condition on that new label so it shows only if a variable is equal to a specific value? (example: @mystring == 'some_text'

Thanks a lot in advance!

how to solve : Launching My project, binary not found exe has encountered a problem in C/C++ [closed]

Posted: 27 Mar 2022 12:25 AM PDT

Launching My project, binary not found exe has encountered a problem. And program file does not exit and error starting process show in my eclipse IDE . Currently I'm using windows 11 enter image description hereI'm trying to create a new project in eclipse IDE. My installation process done successfully but can't make Run my project because of some issues like binary not found, Launching project.exe has encountered a problem. Error starting process.

Sort multiple levels of array after group in Mongo Java

Posted: 27 Mar 2022 12:24 AM PDT

I have documents with below schema

id :   currencyCode : "USD"  businessDayStartDate : ""  hourZoneNumber : 1  customerCount : 0  itemQuantity : 4  nodeId : "STORE_DEV"  endpointId : "998"  amount : 4    

I am trying to find documents that match nodeId and trying to aggregate customerCount, itemQuantity and amount for each hourZoneNumber.

Below is the query

db.getCollection("tgcp_totalizer_fin_ttl").aggregate([  { "$match": { "nodeId": { "$in":["STORE_DEV_1","STORE_DEV_2"] }, "businessDayStartDate" : { "$gte": "2022-03-04" , "$lte": "2022-03-07" } }},  { "$group": {         "_id": {            "nodeId": "$nodeId",            "endpointId": "$endpointId",            "hourZoneNumber": "$hourZoneNumber"         },         "customerCount": { "$sum": "$customerCount" },         "itemQuantity" : { "$sum": "$itemQuantity" },         "amount" : { "$sum": "$amount" }             }  },  { "$group": {         "_id": {            "nodeId": "$_id.nodeId",            "endpointId": "$_id.endpointId"         },         "hourZones": {            "$addToSet": {              "hourZoneNumber": "$_id.hourZoneNumber",              "customerCount": { "$sum": "$customerCount" },              "itemQuantity" : { "$sum": "$itemQuantity" },              "amount" : { "$sum": "$amount" }            }         }             }  },  { "$group": {         "_id": "$_id.nodeId",         "endpoints": {            "$addToSet": {              "endpointId": "$_id.endpointId",               "hourZones": "$hourZones"            }         },         "total": {              "$addToSet": {                  "customerCount": { "$sum": "$hourZones.customerCount" },                  "itemQuantity" : { "$sum": "$hourZones.itemQuantity" },                  "amount" : { "$sum": "$hourZones.amount" }            }         }    }  },  {      $project: {        _id: 0,        nodeId: "$_id",        endpoints: 1,        hourZones: 1,        total: 1      }    }  ])  

Output is as below:

{    nodeId: 'STORE_DEV_2',    endpoints: [       { endpointId: '998',         hourZones:           [             { hourZoneNumber: 1,              customerCount: 0,              itemQuantity: 4,              amount: Decimal128("4") }          ] } ],    total: [ { customerCount: 0, itemQuantity: 4, amount: Decimal128("4") } ],  }  {     nodeId: 'STORE_DEV_1',    endpoints:      [ { endpointId: '999',         hourZones:           [ { hourZoneNumber: 2,              customerCount: 2,              itemQuantity: 4,              amount: Decimal128("4") },            { hourZoneNumber: 1,              customerCount: 4,              itemQuantity: 8,              amount: Decimal128("247.56") } ] } ],    total:      [ { customerCount: 6,         itemQuantity: 12,         amount: Decimal128("251.56") } ]  }  

I want the output to be sorted as : First sort by nodeId, then by endpointId within the endpoints and lastly by hourZoneNumber within hourZones.

How do I do this ? I tried using sort() with all the three fields. But it did not work. Also, how do we convert this whole thing to Java ?

Get code coverage only for a folder in Cypress

Posted: 27 Mar 2022 12:24 AM PDT

I am using Cypress and Nyc configurations. My folder structure looks like this:

|/project  | /coverage/     /lcov-report      /index.html     |/cypress  | /main     /car      /car.spec.tsx      /color.spec.tsx       ...  | /integration

I need a solution to get inside the index.html only the tests coverage from main folder. So as a result in index.html i need to see only the coverage for the tests that was written there.
I noticed that NYC docs. have some configurations https://github.com/istanbuljs/nyc#common-configuration-options . But there i can specifiy only the files that contains features in include, but in each folder from my project i could have a test file and i can not specify every time the each new file only to get the coverage.
Question: Is there a solution to get the coverage only for the main folder or to get the coverage for the files that have already written a spec test? Or to get a coverage for the file that have spec.tsx extension?

How to delay react-navigation action with setTimeout?

Posted: 27 Mar 2022 12:25 AM PDT

I have a navigation function that navigates inside a nested stack. The route goes:

  • Course Tab
    • Course Item

Here's the function:

const goToCourse = () => {        props.navigation.navigate(          NavigationActions.navigate({              routeName: 'CourseTab',              // Delay this action slightly until slightly after the first navigation has completed.              action: setTimeout(() => {NavigationActions.navigate({                  routeName: "CourseItem",              })}, 330)          })      )  }  

Unfortunately using setTimeout in this way does not work. I would like to know how to achieve this using alternative means?

WebdriverIO typescript mocha to get last similar classname on a table <tr><td>

Posted: 27 Mar 2022 12:23 AM PDT

I need to get the last classname data, the number of classname is dynamic, so the number of classname cannot be determined and it always change every time i run the automation, but I just need to get the last classname data. Need your help guys, thanks

<tbody>   <tr>     <td class="classnameData"> mydata1@here </td>   </tr>   <tr>     <td class="classnameData"> mydata2@here </td>   </tr>   <tr>     <td class="classnameData"> mydata3@here </td>   </tr>   <tr>     <td class="classnameData"> mydata4@here </td>   </tr>   <tr>...</tr>   <tr>...</tr>   <tr>...</tr>   <tr>      <td class="classnameData"> mydata8@here </td>   </tr>  

how can i get tha last classname? tried it on a page object, its showing an error on .[last()], .last() , .[-1] and others mentioned below

pageObject.ts tried both of this

get tableData_last() { return  $(".classnameData").[last()]}  get tableData_last() { return  $(".classnameData").last()}  

and tried using [-1] , :last-of-type and :nth-child(-1) they all returned undefined

get tableData_last() { return  $(".classnameData")[-1]}  get tableData_last() { return  $(".classnameData:last-of-type")}  get tableData_last() { return  $(".classnameData:nth-child(-1)")}  

and will not be able to check on my it method

await expect(pageObject.tableData_last).toHaveTextContaining(TESTDATA.DATA);  

c# - Use alias in another file

Posted: 27 Mar 2022 12:24 AM PDT

Is it possible to use an alias defined in one file throughout an assembly?

For eg. in Foo.cs I have

using IO = System.IO;  namespace Foo  {}  

How can I use the alias "IO" in FooBar.cs

namespace Foo.Bar  {}  

No comments:

Post a Comment