text:
Q: How to add data in json object from another object? I have a data object which has some data now i want to create another object mapdata2 which has same structure as data. but my code did not work and also shows some syntax error.
I have created mapdata2 object and empty features array inside it.
It shows an error:

TypeError: i.features is undefined

<script>
data = {"type": "FeatureCollection",
        "features": [
           {
                "type": "Feature",
              "properties":
              {
                "title": "ABC", "startDate": 1100, "endDate": 1200, "latitude": 60.814, "longitude": 11.845, "content": "content."
              },
              "geometry":
              {
                "type": "Point","coordinates": [ 60.814, 11.845, 1]
              }
           },
           {
                "type": "Feature",
              "properties":
              {
                "title": "XYZ", "startDate": 1100, "endDate": 1200, "latitude": 40.814, "longitude": 15.845, "content": "content."
              },
              "geometry":
              {
                "type": "Point","coordinates": [ 40.814, 15.845, 1]
              }
           },

         ]
     }
               mapdata2 = {
                  "type": "FeatureCollection",
                  "features" : []
                };

                for(i in data){
                    console.log(i);
                          mapdata2.features.push({
                            type:"Feature",
                            properties : { title: i.features.properties.title, startDate: i.features.properties.startDate, endDate: i.features.properties.endDate latitude: i.features.properties.latitude, longitude: i.features.properties.longitude, content: i.features.properties.content },
                            geometry : { type: "Point", coordinates: i.features.geometry.coordinates }
                        })
                  }
                  console.log(mapdata2);

 </script>

A: That happens because you are trying to access features for each i in data, but the first iis "type" and it doesn't have features in it.
So I modified your code so that you iterate only over the "features", and for each feature you do what you did, and now it's working.

data = {
  "type": "FeatureCollection",
  "features": [{
      "type": "Feature",
      "properties": {
        "title": "ABC",
        "startDate": 1100,
        "endDate": 1200,
        "latitude": 60.814,
        "longitude": 11.845,
        "content": "content."
      },
      "geometry": {
        "type": "Point",
        "coordinates": [60.814, 11.845, 1]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "title": "XYZ",
        "startDate": 1100,
        "endDate": 1200,
        "latitude": 40.814,
        "longitude": 15.845,
        "content": "content."
      },
      "geometry": {
        "type": "Point",
        "coordinates": [40.814, 15.845, 1]
      }
    },

  ]
}
mapdata2 = {
  "type": "FeatureCollection",
  "features": []
};

data.features.forEach((feature) => {
  mapdata2.features.push({
    type: "Feature",
    properties: {
      title: feature.properties.title,
      startDate: feature.properties.startDate,
      endDate: feature.properties.endDate,
      id: feature.properties.id,
      latitude: feature.properties.latitude,
      longitude: feature.properties.longitude,
      content: feature.properties.content
    },
    geometry: {
      type: "Point",
      coordinates: feature.geometry.coordinates
    }
  })

});
console.log(mapdata2);

A: You dont need to map or loop at all if you simply wish to copy the json list to mapdata2.
mapdata2.features = data.features
console.log(mapdata2);

This will do what you wish to accomplish without having to loop at all.

data = {"type": "FeatureCollection",
        "features": [
           {
                "type": "Feature",
              "properties":
              {
                "title": "ABC", "startDate": 1100, "endDate": 1200, "latitude": 60.814, "longitude": 11.845, "content": "content."
              },
              "geometry":
              {
                "type": "Point","coordinates": [ 60.814, 11.845, 1]
              }
           },
           {
                "type": "Feature",
              "properties":
              {
                "title": "XYZ", "startDate": 1100, "endDate": 1200, "latitude": 40.814, "longitude": 15.845, "content": "content."
              },
              "geometry":
              {
                "type": "Point","coordinates": [ 40.814, 15.845, 1]
              }
           },

         ]
     }
mapdata2 = {
  "type": "FeatureCollection",
  "features" : []
};

mapdata2.features = data.features
console.log(mapdata2);

A: It seems you want to copy the object. You can simply do as below.
var mapdata2 = JSON.parse(JSON.stringify(data));

By the way, you got error "TypeError: i.features is undefined" because i is a string representing a key of the object. It will take the values "type" and "features".
To loop over the items in the array data.features, you should do:
for (var i=0;i<data.features.length;i++) {
  var item = data.features[i];
}

A: There are some errors here:

*

*in keyword in a for bucle iterates over keys, not values, which is what I understand you want to do to copy your data.

*you are trying to access property properties of the array features without accessing an index of that array first.

Changing the last part of your code to:
for(const feature of data.features){
    mapdata2.features.push({
        type:"Feature",
        properties : { title: feature.properties.title, startDate: feature.properties.startDate, endDate: feature.properties.endDate, latitude: feature.properties.latitude, longitude: feature.properties.longitude, content: feature.properties.content },
        geometry : { type: "Point", coordinates: feature.geometry.coordinates }
    })
}
console.log(mapdata2);

should do the job :)
However, if you are just intending to copy the data I would recommend:
mapdata2 = {...data}
console.log(mapdata2)

A: a 'quick fix' maintaining your style:
for(i of data.features) {
  console.log(i)
    mapdata2.features.push({
        type:"Feature",
        properties : {
            title: i.properties.title,
            startDate: i.properties.startDate,
            endDate: i.properties.endDate,
            id: i.properties.id,
            latitude: i.properties.latitude,
            longitude: i.properties.longitude,
            content: i.properties.content },
        geometry : {
            type: "Point",
            coordinates: i.geometry.coordinates
        }
    })
}


text:
Q: Would it be possible for a JIT compiler to utilize GPU for certain operations behind the scenes? Feel free to correct me if any part of my understanding is wrong.
My understanding is that GPUs offer a subset of the instructions that a normal CPU provides but executes them much faster.
I know there are ways to utilize GPU cycles for non-graphical purpose, but it seems like (in theory) a language that's Just In Time compiled could detect the presence of a suitable GPU and offload some of the work to the GPU behind the scenes without code change.
Is my understanding naive?  Is it just a matter of it's really complicated and just hasn't been done it?

A:
My understanding is that GPUs offer a
  subset of the instructions that a
  normal CPU provides but executes them
  much faster.

It's definitly not as simple. The GPU is tailored mainly at SIMD/vector processing. So even though the theoretical potential of GPUs nowadays is vastely superior to CPUs, only programs that can benefit from SIMD instructions can be executed efficiently on the GPU. Also, there is of course a performance penalty when data has to be transfered from the CPU to the GPU to be processed there.
So for a JIT compiler to be able to use the GPU efficiently, it must be able to detect code that can be parallelized to benefit from SIMD instructions and then has to determine, if the overhead induced by transfering data from the CPU to the GPU will be outweight by the performance improvements.

A: It is possible to use GPU (e.g., a CUDA- or OpenCL-enabled one) to speed up JIT itself. Both register allocation and instruction scheduling could be efficiently implemented.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why does File.Exists() no longer work if I restart the application? I have a ClickOnce application that needs to determine if an excel file exists or not, in order to decide whether to create it or write over it.
        Excel.Workbook workBook;
        if (File.Exists(fullFilePath)) {
            workBook = excelApp.Workbooks.Open(fullFilePath);
        } else {
            workBook = excelApp.Workbooks.Add(ApplicationDeployment.CurrentDeployment.DataDirectory + @"\" + TEMPLATE_NAME);
            workBook.SaveAs(path + "\\" + fileName, Excel.XlFileFormat.xlWorkbookNormal);
        }

This works fine the first time the application is installed and used, but if I restart the application it no longer sees the file if it exists, causing the SaveAs to be executed and causing an exception. The exception is System.Runtime.InteropServices.COMException (0x800A03EC).

A: Well, that was stupid. I was accidentally adding a newline to the file name when the application starts up, which I didn't notice because the file name is displayed on a single line textbox... oh boy.


text:
Q: Summary of multiple columns Need help with the summarise and group function on the dataset below
The goal is to get a sum of all non blanks against the column with header "name"
Sample of data using dput below
structure(list(Name = c("CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019",
"CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019",
"CICS_TEL_6_PP Nov2019"), ResponseID = c("R_3m9rPOhCDF9NOUy",
"R_30pk7WWmuFJLNZ9", "R_2UXISAuayZqcSS6", "R_3szvWUgiCdhl6y2",
"R_1DGrZ7gfZ8vkljb", "R_2usuFssDJ7wxJUv"), StartDate = c("01-11-2019 06:08",
"01-11-2019 06:08", "01-11-2019 06:08", "01-11-2019 06:08", "01-11-2019 06:08",
"01-11-2019 06:08"), EndDate = c("01-11-2019 06:13", "01-11-2019 06:10",
"01-11-2019 06:51", "01-11-2019 07:14", "02-11-2019 14:54", "01-11-2019 06:29"
), Month = c("Nov", "Nov", "Nov", "Nov", "Nov", "Nov"), Year = c(2019L,
2019L, 2019L, 2019L, 2019L, 2019L), Mnth.Yr = c("Nov-19", "Nov-19",
"Nov-19", "Nov-19", "Nov-19", "Nov-19"), NPS = c(2L, 10L, 10L,
2L, 10L, 10L), Effort = c(5L, 10L, 10L, 5L, 9L, 10L), Reason.did.you.rate.your.support.experience.as = c("",
"", "", "", "", ""), I.feel.that.Three.is.putting.in.a.significant.effort.to.make.my.experience.with.them.a.positive.one. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), feel.that.I.need.to.put.in.more.effort.than.I.would.expect.when.I.deal.with.Three. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), How.satisfied.were.you.will.your.recent.experiences..Network.Performance = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), How.satisfied.were.youCustomer.Care = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), How.satisfied.Website = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), How.satisfied..Store = c(NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_), How.satisfied.were.you.N.A = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), ffers.good.value.for.money = c(NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_), Is.a.brand.I.can.trust = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Understands.my.needs.as.a.customer = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), Rewards.customers.for.their.loyalty = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Meets.my.expectations = c(NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_), Three.makes.a.significant.effort.to.make = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), My.monthly.mobile.costs.meets.my.expectations. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), My.experience.with.Three.s.network.meets.my.everyday.needs. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), What.is.your.preferred.channel.to.use.if.you.need.support.or.assistance. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Do.you.find.it.easy.to.access.support.when.you.need.help. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Three.s.products.and.services.enhance.my.life. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Are.you.aware.of.3Plus.rewards. = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), Three.is.a.brand.I.trust. = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), We.would.like.to.hear.your.thoughts..is.there.anything.else.you.would.like.us.to.focus.on. = c("",
"", "", "", "", ""), What.steps.can.we.take.to.build.your.trust.with.us. = c("",
"", "", "", "", ""), I.need.to.put.in.more.effort.than.I.would.expe = c("",
"", "", "", "", ""), How.satisfied.were.you.with.your.recent.Network.experience = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Three.offers.good.value.for.money = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), Three.is.a.brand.I.can.trust = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Three.understands.my.needs.as.a.customer = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Three.Rewards.customers.for.their.loyalty = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Three.meets.my.expectations = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), what.you.feel.could.be.done.better.to.improve.your.overall.exper = c("",
"", "", "", "", ""), Ability.to.make.and.receive.calls.and.texts = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), experience.on.data.speeds.with.your.data.connection... = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), On.a.scale.of.1.to.5.how.would.you.rate.your.coverage.in.your.home = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Is.this.related.to.indoor.outdoor.coverage = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Thinking.about.your.recent.experience.usage.of.the.Three.Mobile.Network.over.the.last.7.days = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Usage.of.the.Three.Mobile.Network.over.the.last.7.days..hav... = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), improve.your.overall.network.experience.over... = c("", "",
"", "", "", ""), reason.did.you.rate.your.network.experience.as = c("",
"", "", "", "", ""), To.what.extent.do.you.trust.the.Three.Network = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), easy.or.difficult.was.it.to.purchase.in.store = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Was.the.Sales.Agent.Welcoming = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), Sales.Agent.take.the.time.to.understand.your.needs.and.tailor.the.offer.to.suit = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Was.the.Sales..Agent.helpful. = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), Did.the.Sales.Agent.inform.you.of.the.3Plus.Programme = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Did.the.Sales.Agent.say.Thank.You = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), rate.your.recent.purchase.experience = c("",
"", "", "", "", ""), Sales.Agent.could.have.done.better.to.improve = c("",
"", "", "", "", ""), Three.may.call.you.to.discuss.your.feedback = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), person.was.knowledgeable = c(NA, NA, 5L, NA, NA, 5L), complete.confidence.in.the.person = c(NA,
NA, NA, 4L, NA, NA), Person.listened.and.understood = c(5L, 5L,
NA, NA, 5L, NA), FCR = c(1L, 1L, 1L, 1L, 1L, 1L), Three.is.good.at.fixing.issues = c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), Information..required.on.the.My3.App = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), Verb = c("You obviously have no loyalty dept",
"Nothing", "He couldn't have done any more very polite very helpful and a great Person for ur company ??",
"Nothing cause 3 take my money and fee me for no reason", "",
"There is nothing I can say that it needed to improve I was very happy with the way my query was handled in a very professional manner"
)), row.names = c(NA, 6L), class = "data.frame")

