How to take a screenshot with colors as they appear in night mode

I often find myself in situations where some images have nicer looking colors in the night-mode. I often want to screenshot them. Unfortunately, what I get is the original image.

Is there any way to get the image as it appears on the display?

PS: A lot of times, I want to pick colors from images in night-mode. If it is not possible/easy to take screenshots in night-mode, can you please suggest a way to pick those colors?

How To Make Popup Modal Appear When Clicking a Link?

I am trying to create a Login Modal Form for an application. However, I want the popup to appear when I click a link versus a button. In other words, when I click the login link in my navbar, I don’t want to be redirected to another page entirely. I just want the modal to pop up.

I’m very new to ReactJS, so I’m not sure how to go about this. Could somebody please help me understand how to get this function to work? I’d really appreciate it.

Additionally, if anyone knows of some great resources on how to implement a proper login form, I would also greatly appreciate that. I found a few on CodePen, but none of them really show a clear and approachable way on how to build this component. At least, for a beginner like me.

Located below is my code. Also, if it helps, I provided the link to the site I am currently using as a reference to build this code.

Resource: https://react-bootstrap.github.io/components/modal/

App.js

import React from 'react'; import {BrowserRouter, Route, Switch} from 'react-router-dom' import Navbar from './components/Navbar/navbar.js'; import Footer from './components/Footer/footer.js'; import Home from './pages/Home/home.js'; import Login from './pages/Login/login.js'; import Languages from './pages/Languages/languages.js';  function App() {   return (     <div className="App">       <BrowserRouter>         <Navbar/>           <Switch>             <Route exact path="/" component={Home}/>             <Route path="/login" component={Login}/>             <Route path="/languages" component={Languages}/>           </Switch>       </BrowserRouter>       <Footer />     </div>   ); }  export default App; 

Login.js

import React, { Component } from 'react'; // import { connect } from 'react-redux'; import Modal from 'react-bootstrap/Modal'; import Button from 'react-bootstrap/Button'; import './login.css';  class Login extends Component {     constructor(props, context) {         super(props, context);          this.handleShow = this.handleShow.bind(this);         this.handleClose = this.handleClose.bind(this);          this.state = {           show: false,         };       }        handleClose() {         this.setState({ show: false });       }        handleShow() {         this.setState({ show: true });     }      render() {         return (             <>                 <Button variant="primary" onClick={this.handleShow}>                   Launch demo modal                 </Button>                  <Modal show={this.state.show} onHide={this.handleClose}>                   <Modal.Header closeButton>                     <Modal.Title>Login</Modal.Title>                   </Modal.Header>                   <Modal.Body>...</Modal.Body>                   <Modal.Footer>                     <Button variant="danger" onClick={this.handleClose}>                       Cancel                     </Button>                   </Modal.Footer>                 </Modal>             </>         );     } }  export default Login; 

Using node, is it possible to wait for a database entry to appear?

Is it possible with node to asynchronously wait for a record to appear in a database table?

I use a SMS service where I send a POST request to an API endpoint where I receive a sms-id (uuid) then a “Delivery Report” as XML sent to an API-endpoint on my server; eg. sms.mydomain.com.

This sms-id is used to match a reportId field in the “Delivery Report”. This Delivery Report can take anywhere from 1 to 60 seconds to be sent/received by my endpoint, parsed and inserted into a DB table.

So far, I’ve used a simple timeout script to check if a record with a reportId that matches the sms-id has been inserted into a table. This script has been edited a bit to clearly display my use-case and setup.

