on-internet

Getting id from element with forEach loop

I am using a foreach loop to loop through an array of a grid datasource view and don't know how to get the Id of an element from a column. The element is a div and an input and I don't know how to get the id from the input. The element.Option being returned is <div class="checkbox" style="margin:0"> <input id="428" checked="" type="checkbox" data-size="mini" data-on="Yes" data-off="No"> </div> and I am looping through the ds ds.forEach(function (element) { // How can I get the id of the input let me = document.getElementById(element.Option.id).checked; ... }); EDIT Here is exactly what each el

Join the discussion →

Using PHP's null coalescing operator on an array

I am using PHP's null coalescing operator; Null coalescing operator The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand. <?php // Fetches the value of $_GET['user'] and returns 'nobody' // if it does not exist. $username = $_GET['user'] ?? 'nobody'; // This is equivalent to: $username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; // Coalescing can be chained: this will return the first // defined val

Join the discussion →

How to properly access mapped memory without undefined behavior in C++

I've been trying to figure out how to access a mapped buffer from C++17 without invoking undefined behavior. For this example, I'll use a buffer returned by Vulkan's vkMapMemory. So, according to N4659 (the final C++17 working draft), section [intro.object] (emphasis added): The constructs in a C++ program create, destroy, refer to, access, and manipulate objects. An object is created by a definition (6.1), by a new-expression (8.3.4), when implicitly changing the active member of a union (12.3), or when a temporary object is created (7.4, 15.2). These are, apparently, the only valid ways to c

Join the discussion →

Where can I find the ports of all running pm2 apps?

I have a server with PM2 installed and 10 running node apps. Every App should run with a different port number. When I install a new App on the server I need the information about the used ports. With 'pm2 list' I get much info about the apps but not the port. pm2 list App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching example_name │ 1 │ 0.0.0 │ fork │ 25651 │ online │ 0 │ 37D │ 0% │ 386.3 MB │ root │ disabled I can not find a overview of all used ports and I can't believe that this important information is not given by PM2. Does anyone have any idea

Join the discussion →

Spring nullable annotation generates unknown enum constant warning

In my app, whenever I add @Nullable (which imports from org.springframework.lang.Nullable) to any of the fields, I get a build warning: Warning:java: unknown enum constant javax.annotation.meta.When.MAYBE reason: class file for javax.annotation.meta.When not found @NonNull and other null safety annoations from spring compile without any warnings as its implementation doesn't import import javax.annotation.meta.When. The application runs just fine but the warning is just annoying. I am using spring boot 2.1.0 and java version 1.8.0_191

Join the discussion →

DAX Index and Match?

I am looking to bring a value dependant on two other columns within the same table in Power Pivot. What I did first: got the latest date for a name entered in the table. I now need to match an ID number based on the name and the date. For example: ID | Name | Date | Latest Date | ID Number 1 | John | 1/1/2018 | 1/5/2018 | 2 | Kyle | 1/15/2018 | 1/30/2018 | 3 | John | 1/5/2018 | 1/5/2018 | 4 | Kyle | 1/30/2018 | 1/30/2018 | What I need is: ID | Name | Date | Latest Date | ID Number 1 | John | 1/1/2018 | 1/5/2018 | 3 2 | Kyle | 1/15/2018 | 1/30/2018 | 4 3 | John | 1/5/2018 | 1/5/2018 | 3 4 | Kyl

Join the discussion →

There is no package called devtools in R even after installing devtools

I am trying to follow this guide to get R as a usable language in jupyter notebook. The first step is to run: install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest')) But even after running this command, I still cannot execute the next step: devtools::install_github('IRkernel/IRkernel') returning the error: Error in loadNamespace(name) : there is no package called ‘devtools’ If you look at the comment section of the link I posted someone else seems to also have run into this problem. Update: Scott Richie suggested I rerun install.packages('devtools

Join the discussion →

Set up Neovim integration in VS code

Currently a (neo)vim user, I read that VS Code supports neovim backend integration, but after searching I cannot find how to set it up. How to set up neovim integration in VS Code? I use both linux and windows so if there are some OS specifity you could mention it.

Join the discussion →

Trying to parse XML directly from a URL

I'm looking at this XML: https://data.cityofnewyork.us/api/views/25th-nujf/rows.xml I thought I could parse out the 'ethcty' and 'cnt' items from the list, using the code below, but I'm actually getting nothing at all. import xml.etree.ElementTree as ET tree = ET.parse('https://data.cityofnewyork.us/api/views/25th-nujf/rows.xml') root = tree.getroot() for child in root: print(child.tag, child.attrib) for _id in root.findall('_id'): rank = _id.find('ethcty').text name = _id.get('cnt') print(name, rank) I am following the examples from the URL below. https://docs.python.org/3.4/library/xml.etree

Join the discussion →

Can i enable Group Policy to Launch an App as an Admin?

I want all my users to run an App as admin by default. So when the app launches, the Credentials box will not appear to enter an Admin Domain Account. so basically I would like to whitelist the app (if that's the correct terminology?) Is there a Group Policy setting to enable a specific app to run as Admin? Or set the app up to launch as Admin? For arguments sake, I would like to run the Notepad app as Admin for all my users so they can edit some Admin Text files. Thanks,

Join the discussion →

Optimize power consumption with STM32L4 ADC

I'm working on a firmware development on a STM32L4. I need to sample an analog signal at around 200 Hz. So basically one analog to digital conversion every 5 ms. Up to now, I was starting the ADC in continuous conversion mode, triggered by a timer. However, this prevents to put the STM32 in Stop mode in between conversions, which would be very efficient in terms of power consumption, since more than 99% of the time, the product doesn't have anything to do. So my idea is to use the single conversion mode: Use a low power timer to wakeup the product from Stop mode every 5 ms, launch a single con

Join the discussion →

JSch Socket timeout - Connection timeout

I am trying to establish an SFTP session using JSch. The code is working correctly and I am able to establish a session with multiple servers. However, today I am encountering an issue with one of the server. Caused by: com.jcraft.jsch.JSchException: java.net.ConnectException: Connection timed out: connect at com.jcraft.jsch.Util.createSocket(Util.java:349) ~[jsch-0.1.54.jar:?] at com.jcraft.jsch.Session.connect(Session.java:215) ~[jsch-0.1.54.jar:?] at com.jcraft.jsch.Session.connect(Session.java:183) ~[jsch-0.1.54.jar:?] After debugging, I see that the issue is happening in Session.class. tm

Join the discussion →

Is there a javascript equivalent to php's strtok function?

I was looking for a function in javascript that is an equivalent to php's strtok function and found this question/answers: javascript or jquery equivalent of PHP's strtok()? There are a lot of good splitting options, but none were an actual equivalent to strtok. I added my input here: https://stackoverflow.com/a/53163790/1934903 From the post: I don't know the exact equivalent to php's strtok function in javascript (I was searching for the same), but I noticed that all of the answers here missed a nuance of the strtok function and wanted to point it out. If all you're looking to do is break up

Join the discussion →

How To Properly Initialize Form Data In Vue

so I have a component that is rendering a form and it also is pre-filling the fields with data received from ajax request. My issue is that I want to not only be able to edit fields but also add new fields to submit at the same time, so because of this I am trying to initialize my pre-filled data and new data into the same Object to be submitted with my ajax request. With my current set up the form-data is not consistently filling in the fields before the form is rendered. This is the form template <form @submit.prevent="editThisWorkflow" class="d-flex-column justify-content-center" > <div> <i

Join the discussion →

Property or method "key" is not defined on the instance - Vue/Laravel application

I have an application in which on deleting one of the registers i receive the message following Vue-warn: Property or method "key" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option or for class-based components, by initializing the property. Only initializing the variable key on the data/return didn't actually solve my problem. Another thing i noticed is that the data is deleted from the DB, the field log.title and log.user are deleted from the the logs list straight away but the other half of the row still remain o

Join the discussion →

como iterar fila por fila en pandas

como puedo iterar fila por fila en un dataframe usando python: por ejemplo , tengo el siguiente data: canciones={'albun':['cacho','beto','pedrito','loshermanos'], 'ano':[1992,1998,1994,1993], 'tiempo':['00:22:04','00:42:02','00:23:33','00:44:33']} ahora yo quiero saber como hacer para iterar la fila 1 o tal vez la 2 o tal vez 1 y dos: for i en fila 1: if fila 1 elemento 1(osea la de la columna 1 y despues hasta columna n) es > 20: guardame en ese espacio ('no') elif: si es <20 y >10: guardame en ese espacio ('si') else dejalo como esta y tal vez no solo agarrando una fila sino la fila 10 , 20

Join the discussion →

openpyxl: password protect entire excel file (xlsx)

I am trying to find pythonic ways to encrypt/password-protect excel xlsx files. Came across openpyxl, where in their documentation (https://openpyxl.readthedocs.io/en/stable/protection.html) states that it can do so. However, an error message AttributeError: 'NoneType' object has no attribute 'workbookPassword' is prompted when I executed the following. Help anyone? from openpyxl import workbook file = 'test.xlsx' // an existing xlsx wb = load_workbook(filename = file) wb.security.workbookPassword = 'test_password' wb.security.lockStructure = True Edit: I believe I have used the function impro

Join the discussion →

Update Data from Child component - Vue.js/Axios/Laravel

I am trying to update data that comes from a child component on a Vue.js Laravel application and for some reason, i cant that straight to work. The return given on the inspector tells me Creating default object from empty value The parent component opens a modal which is a child component, then the information has to be updated through the update() method. Can someone help me understand what I'm missing? This is basically a img of my database for a matter of knowing how it is structured: Those methods are in my parent component Log.vue and this is how i am passing the data from the parent to t

Join the discussion →

How can I implement interrupt for serial USART communication for ATmega328P/Arduino Nano?

I have a small project for school that requires me to load data in the EEPROM of an ATmega328P through the USART serial communication. I'm going to figure out the EEPROM read/write myself. I have problems sending data using interrupts. Basically, I want to have the Arduino Nano loop through code and when I send something through the USART serial communication using the serial monitor of the Arduino IDE, an interruption will occur and the data that was send will be saved in a variable. My clock is 16 MHz, with a baud rate of 9600; and as I've said I'm using the Arduino IDE. Here is what I've tr

Join the discussion →

How to send an email with a link to reset password?

How to send an email with a link to reset the password of a user? Here is my method of hashing: $options = ['cost' => 11, 'salt' => random_bytes(22)]; $passwordCrypter = password_hash($password, PASSWORD_BCRYPT, $options); I think we need to use this method because to decrypt a password is not recommended. But why?

Join the discussion →

Convert Microsoft Word document to PDF using Python

I have tons of Word and Excel files. I want to convert many Word files in folders by sub folders to PDF, and I try following code. This code is not active (I mean there aren't Word convert to PDF) although no error. What could be the problem? Is there another solution? This is my code: import os from win32com import client path = 'D:\programing\test' word_file_names = [] word = client.DispatchEx("Word.Application") for dirpath, dirnames, filenames in os.walk(path): print (dirpath) for f in filenames: if f.lower().endswith(".docx") and re.search('Addendum', f): new_name = f.replace(".docx", r".

Join the discussion →

Time zones `Etc/GMT`, why is it other way round?

Time zones in php work like this https://www.gsp.com/support/virtual/admin/unix/tz/gmt/ and when it named Etc/GMT+11 it actually GMT-11 and when it named Etc/GMT-11 it actually GMT+11 Why? And what does it mean Etc/GMT? I find it in PHP, is it a bug in PHP or is it everywhere?

Join the discussion →

Time zones `Etc/GMT`, why it is other way round?

Time zones in php work like this https://www.gsp.com/support/virtual/admin/unix/tz/gmt/ and when it named Etc/GMT+11 it actually GMT-11 and when it named Etc/GMT-11 it actually GMT+11 Why? And what does it mean Etc/GMT? I find it in PHP, is it a bug in PHP or is it everywhere?

Join the discussion →

How to make post request in apache camel rest

I am new apache rest dsl with spring boot, have made following changes Main Class package com.javaoutofbounds.pojo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication(scanBasePackages = {"com.ccs.batchfile"}) public class BatchFileApplication { public static void main(String[] args) { SpringApplication.run(BatchFileApplication.class, args); } } Service class package com.ccs.batchfile.service; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.model.rest.RestBindingMode; import org.spr

Join the discussion →

Hide/Show side editor in VS Code?

I love the editor splitting in VS Code. But I'm also used to Xcode, where the Assistant Editor can be opened/closed, or rather hidden/shown, maintaining what it last showed. (okay technically that may not be true but just imagine it is, or just ignore that and move on with my actual question haha) Could I possibly hide/show side editors without closing and then having to reopen all their tabs? Like say I have File A on the left and File B on the right and I want to focus on just A, so I want to hide B on the right but then be able to show it again without having to explicitly select File B and

Join the discussion →

How can I disable webRTC local IP leak with puppeteer?

I tried: const browser = await puppeteer.launch({args: ['--enable-webrtc-stun-origin=false', '--enforce-webrtc-ip-permission-check=false']}); But this is not working. Next I tried: const targets = await browser.targets(); const backgroundPageTarget = targets.find(target => target.type() === 'background_page'); const backgroundPage = await backgroundPageTarget.page(); await backgroundPage.evaluateevaluateOnNewDocument(() => { chrome.privacy.network.webRTCIPHandlingPolicy.set({ value: "default_public_interface_only" }); }); But got: TypeError: Cannot read property 'page' of undefined EDIT: Need

Join the discussion →

Acrescentar paragrafo em vba

Eu tenho várias celulas que quero concatenar para enviar um email através do excel Acontece que a cada celula eu gostaria de ter line breaks mas não estou a conseguir Já utilizei o WrapText e o Chr() mas não está a resultar, alguém me pode ajudar? Dim outapp As Outlook.Application Dim outmail As Outlook.MailItem Dim linha As Integer Dim folha_origem As String Dim listamails As String Dim email As String 'cria e chama os objetos Set outapp = CreateObject("outlook.application") Set outmail = outapp.CreateItem(olMailItem) linha = 7 folha_origem = "Contactos Experts" 'desativar a mensagem de alert

Join the discussion →
Older stories