The code i have tried
`Dropoff_II %>% group_by(Name) %>%`
summarise_at(vars(NPS:Verb),list(count=~sum(!is.na(.x))))`

The summarized output (sum) does not match the actual numbers, the formula is unable to produce the actual sum of rows for the given conditions
A crude sample of the output i'd like is illustrated below with only two columns, (nps count and effort count) (total 59 columns given the distribution of data)

Name
nps count

effort count

CICS_TEL_6_PPJan Feb2020
xxx
xxx

J_FTC_RTL_PPUpdated JanFeb2020
xxx
xxx

PS: OP had some typos, apologies!
Help appreciated guys

A: I think this gives you the result you're looking for.
library(tidyverse)

data <-
  structure(list(Name = c("CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019", "CICS_TEL_6_PP Nov2019"),
                 ResponseID = c("R_3m9rPOhCDF9NOUy", "R_30pk7WWmuFJLNZ9", "R_2UXISAuayZqcSS6", "R_3szvWUgiCdhl6y2","R_1DGrZ7gfZ8vkljb", "R_2usuFssDJ7wxJUv"),
                 StartDate = c("01-11-2019 06:08", "01-11-2019 06:08", "01-11-2019 06:08", "01-11-2019 06:08", "01-11-2019 06:08", "01-11-2019 06:08"),
                 EndDate = c("01-11-2019 06:13", "01-11-2019 06:10", "01-11-2019 06:51", "01-11-2019 07:14", "02-11-2019 14:54", "01-11-2019 06:29"),
                 Month = c("Nov", "Nov", "Nov", "Nov", "Nov", "Nov"),
                 Year = c(2019L,2019L, 2019L, 2019L, 2019L, 2019L),
                 Mnth.Yr = c("Nov-19", "Nov-19","Nov-19", "Nov-19", "Nov-19", "Nov-19"),
                 NPS = c(2L, 10L, 10L, 2L, 10L, 10L),
                 Effort = c(5L, 10L, 10L, 5L, 9L, 10L),
                 Reason.did.you.rate.your.support.experience.as = c("", "", "", "", "", ""),
                 I.feel.that.Three.is.putting.in.a.significant.effort.to.make.my.experience.with.them.a.positive.one. = c(NA_integer_,NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 feel.that.I.need.to.put.in.more.effort.than.I.would.expect.when.I.deal.with.Three. = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 How.satisfied.were.you.will.your.recent.experiences..Network.Performance = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 How.satisfied.were.youCustomer.Care = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 How.satisfied.Website = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 How.satisfied..Store = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 How.satisfied.were.you.N.A = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 ffers.good.value.for.money = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Is.a.brand.I.can.trust = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Understands.my.needs.as.a.customer = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Rewards.customers.for.their.loyalty = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Meets.my.expectations = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.makes.a.significant.effort.to.make = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 My.monthly.mobile.costs.meets.my.expectations. = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 My.experience.with.Three.s.network.meets.my.everyday.needs. = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 What.is.your.preferred.channel.to.use.if.you.need.support.or.assistance. = c(NA_integer_,NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Do.you.find.it.easy.to.access.support.when.you.need.help. = c(NA_integer_,NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.s.products.and.services.enhance.my.life. = c(NA_integer_,NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Are.you.aware.of.3Plus.rewards. = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.is.a.brand.I.trust. = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 We.would.like.to.hear.your.thoughts..is.there.anything.else.you.would.like.us.to.focus.on. = c("", "", "", "", "", ""),
                 What.steps.can.we.take.to.build.your.trust.with.us. = c("","", "", "", "", ""),
                 I.need.to.put.in.more.effort.than.I.would.expe = c("", "", "", "", "", ""),
                 How.satisfied.were.you.with.your.recent.Network.experience = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.offers.good.value.for.money = c(NA_integer_, NA_integer_,NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.is.a.brand.I.can.trust = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.understands.my.needs.as.a.customer = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.Rewards.customers.for.their.loyalty = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Three.meets.my.expectations = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 what.you.feel.could.be.done.better.to.improve.your.overall.exper = c("", "", "", "", "", ""),
                 Ability.to.make.and.receive.calls.and.texts = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 experience.on.data.speeds.with.your.data.connection... = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 On.a.scale.of.1.to.5.how.would.you.rate.your.coverage.in.your.home = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Is.this.related.to.indoor.outdoor.coverage = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Thinking.about.your.recent.experience.usage.of.the.Three.Mobile.Network.over.the.last.7.days = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Usage.of.the.Three.Mobile.Network.over.the.last.7.days..hav... = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 improve.your.overall.network.experience.over... = c("", "", "", "", "", ""),
                 reason.did.you.rate.your.network.experience.as = c("", "", "", "", "", ""),
                 To.what.extent.do.you.trust.the.Three.Network = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 easy.or.difficult.was.it.to.purchase.in.store = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Was.the.Sales.Agent.Welcoming = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Sales.Agent.take.the.time.to.understand.your.needs.and.tailor.the.offer.to.suit = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Was.the.Sales..Agent.helpful. = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Did.the.Sales.Agent.inform.you.of.the.3Plus.Programme = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Did.the.Sales.Agent.say.Thank.You = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 rate.your.recent.purchase.experience = c("", "", "", "", "", ""),
                 Sales.Agent.could.have.done.better.to.improve = c("", "", "", "", "", ""),
                 Three.may.call.you.to.discuss.your.feedback = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 person.was.knowledgeable = c(NA, NA, 5L, NA, NA, 5L),
                 complete.confidence.in.the.person = c(NA, NA, NA, 4L, NA, NA),
                 Person.listened.and.understood = c(5L, 5L, NA, NA, 5L, NA),
                 FCR = c(1L, 1L, 1L, 1L, 1L, 1L),
                 Three.is.good.at.fixing.issues = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Information..required.on.the.My3.App = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_),
                 Verb = c("You obviously have no loyalty dept", "Nothing", "He couldn't have done any more very polite very helpful and a great Person for ur company ??", "Nothing cause 3 take my money and fee me for no reason", "",  "There is nothing I can say that it needed to improve I was very happy with the way my query was handled in a very professional manner")),
            row.names = c(NA, 6L),
            class = "data.frame")

#

#make the data a tibble to make viewing it easier in the consol
data <- data %>% as_tibble()

#select just a subset of columns to make debugging easier
df <- data %>% select(Name, StartDate, EndDate, NPS, Effort, Reason.did.you.rate.your.support.experience.as,I.feel.that.Three.is.putting.in.a.significant.effort.to.make.my.experience.with.them.a.positive.one.,  Verb)

#This one sums numeric data and counts character entries
df %>%
  group_by(Name) %>%
  summarise(across(where(is.numeric), sum), #if it is a numeric column, add it up
            across(where(is.character), ~sum(!is.na(.))) #if it is a character column, count the non-NA values
            )
#> `summarise()` ungrouping output (override with `.groups` argument)
#> # A tibble: 1 x 8
#>   Name     NPS Effort I.feel.that.Thre~ StartDate EndDate Reason.did.you.~  Verb
#>   <chr>  <int>  <int>             <int>     <int>   <int>            <int> <int>
#> 1 CICS_~    44     49                NA         6       6                6     6

#this on counts how many non-NA values there are
df %>%
  group_by(Name) %>%
  summarise(across(NPS:Verb, ~sum(!is.na(.))))
#> `summarise()` ungrouping output (override with `.groups` argument)
#> # A tibble: 1 x 6
#>   Name       NPS Effort Reason.did.you.rate.y~ I.feel.that.Three.is.putti~  Verb
#>   <chr>    <int>  <int>                  <int>                       <int> <int>
#> 1 CICS_TE~     6      6                      6                           0     6

#now with the entire dataset
data %>%
  group_by(Name) %>%
  summarise(across(NPS:Verb, ~sum(!is.na(.))))
#> `summarise()` ungrouping output (override with `.groups` argument)
#> # A tibble: 1 x 59
#>   Name    NPS Effort Reason.did.you.~ I.feel.that.Thr~ feel.that.I.nee~
#>   <chr> <int>  <int>            <int>            <int>            <int>
#> 1 CICS~     6      6                6                0                0
#> # ... with 53 more variables:
#> #   How.satisfied.were.you.will.your.recent.experiences..Network.Performance <int>,
#> #   How.satisfied.were.youCustomer.Care <int>, How.satisfied.Website <int>,
#> #   How.satisfied..Store <int>, How.satisfied.were.you.N.A <int>,
#> #   ffers.good.value.for.money <int>, Is.a.brand.I.can.trust <int>,
#> #   Understands.my.needs.as.a.customer <int>,
#> #   Rewards.customers.for.their.loyalty <int>, Meets.my.expectations <int>,
#> #   Three.makes.a.significant.effort.to.make <int>,
#> #   My.monthly.mobile.costs.meets.my.expectations. <int>,
#> #   My.experience.with.Three.s.network.meets.my.everyday.needs. <int>,
#> #   What.is.your.preferred.channel.to.use.if.you.need.support.or.assistance. <int>,
#> #   Do.you.find.it.easy.to.access.support.when.you.need.help. <int>,
#> #   Three.s.products.and.services.enhance.my.life. <int>,
#> #   Are.you.aware.of.3Plus.rewards. <int>, Three.is.a.brand.I.trust. <int>,
#> #   We.would.like.to.hear.your.thoughts..is.there.anything.else.you.would.like.us.to.focus.on. <int>,
#> #   What.steps.can.we.take.to.build.your.trust.with.us. <int>,
#> #   I.need.to.put.in.more.effort.than.I.would.expe <int>,
#> #   How.satisfied.were.you.with.your.recent.Network.experience <int>,
#> #   Three.offers.good.value.for.money <int>,
#> #   Three.is.a.brand.I.can.trust <int>,
#> #   Three.understands.my.needs.as.a.customer <int>,
#> #   Three.Rewards.customers.for.their.loyalty <int>,
#> #   Three.meets.my.expectations <int>,
#> #   what.you.feel.could.be.done.better.to.improve.your.overall.exper <int>,
#> #   Ability.to.make.and.receive.calls.and.texts <int>,
#> #   experience.on.data.speeds.with.your.data.connection... <int>,
#> #   On.a.scale.of.1.to.5.how.would.you.rate.your.coverage.in.your.home <int>,
#> #   Is.this.related.to.indoor.outdoor.coverage <int>,
#> #   Thinking.about.your.recent.experience.usage.of.the.Three.Mobile.Network.over.the.last.7.days <int>,
#> #   Usage.of.the.Three.Mobile.Network.over.the.last.7.days..hav... <int>,
#> #   improve.your.overall.network.experience.over... <int>,
#> #   reason.did.you.rate.your.network.experience.as <int>,
#> #   To.what.extent.do.you.trust.the.Three.Network <int>,
#> #   easy.or.difficult.was.it.to.purchase.in.store <int>,
#> #   Was.the.Sales.Agent.Welcoming <int>,
#> #   Sales.Agent.take.the.time.to.understand.your.needs.and.tailor.the.offer.to.suit <int>,
#> #   Was.the.Sales..Agent.helpful. <int>,
#> #   Did.the.Sales.Agent.inform.you.of.the.3Plus.Programme <int>,
#> #   Did.the.Sales.Agent.say.Thank.You <int>,
#> #   rate.your.recent.purchase.experience <int>,
#> #   Sales.Agent.could.have.done.better.to.improve <int>,
#> #   Three.may.call.you.to.discuss.your.feedback <int>,
#> #   person.was.knowledgeable <int>, complete.confidence.in.the.person <int>,
#> #   Person.listened.and.understood <int>, FCR <int>,
#> #   Three.is.good.at.fixing.issues <int>,
#> #   Information..required.on.the.My3.App <int>, Verb <int>

Created on 2021-01-25 by the reprex package (v0.3.0)


text:
Q: Pass variable name as argument dynamically on svydesign and dplyr::select functions I'm newbie with R. There is a code like the following, and for that code, variable name wt_itvex_divided_by_4 should be dynamically replaced with wt_itvex_divided_by_3 or wt_itvex_divided_by_2
df_odds_sv <- as_survey(
  svydesign(id = ~psu+ID_fam,
            strata = ~kstrata,
            weights = ~wt_itvex_divided_by_4,
            data = data_sd1013
            )) %>%
  dplyr::select(ID, ID_fam, psu, kstrata, wt_itvex_divided_by_4) %>%
  subset(ID %in% df_odds$ID)

To implement dynamical change, I tried something like the following by using temp variable, but it didn't work
temp='wt_itvex_divided_by_3'

df_odds_sv <- as_survey(
  svydesign(id = ~psu+ID_fam,
            strata = ~kstrata,
            weights = ~temp,
            data = data_sd1013
            )) %>%
  dplyr::select(ID, ID_fam, psu, kstrata, temp) %>%
  subset(ID %in% df_odds$ID)

Or, by some search on this problem, I saw someone recommended to use get(), so I tried like the following. It didn't create the error but wt_itvex_divided_by_3 column wasn't selected
s<-'wt_itvex_divided_by_3'

df_odds_sv <- as_survey(
  svydesign(id = ~psu+ID_fam,
            strata = ~kstrata,
            weights = ~get(s),
            data = data_sd1013
            )) %>%
  dplyr::select(ID, ID_fam, psu, kstrata, get(s)) %>%
  subset(ID %in% df_odds$ID)

Referencing Ronak Shah's answer, I solved the issue by the following code (note that I used arguments differently for svydesign's weights and dplyr::select)
temp='wt_itvex_divided_by_3'

df_odds_sv <- as_survey(
  svydesign(id = ~psu+ID_fam,
            strata = ~kstrata,
            weights = ~data_sd1013[[temp]],
            data = data_sd1013
            )) %>%
  dplyr::select(ID, ID_fam, psu, kstrata, temp) %>%
  subset(ID %in% df_odds$ID)

A: You may try subsetting from the dataframe directly with [[.
Using apistrat data as an example.
library(survey)
library(srvyr)
data(api)

temp= "pw"

dstrat1 <- svydesign(id=~1,strata=~stype, weights= ~apistrat[[temp]],
                     data=apistrat, fpc=~fpc)


text:
Q: Как компилировать исходники c#? Вообщем прислали тестовое задание. Задание решил, но тут в требованиях к оформлению увидел следующее
Задание делал в Visual Studio. Как изменить исходники под эту команду? Вообщем как этой командой запустить, скажем, "hello wordl" на c#?

A: Ссылка https://www.mono-project.com/download/stable/ ведет на скачивание дистрибутива MONO.
Там же можно найти ссылку с гайдом на установку. Вот для винды https://www.mono-project.com/docs/getting-started/install/windows/
После установки

*

*Открываем консольное приложение "Open Mono Command Prompt".

*Переходим в корень проекта cd C:\koren_proecta\

*И командой из вопроса у меня всё компилится.


text:
Q: Android - Keyboard compresses my View i'm working on an Android/iOS Application. When the Keyboard opens up for the login (username and password) all gets shrinked together and it looks like this:

normaly it should not be compressed. It should move up, and give me a clear view on what i'm typing.

Yes, so i don't know, what to do. I tried to work with percentages in the whole app (width/height) - maybe this is the reason, why my View gets not moved up but shrinked?
I looked around here at stack and found some suggestions like:
<activity
   ...
   android:windowSoftInputMode="adjustPan">
</activity>

or adjustResize instead, but nothing of that worked for me. On iOS all works fine. What i want the view to do is that he just moves a bit up, and nothing gets resized.
I hope you can help me and if you need more information, please let me know, i'll update or comment my Question then.

*

*Cordova 3.5

*jQuery/jQuery-Mobile

*Plugins: Camera/Console/Device/Dialogs/File-Transfer/File/inappbrowser/Splashscreen/Statusbar/vibration/geolocation/network-information

*Eclipse with Genymotion emulator

*Devices: Galaxy Note 10.1, 4.4.2; Xperia Z2 4.4.2

This is what my Androidmanifest looks like:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="1.0" package="de.*****************.de" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:screenOrientation="portrait" android:label="@string/activity_name" android:launchMode="singleTop" android:name="********" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustPan">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="20" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
</manifest>

A: I was stuck with the same problem, few days ago.
As you said, you have given height and width in percentage.
When the android keyboard appears the window is resized and its height is the screen size excluding the keyboard size.
Giving height in percentage to the main container of your page, (i.e. to the body tag)  will shrink the height of your page when the keyboard appears,
Setting the min-height for the body tag once on document.ready worked for me.
$(function(){

$("body").css("min-height",$(window).height())

});

A: Add this In your manifest .I hope it will works. For more information Do Click HERE
android:windowSoftInputMode="stateUnchanged|adjustResize"


text:
Q: Can I call mysql query result into a html file using node.js? I have an question that there is a way to put mysql query results into a html file without template engines or express.
From many examples, they use template engines to contain a mysql result in html
like this. (using express)
app.get('/', function(req, res){
connection.query('SELECT * FROM users', function(err, rows){
res.render('users', {users : rows});

But I don't want to use template engines.
Is there a way to show mysql query results without using template engines?
Do I have to use squelize or backbone.js?
Thanks.

A: Always Handle the errors. You can directly send the data without using any template engine as shown below.
app.get('/', function(req, res){
    connection.query('SELECT * FROM users', function(err, rows){
        if(err)
            res.status(500).json({"Error":err});
        else if(rows.length)
            res.status(200).json({"Data":rows});
        else
            res.status(200).json({"Data":"No records found"});
    }
}


text:
Q: List number of files in multiple zip files How can I get the total number of files in multiple zip files at the same time? I have around 1000 zipfiles in one folder and would like to know the total amount of files inside them all combined. How can I do this? I've tried
zipinfo -t file.zip

But that only gives me the number from that archive, I've also tried
zipinfo -t *zip/?.zip

and gets
caution: filename not matched:  Jo Coo-Day-Sun.zip
caution: filename not matched:  Micke Mouse-Stare-Well-Pt1.zip
caution: filename not matched:  Micke Mouse Cooley-Stare-Well-Pt2.zip

Any suggestions?

A: There is certainly more then one way to do this and what I'm presenting is not necessarily the best way, however it is a way that works.  Create a bash script using the following code.
#!/bin/bash
c=0
for f in *.zip; do
    x="$(zipinfo -t "$f" | awk '{print $1}')"
    c=$(( $c + $x ))
done
echo "The total file count is:" $c

Then you'd cd to the directory containing the zip archive files and execute the bash script by its name if it's in the $PATH or its pathname if it's not in the $PATH.
Say you save it as getfilecount in your $HOME directory, which normally is not in your $PATH you'd cd to the directory containing the zip archive files and then use:
~/getfilecount

To make the bash script create an empty text file, e.g. touch getfilecount and then open the file, e.g. open getfilecount add the code above via copy and paste and save it.  Now make the file executable, e.g chmod +x getfilecount and now you can use it as is or place it in a directory that's in the $PATH, then all you'd need to type once changing to the directory containing the zip archive files is: getfilecount
Below is sample output to show the difference between using single commands method and a bash script.
Issuing commands, one at a time:
$ cd zipfiles
$ ls
codetest.zip    destination.zip helloworld.zip  source.zip
$ zipinfo -t "*.zip"
1 file, 820 bytes uncompressed, 437 bytes compressed:  46.7%

1 file, 0 bytes uncompressed, 0 bytes compressed:  0.0%

6 files, 12385 bytes uncompressed, 895 bytes compressed:  92.8%

101 files, 0 bytes uncompressed, 0 bytes compressed:  0.0%

4 archives were successfully processed.
$

Using getfilecount (when the bash script is in the $PATH):
$ cd zipfiles
$ getfilecount

The total file count is: 109
$


text:
Q: Fixing dates that were coerced into the wrong format I have a large df with dates that were accidentally coerced into the wrong format.
Data:
id <- c(1:12)
date <- c("2014-01-03","2001-08-14","2001-08-14","2014-06-02","2006-06-14", "2006-06-14",
          "2014-08-08","2014-08-08","2008-04-14","2009-12-13","2010-09-14","2012-09-14")
df <- data.frame(id,date)

Structure:
    id  date
1   1   2014-01-03
2   2   2001-08-14
3   3   2001-08-14
4   4   2014-06-02
5   5   2006-06-14
6   6   2006-06-14
7   7   2014-08-08
8   8   2014-08-08
9   9   2008-04-14
10  10  2009-12-13
11  11  2010-09-14
12  12  2012-09-14

The data set only includes, or rather should only include the years 2014 and 2013. The dates 2001-08-14 and 2006-06-14 are most likely 2014-08-01 and 2014-06-06, respectively.
Output:
    id  date
1   1   2014-01-03
2   2   2014-08-01
3   3   2014-08-01
4   4   2014-06-02
5   5   2014-06-06
6   6   2014-06-06
7   7   2014-08-08
8   8   2014-08-08
9   9   2014-04-08
10  10  2013-12-09
11  11  2014-09-10
12  12  2014-09-12

How can I reconcile this mess?

A: Package lubridate has the convenient function year that will be useful here.
library(lubridate)

# Convert date to proper date class variable
df$date <- as.Date(df$date)

# Isolate problematic indices; when year is not in 2013 or 2014,
# we'll go to and from character representation. We'll trim
# the "20" in front of the "false year" and then specify the
# proper format to read the character back into a Date class.

tmp.indices <- which(!year(df$date) %in% c("2013", "2014"))
df$date[tmp.indices] <- as.Date(substring(as.character(df$date[tmp.indices]),
                                first = 3), format = "%d-%m-%y")

Result:
   id       date
1   1 2014-01-03
2   2 2014-08-01
3   3 2014-08-01
4   4 2014-06-02
5   5 2014-06-06
6   6 2014-06-06
7   7 2014-08-08
8   8 2014-08-08
9   9 2014-04-08
10 10 2013-12-09
11 11 2014-09-10
12 12 2014-09-12

A: We could convert the 'date' column to 'Date' class, extract the 'year' to create a logical index ('indx') for years 2013, 2014).
df$date <- as.Date(df$date)
indx <- !format(df$date, '%Y') %in% 2013:2014

By using lubridate, convert to 'Date' class using dmy after removing the first two characters.
library(lubridate)
df$date[indx] <- dmy(sub('^..', '', df$date[indx]))
df
#   id       date
#1   1 2014-01-03
#2   2 2014-08-01
#3   3 2014-08-01
#4   4 2014-06-02
#5   5 2014-06-06
#6   6 2014-06-06
#7   7 2014-08-08
#8   8 2014-08-08
#9   9 2014-04-08
#10 10 2013-12-09
#11 11 2014-09-10
#12 12 2014-09-12


text:
Q: PowerBI generates an SQL query that is too deeply nested. How to fix? In PowerBI Query builder, I create the following query:
let
    SV_DATA = Sql.Database("my.ip.add.ress", "SV_DATA", [CreateNavigationProperties=false]),
    ImportanceTables = Table.SelectRows(SV_DATA, each Text.EndsWith([Name], "_IMPORTANCE_RATINGS")),
    Importances = Table.Combine(ImportanceTables[Data])
in
    Importances

As you can see, the query looks for all tables that end in _IMPORTANCE_RATINGS and combines them into a single table.  (This is necessary because there are thousands of *_IMPORTANCE_RATINGS tables and they are added and dropped over time;  I therefore can't hard-code them).
The preview works perfectly.
However when I try to apply the query in my report, I get the following error from SQL Server:

Failed to save modifications to the server.  Error returned: 'OLE DB or ODBC error: [DataSource.Error] Microsoft SQL: Some part of your SQL statement is nested too deeply.  Rewrite the query or break it up into smaller queries..'.

However, I don't see any way to simplify my work in PowerBI.  It seems that it is PowerBI itself that makes the SQL query too complex.
Suggestions?
Thanks,
DC

A: Try this:
Importances = Table.Combine(ImportanceTables[Data], {"PROG_ID", "RESPONSE_ID", "COMPOSITE", "PRACTICE_NUMBER", "IMPORTANCE_RATING", "CHANNEL", "BREAKOUT", "SOURCE"} )

or even
Importances = Table.Combine(ImportanceTables[Data])

, if columns are uniform across tables.
Table.Combine() accepts a list of tables as first argument.
However if your table count is too large you can potentially face other problems.


text:
Q: Add custom control to DevExpress GridControl I have a custom DateTimePicker control that prepared for Persian calendar. Is there any way to add it to the DevExpress GridControl column?
Please help me.

A: From: Creating a custom (RepositoryItem) ImageComboBox

If you wish to use your custom control in GridControl, it is necessary
  to create an editor and its RepositoryItem descendants.
Please refer to the Custom Editors and How to register a custom
  editor for use in the XtraGrid articles for complete information
  on how to create custom controls. You can find some custom editor
  descendants in our examples: editor descendants.
The RepositoryItem class contains editor settings and is used as
  a template for cells in the grid. In the display mode, GridControl
  only draws cells content via RepositoryItem's methods. In the edit
  mode, GridControl creates a corresponding editor via the
  RepositoryItem.CreateEditor method. Thus, if you wish to add items to
  the editor used in the grid on its initialization, implement this at
  the RepositoryItem level.

You can set an editor for the auto filter row if you handle GridView.CustomRowCellEdit event with following code
    RepositoryItemDateEdit rd = new RepositoryItemDateEdit();
    void gridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e) {
      GridView view = sender as GridView;
      if(e.Column.FieldName == "DOB" && view.IsFilterRow(e.RowHandle)) {
          e.RepositoryItem = rd;
      }
    }

Review the Assigning Editors to Columns and Card Fields help article to learn how to assign a specific editor to a particular GridView's column.
I hope you will find this information useful.


text:
Q: Using OAuth2.0 with VueJS? How to step by step? How using Oauth2 in vuejs, anyone knows or someone has an example please help. Thank You

A: I have a step by step tutorial that intentionally uses procedural plain JavaScript - with the oidc client certified library:
https://authguidance.com/2017/09/24/basicspa-overview/
The main things to understand are the Open Id Connect standards and how to integrate the library.
As a web developer you should then be able to translate the solution to your web framework of choice.


text:
Q: How do I configure Nagios mobile / SMS alerts? How do I send alerts from Nagios monitoring tool to mobile?
Any resources or links or tutorials are fine.

A: The following describes how alerts can be sent directly to SMS, without using e-mail. Basically, you need to connect a GSM modem (or a suitable mobile phone) via USB, then send your text messages directly via the GSM network.

*

*http://matt.bottrell.com.au/archives/205-Nagios-2-way-alerting-via-SMS-Part-2.html
If you want a much simpler solution and are comfortable using e-mail (such that if your internet connection goes down, you will not get alerts on your cell phone), just send alerts to your phone's e-mail address:

*

*http://en.wikipedia.org/wiki/List_of_SMS_gateways

A: The March 2010 issue of Linux Journal has an article titled Using an SMS Server to Provide a Robust Alerting Service for Nagios
They use the MultiTech Systems MultiModem iSMS Intelligent SMS server, and explain in great detail how they got it up and running. As well as all the scripts and configuration they wrote.
Definitely worth a read.

A: SMS messages can be send by using a GSM modem (hardware option) or using a web based service. Nagios exchange has a list of available options http://exchange.nagios.org/directory/Addons/Notifications
Shameless plug:
At OpsGenie, we've recently implemented support for sending Nagios alerts to iPhone/iPad and Android devices using push notifications in addition to sending notifications via email and SMS. Description of the integration is on our support site How to configure Nagios for OpsGenie.

A: I personally opt for hardware solutions. They have such advantage over internet sms gateway services, that they work even if your Internet connection is broken (firewall, router, internet connection is down).
Have a google search on sms hardware gateway. These kind of devices usually offer you a HTTP API which can be used for easy integration with Nagios.
I personally can say that SMSEagle device is worth to take look.
Beside API for sending/receiving SMS they also have a functionality for monitoring services/servers.
Ready-to-use Nagios plugin: https://exchange.nagios.org/directory/Addons/Notifications/SMS/SMS-Notifications-and-Alerting-via-SMSEagle/details

A: You could use email to sms

A: The easiest way is to try this: http://www.alertwoo.com
It sends out SMS alerts when you receive emails from Nagios. You don't receive any configuration, they just convert your emails received from Nagios and send them as SMS text message to you in seconds.
It works great. Try it.

A: RTFM - really. The nagios documentation and online resources will help you. To get started, maybe begin at: http://nagios.sourceforge.net/docs/nagioscore/3/en/notifications.html
There are a myriad of possible solutions to your problem, so you need to decide by yourself what's appropiate for you. Just one hint: Use a REAL modem or GSM module. Don't rely on online SMS services.

A: An another solution exist : TeamTILT for Nagios.
A great advantage is the heartbeat functionnality ! If your server or your mail service is down, the TeamTILT platform notifies you by SMS…
An another advantage is the number of media types : SMS, Voice call, iPhone push, email, fax, …
Just have a look here : http://www.alarmtilt.com/en/manage-your-nagios-alerts-with-teamtilt.html
;) !


text:
Q: Parameter type may not live long enough I have a simple program where I am trying to implement a polymorphic account type:
enum AccountType {
    INVALID,
    TYPE1,
    TYPE2,
}

trait Account {
    fn get_name(&self) -> String;
    fn get_type(&self) -> AccountType;
}

struct Accounts {
    accounts: Vec<Box<Account>>,
}

impl Accounts {
    fn new() -> Accounts {
        let accs: Vec<Box<Account>> = Vec::new();
        Accounts { accounts: accs }
    }

    fn add_account<A: Account>(&self, account: A) {
        self.accounts.push(Box::new(account));
    }
}

fn main() {
    let accounts = Accounts::new();
}

(Rust Playground)
When I compile it, I see the following error:
error[E0310]: the parameter type `A` may not live long enough
  --> src/main.rs:23:28
   |
22 |     fn add_account<A: Account>(&self, account: A) {
   |                    -- help: consider adding an explicit lifetime bound `A: 'static`...