const axios = require('axios');  const setAsyncTimeout = (cb, timeout = 0) => new Promise(resolve => {     setTimeout(() => {         cb();         resolve();     }, timeout); });  const url = 'https://api.mydomain.com/v1/get/7654fec9-33ba-4881-931d-0e6f4d7de710'; const getData = async url => {     try {         const response = await axios.get(url);         const data = response.data;         await setAsyncTimeout(() => {             // Do whatever with the returned Delivery Report here         }, 30000);     } catch (error) {         // Add entry to monolog. Endpoint returns json or 404/500         $  log->error(`Could not find a Delivery Report with this ID.\n$  {error}`);     } };  getData(url); 

With the code above, if a Delivery Report is found where the given SMS-id and reportId matches, it returns the table as JSON for further handling, if no matching Delivery report is found, a 404 HTTP error message is returned instead.

While this method certainly works, it misses checks for about 15-20% of reports that take longer than 30 seconds to be received by my endpoint. I don’t feel it’s very clean or right to do it like this. I believe there has to be a better approach but looking up the issue has yielded few results.

Why reading permission to /proc/1/maps is denied and why doesn’t the denial appear in logcat?

I’m developing a native app for Android, and I’m occasionally confronted with permission denied which doesn’t trigger a log in the logcat logs. For example, trying to run:

shell@kltevzw:/ $   cat /proc/<some-not-shell-pid>/maps /system/bin/sh: cat: /proc/<some-not-shell-pid>/maps: Permission denied 

from the adb shell prompt results in a permission denied message sent to stderr, but nothing appears in the logcat. It’s not a unix permissions problem as well, as anyone should be able to read the file. For example:

shell@kltevzw:/ $   ls -lZ /proc/1/maps -r--r--r-- root     root              u:r:init:s0 maps 

It happens in some other situations as well, in which I have less control of the environment. Is it possible that this is caused by some dontaudit rules in the policy? I ran sesearch –dontaudit /sepolicy but didn’t find there any relevant rules. Does anyone here know why are some denials sent to the log and some don’t, and how to debug such cases?

Thanks!

Can my company see my network traffic if their certificate doesn’t appear in the web browser?

I have a work-issued Mac, when I go to keychain access right now these are the following certificates:

  1. AddTrust External CA Root (Root certificate authority)
  2. COMODO RSA Certification Authority (Root certificate authority)
  3. COMODO RSA Certification Authority (Intermediate certificate authority)
  4. COMODO RSA Organization Validation Secure Server CA (Intermediate certificate authority)
  5. ise-auth.[company name].com (Issued by COMODO RSA Organization Validation Secure Server CA)
  6. My account name (Issued by [some certificate from my company])

So I see there is a certificate on my computer from my company. However, when I access websites and click the padlock on the browser I don’t see my company’s certificate. For example, with google.com the certificate chain I see is GlobalSign -> Google Internet Authority G3 -> google.com. Does this mean my traffic is encrypted if I’m on their wifi? Or can they still see traffic?

Why an I2C device driver doesn’t appear in /sys/bus/i2c/drivers?

Starting from an image ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img.xz (https://wiki.ubuntu.com/ARM/RaspberryPi) I’m trying to add the ad525x_dpot I2C driver which was not enabled during the build of the kernel.

I’ve taken ad525x_dpot.c, ad525x_dpot.h, ad525x_dpot-i2c.c from the corresponding linux source to make a DKMS package.

dkms.conf:

PACKAGE_NAME="ad525x_dpot" PACKAGE_VERSION="0.10" MAKE[0]="make all KVERSION=$  kernelver" CLEAN="make clean" BUILT_MODULE_NAME[0]="ad525x_dpot" DEST_MODULE_LOCATION[0]="/kernel/drivers/misc" AUTOINSTALL="yes" 

Makefile:

obj-m := ad525x_dpot.o ad525x_dpot-i2c.o KVERSION := $  (shell uname -r)  all:     $  (MAKE) -C /lib/modules/$  (KVERSION)/build M=$  (PWD) modules  clean:     $  (MAKE) -C /lib/modules/$  (KVERSION)/build M=$  (PWD) clean 

The module ad525x_dpot can be loaded by modprobe and it shows in lsmod but not in /sys/bus/i2c/drivers. There are some warnings in syslog.

ad525x_dpot: loading out-of-tree module taints kernel. ad525x_dpot: module verification failed: signature and/or required key missing - tainting kernel 

Why doesn’t it show in /sys/bus/i2c/drivers?

I’ve tried to load a similar kernel module ad799x that comes with the kernel. It appears in /sys/bus/i2c/drivers/ad799x (no devices are defined to use the ad799x, so it’s not related to the device tree or the board config).

How to get Wi-Fi entry dialogue box to appear on MacBook

I’m having trouble connecting to the hotel WiFi. It is unlocked and not secured, but when you try to connect, usually a dialogue box opens and tells you to input a password and then you will be connected to the Internet. This box is not showing up anymore.

The first time I tried using Terminal and the command ifconfig and changing the MAC address by one digit. However this stopped working. I am getting the response

ifconfig:ioctl (SIOCAIFADDR): device power is off.

I have done this following the steps to turn Wi-Fi off. Then opened Terminal, then put in the code, then turned Wi-Fi back on.

Do you have any suggestions?

Can I keep an email folder on a remote drive and have it appear in Mail when I mount that drive?

All of my mac’s email is IMAP and kept on iCloud and I’m fine with that. However, I have an email hierarchy that I’d rather not keep locally on my machine or in the cloud and would prefer to keep it either on an external drive or in an encrypted dmg on my Mac. I moved that particular hierarchy into the “On My Mac” part of the Mail app to get it out of iCloud in the hopes that it’s contents would exist separate from all the other emails and maybe I could replace it with a sym link. However Apple’s storage of emails in ~/Library/Mail is complete gobbledygook and it didn’t look possible. Are there any creative ways to achieve this?