23 |         self.accounts.push(Box::new(account));
   |                            ^^^^^^^^^^^^^^^^^
   |
note: ...so that the type `A` will meet its required lifetime bounds
  --> src/main.rs:23:28
   |
23 |         self.accounts.push(Box::new(account));
   |                            ^^^^^^^^^^^^^^^^^

I have tried adding lifetimes to the type but could not find the right way to do it. Please let me know if this is not the right way to do polymorphism in Rust.

A: The compiler's suggestion actually works. If you write add_account as follows:
fn add_account<A: Account + 'static>(&mut self, account: A) {
    self.accounts.push(Box::new(account));
}

your code compiles. (Incidentally, you need &mut self, not &self here)

A: I'll try to give a more thorough answer: the issue has to do with the definition of the accounts member of Accounts.  Vec<Box<Account>> in this context is equivalent to Vec<Box<Account + 'static>>, i.e. the box can't contain any references to data on the stack.  On the other hand, the declaration of add_account doesn't restrict the lifetime of the type: it's equivalent to fn add_account<'a, A: Account + 'a>(&self, account: A) {.
The solution is to make sure the type A lives long enough.  The simplest approach is to just add the A: 'static bound suggested in the error message (fn add_account<A: Account + 'static>(&self, account: A) {).
If you don't want to copy the Account data, you can do something more complicated, like this:
struct Accounts<'a> {
    accounts: Vec<&'a Account + 'a>
}

impl<'a> Accounts<'a> {
    fn new() -> Accounts<'a> {
        Accounts { accounts: Vec::new() }
    }

    fn add_account<A: Account + 'a>(&mut self, account: &'a A) {
        self.accounts.push(Box::new(account));
    }
}

At this point, though, you have a data structure which is probably more general than you actually need.


text:
Q: Clean way to install gdaltools plugin for QGIS on OSX I have qgis 1.8.0 on osx mountain lion and am installing the gdaltools 1.2.29. I have run into a problem that a number of people are seeing.  The plugin cannot find my gdal python (see below).
Anyway, I can fix the problem hackily (if that is a word) by symlinking
  cd /Library/Python/2.7
  sudo mv site-packages/ site-packages-old
  sudo ln -s /Library/Frameworks/GDAL.framework/Versions/1.9/Python/2.7/site-packages /Library/Python/2.7

So that fixes the prob because the python path list that the plugin knows about includes /Library/Python/2.7/site-packages  But the real solution is to add a path to the list of paths that the python plugin[s] know about.  How do you do that?
----start of error message----
Couldn't load plugin GdalTools due an error when calling its classFactory() method
Traceback (most recent call last):
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 164, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/aberezin/.qgis//python/plugins/GdalTools/init.py", line 32, in classFactory
    from GdalTools import GdalTools
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/aberezin/.qgis//python/plugins/GdalTools/GdalTools.py", line 39, in
    raise ImportError( error_str )
ImportError: No module named osgeo [python-gdal]
Python version:
2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
QGIS version:
1.8.0-Lisboa Lisboa,
Python path: ['/Applications/QGIS.app/Contents/MacOS/../Resources/python', '/Users/aberezin/.qgis//python', '/Users/aberezin/.qgis//python/plugins', '/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']

A: Alan,
The path to gdal's Python bindings is missing because Apple seems to remove anything in the system site-packages folder during upgrade to Mt. Lion (thank-you-very-much Apple).
There is a thread in the QGIS User mailing list about this, and gdal in particular. You basically have to reinstall all previously installed Python packages, or possibly copy them over from a pre-Mt. Lion upgrade backup.
However, first you must undo what you did when creating your symbolic link to the gdal framework subdirectory: remove the link and rename site-packages-old back to site-packages. You definitely do not want to rename the site-packages folder of your Python installation, or point it to a specific library's install.
After you have your gdal/osgeo Python support reinstalled, GdalTools, which is a separate core plugin that is part of QGIS, as Giovanni noted, should work fine.

A: Here is how I got this working on my machine :
Here is the context:
You are running a Mac with Mountain Lion
You need to install GDAL with its python bindings
Pre-Requisites:
I use the MacPorts package managers for mac, and PythonBrew for managing my python installation and virtual environment management, and based on my experiences, I urge you to do the same :)

*Install mac ports and pythonbrew

*Using pythonbrew, install the python version > 3.2 for the latest python GDAL bindings to work (yup, you heard it right. you need python > 3.2 for you to use the python bindings). 'switch' to that version of python.

*using macports, install gdal, by doing : port install gdal

*Setup a virtual environment using pythonbrew (see the the "usage" section of the pythonbrew home page above), and switch to that virtual env.

*Download the gdal package by doing : pip install —no-install GDAL
This will error out : don't worry, we did this to grab the source.

*cd ~/.pythonbrew/venvs/PYTHON_VERSION/VIRTUALENV_NAME/build/GDAL

*Edit setup.cfg, and change gdal_conf to point to /opt/local/bin/gdal-config (note that this does not have a '_', but a hyphen)

*From the same directory, do a : python setup.py build_ext —include-dirs=/opt/local/include/

*This should compile without any errors (some warnings, but no actual errors)

*We aren't done yet : to complete installation, do a 'pip install —no-download GDAL'

To test your installation, from the python interpreter, do a : 'from osgeo import gdal' and check that no errors show up.
Hope that helps!


text:
Q: list.save and list.distUpgrade This is more of a curiosity question as I try to get a better understanding of apt and package management.
I'm seeing that in my /etc/apt/ and /etc/apt/sources.list.d/ folders I have very or sometimes identical files which have the extension of sources.list, sources.list.distUpgrade, sources.list.save, and so on.
What's the point of these duplicate or similar files?
sources.list and sources.list.save in /etc/apt/ seem to be identical but sources.list.distUpgrade shows quantal instead of raring for most stuff (I probably first installed quantal).
On the other hand, in the case of google-talkplugin.list and google-talkplugin.listUpgrade in /etc/apt/sources.list.d/ the content of the files seems to be completely identical.
Didn't find much in Google searches. I reviewed the sources.list manpage but it didn't talk much about it.
Also noticed this article where a bug related to the extensions was noted for 10.10

A: I am not sure about sources.list.distUpgrade, but the sources.list.save file is a backup of the sources.list file.  I know from personal experience (about 5 minutes ago) that the sources.list.save file is extremely important after attempting to add a repository.  If  software center stops working correctly (EX: closing right after starting) then you need to replace the current sources.list file with the sources.list.save file.
To do this, open a new terminal (CTRL+ALT+T) and type the command
sudo cp /etc/apt/sources.list.save /etc/apt/sources.list

and then
sudo apt-get update

This should fix the corrupt sources.list as long as sources.list.save exists in the /etc/apt/ directory.
Simply put, sources.list.save is just a backup file.

A: I was concerned about whether these files are included in the repos used when updating etc packages. It seems they're not: From man sources.list re. the sources.list.d directory:

Filenames need to have either the extension .list or .sources depending on the contained format.

it goes on to talk about ignoring files. In summary I take it to mean that only files with .list or .sources get used when updating packages etc. The meaning of the .save and .distUpgrade files is well explained in the existing answer from Strato1 and the comments there.


text:
Q: Invalid object name on create table I have the following code, but I can not get it work. I get the error msg:
Invalid object name 'ad_hoc_raportointi.dbo.tuote_testi'. I am trying to create a new table to DB1  and the query data from DB2 and insert it to DB1 table. the db already exists, but the table should be created there.
I am trying to write to my test db (ad_hoc_raportointi) and create a table called dbo.tuote_testi but I keep bumping in the same error , but I don´t know why. If you could please help me and tell me what am I doing wrong.
USE [LemonDB0922]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE Hae_tuote_kuva_tiedot3
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
if not exists (select * from [ad_hoc_raportointi].[dbo.tuote_testi])
    create table [ad_hoc_raportointi].[dbo.tuote_testi] (
    tuoteID int ,
    tuoteKoodi int ,
    tuotekuvaus varchar(200) ,
    tuotetarkempikuvaus varchar(200) ,
    tuotevarastossa SMALLINT ,
    tuotehinta decimal(16,2) ,
    tuoteverot SMALLINT ,
    tuote_myyntitili int ,
    tuote_guid varchar(200) ,
    tuote_viim_paivitys datetime ,
    tuote_kuva_tuote_relaatio int ,
    tuote_kuva_hexa varbinary(MAX) ,
    tuote_kuva_koko_nimi varchar(50) ,
    tuote_kuva_paate varchar(10) ,
    PRIMARY KEY (tuoteID)

)

    -- Insert statements for procedure here
    INSERT INTO [ad_hoc_raportointi].[dbo.tuote_testi](tuoteID,tuoteKoodi,tuotekuvaus, tuotetarkempikuvaus, tuotevarastossa, tuotehinta, tuoteverot, tuote_myyntitili, tuote_guid, tuote_viim_paivitys , tuote_kuva_tuote_relaatio , tuote_kuva_hexa , tuote_kuva_koko_nimi, tuote_kuva_paate)
    SELECT  dbo.products.product_id, dbo.products.product_code, dbo.products.product_description, dbo.products.product_description2, dbo.products.product_nonstock_bit, dbo.products.product_price, dbo.products.product_include_tax_bit, dbo.products.sales_account, dbo.products.product_guid, dbo.products.product_last_upd_date, dbo.program_images.program_image_dataid , dbo.program_images.program_image_image ,   dbo.program_images.program_image_description, dbo.program_images.program_image_prefix
    FROM [LemonDB0922].[dbo.products]
    LEFT JOIN [LemonDB0922].dbo.program_images
    ON dbo.program_images.program_image_dataid = dbo.products.product_id

END
GO

A: You should use [ad_hoc_raportointi].[dbo].[tuote_testi] not [ad_hoc_raportointi].[dbo.tuote_testi] for all of your queries.
You call a table as [ad_hoc_raportointi].[dbo.tuote_testi] but I guess in your DB there is ad_hoc_raportointi.dbo.[tuote_testi]. Using [] you give a name [dbo.tuote_testi] to table it's not the same as [dbo].[tuote_testi].


text:
Q: What is the point of mocking this Feign object? I'm trying to write a unit test for an implementation of a Feign client. I wasn't sure how to go about it so I googled it and came across this answer and the accepted answer is this code snippet:
@Test
public someTestClient(){
    Person expectedPerson = new Person("name",12));
    when(mockPersonClient.getPerson()).return(expectedPerson);
    Person person = mockPersionClient.getPerson();
    assertEquals(expectedPerson, person);
}

I don't understand why this is a useful test or under what circumstance, other than a problem with the Person constructor, this test could ever fail. Isn't this test essentially the equivalent of:
Person person = new Person("a", 1)
Person expectedPerson = new Person("a", 1)
assertEquals(person, expectedPerson)

I understand unit testing should test functionality in isolation. Will this test just ensure that mockPersonClient exists at runtime?

A: We can configure a mock object to always return a hard coded and fake object when calling a method on that mock object.
In this example , the OP configured mockPersonClient.getPerson() return a fake Person.However, he just wonder why the fake person was not returned as configured when he called mockPersonClient.getPerson(). I think the codes example he shown was just for him to demonstrate this question. It does not mean he actually wrote that unit test codes to test some production codes.

A: A test like that doesn't have any value.
Here is a person, I am going to ask this call to return person and then I will check I got person when calling that thing. Of course you will get person, you just hard-coded that, so how is it useful?
Unit tests are about functionality, a simple fact which is lost on many.
Any code which changes data, which filters something, which changes something in a controlled way, is a good candidate for a unit test.
People use mocks a little bit too much and for most of the time for the wrong thing. Yes, we are advised to code against interfaces, but this doesn't mean you should have a very complex system, where you pass interfaces all over the place and then your test code tries to mimic that.
When you mock too much, it means the test you are writing is tied too much to the code it tests, it knows too much about it. Unit tests should not do that, because every time you change the code in some small way, you then discover that now you have to change the test, because you're no longer using 35 interfaces, now you have 47 to mock in a very specific order. That may not be an issue when you have one test, but imagine what happens when you have 1000 tests ...
If people tried to code in more of a functional way then this would not happen. If you pass data, instead of abstractions, now you don't have to mock anything.
Instead of mocking a call a database, isolate it, take the result and pass that to a method, you've just lost an abstraction and your code does not need to mock anything, you just call the method, pass the data in whatever format you want and see what happens.
If you want to test a real database, then you write an integration test. It's really not that complicated, mocking should not be the first thing you do, do it when it helps and you really must, but most of the time, you really don't and it simplifies things if you don't.


text:
Q: Find a vertex cover of size 20 for the pictured graph I want to use Konig's theorem to show that the pictured graph $G$ has no perfect matching. By this theorem it suffices to find a vertex cover of size $|G|/2-1= 20$, but so far I have only been able to find vertex covers of size 21. I'm just doing this by inspection as opposed to using any algorithms, and it's not immediately obvious to me how to find a cover of size 20.

A: Must write at least $30$ charcters.

A: If you don't want to just stumble around blindly until you get there, here's how you find the solution.
The solution you found with $21$ vertices probably looks something like this:

If this is the optimal solution, then there is a perfect matching in which every edge has one endpoint among the chosen vertices. But in fact, if we try to find such a matching, we get irreparably stuck:

We started by giving a bunch of vertices an edge, but the purple vertex has no edge to an unused neighbor. There's no way to fix this, because the $11$ vertices we've looked at so far (the $10$ we've given an edge, plus the purple vertex) have only $10$ neighbors... but that's exactly what we want to improve the vertex cover. Just replace these $11$ vertices by their $10$ neighbors, and you get a solution of size $20$:


text:
Q: How to control this 72-LED light bar PCB I have two LED light bars from an old (manufactured January of 2000) Unisys check scanning machine. They apparently (based on the PCB's labels) have 72 LEDs. Most of the LEDs are green, but a few red ones are scattered among them for reasons unknown. The boards have 16-pin ribbon cables and metal pieces glued to the backs that seem to be heatsinks. Breaking the glue, there seems to be a line of thermal paste between the heatsink and the metal surface of the back of the PCB. The individual LEDs seem to be isolated from each other, not even sharing a common ground or power. There don't seem to be any flip-flops or microcontrollers on the board. I found only one pin on the ribbon cable that seemed to have any continuity to the LEDs. Below are pictures of these boards. Any ideas of how these could be driven with e.g. an Arduino, besides soldering to each LED? Thanks.

A: My probing is beginning to bear fruit. Here is what I have discovered so far:

*

*My multimeter's leads are too blunt to make good contact; jumpers from my Arduino kit work better.

*The LEDs seem to be divided into sets; within each set the LEDs are wired in series.

*Pins 1 through 7 on the ribbon cable are electrically connected inside the PCB and form the positive power supply (approx. +12V)

*All the red LEDs are a set (I can get up to 3 to light up at a time with 5V from my Arduino)

*Every ninth green LED is part of the same set.

*Pin 8 is the ground for the red LEDs.

*Even with 12V, only 7 out of the 8 red LEDs will light (I have to touch one of my power leads to the second-to-last LED rather than the ribbon cable). With the green LEDs, only 6 out of each set of 8 will light with any reasonable brightness. I assume that with higher voltages I could get them all to light at once.

The two light bars are slightly different (the ground pin details above refer to the one labelled "R/R") but they are very similar otherwise. The only major difference seems to be that the "L/F" one has two sets of red LEDs and the "R/R" one has only one. Thanks for your suggestions; I think the mystery is solved.


text:
Q: Right approach for setting variables in super type I have an abstract class Compartment with variables label tariff totalSeats and seatsAvailable as shown below. I am setting these variables by calling super() from the constructor of subclass FirstClassCompartment. I have few questions regarding my code.
First of all, is this a right approach to set variables using super class constructor or I should create a setter method in super class to set these variables.
Second, is it bad coding to access the variables of super class directly and not using getter/setter methods.
Last, Value of variable seatsAvailable in super class depends upon the variable seatsReserved in sub class like this seatsAvailable = totalSeats - seatsReserved. Might this cause code maintenance or flexibility issues in the future?
public abstract class Compartment {

    protected final char label;
    protected final double tariff;
    protected final int totalSeats;
    protected int seatsAvailable;

    public Compartment(char label, double tariff, int totalSeats) {
        this.label = label;
        this.tariff = tariff;
        this.totalSeats = totalSeats;
    }

    public char getLabel() {
        return label;
    }

    public int getTotalSeats() {
        return totalSeats;
    }

    public void setSeatsAvailableLessByOne() {
        seatsAvailable--;
    }

    public abstract int getSeatsAvailable();

    public abstract double getTariff();

}

public class FirstClassCompartment extends Compartment {

    protected final int seatsReserved;

    public FirstClassCompartment(char label, double tariff, int totalSeats, int seatsReserved) {
        super(label, tariff, totalSeats);
        this.seatsReserved = seatsReserved;
        seatsAvailable = totalSeats - seatsReserved;
    }

    @Override
    public double getTariff() {
        return tariff + tariff * .13;
    }

    @Override
    public int getSeatsAvailable() {
        return seatsAvailable;
    }
}

A: First question: this is absolutely the right way to do it. Invoke the superclass constructor, and pass the relevant arguments.
Second question: this is in part a stylistic thing. It's good practice not to make the fields directly available to all and sundry, so you wouldn't want them to be public, but having them available to your own subclasses is not disastrous. It would be quite reasonable to make them available via getters and setters, though, and certainly if you had fields that you wanted to be readable by the subclass but not writable, then a getter would be appropriate.
Third question: there's no problem here. The superclass is abstract, so you'd expect the subclass implementation to fill in some of the gaps. But since the seatsAvailable logic is so simple (a subtraction), you might think about getting rid of the seatsAvailable field entirely, and just having
@Override
public int getSeatsAvailable() {
    return totalSeats - seatsReserved;
}

That way, it will be calculated on the fly, and you won't have to worry about keeping this field in sync with the others.

A: Looks good to me, I would probably rename the method setSeatsAvailableLessByOne to something more meaningful, like decrementSeatsAvailable if you want to have it at all.
Edit
You're right that having a seatsAvailable is redundant. You could just move seatsReservedand the derived value to the super class tho'. It's unlikely that there would be other ways to implement the getSeatsAvailablemethod, and even if there was, you could still override it, in these specific cases.

A: I use to declare my fields with 'package' visibility. Its the default visibility, it can be accessed by inhered classes and same package classes. It helps a lot when you are unit testing, because test are written in the same package.
Indiscriminate use of getters/setters breaks encapsulation in my opinion. You are exposing all by fields default, when probably its not needed.
If your variables are setted only one time in constructor, then they should be 'final'.
If a setter has some logic, and in a future you may need to override it, then make it overridable, but its not a good practice to use an overridable method inside a constructor.


text:
Q: Add connector json configuration to Kafka Connect REST API via gradle I want to use Debezium and Kafka Connect to implementing transaction outbox pattern. I also use Postgres.
According to the official documentation, I have to call a REST endpoint to register our connector.
However I think it would be better if this REST call executed outside of my codes. I prefer that it be done by gradle. In this way, the DevOps team has also the ability to maintain this work.
Now I have the following questions:

*

*Am I right about passing the responsibility of registering connector to DevOps team?

*Is Gradle a good place to do this?

*I explored for a gradle solution and found this gradle plugin. But it's depend on jsonnet. My configuration is a json file, just contains some environment variables. The final json could be available only after replacing the environment variables by their values. I think jsonnet is overqualified for this. Another way is that I implement gradle task by myself which reads the file and replaces the variables. It is really easy. But I think it is a common use case and some guys should have implemented it, so far. Isn't it?

Any help would be appreciated.


text:
Q: Is 'cry' a catenative complement in this example? In the provided example (below), is 'cry' considered a catenative complement?

He made him cry.

'Him' is the object of 'made,' so 'cry' must be a complement. I know that a verb cannot function as an object complement (only nouns and adjectives can), so this is the only plausible explanation I've been able to find. If this is the case, please could someone explain why 'cry' is a catenative complement?

A:
He made him cry.

You are right in saying that this is a catenative construction.
"Make" is a catenative verb and the subordinate infinitival clause is its catenative complement.
The intervening NP "him" is the syntactic object of "made" and the understood (semantic) subject of the subordinate clause.
That "him" belongs in the matrix clause, not the subordinate one, is evident from the fact that it can be made subject of a passive, as in "He was made to cry".

A: It is a complex transitive construction here, i.e. the two elements following the verb are notionally equated with the subject and predication respectively of a nominal clause.
Since nouns or adjectives function as the object comlement in complex transitive constructions and nonfinite clauses don't, the definition "a predication adjunct" was adopted by R.Quirk etal for the nonfinite clause following the direct (raised) object (him).
Hence you can abide by R.Quirk etal and regard "cry" as a predication adjunct.


text:
Q: Java - How to make overriding a method compulsory in child anonymous classes? I've been designing some source code because we had in our project much code being repeated when making SQL queries.
So I did this code below which seems to work fine trying something similar to Command pattern. It receives just a SQL query in a String and some parameters (if needed) to set on the statement. So you can use this code as an anonymous class an execute the query only defining what to do with the output of the query.
My problem is that I wanted to design this to make mandatory to define and write the method getResult in the anonymous child class, but I can't think any way of doing it without making an abstract method and class.
If QueryCommand becomes abstract I should make another class to be able to instantiate, which can't be abstract as well. Is there any other way to make compulsory the overriding in child class? I'm looking for the smartest simplest way to achieve it.
Didn't know how to search for a similar pattern or solution.
Thanks in advance.
Source code:
import java.sql.Connection;
import java.sql.SQLException;

public interface IQueryCommand<T> {
    T executeQuery(Connection conn, String query, Object... args) throws SQLException;
}

import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.MessageFormat;
import org.apache.log4j.Logger;

public class QueryCommand<T> implements IQueryCommand<T> {
    private Logger LOGGER = Logger.getLogger(this.getClass());

    /** The constant ERROR_CLOSING_RESULT_SET */
    protected static final String ERROR_CLOSING_RESULT_SET = "Error when closing ResultSet";

    /** The Constant ERROR_CLOSING_PREPARED_STATEMENT. */
    protected static final String ERROR_CLOSING_PREPARED_STATEMENT = "Error when closing PreparedStatement";

    // FIXME: I want this method to be mandatory to be defined in the anonymous child class
    protected T getResult(ResultSet rs) throws SQLException {
        return null;
    };

    public T executeQuery(Connection conn, String sqlQuery, Object... args) throws SQLException {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(sqlQuery);
        }
        PreparedStatement ps = null;
        ps = conn.prepareStatement(sqlQuery);

        return executeQuery(conn, ps, args);
    }

    public T executeQuery(Connection conn, PreparedStatement ps, Object... args) throws SQLException {
        ResultSet rs = null;
        try {
            if(args != null && args.length > 0) {
                for(int i=0; i< args.length; i++) {
                    setArg(ps, i+1, args[i]);
                }
            }
            rs = ps.executeQuery();
            T result = getResult(rs); // Method defined in child class

            return result;
        } catch (SQLException e) {
            throw e;
        } finally {
            if(rs != null) {
                try {
                    rs.close();
                } catch (final SQLException e) {
                    LOGGER.error(ERROR_CLOSING_RESULT_SET, e);
                }
            }
            if (ps != null) {
                try {
                    ps.close();
                } catch (final Exception e) {
                    if(ps instanceof CallableStatement) {
                        LOGGER.error("Error when closing CallableStatement", e);
                    } else if(ps instanceof PreparedStatement) {
                        LOGGER.error(ERROR_CLOSING_PREPARED_STATEMENT, e);
                    }
                }
            }
        }
    }

    /**
     * Sets a value on the PreparedStatemente with a method dependending on dataType
     *
     * @param ps the preparedStatement
     * @param idx the index on which the value is set
     * @param value the value to set
     * @throws SQLException if an error is detected
     */
    private void setArg(PreparedStatement ps, int idx, Object value) throws SQLException {
        // Implementation not relevant...
    }
}

Example of how to use this:
sqlQuery = " SELECT X FROM Y WHERE countryId = ? and languageId = ?";
return new QueryCommand<String>() {
    // This method should be REQUIRED when compiling
    @Override
    protected String getResult(ResultSet rs) throws SQLException {
        String result = "";
        while (rs.next()) {
            result = rs.getString("DESCRIPTION");
        }
        return result;
    };
}.executeQuery(getDB2Connection(), sqlQuery.toString(), new Object[] { countryIdParameter, languageIdParameter});

A:
I can't think any way of doing it without making an abstract method and class.

Abstract class is precisely the mechanism that you need

I should make another class to be able to instantiate, which can't be abstract as well.

That is not correct: anonymous classes are perfectly capable of inheriting an abstract class, or even extending an interface, provided, of course, that they implement all abstract methods:
public class AbstractQueryCommand<T> implements IQueryCommand<T> {
    abstract protected String getResult(ResultSet rs) throws SQLException;
    ...
}
return new AbstractQueryCommand<String>() {
    @Override
    protected String getResult(ResultSet rs) throws SQLException {
        String result = "";
        while (rs.next()) {
            result = rs.getString("DESCRIPTION");
        }
        return result;
    };
}

A: Make QueryCommand abstract, then create an additional concrete final class. That way any anonymous classes need to implement the method, but you still have a non-abstract class you can instantiate (since it was apparently a requirement, although I fail to see why).


text:
Q: Password Protect the Applications Button How can I password protect the Applications button on my Home of my android phone (samsung galaxy s captivate).
I know there is password protect application out there with a list of application you need to add but I don't want that. I want to protect the whole access of the applications.

A: I'm pretty sure that blocking access to an application from the Home Screen isn't common practice, actually I think you can't even control this as it's part of the Android OS itself. After all, what's the point in blocking user access at the Home Screen since the user already has to unlock his phone in order to get there... usually trough a password.
A viable option would be to greet your users on a Login Activity and you'd have them identify themselves before they can access the actual Application functionality.
If you really want to start blocking users at the Home Screen, you're probably looking at creating your own ROM and Application. But then, no one will want to re-do their whole OS simply to run your application.

A: Write your own home screen, one that prevents launching any applications unless the user authenticates.


text:
Q: Adding android:configChanges to generated manifest I'm using Flash Builder to build an AIR android app. To prevent the app being activated when lock screen is presented, I need to modify AndroidManifest.xml to include modified android:configChanges attribute in the application tag.
AIR provides manifestAdditions tag in AIR application descriptor file (*-app.xml) to accomplish this, but the compiler throws an error if I include configChanges attribute. I can manually unpack and edit the manifest, but then I have to re-sign the package, and that is a hassle (and kinda defeats the point of using an IDE).
Is there a way to automate the process of modifying the manifest?

A: You cannot tweak it within AIR, it is reserved. You'll need to do it the manual way.
Take a look at:
http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-5d0f4f25128cc9cd0cb-7ffc.html
Reserved Android manifest settings
AIR sets several manifest entries in the generated Android manifest document to ensure that application and runtime features work correctly. You cannot define the following settings:
manifest element
You cannot set the following attributes of the manifest element:

*

*package

*android:versionCode

*android:versionName

*xmlns:android

activity element
You cannot set the following attributes for the main activity element:

*

*android:label

*android:icon

application element
You cannot set the following attributes of the application element:

*

*android:theme

*android:name

*android:label

*android:windowSoftInputMode

*android:configChanges

*android:screenOrientation

*android:launchMode


text:
Q: ExpressJS video streaming has annoying audio issues I have been attempting to run an ExpressJS web server that serves videos from my filesystem. For some reason, whenever a video is played, there is constant popping sounds and eventually (after 3-10 minutes) the audio cuts out entirely. Reloading the page will bring the audio back, but won't stop the popping.
I have 2 different methods for serving the video, but only 1 is used at runtime. They both serve to this function:
app.get(`/${VIDTYPE}/:path`, (req, res) => {
    let p = decode(req.params.path)
    let dir = path.dirname(p)
    let name = path.parse(p).name
    let ext = '.vtt'

    let track = path.resolve(`${dir}/${name}${ext}`)

    console.log({track})

    res.send(
        `<video id="videoplayer" controls width="90%" height="90%">` +
        `<source src="/video/${req.params.path}"/>` +
        `<track default kind="subtitles" label="en" src="/track/${encode(track)}"/>` +
        `</video>`
    )
})

The first method was copied from the internet and felt rather complicated.
app.get("/video/:path", (req, res) => {
    let decoded = decode(req.params.path)
    console.log("video", {decoded})
    let stat = fs.statSync(decoded)
    let fileSize = stat.size
    let range = req.headers.range

    if (range) {
        const parts = range.replace(/bytes=/, "").split("-")
        const start = parseInt(parts[0], 10)
        const end = parts[1]
            ? parseInt(parts[1], 10)
            : fileSize-1
        const chunksize = (end-start)+1
        const file = fs.createReadStream(decoded, {start, end})
        const head = {
            'Content-Range': `bytes ${start}-${end}/${fileSize}`,
            'Accept-Ranges': 'bytes',
            'Content-Length': chunksize,
            'Content-Type': 'video/mp4',
        }
        res.writeHead(206, head);
        file.pipe(res);
    } else {
        const head = {
            'Content-Length': fileSize,
            'Content-Type': 'video/mp4',
            }
        res.writeHead(200, head)
        fs.createReadStream(path).pipe(res)
    }
})

The second method is much simpler and seems to function the same way. Both of them have the audio issues with no discernible difference in quality.
app.get("/video2/:path", (req, res) => {
    res.sendFile(decode(req.params.path))
})

The full codebase will be in the comments. All mp4 files were converted from mkv using ffmpeg, so that could be causing issues, but none of the videos have the same audio problems when played directly. I have also isolated the issue to mobile.
Any ideas on where I went wrong?

A: codebase:
const { json } = require('body-parser')
const { dir } = require('console')
const { response } = require('express')
const express = require('express')
const fs = require("fs")
const path = require("path")

const port = 80

const app = express()

const vid_ext = [
    '.mp4',
    '.webm'
]

const VIDTYPE = "vid"
const DIRTYPE = "dir"

const getAllFiles = function(dirPath) {
    console.log({dirPath});
    files = fs.readdirSync(dirPath)

    arrayOfFiles = [{
        path: path.join(dirPath + "/.."),
        title: "go up(beta)",
        type: DIRTYPE
    }]

    files.forEach(function(file) {
        let p = path.resolve(path.join(dirPath, "/", file))
        if (fs.statSync(dirPath + "/" + file).isDirectory()) {
            arrayOfFiles.push({
                path: p,
                title: file,
                type: DIRTYPE
            })
        } else {
            if (vid_ext.includes(path.extname(p))) {
                arrayOfFiles.push({
                    path: p,
                    title: file,
                    type: VIDTYPE
                })
            }
        }
    })

    return arrayOfFiles
}

app.get('/', (request, response) => {
    response.redirect(`/${DIRTYPE}/${encode("../stuff")}`);
});

app.get(`/${DIRTYPE}/:path`, (req, res) => {
    let decoded = decode(req.params.path)
    console.log(DIRTYPE, decoded)

    res.send(dirtable(decoded))
})

app.get("/video/:path", (req, res) => {
    let decoded = decode(req.params.path)
    console.log("video", {decoded})
    let stat = fs.statSync(decoded)
    let fileSize = stat.size
    let range = req.headers.range

    if (range) {
        const parts = range.replace(/bytes=/, "").split("-")
        const start = parseInt(parts[0], 10)
        const end = parts[1]
            ? parseInt(parts[1], 10)
            : fileSize-1
        const chunksize = (end-start)+1
        const file = fs.createReadStream(decoded, {start, end})
        const head = {
            'Content-Range': `bytes ${start}-${end}/${fileSize}`,
            'Accept-Ranges': 'bytes',
            'Content-Length': chunksize,
            'Content-Type': 'video/mp4',
        }
        res.writeHead(206, head);
        file.pipe(res);
    } else {
        const head = {
            'Content-Length': fileSize,
            'Content-Type': 'video/mp4',
            }
        res.writeHead(200, head)
        fs.createReadStream(path).pipe(res)
    }
})

app.get("/video2/:path", (req, res) => {
    res.sendFile(decode(req.params.path))
})

app.get(`/${VIDTYPE}/:path`, (req, res) => {
    let p = decode(req.params.path)
    let dir = path.dirname(p)
    let name = path.parse(p).name
    let ext = '.vtt'

    let track = path.resolve(`${dir}/${name}${ext}`)

    console.log({track})

    res.send(
        `<video id="videoplayer" controls width="90%" height="90%">` +
        `<source src="/video/${req.params.path}"/>` +
        `<track default kind="subtitles" label="en" src="/track/${encode(track)}"/>` +
        `</video>`
    )
    //res.redirect(`/video2/${req.params.path}`)
})

app.get("/track/:path", (req, res) => {
    res.sendFile(decode(req.params.path))
})

function dirtable(a) {
    let files = getAllFiles(a)

    return (
        "

" +
        files.map(x => `<td>${linkfrom(x)}</td><td>${x.type}</td>`).reduce((acc, x) => acc + `<tr>${x}</tr>`) +
        "

"
    )
}

function linkfrom(a) {
    return `<a href="/${a.type}/${encode(a.path)}">${a.title}</a>`
}

function encode(h) {
    return Buffer.from(h).toString('base64')
}

function decode(h) {
    return Buffer.from(h, "base64").toString()
}

app.listen(port, console.log(`App Listening to port ${port}`));


text: Q: Most windows appear offscreen I'm using Ubuntu 16.04 LTS. Lately I've been having an issue with all the windows that had been opened appearing off screen, where I could see most of the window but the title bar including the close and maximize buttons were submerged into the upper left corner of the screen. Everytime a window is opened I needed to Alt+F7 and then moved it to from offscreen before I could work with the application. It's really time consuming when you do this hundreds of times a day. I tried to search on google for a solution but really haven't got any working for me.


text:
Q: Why the fragments conflicts each other during tab navigation or screen rotation in android I have 3 tabs in an activity works fine. but when I navigate from one tab to another, the previous tab contents views in the current tabs. I couldn't figure out what the problem is? I don't get error messages on LogCat and no redFlags. Can someone help me to solve this problem?
The display looks like this:

A: I've seen this where I've added fragments instead of replacing them.  Take a look at your TabListener.  This works for me:
    class MyTabsListener implements ActionBar.TabListener {
    private Fragment fragment;

    public MyTabsListener(ListFragment fragment) {
        this.fragment = fragment;
    }

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        Bundle bundle = new Bundle();
        bundle.putInt("Tab", tab.getPosition());
        fragment.setArguments(bundle);
        ft.replace(android.R.id.content, fragment);;
    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) {

        // Clear the backstack if another Tab is selected
        if (fragment != null) {
            FragmentManager fm = getSupportFragmentManager();
            if (fm.getBackStackEntryCount()>0) {
                fm.popBackStack(fm.getBackStackEntryAt(0).getName(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
            }
            ft.remove(fragment);
        }
    }

    @Override
    public void onTabReselected(Tab tab,FragmentTransaction ft) {
        // TODO Auto-generated method stub
    }
}

A: if you want dynamic fragments you cannot declare fragments statically in your xml, you need a placeholder such as a frame and then replace your fragments with that frame
for example
<FrameLayout
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

and in your activity
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment fragment = new NearMeFragment();
ft.replace(R.id.map, fragment).commit();

check this link from a question I asked a while back
Replacing a ListFragment shows the previous list on top of the new one
also you are calling ft.add(android.R.id.content,mFragment, mTag); which is adding a fragment right on top of each other


text:
Q: Wiki Page name cannot contain special characters when created using UI, but can contain special charterers when created using code I am facing this strange problem inside my enterprise wiki site collection inside sharepoint enterprise server 2013.
now when i try to create a new wiki page using the UI , and i enter some special characters such as & or * inside the Name field, i will get the following error :-

Page name cannot contain any of the following characters: " # % & * :
  < > ? \ / { } ~ |

as follow:-

but i have an event receiver where i am programmatically creating wiki pages inside the same site collection and the same library. and inside the event receiver i am able to create wiki page which contain special characters inside their wiki page name , here is the code i am using to create wiki pages:-
PublishingSite pSite = new PublishingSite(properties.Site);
SPContentType ctype = pSite.ContentTypes["Enterprise Wiki Page"];
PageLayoutCollection pageLayouts = pSite.GetPageLayouts(ctype, true);
PageLayout pageLayout = pageLayouts["EnterpriseWiki.aspx"];
PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(properties.Web);

///First page
PublishingPageCollection pPages = pWeb.GetPublishingPages();
string itemTitle = properties.ListItem.Title.Trim();
PublishingPage pPage = pPages.Add(itemTitle + ".aspx", pageLayout);

and the generated URL for the wiki page will be as follow inside the browser (where the itemTitle variable will be "L & F"):-
/Pages/L%20&%20F.aspx

here is a screen shot from my browser:-

so can anyone advice on this and where the problem is? i mean is it a limitation inside the UI which prevent us from adding some special characters inside the wiki pages names? or the problem is within the server side API which is not returning any error when the page name contain these special characters ?
i am a bit confused on how i need to appraoch this? should i for example check the page name for these special characters before adding it inside my event receiver ?

A: There are differences between UI and API and more than one. I would go with the lowest common denominator so if something is forbidden in UI try not to change it (as general rule) and apply same restrictions on any automation you are implementing. With SP 2016 ampersand is no longer limitation so API may be a bit ahead.


text:
Q: I changed the dataset architecture and suddenly I have no valid results anymore This is in relation to a previous question that I asked and was answered. To give a quick explanation, I have 3 different projects using the same datasource and so they told me to create a n-tier architecture for my projects which I did. I have the following code that used to work and doesn't anymore after the changes. I inserted a breakpoint and the tables are still getting filled with the proper info but amexQuery returns no results. I'm sorry for sounding so clueless but I don't know what in the world would be causing this.
EDIT: I believe the source of the problem is the library reference because I inserted a breakpoint at the amexQuery and it is immediately timing out and giving me the default error of Function evaluation disabled because a previous function evaluation timed out.
dailyAmexAdapter.FillBySymbol(dailyAmexTable, symbol);
dailyAmexAdapter.FillBySymbol(dailyGlobalTable, symbol);

                    var amexQuery = from c in dailyGlobalTable.AsEnumerable()
                                    where c.Date >= DateTime.Now.Subtract(TimeSpan.FromDays(30))
                                    orderby c.Date descending
                                    join d in dailyAmexTable.AsEnumerable() on c.Date equals d.Date
                                    select new { date = c.Date, stockClose = d.AdjustedClose, sandpClose = c.AdjustedClose };

                    if (amexQuery.Count() > 0)
                    {
                      // do something
                    }

A: I bet that your date field is returning a DATETIME from the database and you are wanting all records with the same date.
join d in dailyAmexTable.AsEnumerable() on c.Date equals d.Date

The line above will return only transactions with the same HH:MM:SS:MS.