Sunday, April 18, 2021

e-techbytes

e-techbytes


Recent Questions - Server Fault

Posted: 18 Apr 2021 10:03 PM PDT

Recent Questions - Server Fault


Docker Nginx returning 404 on install.php

Posted: 18 Apr 2021 09:53 PM PDT

Let me first describe the server structure. My Wordpress is hosted inside a docker container along with nginx on lets say Server B (https://serverB.com). But I am trying to access the Wordpress site through (https://serverA.com/blogs). Now, if configure WP_HOME to https://serverB.com, everything runs smoothly, I can install Wordpress and everything. But if I change the WP_HOME to https://serverA.com/blogs, all of a sudden I am getting 404 - Not Found Error. (I downed the docker containers and deleted the volume).

I added the following line on wp-config.php as well.

$_SERVER['REQUEST_URI'] = '/blogs' . $_SERVER['REQUEST_URI'];  

404 - Not Found error is receiving on docker's nginx. That means the request has travelled all the way to the docker's nginx and then either it does not know what's happening or where's the file...

Error message from docker logs:

webserver_test | 192.168.192.1 - - [19/Apr/2021:04:44:18 +0000] "GET /blogs/wp-login.php HTTP/1.0" 404 556 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36"  

docker-compose.yml file

version: '3'      services:    db:      image: mysql:8.0      container_name: db_test      restart: unless-stopped      env_file: .env      environment:        - MYSQL_DATABASE=wordpress      volumes:        - mysql_db_data_test:/var/lib/mysql      command: '--default-authentication-plugin=mysql_native_password'      networks:        - app-network      wordpress:      depends_on:        - db      image:  wordpress:5.1.1-fpm-alpine      container_name: wordpress_test      restart: unless-stopped      env_file: .env      environment:        - WORDPRESS_DB_HOST=db:3306        - WORDPRESS_DB_USER=$MYSQL_USER        - WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD         - WORDPRESS_DB_NAME=wordpress        - WORDPRESS_CONFIG_EXTRA=            define('WP_HOME','https://serverA.com/blogs/');            define('WP_SITEURL', 'https://serverA.com/blogs/');            define( 'WP_DEBUG', true );      volumes:        - wordpress_data_test:/var/www/html      networks:        - app-network        webserver:      depends_on:        - wordpress      image: nginx:1.15.12-alpine      container_name: webserver_test      restart: unless-stopped      ports:        - "7070:80"      volumes:        - wordpress_data_test:/var/www/html        - ./nginx-conf:/etc/nginx/conf.d      networks:        - app-network      volumes:    wordpress_data_test:    mysql_db_data_test:      networks:    app-network:      driver: bridge  

Please let me know if I have to add any more information. Thank you

Start getty on pty

Posted: 18 Apr 2021 09:25 PM PDT

I'm trying to write a ascii to baudot converter (for a teletype, obviously with dropped characters) using pseudoterminals. The idea is to have a pty master/slave pair, write to the slave, read from the master, convert ascii to baudot, and send to teletype. Input from the teletype will be read in, converted from baudot to ascii, sent to the master, and processed by the slave.

I can do this with a direct serial connection (screen /dev/pts/x), but agetty doesn't seem to work. I'm monitoring the master with

import pty  import os    m, s = pty.openpty()  print(s, os.readlink(os.path.join('/proc/self/fd', str(s))))    while True:      data = os.read(m, 1)      print(data)  

and can see data sent through screen, but not agetty. The agetty command I'm using is (where /dev/pts/2 is the slave file)

sudo /sbin/agetty 9600 /dev/pts/2  

How do I start a getty on a pseudoterminal? Does getty look for a special response character (similar to a modem) before sending data? The getty process is not sending any data to my pseudoterminal.

Best MySQL/MariaDB scaling strategy for shared hosting provider

Posted: 18 Apr 2021 09:56 PM PDT

As a small shared hosting service provider our MariaDB server is going to face a hardware limit very soon. So we want to add another machine for another MariaDB instance.

Our goals are:

  1. Reduce disk/cpu/ram usage on current machine.
  2. By reducing resources usage(1), there will be more room for current users/tables in this machine.
  3. Easily scale to more machines in the future.
  4. Our customers should not notice anything at all. They should not forced to change configurations of their softwares.

What I am thinking of is something like an instance which works as something like a proxy, which also knows that which database is on which instance and then automatically redirect queries to that instance, then receives and forwards the to the client.

Here are my Question:

Is this possible? What is it's technical name and how can we implement it in MySQL? Is there any better way to fulfill our goals? Bests,

Glassfish : Class name is wrong or classpath is not set for : com.mysql.cj.jdbc.Driver Please check the server.log for more details

Posted: 18 Apr 2021 07:09 PM PDT

I build JAVA EE project and choose glassfish as a server and mysql as a database, when i trying integrate mysql database in glassfish server, there are some errors : I fill properties database like name , server , PortNumber .. etc. when I test connection by press on ping button , this message displayed

An error has occurred Ping Connection Pool failed for DemoDatabase.  Class name is wrong or classpath is not set for : com.mysql.cj.jdbc.Driver   Please check the server.log for more details. An error has occurred      Ping Connection Pool failed for DemoDatabase.   Class name is wrong or classpath is not set for : com.mysql.cj.jdbc.Driver Please check the server.log for more details.  

this message in Server.log

Cannot find poolName in ping-connection-pool command model, file a bug\ninjection failed on org.glassfish.connectors.admin.cli.PingConnectionPool.poolName with class java.lang.String  

Windows Service running on Windows 10 to persistently connect to network share from comp running windows 7 - no domain

Posted: 18 Apr 2021 07:01 PM PDT

I'm trying to write a Windows service that will persistently connect and pull files from a network share on a windows 7 computer. Both computers are on a private network and the network share has read permissions set to "Everyone" and write permissions set to administrators. Neither computer is on a domain.

I'm able to access the network share through the GUI without entering a username or password. However, when I use the UNC path in a windows service running as a network service, it says the network UNC path doesn't exist. I've also tried to create a user on the Windows 10 computer with the same credentials as a non-administrative user on the windows 7 computer (as suggested here) with no luck there either.

Does anybody know how to accomplish this?

How to create a docker container that simply forwards a range of ports to another, external IP address?

Posted: 18 Apr 2021 06:36 PM PDT

I would like to create a docker container that all it does is forward any connection on a range of IP addresses to another host, at the same port.

I've looked at iptables, pipeworks and haproxy and they look rather complex.

socat and redir look like they could do what I want, but they don't take a port range.

FROM ubuntu:latest    ENV DEST_IP=8.8.8.8 \      PORTS=3000-9999    RUN apt update && apt install -y ????    CMD ???? --source 0.0.0.0 --ports ${RANGE} --dest ${DEST_IP}  

I am using Gmail with a vanity account alias and external SMTP server (AWS SES). My first email is not being threaded

Posted: 18 Apr 2021 07:00 PM PDT

So this is a minor inconvenience but I am curious if anyone well versed in email forwarding and Gmail can help me.

I have a vanity domain I'll call code@coder.dev. I am using it as an alias for my personal gmail code@gmail.com.

  • I compose the initial message, message_id=A, in Gmail, and send it through AWS SES SMTP.
  • AWS SES creates its own message_id=B and sends it to end user (stranger@gmail.com)
  • stranger@gmail.com replies with message_id=C, and sends it to AWS SES. It also sets References: B
  • My email forwarding Lambda forwards the message to me (code@gmail.com), with message_id=D.
  • Gmail does not show A in the same thread as D, on my end (code@gmail.com)

Note that if I reply to D, and stranger replies, and I reply back, etc. etc., all those messages are threaded together. Because at this point, we are building up the References: list with ids we have both seen before. It's only A that is left out.

What's funny/sad is message A also contains X-Gmail-Original-Message-ID: A, and that makes it to stranger@gmail.com, but then stranger doesn't send that header back in message C or use it in the References: list. Google doesn't know how to talk to itself :|

Also see https://workspaceupdates.googleblog.com/2019/03/threading-changes-in-gmail-conversation-view.html

How to Trace Who was Using my Mail Relay on Spamming?

Posted: 18 Apr 2021 04:21 PM PDT

I have a Postfix mail relay server running as Exchange smarthost as well as hosting another mail locally.

Last week I observed an attack on this server, someone is using it to send massive emails to different destinations.

I can't find out where it is connected from and the "from" address is also masked.

Below is the mail logs:

Apr 16 06:29:10 mail.xxx.com postfix/qmgr[25497]: EC5A91D727: from=<>, size=3096, nrcpt=1 (queue active)  Apr 16 06:29:10 mail.xxx.com postfix/bounce[12183]: B37D31D6FA: sender non-delivery notification: EC5A91D727  Apr 16 06:29:10 mail.xxx.com postfix/qmgr[25497]: B37D31D6FA: removed  Apr 16 06:29:11 mail.xxx.com postfix/smtp[12164]: 1A9B71D801: to=<xxx@inver**.com>, relay=inver**.com[164.138.x.x]:25, delay=50, delays=39/0/6.7/5, dsn=2.0.0, status=sent (250 OK id=1lX6jh-000875-TC)  Apr 16 06:29:11 mail.xxx.com postfix/qmgr[25497]: 1A9B71D801: removed  Apr 16 06:29:11 mail.xxx.com postfix/smtp[11990]: 3BEAB1D9C3: to=<xxx@tms**.pl>, relay=tms**.pl[194.181.x.x]:25, delay=49, delays=37/0/6.7/5.4, dsn=2.0.0, status=sent (250 OK id=1lX6ji-000469-QT)  Apr 16 06:29:11 mail.xxx.com postfix/qmgr[25497]: 3BEAB1D9C3: removed  Apr 16 06:29:12 mail.xxx.com postfix/smtp[12954]: 418621D80D: to=<xxx@medi**.com.cn>, relay=mxw**.com[198.x.x.x]:25, delay=51, delays=38/0/8.5/4.5, dsn=5.0.0, status=bounced (host mxw.mxhichina.com[198.11.189.243] said: 551 virus infected mail rejected (in reply to end of DATA command))  Apr 16 06:29:12 mail.xxx.com postfix/cleanup[7936]: 6711A1D7B7: message-id=<20210415182912.6711A1D7B7@mail.xxx.com>  Apr 16 06:29:12 mail.xxx.com postfix/bounce[12184]: 418621D80D: sender non-delivery notification: 6711A1D7B7  Apr 16 06:29:12 mail.xxx.com postfix/qmgr[25497]: 418621D80D: removed  Apr 16 06:29:12 mail.xxx.com postfix/qmgr[25497]: 6711A1D7B7: from=<>, size=2554, nrcpt=1 (queue active)  Apr 16 06:29:12 mail.xxx.com postfix/smtp[11499]: 65E4C1D95F: to=<xxx@an**.com>, relay=aspmx.l.google.com[172.217.x.x]:25, delay=51, delays=38/0/6.3/6.7, dsn=5.7.0, status=bounced (host aspmx.l.google.com[172.217.194.27] said: 552-5.7.0 This message was blocked because its content presents a potential 552-5.7.0 security issue. Please visit 552-5.7.0  https://support.google.com/mail/?p=BlockedMessage to review our 552 5.7.0 message content and attachment content guidelines. z63si3810735ybh.300 - gsmtp (in reply to end of DATA command))  Apr 16 06:29:12 mail.xxx.com postfix/cleanup[10468]: 705F91D801: message-id=<20210415182912.705F91D801@mail.xxx.com>  Apr 16 06:29:12 mail.xxx.com postfix/smtp[11996]: F05911DBCA: to=<xxx@maq**.ae>, relay=maq**.protection.outlook.com[104.47.x.x]:25, delay=36, delays=27/0/3.1/6, dsn=2.6.0, status=sent (250 2.6.0 <20210415112836.BE31E4C0C57EAA1B@alshirak.com> [InternalId=93338229282509, Hostname=DB8PR10MB2745.EURPRD10.PROD.OUTLOOK.COM] 933811 bytes in 3.322, 274.451 KB/sec Queued mail for delivery)  Apr 16 06:29:12 mail.xxx.com postfix/qmgr[25497]: F05911DBCA: removed  Apr 16 06:29:12 mail.xxx.com postfix/bounce[12183]: 65E4C1D95F: sender non-delivery notification: 705F91D801  Apr 16 06:29:12 mail.xxx.com postfix/qmgr[25497]: 65E4C1D95F: removed  

How to check where is the attack source? Is there a way to limit only a specific range of domains that can be used for mail relay?

I'm not a Postfix professional, so any suggestions/advises would be appreciated.

Trying to force Apache to use only TLSv1.3 on a vhost, but it refuses to disable TLSv1.2

Posted: 18 Apr 2021 04:17 PM PDT

I have a test vhost on my web server for which I'm trying to enforce TLSv1.3-only but Apache refuses to disable TLSv1.2. TLSv1.3 does work however the following validation services all show that TLSv1.2 is still running on my vhost:

https://www.digicert.com/help/

https://www.ssllabs.com/ssltest/

https://www.immuniweb.com/ssl/

I've tried a few different ways including all of the following:

SSLProtocol -all +TLSv1.3  SSLProtocol +all -SSLv3 -TLSv1 -TLSv1.1 -TLSv1.2  SSLProtocol -all -TLSv1.2 +TLSv1.3  SSLProtocol +TLSv1.3  

System info:

Ubuntu 20.04.2 LTS  OpenSSL 1.1.1f  Apache 2.4.41  

Global SSL configuration:

SSLRandomSeed startup builtin  SSLRandomSeed startup file:/dev/urandom 512  SSLRandomSeed connect builtin  SSLRandomSeed connect file:/dev/urandom 512  AddType application/x-x509-ca-cert .crt  AddType application/x-pkcs7-crl .crl  SSLPassPhraseDialog  exec:/usr/share/apache2/ask-for-passphrase  SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)  SSLSessionCacheTimeout  300  SSLCipherSuite HIGH:!aNULL  #SSLProtocol all -SSLv3  SSLUseStapling On  SSLStaplingCache "shmcb:${APACHE_RUN_DIR}/ssl_stapling(128000000)"  SSLStaplingResponderTimeout 2  SSLStaplingReturnResponderErrors off  SSLStaplingFakeTryLater off  SSLStaplingStandardCacheTimeout 86400  

vhost configuration:

<VirtualHost XX.XX.XX.XX:443>      ServerName testing.example.com      DocumentRoot "/var/www/test"      ErrorLog ${APACHE_LOG_DIR}/test-error.log      CustomLog ${APACHE_LOG_DIR}/test-access.log combined  #   Include /etc/letsencrypt/options-ssl-apache.conf      SSLEngine on      SSLCompression off      SSLCertificateFile /etc/letsencrypt/live/testing.example.com/fullchain.pem      SSLCertificateKeyFile /etc/letsencrypt/live/testing.example.com/privkey.pem      Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"  #   SSLCipherSuite "HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AES128"  #   SSLHonorCipherOrder off      SSLProtocol -all +TLSv1.3      SSLOpenSSLConfCmd DHParameters "/etc/ssl/private/dhparams_4096.pem"  </VirtualHost>  

info from "apachectl -S":

root@domain:~# apachectl -S  VirtualHost configuration:  XX.XX.XX.XX:80      is a NameVirtualHost  ...  (irrelevant)  ...  XX.XX.XX.XX:443     is a NameVirtualHost           default server blah.example.com (/etc/apache2/sites-enabled/sites.conf:13)           port 443 namevhost blah.example.com (/etc/apache2/sites-enabled/sites.conf:13)           **port 443 namevhost test.example.com (/etc/apache2/sites-enabled/sites.conf:29)**           port 443 namevhost blah.example.com (/etc/apache2/sites-enabled/sites.conf:54)           port 443 namevhost blah.example.com (/etc/apache2/sites-enabled/sites.conf:93)           port 443 namevhost blah.example.org (/etc/apache2/sites-enabled/sites.conf:111)           port 443 namevhost blah.example.tk (/etc/apache2/sites-enabled/sites.conf:132)           port 443 namevhost blah.example.com (/etc/apache2/sites-enabled/sites.conf:145)  [XX:XX:XX:XX:XX:XX:XX:XX]:80 is a NameVirtualHost  ...  (irrelevant)  ...  [XX:XX:XX:XX:XX:XX:XX:XX]:443 is a NameVirtualHost  ...  (irrelevant; note the subdomain in question only has IPV4 DNS entry no IPV6)  ...  ServerRoot: "/etc/apache2"  Main DocumentRoot: "/var/www/html"  Main ErrorLog: "/var/log/apache2/error.log"  Mutex fcgid-proctbl: using_defaults  Mutex ssl-stapling: using_defaults  Mutex ssl-cache: using_defaults  Mutex default: dir="/var/run/apache2/" mechanism=default  Mutex mpm-accept: using_defaults  Mutex fcgid-pipe: using_defaults  Mutex watchdog-callback: using_defaults  Mutex rewrite-map: using_defaults  Mutex ssl-stapling-refresh: using_defaults  PidFile: "/var/run/apache2/apache2.pid"  Define: DUMP_VHOSTS  Define: DUMP_RUN_CFG  Define: MODPERL2  Define: ENABLE_USR_LIB_CGI_BIN  User: name="www-data" id=33  Group: name="www-data" id=33  root@domain:~#  

I have it commented out of the vhost in question but other vhosts are using a letsencrypt/options-ssl-apache.conf which I'll include here in case it could be interfering somehow:

SSLEngine on  SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1  SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384  SSLHonorCipherOrder     on  SSLSessionTickets       off  SSLOptions +StrictRequire  

Is it possible to receive email for aliases of multiple domains on a single KVM?

Posted: 18 Apr 2021 02:37 PM PDT

I'm pretty new, so please do go easy on me. :)

Tl dr; is it possible to receive email for aliases of multiple domains on a single KVM?

I had a digital ocean server with multiple websites hosted on it, and needed email aliases of more than one of those domains. On several occasions, mail was not delivered, I believe it's possible that this is because the corresponding domain did not use a PTR record (Could be wrong, I'm new, here.)

The PTR records with DO are tied to droplet names, so it seemed impossible to have PTR records for multiple domains, thus I was stuck with incomplete MX records and that may have been the cause of my undelivered mail.

I was thinking, there must be a way around this issue, besides renting another KVM.

please share your advice.

Best regards, Glenn

Why does AWS use host names for their load balancers instead of IP addresses?

Posted: 18 Apr 2021 03:03 PM PDT

I'm getting to know how load balancers work in cloud platforms. I'm specifically talking about load balancers you use to expose multiple backends to the public internet here, not internal load balancers.

I started with GCP, where when you provision a load balancer, you get a single public IP address. Then I learned about AWS, where when you provision a load balancer (or at least, the Elastic Load Balancer), you get a host name (like my-loadbalancer-1234567890.us-west-2.elb.amazonaws.com).

With the single IP, I can set up any DNS records I like. This means I can keep my name servers outside of the cloud platform to set up domains, and I can do DNS challenges for Lets Encrypt because I can set a TXT record for my domain after setting an A record for it. With the host name approach, I have to use ALIAS records (AWS has to track things internally) so I have to use their DNS service (Route 53). This DNS difference is a slight inconvenience for me, because it's not what I'm used to, and if I want to keep my main name servers for my domain outside of AWS, I can. I would just delegate a subdomain of my domain to Route 53's name servers.

So far, this DNS difference is the only consequence of this load balancer architectural difference that I've noticed. Maybe there are more. Is there a reason GCP and AWS may have chosen the approaches they did, from an architecture perspective? Pros and cons?

cookie is lost on refresh using nginx as proxy_reverse. I like the cookie and would like to keep it set in the browser

Posted: 18 Apr 2021 02:53 PM PDT

I'm new to Nginx and Ubuntu - have been with windows server for over a decade and this is my first try to use ubuntu and Nginx so feel free to correct any wrong assumption I write here :)

My setup: I have an expressjs app (node app) running as an upstream server. I have front app - built in svelte - accessing the expressjs/node app through Nginx proxy_reverse. Both ends are using letsencrypt and cors are set as you will see shortly.

When I run front and back apps on localhost, I'm able to login, set two cookies to the browser and all endpoints perform as expected.

When I deployed the apps I ran into weird issue. The cookies are lost once I refresh the login page. Added few flags to my server block but no go.

I'm sure there is a way - I usually find a way - but this issue really beyond my limited knowledge about Nginx and proxy_reverse setup. I'm sure it is easy for some of you but not me. I hope one of you with enough knowledge point me in the right direction or have explanation to how to fix it.

Here is the issue: My frontend is available at travelmoodonline.com. Click on login. Username : mongo@mongo.com and password is 123. Inspect dev tools network. Header and response are all set correctly. Check the cookies tab under network once you login and you will get two cookies, one accesstoken and one refreshtoken.

Refresh the page. Poof. Tokens are gone. I no longer know anything about the user. Stateless.

In localhost, I refresh and the cookies still there once I set them. In Nginx as proxy, I'm not sure what happens.

So my question is : How to fix it so cookies are set and sent with every req? Why the cookies disappear? Is it still there in memory somewhere? Is the path wrong? Or the cockies are deleted once I leave the page so if I redirect the user after login to another page, the cookies are not showing in dev tools.

My code : node/expressjs server route code to login user:

app.post('/login',  (req, res)=>{     //get form data and create cookies     res.cookie("accesstoken", accessToken, { sameSite: 'none', secure : true });       res.cookie("refreshtoken", refreshtoken, { sameSite: 'none', secure : true }).json({      "loginStatus": true, "loginMessage": "vavoom : doc._id })           }  

Frontend - svelte - fetch route with a form to collect username and password and submit it to server:

    function loginform(event){    username = event.target.username.value;    passwordvalue = event.target.password.value;      console.log("event username: ", username);    console.log("event password : ", passwordvalue);      async function asyncit (){         let response = await fetch('https://www.foodmoodonline.com/login',{    method: 'POST',    origin : 'https://www.travelmoodonline.com',    credentials : 'include',    headers: {    'Accept': 'application/json',    'Content-type' : 'application/json'    },    body: JSON.stringify({    //username and password    })      }) //fetch  

Now my Nginx server blocks :

# Default server configuration  #  server {            listen 80 default_server;      listen [::]:80 default_server;          root /var/www/defaultdir;      index index.html index.htm index.nginx-debian.html;        server_name _;       location / {          try_files $uri $uri/ /index.html;      }       }        #  port 80 with www    server {      listen 80;      listen [::]:80;          server_name www.travelmoodonline.com;        root /var/www/travelmoodonline.com;        index index.html;        location / {          try_files $uri $uri/ /index.html;      }        return 308 https://www.travelmoodonline.com$request_uri;     }    #  port 80 without wwww  server {      listen 80;      listen [::]:80;        server_name travelmoodonline.com;        root /var/www/travelmoodonline.com;         index index.html;        location / {          try_files $uri $uri/ /index.html;      }        return 308 https://www.travelmoodonline.com$request_uri;  }        # HTTPS server (with www) port 443 with www    server {      listen 443 ssl;      listen [::]:443 ssl;      add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";      server_name www.travelmoodonline.com;          root /var/www/travelmoodonline.com;      index index.html;                            ssl_certificate /etc/letsencrypt/live/travelmoodonline.com/fullchain.pem; # managed by Certbot      ssl_certificate_key /etc/letsencrypt/live/travelmoodonline.com/privkey.pem; # managed by Certbot      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot        location / {          try_files $uri $uri/ /index.html;             }          }      # HTTPS server (without www)   server {      listen 443 ssl;      listen [::]:443 ssl;       add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";      server_name travelmoodonline.com;      root /var/www/travelmoodonline.com;      index index.html;             location / {          try_files $uri $uri/ /index.html;             }            ssl_certificate /etc/letsencrypt/live/travelmoodonline.com/fullchain.pem; # managed by Certbot      ssl_certificate_key /etc/letsencrypt/live/travelmoodonline.com/privkey.pem; # managed by Certbot      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot             }              server {        server_name foodmoodonline.com www.foodmoodonline.com;    #   localhost settings      location / {          proxy_pass http://localhost:3000;          proxy_http_version 1.1;          proxy_set_header Upgrade $http_upgrade;          proxy_set_header Connection 'upgrade';          proxy_set_header Host $host;          proxy_cache_bypass $http_upgrade;              #    proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";      #   proxy_pass_header  localhost;        #    proxy_pass_header Set-Cookie;      #    proxy_cookie_domain localhost $host;      #   proxy_cookie_path /;         }        listen [::]:443 ssl; # managed by Certbot      listen 443 ssl; # managed by Certbot      ssl_certificate /etc/letsencrypt/live/foodmoodonline.com/fullchain.pem; # managed by Certbot      ssl_certificate_key /etc/letsencrypt/live/foodmoodonline.com/privkey.pem; # managed by Certbot      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot  }    server {      if ($host = www.foodmoodonline.com) {          return 301 https://$host$request_uri;      } # managed by Certbot          if ($host = foodmoodonline.com) {          return 301 https://$host$request_uri;      } # managed by Certbot          listen 80;      listen [::]:80;      server_name foodmoodonline.com www.foodmoodonline.com;      return 404; # managed by Certbot    }  

I tried 301-302-307 and 308 after reading about some of them covers the GET and not POST but didn't change the behavior I described above. Why the cookie doesn't set/stay in the browser once it shows in the dev tools. Should I use rewrite instead of redirect???? I'm lost.

Not sure is it nginx proxy_reverse settings I'm not aware of or is it server block settings or the ssl redirect causing the browser to loose the cookies but once you set the cookie, the browser suppose to send it with each req. What is going on here?

Thank you for reading.

Hard limiting monthly egress to prevent charges

Posted: 18 Apr 2021 02:59 PM PDT

I've got a Google Cloud VM, which I'm currently running on the free tier. This gives me 1GB free egress per month before I start getting charged.

Because of this, I want to hard limit the egress of the VM to never exceed this cap in a given month.

After searching for how to do this for a while, every piece of info seems to be generalised traffic shaping to limit peak bandwidth, rather than setting monthly limits.

Eventually I stumbled across this guide, which implies what I want to do is possible with tc. However, this particular use case doesn't suit my needs as the bandwidth limits reset at the start of the calendar month and this seems to be a rolling limiter.

Ideally, I would like this to work in two tiers. The first is 900MB of carefree usage per calendar month, which can be used as quickly or as slowly as is needed. Once that has been used, the remaining 100MB should be allocated as is described in the guide linked above, accumulating in the bucket. Then, at the end of the calendar month, all limits are reset.

Is there a simple way to go about this?

Annoyingly GCP doesn't have the ability to monitor the cumulative egress and set an alert, the best I can do is set a budget alert once I've been charged. I'd ideally like to stop this from happening before, rather than after I'm charged.

Kubernetes - Nginx Frontend & Django Backend

Posted: 18 Apr 2021 06:52 PM PDT

I'm following along this doc: https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/ the mainly difference is that my app is a Djago app running on port 8000.

The frontend pod keeps crashing:

2021/03/15 00:15:52 [emerg] 1#1: host not found in upstream "posi:8000" in /etc/nginx/conf.d/posi.conf:2  nginx: [emerg] host not found in upstream "posi:8000" in /etc/nginx/conf.d/posi.conf:2  

Could someone point out my mistakes, please.

deploy_backend.yaml

apiVersion: apps/v1  kind: Deployment  metadata:    name: posi-backend  spec:    selector:      matchLabels:        app: posi        tier: backend        track: stable    replicas: 2    template:      metadata:        labels:          app: posi          tier: backend          track: stable      spec:        containers:        - name: posi-backend          image: xxxxxxxxxx.yyy.ecr.us-east-1.amazonaws.com/posi/posi:uwsgi          command: ["uwsgi"]          args: ["--ini", "config/uwsgi.ini"]          ports:          - name: http            containerPort: 8000        imagePullSecrets:          - name: regcred  

service_backend.yaml

 apiVersion: v1   kind: Service   metadata:     name: posi-backend   spec:     selector:       app: posi       tier: backend     ports:     - protocol: TCP       port: 8000       targetPort: 8000  

deploy_frontend.yaml

 apiVersion: apps/v1   kind: Deployment   metadata:     name: posi-frontend   spec:     selector:       matchLabels:         app: posi         tier: frontend         track: stable     replicas: 1     template:       metadata:         labels:           app: posi           tier: frontend           track: stable       spec:         containers:           - name: posi-frontend             image: alx/urn_front:1.0             lifecycle:               preStop:                 exec:                   command: ["/usr/sbin/nginx", "-s", "quit"]  

service_frontend.yaml

 apiVersion: v1   kind: Service   metadata:      name: posi-frontend   spec:      selector:       app: posi       tier: frontend     ports:     - protocol: "TCP"       port: 80       targetPort: 80     type: NodePort  

nginx.conf

upstream posi_backend {      server posi:8000;  }  server {      listen 80;      server_name qa-posi;       location /static/ {           alias /code/static/;       }      location / {          proxy_pass http://posi_backend;          include     /etc/nginx/uwsgi_params;      }  }  
  • Cluster information:

  • Kubernetes version: 1.20
  • Cloud being used: bare-metal
  • Installation method: Kubeadm
  • Host OS: Centos 7.9
  • CNI and version: Weave 0.3.0
  • CRI and version: Docker 19.03.11

How to Utilize NIC Teaming for Hyper-V VMs with VLAN in Windows Server 2016

Posted: 18 Apr 2021 01:49 PM PDT

I have two Windows Server 2016 with Hyper-V installed. Each server has two ethernet adapters. And each Hyper-V has several VMs. My goal is VMs can communicate with each other if they fall into the same VLAN.

In order to make the network connection redundancy, I created the network teaming on the physical machine. The teaming is using "Switch Independent" with "Address Hash" options. On the Virtual Switch Manager, I created an external adapter by selecting the teamed adapter (Microsoft Network Adapter Multiplexor Driver).

Under each VM, I create a virtual adapter with VLAN tagged.

However, the VMs in the same VLAN cannot communicate with each other.

On the switch side, I have already configured trunk mode for all the ports connected with the physical machines.

If I remove the teaming, the VMs can communicate with VLAN tags. How to address this issue?

Determine which TLS version is used by default (cURL)

Posted: 18 Apr 2021 06:49 PM PDT

I have 2 servers that both run curl 7.29.0 and CentOS 7. However, when I run the following command I get 2 different results:

curl https://tlstest.paypal.com  
  1. PayPal_Connection_OK
  2. ERROR! Connection is using TLS version lesser than 1.2. Please use TLS1.2

Why does one server default to a TLSv1.2 connection and the other does not?

(I know I can force it with --tlsv1.2 if I wanted to)

Automatic profile configuration in Outlook 2016 / Outlook 365

Posted: 18 Apr 2021 02:49 PM PDT

I'm in the process of reconfiguring Outlook 2016 clients with an Exchange 365 backend. The majority of my users need access to one or more shared mailboxes to receive and to send e-mail. Using the default option to give these users full mailbox access to the shared mailboxes, that is easily and automatically accomplished. With some tweaking (Set-MailboxSentItemsConfiguration), I can even have a copy of send items stored in the send items folder of the shared mailbox, so everyone is up to date of what is being send. Nice.

But I also need to have seperate signatures for all mailboxes and I also need to be able to configure different local cache period settings. For the primary mailbox I need to keep a local copy of about 6 months (for fast searching), but for the shared mailboxes one month would do. This keeps the local .ost files a lot smaller, compared to the scenario where all shared mailboxes have the same cache period.

The only way I know how to accomplish this, is by using extra Outlook accounts instead of using extra Outlook mailboxes. Now I need the find a way to add the extra accounts automatically to the Outlook profile. In the pre Exchange 365 era, I would have used Microsoft's Office Customization Tool to create a basic .prf file, use VBscript to find the shared mailboxes the current user has access to and add these to the .prf profile. Have the user start Outlook with the /importprf switch, and voila.

But now I'm already stuck at creating the .prf file with the OCT. What to use for Exchange Server name? This weird guid you find after manually configuring Outlook with Exchange 365? Maybe the OCT is not the best option. I also found a PowerShell tool called PowerMAPI (http://powermapi.com) but it's hard to find out if this works with Exchange 365. The same goes for Outlook Redemption (http://www.dimastr.com/redemption/home.htm). Does anyone have experience with these tools? Or am I making this far more complicated than needed? I'm open to all suggestions...

Why are "Request header read timeout" messages in error log when page loads are short?

Posted: 18 Apr 2021 01:49 PM PDT

I am running a Rails application with Apache 2.4.10 and mod_passenger. The site uses https exclusively. I am seeing these messages in my error log:

[Wed May 31 19:05:37.528070 2017] [reqtimeout:info] [pid 11111] [client 10.100.23.2:57286] AH01382: Request header read timeout    [Wed May 31 19:05:37.530672 2017] [reqtimeout:info] [pid 11229] [client 10.100.23.2:57288] AH01382: Request header read timeout    [Wed May 31 19:05:37.890259 2017] [reqtimeout:info] [pid 10860] [client 10.100.23.2:57271] AH01382: Request header read timeout    [Wed May 31 19:05:37.890383 2017] [reqtimeout:info] [pid 10859] [client 10.100.23.2:57272] AH01382: Request header read timeout    [Wed May 31 19:05:37.890459 2017] [reqtimeout:info] [pid 10862] [client 10.100.23.2:57285] AH01382: Request header read timeout    [Wed May 31 19:05:37.947942 2017] [reqtimeout:info] [pid 10863] [client 10.100.23.2:57287] AH01382: Request header read timeout   

These messages appear in the error log about two to three seconds after the end of my page load. However, the complete page load takes only a few seconds. I am using mod_reqtimeout with this setting:

RequestReadTimeout header=20-40,minrate=500  

Since the page load only takes a few seconds I do not understand why the Request header read timeout messages are being logged to the error log.

Why are these messages appearing and what can I do to remedy this?

Ubuntu 15.10 Server; W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast

Posted: 18 Apr 2021 01:24 PM PDT

I'm running Ubuntu 15.10 server on a Asrock E3C226D2I board. When I get a kernel update or run update-initramfs -u I get a warning about missing firmware:

root@fileserver:~# update-initramfs -u  update-initramfs: Generating /boot/initrd.img-4.2.0-27-generic  W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast  

I can't find much information on this particular firmware, other than it is probably for my video card. Since I'm running a server I don't really care about graphics (no monitor attached).

All works fine so I'm ignoring it for now but is there a way to fix this?

Unable to RDP as a Domain User

Posted: 18 Apr 2021 02:49 PM PDT

I am facing a problem remoting into a machine using a Domain account.

Problem Facts :

  1. The Host VM's are hosted by Company A (read Domain A). The VM's have a local administrator as well Domain 'A' based User accounts who are on "Administrators" on the VM's.
  2. I belong to a Company B (Domain B).
  3. I use a VPN provided by Company A to have access to their network.
  4. I was previously able to use mstsc from Computer on Domain B to remote into any of VM's on Domain A.
  5. Recently Company A migrated their Domain A into Domain Z.
  6. Now I am not able to remote from a computer on Domain B into a VM on Domain Z using my Domain 'Z' user account, however, I am able to login using the local user account. The error for Domain Account is generic credentials not valid.
  7. My domain 'Z' accounts are working when I remote access another VM (say VM1) using my domain account after logging into a VM2 as local admin. (VM 1 & 2 are on the Domain Z)
  8. The problem in step 6 & 7 only SEEM to occur in environment at Domain Based environment. (Domain B where my local machine is located on and Domain C where another company user is facing the same issue as me).
  9. When trying from a local machine with windows freshly installed (no domain, no AV, default OS options) over Company A provided VPN, everything works fine i.e can remote into VM using Domain Accounts.
  10. Windows 7 Enterprise as Guest. Windows 7 , 2008 R2 , 8.1 as guest VMs. 11. On guest machine, tried deactivating firewall, stopping Forefront security app and removing machine from Domain and connecting to internet directly, but still it was not connecting. (maybe some group policy is causing the issue and removing from domain does not deactivate the policy. The surprising factor was people from Company C were also facing the same issue).

How Can I troubleshoot this issue ?

UWSGI Bad Gateway - Connection refused while connecting to upstream

Posted: 18 Apr 2021 04:58 PM PDT

Trying to get a basic Django app running on nginx using UWSGI. I keep getting a 502 error with the error in the subject line. I am doing all of this as root, which I know is bad practice, but I am just practicing. My config file is as follows (it's included in the nginx.conf file):

server { listen 80; server_name 104.131.133.149;

location = /favicon.ico { access_log off; log_not_found off; }  location /static/ {      root /home/root/headers;  }    location / {      include         uwsgi_params;      uwsgi_pass      127.0.0.1:8080;  }  }  

And my uwsgi file is:

[uwsgi]  project = headers  base = /root    chdir = %(base)/%(project)  home = %(base)/Env/%(project)  module = %(project).wsgi:application    master = true  processes = 5    socket = 127.0.0.1:8080  chmod-socket = 666  vacuum = true  

As far as I can tell I am passing all requests on port 80 (from nginx.conf) upstream to localhost, which is running on my VH, where uwsgi is listening on port 8080. I've tried this with a variety of permissions, including 777. If anyone can point out what I'm doing wrong please let me know.

iLO 3 Firmware Update (HP Proliant DL380 G7)

Posted: 18 Apr 2021 03:46 PM PDT

The iLO web interface allows me to upload a .bin file (Obtain the firmware image (.bin) file from the Online ROM Flash Component for HP Integrated Lights-Out.)

enter image description here

The iLO web interface redirects me to a page in the HP support website (http://www.hp.com/go/iLO) where I am supposed to find this .bin firmware, but no luck for me. The support website is a mess and very slow, badly categorized and generally unusable.

Where can I find this .bin file? The only related link I am able to find asks me about my server operating system (what does this have to do with the iLO?!) and lets me download an .iso with no .bin file

And also a related question: what is the latest iLO 3 version? (for Proliant DL380 G7, not sure if the iLO is tied to the server model)

How do I change Jboss' logging directory

Posted: 18 Apr 2021 04:58 PM PDT

I'm running jboss-as 7.2. I'm trying to configure all log files to go to /var/log/jboss-as but only the console log is going there. I'm using the init.d script provided with the package and it calls standalone.sh. I'm trying to avoid having to modify startup scripts.

I've tried adding JAVA_OPTS="-Djboss.server.log.dir=/var/log/jboss-as" to my /etc/jboss-as/jboss-as.conf file but the init.d script doesn't pass JAVA_OPTS to standalone.sh when it calls it.

The documentation also says I should be able to specify the path via XML with the following line in standalone.xml:

<path name="jboss.server.log.dir" path="/var/log/jboss-as"/>  

However, it doesn't say where in the file to put that. Every place I try to put it causes JBoss to crash on startup saying that it can't parse the standalone.xml file correctly.

Configure Citadel to be Used For sending email using smtp

Posted: 18 Apr 2021 03:58 PM PDT

Sorry for this foolish question, but I have less knowldge about servers. So bear with me!

I have configured Citadel as directed in linode documentation and can login using the front-end for accessing citadel. I can send emails using that. How can i configure smtp and use it as a mail service for sending emails from laravel which is a php framework?. Any help will be appreciated.

I have configured it as

Enter 0.0.0.0 for listen address  Select Internal for authentication method  Specify your admin <username>  Enter an admin <password>  Select Internal for web server integration  Enter 80 for Webcit HTTP port  Enter 443 for the Webcit HTTPS port (or enter -1 to disable it)  Select your desired language  

After this i have entered mail name in /etc/mailname as

mail.domain.com  

and i can access adn sendmail using https://mail.domain.com

My laravel mail.php file 'driver' => 'smtp',

/*  |--------------------------------------------------------------------------  | SMTP Host Address  |--------------------------------------------------------------------------  |  | Here you may provide the host address of the SMTP server used by your  | applications. A default option is provided that is compatible with  | the Postmark mail service, which will provide reliable delivery.  |  */    'host' => 'mail.hututoo.com',    /*  |--------------------------------------------------------------------------  | SMTP Host Port  |--------------------------------------------------------------------------  |  | This is the SMTP port used by your application to delivery e-mails to  | users of your application. Like the host we have set this value to  | stay compatible with the Postmark e-mail application by default.  |  */    'port' => 25,    /*  |--------------------------------------------------------------------------  | Global "From" Address  |--------------------------------------------------------------------------  |  | You may wish for all e-mails sent by your application to be sent from  | the same address. Here, you may specify a name and address that is  | used globally for all e-mails that are sent by your application.  |  */    'from' => array('address' => 'no-reply@hututoo.com', 'name' => null),    /*  |--------------------------------------------------------------------------  | E-Mail Encryption Protocol  |--------------------------------------------------------------------------  |  | Here you may specify the encryption protocol that should be used when  | the application send e-mail messages. A sensible default using the  | transport layer security protocol should provide great security.  |  */    'encryption' => 'tls',    /*  |--------------------------------------------------------------------------  | SMTP Server Username  |--------------------------------------------------------------------------  |  | If your SMTP server requires a username for authentication, you should  | set it here. This will get used to authenticate with your server on  | connection. You may also set the "password" value below this one.  |  */    'username' => 'passname',    /*  |--------------------------------------------------------------------------  | SMTP Server Password  |--------------------------------------------------------------------------  |  | Here you may set the password required by your SMTP server to send out  | messages from your application. This will be given to the server on  | connection so that the application will be able to send messages.  |  */    'password' => 'paswwordtest',    /*  |--------------------------------------------------------------------------  | Sendmail System Path  |--------------------------------------------------------------------------  |  | When using the "sendmail" driver to send e-mails, we will need to know  | the path to where Sendmail lives on this server. A default path has  | been provided here, which will work well on most of your systems.  |  */    'sendmail' => '/usr/sbin/citmail -t',  

Change local password as root after configuring for MS-AD Kerberos+LDAP

Posted: 18 Apr 2021 09:58 PM PDT

I have followed this excellent post to configure Kerberos + LDAP:
http://koo.fi/blog/2013/01/06/ubuntu-12-04-active-directory-authentication/

However, there are some local users used for services.
When I try to change the password for one of those, as root, it asks for Current Kerberos password then exits:

passwd service1  Current Kerberos password:  (I hit enter)  Current Kerberos password:  (I hit enter)  passwd: Authentication token manipulation error  passwd: password unchanged  

If I switch to the local user and do passwd, it asks once for Kerberos then falls back to local:
$ passwd
Current Kerberos password:
Changing password for service1.
(current) UNIX password:

My configuration is similar to the site I posted above, and everything works fine, I just can't change the local users' passwords as root.

Thanks in advance for any help.

3.8.0-29-generic #42~precise1-Ubuntu

Update 1 2013-01-31:

# cat /etc/pam.d/common-auth  auth    [success=3 default=ignore]      pam_krb5.so minimum_uid=1000  auth    [success=2 default=ignore]      pam_unix.so nullok_secure try_first_pass  auth    [success=1 default=ignore]      pam_ldap.so use_first_pass  auth    requisite                       pam_deny.so  auth    required                        pam_permit.so  auth    optional                        pam_cap.so      # cat /etc/pam.d/common-password  password        [success=3 default=ignore]      pam_krb5.so minimum_uid=1000  password        [success=2 default=ignore]      pam_unix.so obscure use_authtok try_first_pass sha512  password        [success=1 user_unknown=ignore default=die]     pam_ldap.so use_authtok try_first_pass  password        requisite                       pam_deny.so  password        required                        pam_permit.so  password        optional        pam_gnome_keyring.so  

Create self-signed terminal services certificate and install it

Posted: 18 Apr 2021 04:51 PM PDT

The server RDP certificate expires every 6 months and is automatically recreated, meaning I need to re-install the new certificate on the client machines to allow users to save password.

Is there a straightforward way to create a self-signed certificate with a longer expiry?

I have 5 servers to configure.

Also, how do I install the certificate such that terminal services uses it?

Note: Servers are not on a domain and I'm pretty sure we're not using a gateway server.

Errors getting apache working with fcgi and suexec

Posted: 18 Apr 2021 03:58 PM PDT

I have a Debian 6 server and I was previously using Apache with mod_php but decided to switch to using fcgi instead since Wordpress was somehow causing Apache to crash. I have the following in my site's Apache config file:

Options +ExecCGI  AddHandler fcgid-script .php  FCGIWrapper /usr/lib/cgi-bin/php5 .php    SuexecUserGroup "#1001" "#1003"  

Everything works fine if I don't include the SuexecUserGroup, but it obviously then runs the script as www-data instead of the user and group above. When I include that line, I get a 500 error and the following shows up in my suexec.log file:

[2013-05-22 16:00:12]: command not in docroot (/usr/lib/cgi-bin/php5)  

Everything was installed using the packages, so I don't even know where the docroot is.

Here is my suexec info:

# /usr/lib/apache2/suexec -V   -D SUEXEC_CONFIG_DIR=/etc/apache2/suexec/   -D AP_GID_MIN=100   -D AP_LOG_EXEC="/var/log/apache2/suexec.log"   -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"   -D AP_UID_MIN=100  

And the permissions on my php5 file if that has anything to do with it:

# ls -l /usr/lib/cgi-bin/php5  -rwxr-xr-x 1 root root 7769160 Mar  4 08:25 /usr/lib/cgi-bin/php5  

Server Room Temperature Monitoring - Where to stick my probes?

Posted: 18 Apr 2021 06:09 PM PDT

I have a small server room approx 7' x 12' with an A/C unit dedicated to this room that is positioned on of the short (7') sides and blows air across the room towards the other short (7') side.

The server room is set to temp of 69F but usually will only ever get down to around 70-71F (temp measured by the thermostat control panel on the wall).

I have two 1-wire temp. monitor gauges plugged into a linux box that graphs out measured temperatures. Right now the temp. monitor gauges hang on one of the long (12') sides and are positioned closely together.

I don't think this is ideal measurement and an accurate representation of the room's real temperatures and would like to fix this. Where is it best to position the temperature sensors in a room like this? I don't think hanging them from the drop-ceiling would work since then the A/C unit would blow cold air on them (skewing the measurements terribly).

how to install ssl on tomcat 7?

Posted: 18 Apr 2021 06:49 PM PDT

I know this question might sound too easy and I should had read all docs available on internet, the true is that I did, and I had no luck, its kinda confusing for me, I have installed many times this thing but for Apache, never for Tomcat.

I want to install a certificate from GoDaddy, so, I followed this instructions

http://support.godaddy.com/help/article/5239/generating-a-csr-and-installing-an-ssl-certificate-in-tomcat-4x5x6x

I created my keyfile like this

keytool -keysize 2048 -genkey -alias tomcat -keyalg RSA -keystore tomcat.keystore  keytool -certreq -keyalg RSA -alias tomcat -file csr.csr -keystore tomcat.keystore  

I changed tomcat for mydomain.com .. is it wrong?

I created the keystore, later the csr, after that the problem comes, I add to server.xml on the config folder

<Connector port="8443" maxThreads="200"  scheme="https" secure="true" SSLEnabled="true"  keystoreFile="path to your keystore file" keystorePass="changeit" clientAuth="false" sslProtocol="TLS"/>  

Later I imported the certs

keytool -import -alias root -keystore tomcat.keystore -trustcacerts -file valicert_class2_root.crt  

and I did, but I dont have a gd_intermediate.crt and the last step is

keytool -import -alias tomcat -keystore tomcat.keystore -trustcacerts -file <name of your certificate>  

reading in other blogs I saw they import here the crt , but tomcat is the user I have to leave? or its for example only??

In the docs of tomcat I found this (http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html)

Download a Chain Certificate from the Certificate Authority you obtained the Certificate keytool -import -alias root -keystore \ -trustcacerts -file

   And finally import your new Certificate         keytool -import -alias tomcat -keystore <your_keystore_filename> \  -file <your_certificate_filename>  

but I have no idea what is a "chain certificate" ... can somebody help me? I am really confused and lost. I am using Tomcat7

Thanks.

How to copy many Scheduled Tasks between Windows Server 2008 machines?

Posted: 18 Apr 2021 04:13 PM PDT

I have several standalone Win2008 (R1+R2) servers (no domain) and each of them has dozens of scheduled tasks. Each time we set up a new server, all these tasks have to be created on it.

The tasks are not living in the 'root' of the 'Task Scheduler Library' they reside in sub folders, up to two levels deep.

I know I can use schtasks.exe to export tasks to an xml file and then use:

schtasks.exe /CREATE /XML ...'   

to import them on the new server. The problem is that schtasks.exe creates them all in the root, not in the sub folders where they belong. There is also no way in the GUI to move tasks around.

Is there a tool that allows me to manage all my tasks centrally, and allows me to create them in folders on several machines? It would also make it easier to set the 'executing user and password'.

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 10:02 PM PDT

OSCHINA 社区最新专区文章


数据结构和算法推荐书单

Posted: 16 Jan 2020 01:36 AM PST

对于入门的同学不建议过度追求看上去很经典的书籍,例如:《算法导论》、《算法》这些书。可以看一些相对容易看的书来入门,例如《大话数据结构》、《算法图解》。 《大话数据结构》这本书最大的特点是它将理论讲的非常有趣,不枯燥。而且每个数据结构和算法作者都结合生活中的例子进行讲解,虽然这本书有400+页,但是花...

破万,我用了六年!

Posted: 13 Apr 2021 03:20 AM PDT

`回复 PDF 领取资料 这是悟空的第 94 篇原创文章 就在昨天粉丝量突破一万。 本文主要内容: 一、用订阅号做游戏 1.1 起源 2012 年 8 月,微信正式推出微信公众号。 2013 年 8 月,微信将公众号拆分为服务号和订阅号。 2015 年 3 月,我申请了微信订阅号。 2015 年 3 月 19 日,我发表了第一篇公众号文章,这篇文章主要是...

@arcgis/core

Posted: 18 Apr 2021 06:08 PM PDT

有没有那位大哥用过@arcgis/core,我用了之后,view的点击事件里要弹出popup,但是不报错也不出来,图层的template也不行,有没有那位大哥解答一下。 this.view.popup.open({ title: "基本信息", content: ` ...

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 09:50 PM PDT

OSCHINA 社区最新专区文章


ERNIE加持,飞桨图神经网络PGL全新升级

Posted: 06 May 2020 04:33 AM PDT

在2019年深度学习开发者秋季峰会上,百度对外发布飞桨图学习框架PGL v1.0正式版,历经5个月的版本迭代,PGL再度升级,发布v1.1版本,带来了最新的算法突破、全面的工业级图学习框架能力以及工业级的实践案例。下面我们逐一揭秘升级点。 下载安装命令 ## CPU版本安装命令 pip install -f https://paddlepaddle.org.c...

如何用飞桨打造你的专属“皮肤医生”?

Posted: 09 May 2020 03:19 AM PDT

皮肤疾病种类繁多(约6000余类),发病率高(全球约11%人口患有各类皮肤疾病),已成为困扰全社会的重大公共卫生问题。据统计,我国注册的皮肤科专业医生仅2万余人,医患比例极其悬殊。随着人工智能技术的进步,各类计算机辅助诊断系统是解决上述医疗供需不平衡问题的一条有效途径。"人工智能+医疗",或简称智慧医疗,...

端到端问答新突破:百度提出RocketQA,登顶MSMARCO榜首!

Posted: 22 Oct 2020 01:53 AM PDT

点击左上方蓝字关注我们 开放域问答(Open-domain QA)一直是自然语言处理领域的重要研究课题。百度从面向端到端问答的检索模型出发,提出了RocketQA训练方法,大幅提升了对偶式检索模型的效果,为实现端到端问答迈出了重要的一步。RocketQA已逐步应用在百度搜索、广告等核心业务中,并将在更多场景中发挥作用。 近日,百...

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 08:06 PM PDT

OSCHINA 社区最新专区文章


Jonathan Carter 再次当选为 Debian 项目负责人

Posted: 18 Apr 2021 05:48 PM PDT

2021 Debian 项目负责人 (DPL, Debian Project Leader) 的选举结果已公布,Jonathan Carter 再次当选为新一任的 DPL,他的新任期将从2021-04-21开始。 被提名参与本届选举的人员总共两名,分别是 Jonathan Carter 和前两届 DPL Sruthi Chandran。 Jonathan Carter [jcc@debian.org] [nomination mail] [platform] Sruthi...

Recent Questions - Mathematics Stack Exchange

Posted: 18 Apr 2021 07:53 PM PDT

Recent Questions - Mathematics Stack Exchange


Distributivity of dot product in a scalar multipier

Posted: 18 Apr 2021 07:50 PM PDT

I landed upon this expression while solving a problem; $$\vec a×\vec b (\vec a . \vec c)-\vec a×\vec c(\vec a .\vec b )$$ To simplify this, I thought of factoring the $\vec a$ out, and it seemed okay to do so, since dot products are distributive. But I don't know what's going to happen to the $\vec c$ and $\vec b$ it was dotted with when it's taken out. Together, each pair of dotted vectors formed a scalar multipier for each vector term, but now that I've taken the $\vec a$ out, I have no idea how to treat the other two.

Is taking the $\vec a $ out wrong here? If so, why?

Best notation for partial derivatives

Posted: 18 Apr 2021 07:49 PM PDT

I know this one is a soft question so I will tag it as such, but I'm aware of the following ways in which derivatives are represented:

lets say we have a function: $$f=f(x,y)$$ then the derivative wrt $x$ e.g. is: $$\frac{\partial f}{\partial x}$$ but often it will be written as: $$\partial_xf,\,f_x$$ and several other forms. The reason I ask is because I find when you have equations with large amounts of derivates it can be tedious to type or write them all out fully, e.g.: $$\frac{\partial^2T}{\partial r^2}+\frac1r\frac{\partial T}{\partial r}+\frac{1}{r^2}\frac{\partial^2T}{\partial\theta^2}=0$$ can be nicely abbreviated to: $$\partial^2_rT+\frac{\partial_rT}{r}+\frac{\partial^2_\theta T}{r^2}=0$$ or maybe: $$T_{rr}+\frac1rT_r+\frac1{r^2}T_{\theta\theta}=0$$ Does anyone have any opinions on which shorthand is the least ambiguous or is more generally accepted, or if you have any other interesting notation I'd like to see. I am also aware of common notation like: $\Delta,\nabla$

Sets having the same cardinality

Posted: 18 Apr 2021 07:46 PM PDT

I am asked to think of an example of cardinality being the same between two sets X and Y such that the function from X to Y is one to one but it is not onto. I am so confused about this one because I thought there has to be a one-to-one correspondence between X and Y for their cardinality to be the same. How is it possible for there to just be a one-to-one relationship? Can anyone please explain? Thank you!

$u_{xx}$+$u_{yy}$ +$e^{-u}$ $(u_{x}^2 +u_y^{2})=0$

Posted: 18 Apr 2021 07:41 PM PDT

Find the general solution (involving two arbitrary functions) of the following PDE by making the change of dependent variable $z = e^u:$

$u_{xx}$+$u_{yy}$ +$e^{-u}$$(u_{x}^2 +u_y^{2})=0$

[Hint: The general solution will involve complex quantities.]

I don't understand the Hint given, Are complex numbers involved here?

What are non-numerical variables such as "Heads" and "Tails" officially called?

Posted: 18 Apr 2021 07:42 PM PDT

Is there a mathematical terminology for non-numerical variable such as

Head Tail (referring to a coin flip) or Rock Paper Scissors or Up/Down ?


For example, I want to say that my set $\mathcal{S} $ is filled with ______, where _______ are things like Head, Tail/ Left, Right/ Up, Down, etc. One such set is $\mathcal{S} $ = {Head, Tail}, another set is $\mathcal{S}$ = {Left, Right}, yet another set is $\mathcal{S}$ = {Happy, Sad, Mad}.

Note that I am not assuming a probability context. Non-numerical variables appear all over math, such as in game theory (Confess/Betray).

What should I use as the proper mathematical terminology in the above blanks: States? Strings? Tokens? Literals? Symbols? Alphabets? Words?

Derivative of Unit Speed Parameterization of a Curve

Posted: 18 Apr 2021 07:42 PM PDT

I've been working on this question for about 3 hours now. Part (a) asks to show that the derivative of the unit speed parameterization function is perpendicular to its second derivative. As far as I understand, this is only necessarily true in the case of a circle, but my instructor told me it works in the case of any curve. As for part (b), I'm confused about the notation since the notation used on the assignment is different from any parameterization notation I've seen elsewhere. Is the "unit speed parameterization" a single equation?

Any and all help is much appreciated.

Question 2

Do arbitrary metrics have particular convex or concave properties

Posted: 18 Apr 2021 07:32 PM PDT

Given an arbitrary metric $d$, I want to define a concave continuous function in terms of $d$. For example if $d$ is the Euclidean metric then it is convex, so $-d$ is concave.

Ideally there would be some function which transforms any metric into a concave continuous function but I don't think that's very likely. Instead I wonder if it is possible classify the kinds of metrics and give a function for each kind of metric, like in the following manner:

Suppose every metric is either concave or convex, then either $d$ or $-d$ is a concave continuous function.

So is there some classification of metrics in terms of (quasi/strict) convexity and concavity?

Alternatively let me know if you have good reason to believe that it is impossible to construct a concave continuous function from an arbitrary metric

Why vector field commute but the flow does not commute in this example

Posted: 18 Apr 2021 07:31 PM PDT

I was doing Lee's smooth manifold Problem 9-19.

Which is stated as follows:

9-19. Let $M$ be $\mathbb{R}^{3}$ with the $z$ -axis removed. Define $V, W \in \mathfrak{X}(M)$ by $$ V=\frac{\partial}{\partial x}-\frac{y}{x^{2}+y^{2}} \frac{\partial}{\partial z}, \quad W=\frac{\partial}{\partial y}+\frac{x}{x^{2}+y^{2}} \frac{\partial}{\partial z} $$ and let $\theta$ and $\psi$ be the flows of $V$ and $W$, respectively. Prove that $V$ and $W$ commute, but there exist $p \in M$ and $s, t \in \mathbb{R}$ such that $\theta_{t} \circ \psi_{s}(p)$ and $\psi_{s} \circ \theta_{t}(p)$ are both defined but are not equal.

I solve the ODE and gets the solution:

$$\theta_t\circ \psi_s = (p_1+t,p_2+s,\arctan(\frac{s+p_2}{p_1})+p_3-\arctan(\frac{p_2}{p_1}))\\\psi_s\circ\theta_t = (p_1+t,p_2+s,-\arctan(\frac{t+p_1}{p_2}) +p_3 + \arctan(\frac{p_1}{p_2}))$$

Which is obvious not equal,but they both defined for all $\Bbb{R}^3\setminus \{z\}$,but it contradict to the theorem 9.44 that vector field commute if and only if flow commute?If I haven't made mistake in the computation.Is my computation correct,it's so hard to compute.Why does it not consistent with the theorem?

When will $f\simeq g$ implies $X\bigsqcup_f Y\simeq X\bigsqcup_g Y$?

Posted: 18 Apr 2021 07:35 PM PDT

Let $X,Y$ be two topological spaces and $f,g:X\rightarrow Y$ be two homotopic continuous map between them. My question is when will we have the attaching result space $X\bigsqcup_f Y$ and $X\bigsqcup_g Y$ are homotopic? Well, intuitively, $f,g$ give the way of attaching, and if $f\simeq g$, then we can think the attaching way determined by $f$ can be transformed continuously to the attaching wat determined by $g$, and hence the resulting attaching space should be homotopy. But I doubt this result is not true in general, otherwise this should be proved explicitly in standard textbooks of algebraic topology. So my question is when will the above true? Well, by asking this, I'm not going to pursue the most general result, I want some special cases and a justification why my intuition above failed in general. Thanks.

Aside: the reason I came up with this question is because I want to find the relation between homotopy of continuous maps and the homotopy of spaces, more explictly, I want to know is there any sense in which homotopy maps induce homotopy spaces?

dini number in lebesgue differentiation proof

Posted: 18 Apr 2021 07:26 PM PDT

In Stein's real analysis, I'm trying to prove that if F is of bounded variation, then it is differentiable. To do this, it uses Dini numbers.

Let $\Delta_h (F)(x) = {F(x+h) - F(x) \over h}$. We consider four Dini numbers at $x$. \begin{align*} D^+(F)(x) &= \limsup_{\substack{h \to 0 \\ h > 0}} \Delta_h (F)(x) \\ D_+(F)(x) &= \liminf_{\substack{h \to 0 \\ h > 0}} \Delta_h (F)(x)\\ D^-(F)(x) &= \limsup_{\substack{h \to 0 \\ h < 0}} \Delta_h (F)(x) \\ D_-(F)(x) &= \liminf_{\substack{h \to 0 \\ h < 0}} \Delta_h (F)(x)\\ \end{align*} To prove this thoerem, it suffices to show that (i) $D^+(f)(x) < \infty $ for a.e. $x$, and (ii) $D^+(F)(x) \le D_-(F)(x)$ for a.e. $x$. Indeed if these results hold, then by applying (ii) to $-F(-x)$ instead of $F(x)$ we obtain $D^-(F)(x) \le D_+(F)(x)$ for a.e. $x$. Therefore, $$D^+ \le D_- \le D^- \le D_+ \le D^+$$

I'm having trouble showing that $D^-(F)(x) \le D_+(F)(x)$. \begin{align*} D^+(-F)(-x) &= \limsup_{\substack{h \to 0 \\ h > 0}} \Delta_h (-F)(-x) \\ &= \limsup_{\substack{h \to 0 \\ h > 0}} {-F(-x+h) + F(-x) \over h} \\ &= \limsup_{\substack{h \to 0 \\ h < 0}} {-(F(-x-h) + F(-x) \over -h} \\ &= \limsup_{\substack{h \to 0 \\ h < 0}} {F(-x-h) - F(-x) \over h} \end{align*}

how do I make the last term into $D^-(F)(x)$?

¿Are $\mathbb{Z}[\frac{1 + \sqrt{5}}{2}]$ and $\mathbb{Z}[\frac{1 + \sqrt{3}}{2}]$ integral extensions over $\mathbb{Z}$?

Posted: 18 Apr 2021 07:24 PM PDT

I am currently reading Atiyah's book about Commutative Algebra and someone gave me this question that I can't figure out quite right:
Which one of the following extensions: $\mathbb{Z}[\frac{1 + \sqrt{5}}{2}]$ and $\mathbb{Z}[\frac{1 + \sqrt{3}}{2}]$ is an integral extension over $\mathbb{Z}$ and which one is not.
To be honest, I've tried using the fact that $\mathbb{Z}[x]$ must be finitely generated for every $x \in \mathbb{Z}[\frac{1 + \sqrt{5}}{2}]$ for the last one to be an integral extension (here I can see easily that $x = a + b(\frac{1 + \sqrt{5}}{2})$ for some a,b integers), but I've struggled to see how can I derive the proposition I want. If anyone could show me the proof of this and the reason why any of those two is not an integral extension, I would really appreciate it.

Is this proof about sequences correct?

Posted: 18 Apr 2021 07:37 PM PDT

Let $(u_n)$ and $(v_n)$ be two real sequences with limits L and M respectively. If $x_n$= max$({u_n,v_n})$ and $y_n$=min$(u_n,v_n)$, prove that the sequence $x_n$ and $y_n$ converges to max$(L,M)$ and min$(L,M)$ respectively.

My attempt: It is given that $u_n$ and $v_n$ converges to L and M respectively. So $u_n$+$v_n$ =$L+M$.

Now, taking limits,

$x_n$=max$(u_n,v_n)$=$1/2{(a+b+|a-b|)}$=$1/2{(L+M+|L-M|)}$=max$(L,M)$

Similarly,

$x_n$=min$(u_n,v_n)$=$1/2{(a+b-|a-b|)}$=$1/2{(L+M-|L-M|)}$=min$(L,M)$

Is this correct??

Finding pdf, E(Y) and sd for continuous random variable

Posted: 18 Apr 2021 07:43 PM PDT

w = uniform distribution (0,7)

S= 5w^3/2 + 5

S range (0,100)

pdf of w: f(w) = 1/(b-a) = 1/ 7 for 0 < w < 7

I do not know whether to integrate S over 100 to 0 or 7 to 0 to get the pdf

Find pdf, E(Y), sd of S.

when do we say that a sequence of real valued functions doesnot converge pointwise

Posted: 18 Apr 2021 07:12 PM PDT

I am not able to think much On this. All I think is maybe at some point in the given interval the limit function may tend to infinity.

Calculating CAGR without fractional re-investments

Posted: 18 Apr 2021 07:16 PM PDT

The typical CAGR formula assumes that upon receipt of initial profits, all profits can be reinvested at the same rate of return. This is useful for people investing in the stock market where they can buy fractions of a share, however, what if an investment required fixed amounts of capital for reinvestment? For example, if someone bought and sold a home for a profit of 10%, they could not then go buy 1.1 homes even though they now would have 110% of their original starting capitol. Assuming a consistent growth rate and cost of investment, they would need to repeat this action 10 times before they could buy two homes at once. Then, of corse, they would only need to repeat the process 5 times on the two homes before moving up to three homes at a time ... we all get the point. Does anyone know of a formula for this?

Edit: I am aware my example is imperfect - obviously in the real world real estate investors use the extra capital to buy nicer homes. It was the best hypothetical I could do to get the point across. Another effective example would be trading in the stock market without fractional shares.

$ \int \frac{x^3}{\sqrt{x^2+x}}\, dx$

Posted: 18 Apr 2021 07:30 PM PDT

I'm trying to solve this irrational integral $$ \int \frac{x^3}{\sqrt{x^2+x}}\, dx$$ doing the substitution

$$ x= \frac{t^2}{1-2 t}$$ according to the rule.

So the integral becomes: $$ \int \frac{-2t^6}{(1-2t)^4}\, dt= \int (-\frac{1}{8}t^2-\frac{1}{4}t-\frac{5}{16}+\frac{1}{16}\frac{-80t^3+90t^2-36t+5}{(1-2t)^4})\, dt=\int (-\frac{1}{8}t^2-\frac{1}{4}t-\frac{5}{16}+\frac{1}{16}(\frac{10}{1-2t}-\frac{15}{2} \frac{1}{(1-2t)^2}+\frac{3}{(1-2t)^3}-\frac{1}{2} \frac{1}{(1-2t)^4}))\, dt=-\frac{1}{24}t^3-\frac{1}{8}t^2-\frac{5}{16}t-\frac{5}{16}\cdot \ln|1-2t| -\frac{15}{64}\frac{1}{1-2t}+\frac{3}{64} \frac{1}{(1-2t)^2}-\frac{1}{16 \cdot 12} \frac{1}{(1-2t)^3}+cost $$ with $t=-x+ \sqrt{x^2+x}$.

The final result according to my book is instead $(\frac{1}{3}x^2-\frac{5}{12}x+\frac{15}{24})\sqrt{x^2+x}-\frac{5}{16}\ln( x+\frac{1}{2}+ \sqrt{x^2+x})$

And trying to obtain the same solution putting t in the formulas I'm definitely lost in the calculation... I don't understant why this difference in the complexity of the solution... Can someone show me where I'm making mistakes?

Does this set have cardinality $\beth_\omega$? And if so, how does it require the Axiom of Replacement to construct?

Posted: 18 Apr 2021 07:39 PM PDT

I was reading this Wikipedia article: https://en.wikipedia.org/wiki/Von_Neumann_universe, and it mentions that the Axiom of Replacement is required to go outside of $V_{\omega+\omega}$, one of the levels of the von Neumann Hierarchy. If I'm correct, this means that the Axiom of Replacement would be required to construct a set of cardinality $\beth_\omega$, since such sets would only exist in higher levels of the hierarchy.

But now let the set $N_0 = \mathbb N$, and let $N_{i+1} = P(N_i)$, where $P(N_i)$ is the power set of $N_i$. Now let the set $A$ be the union of all $N_i$ for each $i \in \mathbb N$. Now it seems to me that $A$ has cardinality $\beth_\omega$. Certainly, $N_i$ has cardinality $\beth_i$, and $A$ cannot have cardinality $\beth_m$ for any natural number $m$, because $A$ contains $N_{i+1}$, which has a strictly larger cardinality. So the cardinality of $A$ must be higher than $\beth_m$ for all $m\in \mathbb N$. Further, sets of cardinality $\beth_{\omega + 1}$ or higher can be easily constructed by taking $P(A)$ and so on.

If $A$ does not have cardinality $\beth_\omega$, then how so? And if it does, where in this construction is the Axiom of Replacement invoked?

$N_0$ (or something analogous) exists by the Axiom of Infinity. Then all other $N_i$ exist by the Axiom of Power Set. Admittedly, there is then some subtlety in applying the Axiom of Union, since sets must be in a larger set together before a union can be taken. One might try to construct $A$, or at least a similar set, by repeatedly using the Axiom of Pairing and the Axiom of Union, but this doesn't seem to work, admittedly.

But I'm still unsure how exactly adding the Axiom of Replacement solves this problem. If we want to invoke the Axioms of ZFC explicitly in the construction of $A$, where and how does the Axiom of Replacement come into play?

Derive the equation of motion for test masses

Posted: 18 Apr 2021 07:37 PM PDT

I currently have the topic Newtonian gravity, which is described as a field theory by means of the Poisson equation $$\Delta \phi = 4\pi G\rho\,.$$ As an assignment I have: derive the equation of motion for test masses. (1 point, short task)

I can do something with the single words, but their combination to this sentence, I don't understand. What should I derive? And from what? Should I derive according to the mass, so $\frac{d}{dm}$? And why? What is the point of that? Where should this lead me. This task confuses me.

Proof of Reverse of Heisenberg Commutation Relationship

Posted: 18 Apr 2021 07:30 PM PDT

I'm trying to prove that if for $P,Q,Z\in\mathbf(M)(n,\mathbf{C})$ it holds that $exp(\sigma P)exp(\tau Q)=exp(\hbar \sigma\tau Z)exp(\tau Q)exp(\sigma P)$ for all $\sigma, \tau\in \mathbf{R}$, then $[P,Q]=Z$, $[P,Z]=0$, and $[Q,Z]=0$.

To prove $[P,Q]=Z$, one can just differentiate with respect to $\sigma$, and then $\tau$, but as far as I can tell, differentiating does not yield the other two as easily.

I want to learn maths at masters level by the age of 20.Iam currently 17 and doing bacheleors.How much should i study.

Posted: 18 Apr 2021 07:18 PM PDT

What should I begin with and what should i learn.Also can you tell me the best textbooks in which i can find problems that explain concepts as well as critical thinking as well as creative thinking.Also please tell me about the best youtube channels out there that explain maths at a masters level.So I could puruse my phd when i get a little older than iam currently now.Also can you please inform about how should i apply to prestigous universities and what are their requirments.

Cumulative Distribution Function of $S_{N_{t}}$ where $S_{N_{t}}$ is the time of the last arrival in $[0, t]$

Posted: 18 Apr 2021 07:12 PM PDT

enter image description here

I am confused on this problem. My professor gave this as the solution:

$S_{N_{T}}$ is the time of the last arrival in $[0, t]$. For $0 < x \leq t, P(S_{N_{T}} \leq x) \sum_{k=0}^{\infty} P(S_{N_{T}} \leq x | N_{T}=k)P(N_{T}=k) $

$= \sum_{k=0}^{\infty} P(S_{N_{T}} \leq x | N_{T}=k) * \frac{e^{- \lambda t}*(\lambda t)^k}{k!}$.

Let $M=max(S_1, S_2, ..., S_k)$ where $S_i$ is i.i.d. for $i = 1,2,.., k$ and $S_i $~ Uniform$[0,t]$.

So, $P(S_{N_{T}}) \leq x = \sum_{k=0}^{\infty} P(M \leq x)\frac{e^{- \lambda t}*(\lambda t)^k}{k!} = \sum_{k=0}^{\infty} (\frac{x}{t})^k \frac{e^{- \lambda t}*(\lambda t)^k}{k!} = e^{- \lambda t} \sum_{k=0}^{\infty} \frac{(\lambda t)^k}{k!} = e^{- \lambda t}e^{- \lambda x} = e^{\lambda(x-t)}$

If $N_t = 0$, then $S_{N_{T}} = S_0 =0$. This occurs with probability $P(N_t = 0) = e^{- \lambda t}$.

Therefore, the cdf of $S_{N_{T}}$ is: $P(S_{N_{T}} \leq x) = \begin{array}{cc} \{ & \begin{array}{cc} 0 & x < 0 \\ e^{- \lambda (x-t)} & 0\leq x\leq t \\ 1 & x \geq t \end{array} \end{array}$

I don't really understand the part of creating the variable M of the maximum of k i.i.d. random variables in order to solve the problem. Any help would be greatly appreciated, thank you!

The Hilbert function and polynomial of $S = k[x_1, x_2, x_3, x_4]$ and $I = (x_1x_3, x_1x_4, x_2x_4)$ step clarification.

Posted: 18 Apr 2021 07:42 PM PDT

My professor based on pg.320 - 321 of Eisenbud, wrote the following:

If $I = (m_1, \dots, m_l)$ min. set of monomial generators.And $I' = (m_1, \dots, m_{l-1}) \subsetneq I,$ and $d = \operatorname{deg}m_l.$

$$S\mu \xrightarrow{\varphi} S/I' \rightarrow S/I \rightarrow 0$$ $$\mu \mapsto m_l + I^{'}$$

Then we have:

$$\operatorname{ker}{\varphi} = (I': m_l) = J = (m_1/\operatorname{gcd}(m_1, m_l), \dots , m_{l-1}/\operatorname{gcd}(m_{l - 1}, m_l))$$

Therefore, $\operatorname{im}(\varphi) = S/J . \mu$ and we have the s.e.s:

$$0 \rightarrow S/J . \mu \xrightarrow{\tilde{\varphi}} S/I' \rightarrow S/I \rightarrow 0 $$

Regard $S.\mu$ as a graded $S-$module, $\operatorname{deg}\mu = d.$ Then the $s.e.s$ is graded. So for each $i \in \mathbb Z,$ we get $s.e.s$ of vector spaces

$$0 \rightarrow (S/J)_{i - d} \rightarrow (S/I')_{i} \rightarrow (S/I)_i \rightarrow 0 $$ which implies that $H_{S/I}(i) + H_{S/J}(i -d) = H_{S/I'}(i)$ and this gives us an algorithm to find $H_{S/I}(i).$

Now, here is her solution to the question I mentioned above:

1- Put $m_l = x_2x_4, I' = (x_1x_3, x_3x_4)$ then

$J = (I': x_2x_4) = (x_1x_3/\operatorname{gcd}(x_1x_3, x_2x_4), x_1x_4/\operatorname{gcd}(x_1x_4, x_2x_4)) = (x_1x_3, x_2x_1)= (x_1)$

And $S/J = k[x_2, x_3, x_4],$ so $H_{S/J}(d) = \binom{3 + d -1}{d} = \frac{(d + 1)(d + 2)}{2}$ where $d = \operatorname{deg} m_l $ and $H_{S/J}(i - 2) = \frac{(i-1)i}{2}, i \geq 2$

2- Put $m_{l}^{'}= x_1x_4$, $I^{''} = (x_1x_3)$ then $\operatorname{deg}m_{l}^{'} = 2,$ and $J' = (I'': x_1x_4) = (x_1x_3/\operatorname{gcd}(x_1x_3, x_1x_4)) = (x_1x_3/x_1) = (x_3)$

And $S/J' = k[x_1, x_2, x_4],$ so $H_{S/J'}(d) = \binom{3 + d -1}{d} = \frac{(1 + d)(2 + d)}{2}$ where $d = \operatorname{deg} m_l^{'} $ and $H_{S/J'}(i - 2) = \frac{(i - 1)i}{2}, i \geq 2$

So,$$H_{S/I^{'}}(i) + H_{S/J^{'}}(i - 2) = H_{S/I^{''}}(i)$$

Now, since $H_{S/J^{'}}(i - 2) = i - 2, i \geq 2,$ it remains to find $H_{S/I^{''}}(i)$

Now, since we have $S/I^{''} = \frac{k[x_1, x_3]}{(x_1 x_3)}[x_2, x_4],$ a polynomial ring over the indeterminates $ x_2, x_4,$ monomials: $x_1^a x_{2}^b x_4^c, x_3^ax_2^b x_4^c,$ then $$S/I^{''} = k[x_1, x_2, x_4] + k[x_3, x_2, x_4]$$

But then my professor wrote $H_{S/I^{''}}(d) = 2 \frac{(d + 1)(d + 2)}{2} - (d + 1) = (d + 1)^2$.
She said that multiplication by $2$ because we have $$S/I^{''} = k[x_1, x_2, x_4] + k[x_3, x_2, x_4]$$ is the addition of $2$ polynomial rings (is that reasoning correct ?) and the subtraction of $d+1$ because we have counted $x_2x_4$ twice but I do not understand why the number of $x_2x_4$ is $d+1,$ could someone explain this to me please?

Also, I know that $H_{S/I}(i)$ should be called Hilbert function of dimension $i$, but what should be called Hilbert polynomial and it is polynomial in which determinants? Could anyone clarify this to me, please?

If $xy = ax + by$, prove the following: $x^ny^n = \sum_{k=1}^{n} {{2n-1-k} \choose {n-1}}(a^nb^{n-k}x^k + a^{n-k}b^ny^k),n>0$

Posted: 18 Apr 2021 07:36 PM PDT

If $xy = ax + by$, prove the following: $$x^ny^n = \sum_{k=1}^{n} {{2n-1-k} \choose {n-1}}(a^nb^{n-k}x^k + a^{n-k}b^ny^k) = S_n$$ for all $n>0$

We'll use induction on $n$ to prove this.


My approach is to use this formula: $$ \frac{k}{r} {{r} \choose {k}} = {{r-1} \choose {k-1}}$$

I'd like to show: $$S_{n} = xy.S_{n-1}$$. Or:

$$\sum_{k=1}^{n} {{2n-1-k} \choose {n-1}}(a^{n}b^{n-k}x^k + a^{n-k}b^{n}y^k) = (ax+by)\sum_{k=1}^{n-1} {{2n-3-k} \choose {n-2}}(a^{n-1}b^{n-k-1}x^k + a^{n-1-k}b^{n-1}y^k)$$

We have: $$ (ax+by)\sum_{k=1}^{n-1} {{2n-3-k} \choose {n-2}}(a^{n-1}b^{n-k-1}x^k + a^{n-1-k}b^{n-1}y^k) = \sum_{k=1}^{n-1} {{2n-3-k} \choose {n-2}}(a^{n}b^{n-k-1}x^{k+1} + a^{n-k}b^{n-1}xy^k + a^{n-1}b^{n-k}x^ky + a^{n-1-k}b^ny^{k+1}) = \sum_{k=2}^{n} {{2n-2-k} \choose {n-2}}(\pmb{a^{n}b^{n-k}x^{k}} + a^{n-k+1}b^{n-1}xy^{k-1} + a^{n-1}b^{n-k+1}x^{k-1}y + \pmb{a^{n-k}b^ny^{k}}) = \sum_{k=2}^{n} \frac{n-1}{2n-1-k} {{2n-1-k} \choose {n-1}} [...] $$

Now we can almost extract the intended term($S^{'}_{n}$): $$ \sum_{k=2}^{n} {{2n-1-k} \choose {n-1}} (a^{n}b^{n-k}x^{k} + a^{n-k}b^ny^{k}) + \sum_{k=2}^{n} {{2n-1-k} \choose {n-1}} (a^{n-k+1}b^{n-1}xy^{k-1} + a^{n-1}b^{n-k+1}x^{k-1}y) + \sum_{k=2}^{n} (\frac{n-1}{2n-1-k}-1) {{2n-1-k} \choose {n-1}} [...] $$

There is further derivation but not seems very promising.
The idea of this theorem is really interesting. I'm asking for a simpler approach or how i should countinue my proof. Thank you in advance!

Double layer potential in 1d?

Posted: 18 Apr 2021 07:19 PM PDT

I would like to illustrate the double layer potential idea with a simple 1d example, but seem to run into a situation where the resulting integral equation is singular.

The problem is $u''(x) = 0$ on $[0,1]$, subject to $u(0) = a$, $u(1) = b$. A free-space Green's function for this problem is given by $G_0(x,y) = \frac{1}{2}|x-y|$. This satisfies four desirable properties of the free-space Green's function :

  • $G_0(x,y)$ is continuous on $[0,1]\setminus y$.
  • $\partial^2 G_0(x,y)/\partial x^2 = 0$ on $[0,1]\setminus y$
  • $\left[\partial G_0(x,y)/\partial x\right]_{x=y} = 1$
  • $G_0(x,y) = G_0(y,x)$.

As associated dipole can be expressed as

\begin{equation} \lim_{\varepsilon \to 0}\frac{1}{2}\frac{|x-\frac{\varepsilon}{2}| - |x+\frac{\varepsilon}{2}|}{\varepsilon} = \frac{1}{2} - H(x) \equiv -\frac{\partial G_0(x,y)}{\partial y} \end{equation}

Expressing the solution as a double layer potential, I get

\begin{equation} u(x) = \mu(y)\left(-\frac{\partial G_0(x,y)}{\partial y}\right) \bigg\rvert_{y=0}^{y=1} = \mu(1)\left(\frac{1}{2} - H(x-1)\right) - \mu(0)\left(\frac{1}{2} - H(x)\right) \end{equation}

where $H(x)$ is the Heaviside function. To get an integral equation, I evaluate the above at the endpoints $x = 0^+$ and $x = 1^+$, where "+" indicates taking a limit as $x$ approaches boundary point from within the interval $[0,1]$. The resulting integral equation is given by

\begin{eqnarray} u(0^+) & = & \frac{\mu(0)}{2} + \frac{\mu(1)}{2} = a \\ u(1^+) & = & \frac{\mu(1)}{2} + \frac{\mu(0)}{2} = b \end{eqnarray}

which is clearly singular, and can only be solved if $a = b$.

My question is, where did I go wrong? Or, if the above is correct, is there an explanation for why the 1d double layer potential doesn't exist for $a \ne b$?

I have considered the following ideas :

  • This is really a 2d problem in an infinite strip, and as such, maybe the "boundary" isn't really closed, and so therefore, the solution cannot be expressed as a double layer potential. This sounds dubious, however, since harmonic functions certainly exist in infinite and semi-infinite domains.
  • Design a different dipole expression by solving $w''(x) = -\delta'(x)$ and choosing constants of integration to satisfy jump conditions in the potential at $x=0$ and $x=1$. For example, $w(x) = -H(x) + \frac{1}{2}(x) + \frac{1}{2}$ works. This leads to the potential

\begin{equation} u(x) = -\frac{\mu(0)}{2} + \mu(0) H(x) + \frac{\mu(1) - \mu(0)}{2} x - \mu(1)H(x-1) \end{equation}

with $\mu(0) = 2a$ and $\mu(1) = 2b$. This satisfies necessary double-layer jump conditions, but the dipole representation is not obviously the derivative of a free-space Green's function.

  • The solvability issue goes away if $H(0)$ is defined to be $1/2$. In this case, the dipole densities become $\mu(0) = 2b$, and $\mu(1) = 2a$. But the solution is still not the harmonic function $a(1-x) + bx$.

Finding $f$ s.t. the sequence of functions $f_n(x)=f (x − a_n )$ is not a.e. convergent to $f$

Posted: 18 Apr 2021 07:47 PM PDT

The following is an exercise from Bruckner's Real Analysis (the book in second line not "elementary" one):

Let $a_n$ be a sequence of positive numbers converging to zero. If $f$ is continuous, then certainly $f (x − a_n)$ converges to $f (x)$. Find a bounded measurable function on $[0, 1]$ such that the sequence of functions $f_n(x)=f (x − a_n )$ is not a.e. convergent to f [Hint:Take the characteristic function of a Cantor set of positive measure.]

I don't understand how "$f_n(x)=f (x − a_n )$ is not a.e. convergent to f" can happen at all : $f (x − a_n )$ are 'moving' to become $f(x)$ as $n \to \infty$ and we only have a solution for not a.e. convergent to f when we consider any different $f$ that is not a.e. limit of $f_n$? So what is the use of fat Cantor sets here?

For any $n-1$ non-zero elements of $\mathbb Z/n\mathbb Z$, we can make zero using $+,-$ if and only if $n$ is prime

Posted: 18 Apr 2021 07:50 PM PDT

Inspired by Just using $+$ ,$-$, $\times$ using any given n-1 integers, can we make a number divisible by n?, I wanted to first try to answer a simpler version of the problem, that considers only two operations instead of three.


Let $n>2$ and parentheses are not allowed. Then, there are equivalent ways to ask this:

  • Given any set of $n-1$ non-multiples of $n$, can we make a multiple of $n$ using $+,-$?

  • Given any $n-1$ non-zero elements of $\mathbb Z/n\mathbb Z$, can we make $0$ using $+,-$?

Alternatively, we can also be asking to partition a $n-1$ element set $S$ into two subsets $S_+$ and $S_-$, such that the difference between the sum of elements in $S_+$ and the sum of elements in $S_-$ is a multiple of $n$ (is equal to $0$ modulo $n$).

For example, if $n=3$ then there are only $3$ (multi)sets we need to consider:

$$ \begin{array}{} 1-1=0\\ 1+2=0\\ 2-2=0\\ \end{array} $$

which are all solvable (we can make a $0$ in $\mathbb Z/n\mathbb Z$).

In general, there are $\binom{2n-3}{n-1}$ (multi)sets to consider for a given $n$.


My conjecture is that any such (multi)set is solvable if and only if $n$ is a prime number.

If $n$ is not prime, then it is not hard to see that this cannot be done for all (multi)sets. If $n$ is even, then take all $n-1$ elements to equal $1$, to build an unsolvable (multi)set. If $n$ is odd, then take $n-2$ elements to equal to a prime factor of $n$ and last element to equal to $1$, to build an unsolvable (multi)set.

It remains to show that if $n$ is prime, then all such (multi)sets are solvable.

I have confirmed this for $n=3, 5, 7, 11, 13$ using a naive brute force search.

Can we prove this conjecture? Or, can we find a prime that does not work?

Solving system of polynomial matrix equations over $\Bbb Z_2$

Posted: 18 Apr 2021 07:47 PM PDT

Let $A, B, C, D$ be $4 \times 4$ matrices over $\mathbb{Z}_2$.

Suppose they satisfy \begin{equation} \begin{cases} A^2+ BC+ BCA+ ABC+ A= I_4\\ AB+ BCB+ ABD=0_{4 \times 4} \\ CA+ DCA+ CBC= 0_{4 \times 4} \\ DCB+ CBD= I_4 \end{cases}\,. \end{equation}

Does anyone have an idea on how to find matrices $A, B, C, D$ either theoretically or numerically? I'm thinking that we can find a solution since there are four equations and four unknowns.

Hints would suffice. Thank you so much.

Update: I tried to run the first code in SAS but it gave me the following results:enter image description here

What could I be doing wrong?

proc optmodel;     num n = 4;     set ROWS = 1..n;     set COLS = ROWS;     set CELLS = ROWS cross COLS;       var A {CELLS} binary;     var B {CELLS} binary;     var C {CELLS} binary;     var D {CELLS} binary;       var Y {1..4, CELLS} >= 0 integer;           /* M[i,j,k] = A[i,k]*A[k,j] */     var M {1..n, 1..n, 1..n} binary;     con Mcon1 {i in 1..n, j in 1..n, k in 1..n}:        M[i,j,k] <= A[i,k];     con Mcon2 {i in 1..n, j in 1..n, k in 1..n}:        M[i,j,k] <= A[k,j];     con Mcon3 {i in 1..n, j in 1..n, k in 1..n}:        M[i,j,k] >= A[i,k] + A[k,j] - 1;              /* X[i,j,k] = B[i,k]*C[k,j] */     var X {1..n, 1..n, 1..n} binary;     con Xcon1 {i in 1..n, j in 1..n, k in 1..n}:        X[i,j,k] <= B[i,k];     con Xcon2 {i in 1..n, j in 1..n, k in 1..n}:        X[i,j,k] <= C[k,j];     con Xcon3 {i in 1..n, j in 1..n, k in 1..n}:        X[i,j,k] >= B[i,k] + C[k,j] - 1;               /* O[i,j,k,l] = B[i,k]*C[k,l]*A[l,j] */     var O {1..n, 1..n, 1..n, 1..n} binary;     con Ocon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        O[i,j,k,l] <= B[i,k];     con Ocon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        O[i,j,k,l] <= C[k,l];     con Ocon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        O[i,j,k,l] <= A[l,j];        con Ocon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        O[i,j,k,l] >= B[i,k]+C[k,l]+A[l,j] - 2;                  /* P[i,j,k,l] = A[i,k]*B[k,l]*C[l,j] */     var P {1..n, 1..n, 1..n, 1..n} binary;     con Pcon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        P[i,j,k,l] <= A[i,k];     con Pcon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        P[i,j,k,l] <= B[k,l];     con Pcon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        P[i,j,k,l] <= C[l,j];        con Pcon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        P[i,j,k,l] >= A[i,k]+B[k,l]+C[l,j] - 2;       /* A^2 + BC + BCA + ABC + A = I_4 */     con Con1 {<i,j> in CELLS}:        sum {k in 1..n} M[i,j,k]       + sum {k in 1..n} X[i,j,k]       + sum {k in 1..n, l in 1..n} O[i,j,k,l]       + sum {k in 1..n, l in 1..n} P[i,j,k,l]      + A[i,j]      = 2*Y[1,i,j] + (i=j);          /* E[i,j,k] = A[i,k]*B[k,j] */     var E {1..n, 1..n, 1..n} binary;     con Econ1 {i in 1..n, j in 1..n, k in 1..n}:        E[i,j,k] <= A[i,k];     con Econ2 {i in 1..n, j in 1..n, k in 1..n}:        E[i,j,k] <= B[k,j];     con Econ3 {i in 1..n, j in 1..n, k in 1..n}:        E[i,j,k] >= A[i,k] + B[k,j] - 1;              /* F[i,j,k,l] = B[i,k]*C[k,l]*B[l,j] */     var F {1..n, 1..n, 1..n, 1..n} binary;     con Fcon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        F[i,j,k,l] <= B[i,k];     con Fcon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        F[i,j,k,l] <= C[k,l];     con Fcon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        F[i,j,k,l] <= B[l,j];        con Fcon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        F[i,j,k,l] >= B[i,k]+C[k,l]+B[l,j] - 2;                /* G[i,j,k,l] = A[i,k]*B[k,l]*D[l,j] */     var G {1..n, 1..n, 1..n, 1..n} binary;     con Gcon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        G[i,j,k,l] <= A[i,k];     con Gcon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        G[i,j,k,l] <= B[k,l];     con Gcon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        G[i,j,k,l] <= D[l,j];        con Gcon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        G[i,j,k,l] >= A[i,k]+B[k,l]+D[l,j] - 2;        /* AB + BCB + ABD = 0 */     con Con2 {<i,j> in CELLS}:        sum {k in 1..n} E[i,j,k]       + sum {k in 1..n, l in 1..n} F[i,j,k,l]       + sum {k in 1..n, l in 1..n} G[i,j,k,l]     = 2*Y[2,i,j];          /* H[i,j,k] = C[i,k]*A[k,j] */     var H {1..n, 1..n, 1..n} binary;     con Hcon1 {i in 1..n, j in 1..n, k in 1..n}:        H[i,j,k] <= C[i,k];     con Hcon2 {i in 1..n, j in 1..n, k in 1..n}:        H[i,j,k] <= A[k,j];     con Hcon3 {i in 1..n, j in 1..n, k in 1..n}:        H[i,j,k] >= C[i,k] + A[k,j] - 1;              /* Q[i,j,k,l] = D[i,k]*C[k,l]*A[l,j] */     var Q {1..n, 1..n, 1..n, 1..n} binary;     con Qcon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        Q[i,j,k,l] <= D[i,k];     con Qcon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        Q[i,j,k,l] <= C[k,l];     con Qcon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        Q[i,j,k,l] <= A[l,j];        con Qcon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        Q[i,j,k,l] >= D[i,k]+C[k,l]+A[l,j] - 2;               /* R[i,j,k,l] = C[i,k]*B[k,l]*C[l,j] */     var R {1..n, 1..n, 1..n, 1..n} binary;     con Rcon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        R[i,j,k,l] <= C[i,k];     con Rcon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        R[i,j,k,l] <= B[k,l];     con Rcon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        R[i,j,k,l] <= C[l,j];        con Rcon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        R[i,j,k,l] >= C[i,k]+B[k,l]+C[l,j] - 2;        /* CA + DCA + CBC = 0 */     con Con3 {<i,j> in CELLS}:        sum {k in 1..n} H[i,j,k]      + sum {k in 1..n, l in 1..n} Q[i,j,k,l]       + sum {k in 1..n, l in 1..n} R[i,j,k,l]     = 2*Y[3,i,j];          /* S[i,j,k,l] = D[i,k]*C[k,l]*B[l,j] */     var S {1..n, 1..n, 1..n, 1..n} binary;     con Scon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        S[i,j,k,l] <= D[i,k];     con Scon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        S[i,j,k,l] <= C[k,l];     con Scon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        S[i,j,k,l] <= B[l,j];        con Scon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        S[i,j,k,l] >= D[i,k]+C[k,l]+B[l,j] - 2;                 /* T[i,j,k,l] = C[i,k]*B[k,l]*D[l,j] */     var T {1..n, 1..n, 1..n, 1..n} binary;     con Tcon1 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        T[i,j,k,l] <= C[i,k];     con Tcon2 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        T[i,j,k,l] <= B[k,l];     con Tcon3 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        T[i,j,k,l] <= D[l,j];        con Tcon4 {i in 1..n, j in 1..n, k in 1..n, l in 1..n}:        T[i,j,k,l] >= C[i,k]+B[k,l]+D[l,j] - 2;       /* DCB + CBD = I_4 */     con Con4 {<i,j> in CELLS}:        sum {k in 1..n, l in 1..n} S[i,j,k,l]       + sum {k in 1..n, l in 1..n} T[i,j,k,l]     = 2*Y[4,i,j] + (i=j);       solve noobj with milp / maxpoolsols=100;       print A;     print B;     print C;     print D;  quit;    

How to finish this argument showing preimage of maximal ideal is maximal under surjective map. [duplicate]

Posted: 18 Apr 2021 07:21 PM PDT

Let $f: R \to S$ be a surjective ring homomorphism.

Let $M \subset S$ be maximal, and let $f^{-1}(M) \subset I$ for some ideal $I \subset R$.

Then $M=f(f^{-1}(M)) \subset f(I)$ since $f$ is surjective.

Since $M$ is maximal in $S$, then either $f(I)=M$ or $f(I)=S$.

If $f(I)=M$, then $I \subset f^{-1}(f(I)) =f^{-1}(M)$, hence $I=f^{-1}(M)$.


Now, I'm having trouble showing that if $f(I)=S$, then $I=R$.

Vector Field on the Real Projective Plane

Posted: 18 Apr 2021 07:37 PM PDT

An exercise (8-12) in Lee's Introduction to Smooth Manifolds involves showing that if $F : \mathbb{R}^2 \to \mathbb{RP}^2$ is given by $F(x,y) = [x,y,1]$, then there is a vector field on $\mathbb{RP}^2$ that is $F$-related to the vector field $X = x\partial/\partial y - y\partial/\partial x$ on $\mathbb{R}^2$.

I solved this problem as follows: We begin by letting $U_1,U_2,U_3 \subset \mathbb{RP}^2$ be the open subsets on which the first, second, and third coordinates, respectively, are nonzero, and let $(u_i,v_i) : U_i \to \mathbb{R}^2$ be the usual coordinate systems for each $i = 1,2,3$. We then define a smooth vector field $Y_i$ in coordinates on each $U_i$ as follows: \begin{align*} Y_1 &= (u_1^2 + 1)\frac{\partial}{\partial u_1} + u_1v_1\frac{\partial}{\partial v_1} \\ Y_2 &= -(u_2^2 + 1)\frac{\partial}{\partial u_2} - u_2v_2\frac{\partial}{\partial v_2} \\ Y_3 &= -v_3\frac{\partial}{\partial u_3} + u_3\frac{\partial}{\partial v_3}. \end{align*} It's then a straightforward computation with Jacobians to show that these three vector fields agree on intersections, and so they extend to a smooth global vector field $Y$ on $\mathbb{RP}^2$. One more computation shows that $Y$ is $F$-related to $X$. (I might have made a computational error here but that's beside the point.)

Despite having a formula for the vector field $Y$, I still have no intuitive grasp of what it actually looks like. $\mathbb{RP}^2$ is already a pretty abstract object, and how to imagine vector fields on it is a mystery to me---the above coordinate representations don't shed that much light on its structure. Is there a coordinate-independent way to define $Y$? I'm thinking maybe we can define a visualizable vector field on $\mathbb{R}^3 \setminus \{0\}$ that sinks through the quotient map $q : \mathbb{R}^3 \setminus \{0\} \to \mathbb{RP}^2$, but I don't know how the details would work out.

Correction of -0.5 in percentile formula

Posted: 18 Apr 2021 07:41 PM PDT

My question is about how to calculate the percentile of a list of numbers. I found on the Internet the formula:

$$p_i=100·\frac{i-0.5}{N}$$

Nevertheless, I don't understand the reason of -0.5. I mean, for example if I have the following ranked list of numbers:

$$1, 2, 4, 5, 100$$

In my opinion, 100 should be the 100%p and not:

$$p_5=100·\frac{5-0.5}{5} = 90\%$$

I am assuming that all the numbers have the same probability. In this way I'm having the same problem with another formula that is commonly used in this type of calculations:

$$p=100·\frac{i}{n+1}$$

I found this formulas in the following websites:

https://web.stanford.edu/class/archive/anthsci/anthsci192/anthsci192.1064/handouts/calculating%20percentiles.pdf

http://www.itl.nist.gov/div898/handbook/prc/section2/prc262.htm

Thanks for you help!

OSCHINA 社区最新讨论话题

Posted: 18 Apr 2021 12:11 PM PDT

OSCHINA 社区最新讨论话题


一套代码玩转各种数据库

Posted: 18 Apr 2021 10:22 AM PDT

作为快速开发平台,一套代码适配了mysql,oracle,mssql,pgsql,金仓,达梦。相比多套代码各配各的数据库,哪种受人喜欢?

一套代码玩转各种数据库

Posted: 18 Apr 2021 10:11 AM PDT

我一套代码,适配各种数据库,金仓,达梦,mysql,oracle,mssql,pgsql。这样的脚手架比较适用,还是说分每一个版本代码比较适用,大家怎么看!

mac系统如何执行命令行解压

Posted: 17 Apr 2021 07:32 PM PDT

苹果系统如何在任意位置执行命令行执行解压命令 对文件解压到任意位置 不是在解压文件所在目录进行解压

K8s如何使用本地的docker镜像?

Posted: 17 Apr 2021 07:15 AM PDT

K8s如何使用本地的docker镜像?我在本地构建了一个docker的测试镜像,但没有上传到远程服务端,按照网上的说法设置如imagePullPolicy: Never,但是老失败?哪位知道问题。

OSCHINA 社区最新推荐博客

Posted: 18 Apr 2021 11:52 AM PDT

OSCHINA 社区最新推荐博客


终于等到你,小程序开源啦~

Posted: 12 Apr 2021 03:20 AM PDT

回复 PDF 领取资料 这是悟空的第 93 篇原创文章 作者 | 悟空聊架构 来源 | 悟空聊架构(ID:PassJava666) 转载请联系授权(微信ID:PassJava) 本文主要内容如下: 一、缘起 PassJava 开源项目是一个面试刷题的开源系统,后端采用 Spring Cloud 微服务可以用零碎时间利用小程序查看常见面试题,夯实Java 技术栈,当然题...

Recent Questions - English Language & Usage Stack Exchange

Posted: 18 Apr 2021 10:01 AM PDT

Recent Questions - English Language & Usage Stack Exchange


A mathematics career but a journalist-ic career?

Posted: 18 Apr 2021 09:47 AM PDT

My question pertains to the rules, and more specifically the ostensible violation of the rules on the modification of nouns into adjectives.

I sometimes experience difficulty of knowing when to adjective-ify nouns when (1) the adjective immediately precedes the noun in question and (2) the adjective version of the noun exists and is spelled differently.

Take the two examples I came across, surfing on the web:

a) "A journalistic career"

b) "A mathematics career"

Both phrases convey the same relative semantic idea and an almost identical construction bar one detail : in (a) the adjective version of journalist is deployed however in (b) the noun form of mathematics is left unaltered even though it acts as an adjective.

Is there a rubric or custom to distinguish when to adjective-ify nouns in these contexts? Or is it completely optional and both camps are valid?

Edit: another illustrative example : Is it correct to say "a gallery of cow pictures" or "a gallery of bovine pictures"?

What is the original intentional use of the phrase 'systems thinking'?

Posted: 18 Apr 2021 08:33 AM PDT

I have found references in 1963 which seem to be the 'first published that google knows about', but it seems from this that the phrase was in fairly common use by then:see here and here.

(see my research at stream.syscoi.com)

Meaning of "against"

Posted: 18 Apr 2021 09:42 AM PDT

I have a question about the meaning of "against" in the following sentence:

"These communications should be in writing and delivered against receipt."

I don't understand why "against" is used here or what it exactly means.

I'd appreciate your help. Thank you!

I cannot understand the meaning of the following sentence fron Dickens' Notes of America

Posted: 18 Apr 2021 07:29 AM PDT

The last sentence from the following paragraph from Dickens is ambiguious for me; "He was only twenty-five years old, he said, and had grown recently, for it had been found necessary to make an addition to the legs of his inexpressibles. At fifteen he was a short boy, and in those days his English father and his Irish mother had rather snubbed him, as being too small of stature to sustain the credit of the family. He added that his health had not been good, though it was better now; but short people are not wanting who whisper that he drinks too hard "

Which is grammatically correct? "My test is the next day" or "My test is on next day"?

Posted: 18 Apr 2021 06:46 AM PDT

I want to know that whether both the sentence are same or one is wrong? "My test is the next day" or "My test is on next day"? I know perhaps it is a very basic question but still I want to know so please answer.

When someone asks a question but actually just want to answer it themselves

Posted: 18 Apr 2021 05:30 AM PDT

Is there a term for when someone asks a question but you know it's only because they either want you to ask them it back, or they want to answer it themselves?

Hope I've explained this properly!

A phrase meaning a drawback turned out to be an advantage

Posted: 18 Apr 2021 05:57 AM PDT

I remember having heard one before but can't say how it went. The phrase says that what initially seemed like a disadvantage — became an advantage.

If anyone knows anything even similar to this definition, it'd be much appreciated.

What does 'to be a story' means?

Posted: 18 Apr 2021 06:14 AM PDT

Could you explain to me, please, what the expression "You are a story" means, used in the following dialogue:

A: "You mustn't pay any attention to old Addie," she now said to the little girl.
B: "She's ailing today."
A: "Will you shut your mouth?" said the woman in bed. "I am not."
B: "You're a story."

How is this example an adjective?

Posted: 18 Apr 2021 06:01 AM PDT

The New Oxford American Dictionary defines one sense of drag to be:

Clothing more conventionally worn by the opposite sex, esp. women's clothes worn by a man: a fashion show, complete with men in drag | [as adj.] a live drag show

Now that second bit saying that it is an adjective raises my eyebrows a bit, because that example doesn't look like an adjective to me. I parse that as

a     live  drag show  det.  adj.  noun compound  

And I feel this interpretation is vindicated if we contrast sentences like

The show will be so extravagant.

with

*The show will be so drag.

Here I replaced an adjective (extravagant) describing a "show" (the same noun in the sentence provided by the dictionary) with "drag" and got a sentence that seems to me to be ungrammatical. If "drag" were being used as an adjective in the example sentence then it should be separable from the noun it modifies, and it seems to not be. And this evidence is completely congruent with a noun compound understanding of the phrase.

Now to be a little less naïve, I do definitely see how one could think that drag is an adjective in the sentence. My perspective is quite different from a monolingual English speaker who did not spend a large amount of time in school diagramming sentences. It is a word right before a noun that modifies it, which is basically how adjectives work most the time. And I could definitely see it being a pragmatic choice on the part of the dictionary to cater towards a simpler more approachable understanding. However the issue I see with this is that English allows noun compounding with basically all nouns. And the NOAD does not list every noun this way. So there must be something special about the word it is trying to tell me, but I don't know what it is.

So my questions here are: What's going wrong? Have I misread the dictionary? What is the dictionary trying to tell me.

There's no dessert like this vs. There's no such dessert as this

Posted: 18 Apr 2021 05:01 AM PDT

I was wondering if the following statements mean the same.

There's no dessert like this.

There's no such dessert as this.

It seems obvious to me that the second one could mean something like: There's no such thing as this in the world of desserts or I've never seen it in the world of desserts.

The first one, however, sounds ambiguous to me because it could not only mean the same as the other, but also mean like: This is the best dessert I've ever enjoyed.

I know "like" implies comparison. Does the first sentence sound ambiguous to you too or does it only have one meaning?

I need to know the meaning of the following sentence: we will have this boat fixed

Posted: 18 Apr 2021 04:54 AM PDT

"We'll have this boat fixed." Doesn't it sound like they are gonna employ someone do this job? But here is the thing they are themselves doing this job. So what does it mean?

Have started to do something OR be starting to do something?

Posted: 18 Apr 2021 03:22 AM PDT

I have come across such sentences many times but it is difficult to understand the difference between these two types.

Examples:

"It has started to rain." OR "It is starting to rain."

"I have started to hate iPhones." OR "I'm starting to hate iPhones."

Is there any difference?

Is this sentence correct: "What is correct in exercise 4"?

Posted: 18 Apr 2021 02:52 AM PDT

is that sentence correct: "Which one is the correct answer in exercise 5? A, B or C?"

Or: "In ex. 4 the correct answer is..."

Is the perposition "in" correct? Is there a better way to express the same?

Did "A F" exist as an intensifier prior to social media?

Posted: 18 Apr 2021 06:24 AM PDT

"A F" is short for "as fuck". It popped into my lexicon a few years ago, when I started hearing it in Youtube videos.

The earliest entry in Urban Dictionary I can find is from 2011.

Looking at USA Google Trends for "A F", "A. F." and "as fuck" show "A F" has been used for something (possibly Air France?) since at least 2004, which is pre-Twitter, but post MySpace. It also shows an uptick in "as fuck" from around November 2009, which might coincide with the introduction of "a f" as an intensifier. The "a. f." line is pretty low.

Google Trends chart of "a f" vs "a. f." vs "as fuck"

This seems impossible to search for in Google Books, because A F are initials. Using the ngram viewer with "A F_ADVERB" gets no hits.

It doesn't appear in the OED online, and Greens Dictionary of Slang lumps it in with "as fuck". I'm at a loss for where to look.

Is there any evidence out there that "A F" was coined before the advent of social media? Perhaps in military slang?

What is a word for someone who is speaking in a way to gain sympathy from you?

Posted: 18 Apr 2021 06:31 AM PDT

If someone was trying to persuade you to do something, you might say "he spoke convincingly."

What is a similar word for someone who is speaking in a way to gain sympathy from you?

Hope this makes sense.

What is the term for a special service a firm rolls out to secure a sale?

Posted: 18 Apr 2021 08:07 AM PDT

Is there a standard word to describe something a seller does to secure a sale, particularly an add-on service or package? Like when a car dealer adds a package for new wheels or detailing or a dedicated service support line as encouragement to close soon. A "closer"? "Sweetener"? "White glove"? Value-added service?

Etymology of "had better"

Posted: 18 Apr 2021 08:53 AM PDT

Hadn't ought: "ought not —usually used with to ": you really hadn't ought to do that.

https://www.merriam-webster.com/dictionary/hadn%27t%20ought

Is this ''had'' the same as the one in had better? How'd these expressions come to be?

Is there a word for when something looks correct when wrong?

Posted: 17 Apr 2021 11:57 PM PDT

Is there a word for when something looks correct when wrong? For instance in art, drawing something that technically would be wrong in reality, but drawing it correctly actually looks wrong and drawing it wrong looks correct.

I used to perform magic and I thought there was a term for this.

List of people including non-restrictive appositive

Posted: 18 Apr 2021 09:54 AM PDT

I'm editing a book with this sentence:

'Viroj, his wife, Pranom, Joan and I were duly ushered into an audience room at Chitralada Palace.'

Viroj's wife is Pranom so Pranom is set off with commas as a non-restrictive appositive (Viroj has only one wife). Thus there are four people going to the palace. However, if you do not know that Viroj's wife is Pranom, then you could read the sentence as there being five people going to the palace.

Should I separate the names with semi-colons as so:

'Viroj; his wife, Pranom; Joan; and I were duly ushered into an audience room at Chitralada Palace.'

It looks a little odd to me but I believe it is correct?

Is "You’re a better man than I am, Gunga Din!" still considered a compliment in English?

Posted: 18 Apr 2021 09:34 AM PDT

I grew up hearing the phrase, "You're a better man than I am, Gunga Din!" used as a compliment, a genuine expression of admiration, fairly self-effacing at the same time.

I have to admit that, while I knew from context that it was meant as praise, I long ago forgot most of the poem it came from, remembering just that Gunga Din was heroic on the battlefield. Hence the admiration.

I was about to use the phrase when I realized that the person I was addressing might be too young to get the reference, so I skipped it, but went back to read the poem. It is (to me) shockingly racist, with lines like

An' for all 'is dirty 'ide
'E was white, clear white, inside
When 'e went to tend the wounded under fire!

Researching it a bit, it seems the poem is not taught anymore, much like some of Mark Twain's works in the US.

So, is it still a compliment or have the racist overtones made it obsolete?

Edited to add: The last stanza refers to meeting up with Gunga Din in hell someday. [Again edited to add] I realize that the meeting in hell was a compliment - once again - to Gunga Din. The author calls him, "You Lazarushian-leather Gunga Din!" In the Bible, the Rich man (in hell) asks to let Lazarus (in heaven) give him water: 'Father Abraham, have pity on me and send Lazarus to dip the tip of his finger in water and cool my tongue, because I am in agony in this fire.' While the Biblical answer is 'Nope', the author has so much faith in the goodness of Gunga Din that he believes Gunga Din will bring him - and others - water not only on the battlefield, but also in hell. (I think...) Thanks to @Michael.

Sorry, I realize this has some POB aspects to it.

Brackets and comma usage

Posted: 18 Apr 2021 08:59 AM PDT

In the following sentence

Check out our newly created (by people) directory for quick and easy to access information.

should I be using a comma after the closing bracket and after the word quick? Or should there be any commas used?

That is what …. . This is what …. Can these be used interchangeably here?

Posted: 18 Apr 2021 03:57 AM PDT

I've been wondering if "That is what….," and "This is what ….," in the following passage (taken from Fieldfish.com) can be used interchangeably.

Imagine you are an unmarried couple who have been trying to conceive for years. With the help of a well-established fertility clinic and donor sperm you undergo IVF treatment, and have your much desired child. In the course of the fertility process you are told both parents need to sign consent forms that once signed will confer on both the biological parent and the non-biological parent, the same rights of parentage without needing to go to court after the birth to get a declaration of parental responsibility, nor adoption orders. Then some months later the clinic calls you to tell you that due to an admin error, the forms were not completed correctly and the non-biological parent is not legally the child's parent, and probably the only solution is to go through the adoption process.

That is what happened to many couples in the UK who have had fertility treatment using donor sperm and eggs. This is what happened to a family in 2013 and it prompted the Human Fertilisation and Embryology Authority (the HFEA) to require all clinics to audit their cases to see whether there were any other failures by clinics of having failed to get the family to sign both consent form or, having lost or misfiled these legal consents.

"That" and "This" here seem to be almost the same. It is my understanding that "that" indicates a previously stated idea and "this" suggests the idea and something new about it. Is that correct? How does that affect how they are being used in the above passage?

“The tongue in a certain state will cleave to the roof”

Posted: 18 Apr 2021 01:50 AM PDT

While looking for synonym comparison of "stick-cleave-adhere", I came across this in English Synonyms Explained in Alphabetical Order:

To stick expresses more than to cleave, and cleave than adhere: things are made to stick either by incision into the substance, or through the intervention of some glutinous matter; they are made to cleave and adhere by the intervention of some foreign body: what sicks, therefore, becomes so fast joined as to render the bodies inseparable; what cleaves and adheres is less tightly bound, and more easily separable.

Two pieces of clay will stick together by tho incorporation of the substance in the two parts; paper is made to stick to paper by means of glue: the tongue in a certain state will cleave to the roof: paste, or even occasional moisture, will make soft substances adhere to each other, or to hard bodies.

What does "the tongue in a certain state will cleave to the roof" mean?

Comma after a year question

Posted: 18 Apr 2021 01:53 AM PDT

Would there be a comma after the year here? As this is a series of prepositional phrases, I am uncertain that the comma should be inserted.

The composer was alleged to have said this to his secretary in 1940, about a seasonal song.

placement of descriptive clause in the sentence?

Posted: 18 Apr 2021 05:57 AM PDT

S1. X can be done to handle the unsavory practice by Y, which limits growth.

S2. X can be done to handle the unsavory practice, which limits growth, by Y.

In this sentence the descriptive clause "which limits growth" is supposed to apply to the unsavory practice. Does that mean S1 usage is incorrect?

Question update:

What's the best way to rewrite or express the idea that the non-restrictive clause applies to unsavory practice?

I see both S1 and S2 confusing and not easy to read. Furthermore, this problem seems to be very common whenever some X has both a descriptive thing and a restrictive clause and you want to express it in just one sentence. For example:

John grew up with a brother who worked in construction and was John's only healthy sibling, and another brother who worked in government.

"who worked in construction" is restrictive clause. "John's only health sibling" is non-restrictive.

Another way to rewrite it is:

John grew up with a brother, John's only healthy sibling, who worked in construction, and another brother who worked in government.

Both of these ways to express the idea are clumsy. Any better way?

Quantifiers "most" vs. "most of"

Posted: 18 Apr 2021 02:58 AM PDT

I came across this exercise in one of Oxford books.

Most / Most of flowers bought at airports are safe, about 90%.

Shouldn't we use "most of the" when we are talking about a specific set of something?

I will be grateful for any help you can provide.

Everybody had a different opinion. Is there an idiom for this?

Posted: 18 Apr 2021 02:20 AM PDT

I'm searching for an idiom (in a negative sense) that means that a group of people have different opinions, so it's difficult for them to solve a problem, to decide on something or agree on something. Example:

  • They couldn't decide where to go, because everyone had a different opinion.
  • Since the members of the political party have different opinions about its name, we'll have to wait before designing the campaign.

What does "don’t pave the cow path" mean in this context?

Posted: 18 Apr 2021 07:21 AM PDT

I came across a new phrase while reading description section of a webinar topic on Operational Best Practices in the Cloud here.

Excerpt:

Don't pave the cow path. Cloud infrastructure is very different from traditional infrastructure and requires different approaches to really harness cloud value. From dev/test/prod lifecycle management to deployment automation, patch management, monitoring and automation for autoscaling and disaster recovery...

What does don't pave the cow path mean, in general and in this context?

I couldn't even find the meaning or an idiom entry in The Free Dictionary.

Recent Questions - Unix & Linux Stack Exchange

Posted: 18 Apr 2021 10:00 AM PDT

Recent Questions - Unix & Linux Stack Exchange


Can't access with ssh any more with or without ssh key (digital ocean)

Posted: 18 Apr 2021 09:52 AM PDT

Initially i have problem with: ssh_host_rsa_key invalid format...

i fixed with

I use cent os 8.

I start delete some project whos actually was running.

After desconnection i cant any more to connect with ssh . I already have key host implemented.

On connect :

ssh: connect to host MYDOMAIN.com port 22: Connection timed out  

On the end i remove from digital ocean setting security keys… I also change in sshd_config PasswordAuthentication no ir yes and PubkeyAuthentication yes or no

Still no connect with ssh ....

My only alive options is recovery digital ocean web console...

Headphones recognized as Headset

Posted: 18 Apr 2021 09:18 AM PDT

When I plug in my headphone into the (only, so pobably combined out/in) jack in my laptop in Ubuntu 20.04 the config switches output to headphone (I like that) and mic to the non-existing headphone mic (not so).

I can switch the mic back to internal laptop mic in the settings, but it's quite tiring since I plug/unplug them often.

The jack of the headphone has three sections (not four as proper headsets have).

How do I prevent switching to the non-existing mic?

I tried Changing PulseAudio Source port: 'availability=no' and priority but to no avail.

RAID1 as a personal desktop backup system, pros and cons

Posted: 18 Apr 2021 09:05 AM PDT

I'm seriously considering ways to safeguard my data since I'm really tired of loosing files because of bad redundancy.

I was reading about RAID1 and it seems a very practical method of keeping updated backups, though I'm worried about complexity, security, flexibility and portability.

By complexity I mean that I'm adding another logical layer to the filesystem, so in case that anything goes wrong, maintaining and securing both layers may result in added complexity.

How do you rescue data from a RAID1 system? Is it more complex than a normal ext4?

By security I mean that redundancy is double sharped because an error in the upper ext4 filesystem would affect both drives simultaneously because both drives are readed and written at the same time. Is there any means to prevent this?

By flexibility I mean, what happens if one of the mirrored drives breaks up and I'm not able to afford another drive? can I maintain a RAID1 system with only one drive indefinitely? also is it possible to simplify a raid1 system back to a normal ext4 partition?

  1. How do you rescue data from a RAID1 system? Is it more complex than a normal ext4?
  2. Is there any way to delay mirroring in a RAID1 system?
  3. can I maintain a RAID1 system with only one drive indefinitely? also is it possible to simplify a raid1 system back to a normal ext4 partition?
  4. By portability I mean how to move a RAID filesystem in between computers?

Tricky emulation of custom kernel image using QEMU

Posted: 18 Apr 2021 08:28 AM PDT

thank you for viewing this question. I have an SD image which contains 4 partitions:

  1. U-boot and sys volume info
  2. Only contains sys volume info
  3. Empty
  4. Root file system

After running file at the U-boot kernel I can tell the kernel version is 4.14.24-rt19-stable.

My question is, can I download the kernel and build a boot disk to emulate it with QEMU having only these files available? I know the original target processor is cortex-a7.

Any guidance would be appreciated!

Password manager with fingerprint support?

Posted: 18 Apr 2021 08:07 AM PDT

Is there a password manager with fingerprint support?

I use Fedora KDE.

I know that fingerprints might be somewhat insecure. Still, a password manager with fingerprint support is useful. It can be used for logins which are not too important. Like forums and StackExchange, where losing your password to a state would not be the end of the world in any sense.

which module(s) shall I unload to disable a wifi adapter?

Posted: 18 Apr 2021 09:16 AM PDT

My T400 laptop has an internal wifi adapter. It sometimes works and sometimes don't. I use an external wifi adapter, and want to disable the internal one so that it won't suddenly work again and suspiciously interfere with other things.

How can I find out which module(s) to unload?

Here is the current output, with the external wifi adapter working and the internal one not:

$ lsmod | grep -i wifi  rtlwifi                77824  3 rtl8192c_common,rtl_usb,rtl8192cu  mac80211              786432  4 rtl_usb,rtl8192cu,rtlwifi,rtl8xxxu  cfg80211              634880  2 rtlwifi,mac80211  

and

$ lspci -knn |grep Net -A2  00:19.0 Ethernet controller [0200]: Intel Corporation 82567LM Gigabit Network Connection [8086:10f5] (rev 03)      Subsystem: Lenovo 82567LM Gigabit Network Connection [17aa:20ee]      Kernel driver in use: e1000e      Kernel modules: e1000e  

and

$ lspci -knn |grep -i net -A3  00:19.0 Ethernet controller [0200]: Intel Corporation 82567LM Gigabit Network Connection [8086:10f5] (rev 03)      Subsystem: Lenovo 82567LM Gigabit Network Connection [17aa:20ee]      Kernel driver in use: e1000e      Kernel modules: e1000e  00:1a.0 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 [8086:2937] (rev 03)  

What's the difference between the "%s" in vim normal mode and regular GNU sed

Posted: 18 Apr 2021 08:58 AM PDT

I am quite new to regex, and thought markdown(custom/madeup format of maardown) to html conversion using regex would be a good way to get started. When I'm within Vim(8.1), say converting this line;

+style  #include <style.css>  -style  

to;

<link rel="stylesheet" type="text/css" href="style.css">  

I used this command in Vim;

:%s/^+style$\n\(.*\)$\n^-style/<link rel="stylesheet" type="text\/css" href="\1">/g  

And I get exactly what I was hopping for. However, when I ran the same command from my terminal using GNU sed, I get no change in output;

sed 's/^+style$\n\(.*\)$\n^-style/<link rel="stylesheet" type="text\/css" href="\1">/g'  

Also, including the -z flag doen't seem to be much of a help either, the output remains same as input.

I wonder why that is.

How to connect to VM with NAT via SSH protocol? (Qemu/KVM)

Posted: 18 Apr 2021 08:01 AM PDT

I need your advice.

Brief to my question:

I got two Linux/Ubuntu 18.04 Lts. machines. First one is the host(SSHD) and has a VM machine installed on it(virtual machine's ethernet is configured as NAT: Qemu/KVM - virtualization). Simple SSH connection between host and VM on it in NAT regime works perfectly: ssh user@ip.address > pass

First machine is connected to router via LAN and second machine is a ssh-client connected to a router via Wifi.

machine1(host machine, LAN) > Router < (wifi) machine2(SSH Client)

Is there any solution to access VM(on host machine) with machine that is connected to wifi network only? I'm pretty new with Unix/Linux, so I would really appreciate your support with this case.

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.122.x netmask 255.255.255.0 broadcast 192.168.122.255

P.S. I would prefer not to switch NAT to bridge regime. If you need more data, I will gladly provide you with some more details.

Separete only number and display it in new line using bash command

Posted: 18 Apr 2021 08:21 AM PDT

I need to display count of number of line which content number with no including alphabet. And also display these no. in separate lines. Below given is the content of example.txt file:

Electronic mail is a method of exchanging digital messages between computer   users; such messaging first entered substantial  use in the 1960s and by the 1970s had taken the form now recognised as email.   These are spams email ids:     08av , 29809, pankajdhaka.dav, 165 .    23673 ; meetshrotriya;  221965; 1592yahoo.in  praveen_solanki29@yahoo.com  tanmaysharma07@gmail.com  kartikkumar781@gmail.com  arun.singh2205@gmail.com    sukalyan_bhakat@us.in.y.z  These are incorrect:    065  kartikkumar781r2#  1975, 123  

The output of shell file is given below, somebody suggest how can I do this...

Output  Number of lines having one or more digits are: 4  Digits found:  29809  165  23673  221965  065  1975  123  

Every time I boot into ubuntu, it shuts down immediately and restarts again itself. It goes into a loop

Posted: 18 Apr 2021 09:21 AM PDT

I got an issue that is really bugging me for the past few days.

I am trying to boot into Ubuntu system 20.04 LTS. However, every time I turn on, for about 5 seconds loading something it then suddenly shut down. It then automatically restart, loading and shutdown .. continue in a loop.. However, if I go into Grub, I can log into the recover mode and get access the root command line interface.

Can anyone help me troubleshoot this strange thing.

The following are the only things that are set up in my computer build right now:

Motherboard: Z590 MSI PRO WIFI

CPU: i9-10850k and a CPU fan

RAM: a pair of 16 gb

M2: samsung 980 pro nvme

power supply: EVGA 700 GD, 80+ GOLD 700W

UPDATE:

Currently, What I have tried which can log into the OS and even the user interface is to edit the Ubuntu option in GRUB. However, only before 5 minutes the computer shuts down itself.

Specifically, I added "$vt_handoff nomodeset". When loading, I found that it keeps saying that Bluetooth hc10: reading intel version information failed (-22)

Install Grub to USB drive with installed Linux distro inside (Kali)

Posted: 18 Apr 2021 08:50 AM PDT

I'm trying to make a usb drive with two linux distros installed inside. The idea is to carry the usb drive with me and boot the distros in the computer available at the place where I am at that moment. I know that this might be a bad practice, but just wanna give it a try.

I tried to install Kali Linux distro to my usb drive according to this video, in which a VirtualBox VM is used to install the O.S. into a usb drive.

When I first tried I didn't booted my VM in EFI mode and so the O.S. was installed in legacy mode (boot instructions written in the MBR). All was OK as long as I booted on my pc supporting legacy boot, but when I tried to boot from my Microsoft Surface (which doesn't support legacy boot), I obviously couldn't boot from the external drive.

So I tried to reinstall Kali with EFI mode activated on the VM, but I wasn't lucky this time either and didn't manage to boot the distro on my Surface. The situation was the same as when I tried to boot from my Surface having the distro installed in legacy mode: the Surface didn't recognize the bootable usb drive at all.

Googling I found a bunch of solutions to install/reinstall GRUB to an usb/external drive, but when I tried them, it seemed they were working only as long as I booted on the same device which I used to install GRUB on the usb drive. As an example, when I used the VirtualBox VM to install GRUB into my usb device, I was able to boot my Kali distro into the usb device ONLY from that VirtualBox VM.

I think I'm missing something here... Can someone give me an hand to clarify and, maybe, solve?

I attach screenshots describing the partitioning of my usb drive and the content of the ESP partition on the USB drive after the installation in EFI mode of Kali Linux, in case they can help:

Partitioning

ESP Partition content

--- UPDATE ---

I managed to boot my system on BOTH my PCs capable of EFI boot. I just moved the Kali boot loader located in my ESP from /EFI/Kali to the fallback path /EFI/BOOT and renamed the bootloader from "grubx64.efi" to the fallback name "bootx64.efi". I don't know why the boot process didn't manage to boot /EFI/Kali/grubx64.efi do someone has any clues?

Now I only got to make everything bootable in legacy mode (aka using BIOS), is it possible? It seems to be possible to boot a usb drive both UEFI and legacy mode, but is there a way I can set everything up without messing anything working in my actual EFI bootable configuration?

select data conversion based on value range

Posted: 18 Apr 2021 09:12 AM PDT

I have a text file with 3 columns of data. However at random times in the various files there is a change in the in the observed unit from ppn to ppb resulting in the need of a conversion factor and multiplication by 1000.

actual data                        needed data look  20101001,01:00,0.3                 20101001,01:00,0.3,300.000  20110103,10:00,212.67              20110103,10:00,212.670,212.670  

I have a awk command to print all original and add a fourth column with the conversion.

The only issue is it prints everything everything in the third column by 1000 and print to the fourth column. The command is below....

awk -F ',' '{printf "%s %s %.3f %.3f\n", $1,$2,$3,$3*1000}' temp7.tmp > County001-CO-0012.out  

How can I can only values between 2 and -1 in column #3 only get multiplied by 1000 and other wise print the orignal value of column 3 in column 4?

How to compare two files to get matched records?

Posted: 18 Apr 2021 09:41 AM PDT

I have 2 files with * delimiter, each file with 3k records.

There are common fields in different positions. In file1(count=1590) the position is 1 and in file2(2707) the position is 2. file2 count and output count should be same. Note: in file2 2nd position numbers will be present in file1 we need to take corresponding $3 value which is 1 or 0

In both files total count was 3k, both files were * delimter, in that file1 $1 and file2 $2 was common field for both files, we need check whether common field has 0 or 1 which present in file1 $3. we need to write the file like 1==>000000001D0560020011 2==>000000003D0792917850, $1=seqno,$2=matched9digit value follwed byD and $3 whether is 0 or 1

All $2 values from file2 will be present as $1 values in file1.

file1:

D056002001**1  D005356216**1  D079291785**0  D610350290**1  

file2:

000000001*D056002001  000000002*D610350290  000000003*D079291785  

output:

000000001*D056002001*1  000000002*D610350290*1  000000003*D079291785*0  

I tried using the following awk commands:

awk -F'*' 'NR==FNR{c[$1]++;next};c[$2]' file1 file2 > output  awk -F"*" '{ OFS="*"; if (NR==FNR) { a[$1+0]=$0;} else { if (a[$1+0]) { print $1, a[$2+0]}}}' file1 file2 > output  awk -F"*" '{ OFS="*"; if (NR==FNR) { a[$1+0]=$0;NEXT; } else { if (a[$2+0]) { print $0,a[$2+0]; } else { print $0,"***"; }}}' file1 file2 > output  awk -F"*" '{ OFS="*"; if (NR==FNR) {a[$1]=1; b[$1]=$2;next;} else { if ( a[$1]==1) { print $0,b[$1]} else { print $0,"0";}}}' file1 file2 > output  

Please help on that?

cifs mount error(2): No such file or directory

Posted: 18 Apr 2021 09:36 AM PDT

I have a Buffalo Neworkstorage (NS) installed.

I am able to mount the NS from my Rock Pi N10 running Debian (buster) using the following command:

sudo mount.cifs //<<ip.address>>/SHARE /mnt/lspro  

But on my PC running Ubuntu 18.04, using the exactly the same command as above, I got an error:

mount error(2): No such file or directory  Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)  

The dmesg logs are:

[48381.426142] CIFS: Attempting to mount //10.1.10.77/share  [48381.426168] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.  [48381.440240] CIFS VFS: cifs_mount failed w/return code = -2  

/mnt/lspro exists on the Ubuntu box. I can cd /mnt/lspro and ls /mnt/lspro it's confirmed it there!

I can even mount the NS through Files other location by "smb://<ip.address>" using Anonymous without password, but I cannot mount.cifs in the Ubuntu box.

Does anyone have the same situation and found a solution?

Passing arguments to a command safely

Posted: 18 Apr 2021 09:47 AM PDT

It is well known that it's a bad idea to do something of the kind <command> $FILENAME, since you can have a file whose name is for example -<option> and then instead of executing <command> with the file -<option> as an argument, <command> will be executed with the option -<option>.

Is there then a general safe way to accomplish this? One hypothesis would be to add -- before the filename, but I'm not sure if that is 100% safe, and there could be a command that doesn't have this option.

Exclude specific IP with port from a iptable rule having range of ip and port

Posted: 18 Apr 2021 08:21 AM PDT

Need help to create an iptable rule which will redirect all request of ip range 172.16.0.1 to 172.16.0.120 with port range 20-8081 to localhost service listening on port 22215, but this rule should not catch ip 172.16.0.111 with port 443 (i.e., 172.16.0.111:443 should directly access through internet).

iptables -t nat -A OUTPUT -p tcp --match multiport --dport 20:8081 -m iprange --dst-range 172.16.0.1-172.16.0.120 -j DNAT --to-destination 127.0.0.1:22215  iptables -t filter -A INPUT -p tcp --match multiport --dport 20:8081 -m iprange --dst-range 172.16.0.1-172.16.0.120 -j ACCEPT  iptables -A OUTPUT -p tcp --dport 20:8081 -m iprange --dst-range 172.16.0.1-172.16.0.120 -j ACCEPT  

After applying the above rule all the request which has ip and port in the above range are redirected to 127.0.0.1:22215. But I am not getting how to exclude ip 172.16.0.111 having port 443.

Automatic set-up, the network can bus with Ubuntu 20.04

Posted: 18 Apr 2021 08:13 AM PDT

I want to set-up the network of the CAN bus automatically with Ubuntu 20.04.

For other distributions, it is done like this in /etc/network/interfaces:

allow-hotplug can0  iface can0 can static      bitrate 500000  

But I did not find this path etc/network/interfaces . An

How to get all paths from a website using cURL

Posted: 18 Apr 2021 08:25 AM PDT

curl //website// will get me the source code but from there how would I filter our every unique path and obtain the number of them?

the question:

Use cURL from your machine to obtain the source code of the "https://www.inlanefreight.com" website and filter all unique paths of that domain. Submit the number of these paths as the answer.

from the question, I do not know the meaning of "UNIQUE PATHS", but I think it means something similar to what you get from executing $wget -p


I used this method and it worked somehow

wget --spider --recursive https://www.inlanefreight.com    

this will show

Found 10 broken links.    https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.svg  https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.eot  https://www.inlanefreight.com/wp-content/themes/ben_theme/images/testimonial-back.jpg  https://www.inlanefreight.com/wp-content/themes/ben_theme/css/grabbing.png  https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.woff  https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.woff2  https://www.inlanefreight.com/wp-content/themes/ben_theme/images/subscriber-back.jpg  https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.eot?  https://www.inlanefreight.com/wp-content/themes/ben_theme/images/fun-back.jpg  https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.ttf    FINISHED --2020-12-06 05:34:58--  Total wall clock time: 2.5s  Downloaded: 23 files, 794K in 0.1s (5.36 MB/s)    

at the bottom. assuming 23 downloads and 10 broken links all add up to be the unique path I got 33 and it was the correct answer.

External Microphone not does not work on Linux Mint 20 Ulyana

Posted: 18 Apr 2021 07:20 AM PDT

Issue

I cannot capture audio using an external microphone on my Linux Mint 20 Ulyana system. In Sound Settings under the Input tab, when I select the external microphone from the Device list, the Input level shows zero/nil, irrespective of the Volume slider position.

Screenshot of Sound Settings detailing the above issue.

However, I can still use the internal microphone without any issue.

Things I have tried so far

  1. I have tried three different external microphones, including a bluetooth device. I have eliminated the possibility of an issue with Microphone jack and the microphone pin(s).
  2. Checked whether the device is muted in alsamixer. It looks like the device is unmuted, as I did not see an MM under the device.

Here's my system information: https://termbin.com/31ml

getting current script location in bash (like python __file__ variable)

Posted: 18 Apr 2021 06:56 AM PDT

How can I get the full filename of a script in bash? (Similar to python's __file__ variable)

something like

#!/bin/bash  # my-script.sh    # would evaluate to /dir/my-script.sh  thisfile=$(get-name-for-this-script)    # Do something with some other local file   cp $(dirname $thisfile)/something.txt .  

How do I install wmutils on Fedora easily?

Posted: 18 Apr 2021 09:49 AM PDT

I've tried to compile

https://github.com/wmutils/core  https://github.com/wmutils/libwm  

But I get

CC util.c  util.c:4:10: fatal error: xcb/xcb.h: No such file or directory      4 | #include <xcb/xcb.h>        |          ^~~~~~~~~~~  compilation terminated.  

I also use Homebrew but didn't see a tap for it.

How do I compile this? I tried getting the missing dev package but it wasn't available.

I try to stay within software that's simple to install so I wonder - is there an easier way I'm not seeing?

Packaging binary release on OpenBSD

Posted: 18 Apr 2021 07:07 AM PDT

I have a tiny application written in go and I've cross-compiled it to various operating systems.

Currently my Makefile generates myapp-VERSION-OS-CPUARCH.tar.gz packages to be used as a source binary packages for to be released as .deb, .rpm, PKGBUILD, FreeBSD binary release .tgz and so on with a structure like so:

bin/myapp  LICENSE  README.md  

I can't find tutorials/howtos/examples on how to package this into official OpenBSD .tgz binary release package(s). pkg_create seems to be the command, but I can't find examples.

So how you make the binary release package on OpenBSD so that there's all the metadata such as maintainer, application category, architecture and such?

The idea here is not getting the package to any official ports repository. It's to simply package a release for your own machine and learning about the packaging process on OpenBSD.

Cannot create New folder and Paste files on a drive - Ubuntu

Posted: 18 Apr 2021 09:54 AM PDT

enter image description here My Files drive is not able to modify

enter image description here

Difference between zsh-history-substring-search and up-line-or-beginning-search

Posted: 18 Apr 2021 07:35 AM PDT

Is there a practical difference between history-substring-search-up and up-line-or-beginning-search? I've tried both out and they effectively seem to do the same thing (besides some highlighting that history-substring-search does).

hplip 3.16.2: no installed HP device found (while CUPS finds it)

Posted: 18 Apr 2021 06:59 AM PDT

I was investigating further an issue already reported here. The problem is: after having upgraded the hplip driver to 3.16.2, the scanner in my all-in-one printer HP Color LaserJet Pro MFP M277dw does not work any longer (while the printer does). Today I found other oddities that seem specific to hplip rather than to sane, whereby this other post.

I use Ubuntu Linux 14.04 LTS. In all that follows the device is connected and powered-on. The hplip page for that device is here.

Evidences

a. Moving on from the sane community page on Ubuntu, I followed the suggestion to run sudo hp-setup. The answer is

warning: CUPSEXT could not be loaded. Please check HPLIP installation.

b. If run hp-doctor, the welcome message is

error: This distro (i.e ubuntu 14.04) is either deprecated or not yet supported.

This sounds utterly odd to me, because the previous hplip did not dare to complain this far of the very same distro. The complete output of hp-doctor is available from here on Paste Ubuntu.

c. Ever more puzzling, if I open the HP device manager, I am presented with the window

enter image description here

which seems a false statement to me, since the device works as a printer at the very least. If I click on Setup device... I get again the same dialogue window. And CUPS on localhost:631 indeed confirms that the printer is there ready to be found, nice and idle.

Questions

Is there a way to have the commands hp-setup and hp-doctor run smoothly so that I can fix the scanner issue down the line?

If not, how do I downgrade the hplip driver to the previous stable version? Installing 3.16.2 has led to more havoc than joy.

Keep aspect ratio true to the mode

Posted: 18 Apr 2021 08:53 AM PDT

I've recently installed Linux Mint 17, replacing my ageing Mint 13 installation. I've got a 16:9 screen. In case it matters, my graphics card is an NVidia GeForce 210.

Now back in Mint 13, if a game switched to a 4:3 mode, I got it displayed in the correct aspect ratio, with black bars left and right. However now they are deformed to fill the full screen, which is annoying because it no only looks terrible, but also destroys angles and therefore affects gameplay.

I then also checked explicitly switching to a 4:3 mode (using the "Monitors" settings dialog), and again it deformed the image. I also checked my monitor's setting that it is indeed still set to keep the aspect ratio. Indeed, going into the monitor's menu tells me that the screen still gets a 1920x1080 signal. Therefore I conclude that it's a Linux/X11/graphics driver issue.

I'm using the Nouveau driver. In Mint 13 I used the proprietary NVidia driver; that could make a difference. However I cannot imagine that there's no way to get the correct aspect ratio also with Nouveau.

Therefore my question is: What do I have to do to get 4:3 modes (or, more generally, non-16:9 modes) displayed in the correct aspect ratio on a 16:9 monitor (without affecting the 16:9 modes, obviously)?

How to view traffic over a forwarded ssh port?

Posted: 18 Apr 2021 08:09 AM PDT

It is possible to setup an SSH port forward where the ssh client prints out the traffic exchanged over the ssh port to the screen or a file.

I am trying to debug a problem and want to see what is being sent between a java process running on my local machine and a remote process running on Solaris. I am using the port forwarding via ssh so that i can step through the java program. Normally I would have to copy the .java files to the Solaris machine, build them and run and it is not very productive way to debug, thus the port forwarding. The client and server as using IIOP protocol so I can't use an http proxy to monitor the traffic.

How can I open a new terminal in the same directory of the last used one from a window manager keybind?

Posted: 18 Apr 2021 06:44 AM PDT

I'm using a tiling window manager and I switched from gnome-terminal with multiple tabs to multiple urxvt instances managed by the window manager. One of the features I miss is the ability to open a new terminal that defaults to the working directory of the last one.

In short: I need a way to open a new urxvt (bash) that defaults to $PWD of the last used one.

The only solution that comes to my mind is to save the current path on every cd with something like this:

echo $PWD > ~/.last_dir  

and restore the path on the new terminal in this way:

cd `cat ~/.last_dir`  

I can source the second command in .bashrc but I don't know how to execute the first one on every directory change :)

Any simpler solution that does not involve screen or tmux usage is welcome.

【GAMEMAKER】invincible abilities

Posted: 18 Apr 2021 09:32 AM PDT

 Information about object: obj_player

Sprite: spr_idle_down
Solid: false
Visible: true
Depth: 0
Persistent: true
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

///set up
enum player_state {
idle,
up,
down,
left,
right
}

dir=player_state.down;
is_moving=false;
image_speed=0.5;

col=0;//initial value
sw=0;//for sine wave
move_col=5;
invincible=false;
invincible_timer=100;
alarm[0]=20;//to replenish
Alarm Event for alarm 0:
execute code:

invincible_timer++;
if invincible_timer>100 invincible_timer=100;
alarm[0]=20;
Step Event:
execute code:

//animation
if is_moving
{
switch (dir)
{
case player_state.up:
sprite_index=spr_walk_up;
break;

case player_state.down:
sprite_index=spr_walk_down;
break;

case player_state.left:
sprite_index=spr_walk_left;
break;

case player_state.right:
sprite_index=spr_walk_right;
break;
}
}
else
{
switch (dir)
{
case player_state.up:
sprite_index=spr_idle_up;
break;

case player_state.down:
sprite_index=spr_idle_down;
break;

case player_state.left:
sprite_index=spr_idle_left;
break;

case player_state.right:
sprite_index=spr_idle_right;
break;
}
}



execute code:

///invincibility
if keyboard_check_released(ord('I')) //switch between true / false on key press
{
invincible=!invincible;
}

if invincible
{
sw += 0.1;//for sin wave - ie speed
col= sin(sw) * move_col;//for sin wave
image_blend = make_colour_rgb(125+(col*20), 100, 100);
invincible_timer-=1;
}
else
{
image_blend = make_colour_rgb(255,255,255);
}

//check if player has invincible_timer
if invincible_timer<1 invincible=false;
execute code:

///keypress code
if (keyboard_check(vk_left))
{
dir=player_state.left;
is_moving=true;
}
else
if (keyboard_check(vk_right))
{
dir=player_state.right;
is_moving=true;
}
else
if (keyboard_check(vk_up))
{
dir=player_state.up;
is_moving=true;
}
else
if (keyboard_check(vk_down))
{
dir=player_state.down;
is_moving=true;
}
else
{
is_moving=false;
}

execute code:

///movement
if is_moving
{
switch (dir)
{
case player_state.up:
y -= 4;
break;

case player_state.down:
y += 4;
break;

case player_state.left:
x -= 4;
break;

case player_state.right:
x += 4;
break;
}
}
Draw Event:
execute code:

///draw self and box showing invincible_timer
draw_self();
//background
draw_set_colour(c_red);
draw_rectangle(x-50,y-70,x+50,y-65,false);
//bar
draw_set_colour(c_green);
draw_rectangle(x-50,y-70,x-50+invincible_timer,y-65,false);

Recent Questions - Stack Overflow

Posted: 18 Apr 2021 08:26 AM PDT

Recent Questions - Stack Overflow


Docker Compose local directory not mounted in remote deployment

Posted: 18 Apr 2021 08:22 AM PDT

I'm using docker-compose (on windows) to bring up a mongoDB along with a couple of nodeJS processes (on a remote CentOS machine via SSH). The nodeJS containers are supposed to have the code in my project directory mounted into /home/node/app so they can execute it with the command node web/run. However, when I use docker context to deploy this group of containers to my remote host via SSH, I get an error saying the script at /home/node/app/web/run is not found, suggesting my code was not copied into/mounted into the container.

You can see that I'm mounting the current directory (my project) below:

  web:      image: node:15.12.0      user: node      working_dir: /home/node/app      volumes:        - ./:/home/node/app:ro      ports:        - 80:80      command: node web/run      depends_on:        - events-db  

Am I misunderstanding how volumes work in Docker? What are the best practices for getting my code into a container so it can be executed?

Loops on dataframes & replace

Posted: 18 Apr 2021 08:22 AM PDT

I need to add a new column to my dataframe (Titanic dataset) call Range, with the range of every passenger on the Titanic, following this table:

Kids 11 years Young 18 years Adult 50 years Old 50 years

I created a new column and full it with NaN. Then, I have tried a loop to itinerate the age and replace the value of the column, but the column fills all the rows with 'Adult'. Why can this be happening?

for i in df["Age"]:      if (i < 11.0):          df['Range'].replace(['NaN'],'Niño')      elif (i < 18.0):          df['Range'].replace(['NaN'],'Joven')      elif (i < 50.0):          df['Range'].replace(['NaN'],'Adulto')      elif (i >= 50.0):          df['Range'].replace(['NaN'],'Mayor')  

Thanks a lot!

How to check if a letter is greater another letter in JS

Posted: 18 Apr 2021 08:22 AM PDT

I am trying to work out an efficient way on how to determine how you can check if a letter is greater than another letter in Javascript.

for example,

I want to check if K is greater than J in the alphabet.

return true if it is.

Get the invalid yup item's index from error

Posted: 18 Apr 2021 08:22 AM PDT

I'm currently processing a form with Formik and Yup that contains more than 700 complex entries. I want to print exactly the item which was affected. E.g: If item #548 was invalid, I'd like to get the item index (which should be 547) and then print it out to the user.

I tried using ${path} interpolation in Yup, which almost does what I want, but I'd like to get only the index or be able to transform the output before it goes out of Yup (Or I'd have to modify the other components, and I don't want it to feel like a hack).

Here's my schema:

const toGradeSchema = yup.lazy((_toGrade: any) => {    const toGrade = _toGrade as ToGradeInput | undefined;    const isGradeSet = toGrade?.gradeId || toGrade?.section;    const gradeId = yup      .string()      .test('gradeId', 'Debe de colocar el grado', (val?: any) => {        return (!isGradeSet && !val) || (val && isGradeSet);      });    const section = yup      .string()      .oneOf(sectionList)      .test('gradeId', 'Debe de colocar la sección', (val?: any) => {        return (!isGradeSet && !val) || (val && isGradeSet);      });    const base = yup.object().shape({      gradeId,      section,    });      return base;  });    const newStudentsSchema = yup.array().of(    yup      .object()      .shape({        name: yup.object().shape({          firstName: yup            .string()            .required('El primer nombre es requerido ${path}'),          lastName: yup.string().required('El apellido es requerido'),          fullName: yup.string().notRequired(),        }),        email: yup          .string()          .email('El correo electrónico es inválido')          .required('Debe de colocar un correo electrónico ${path}'),        password: yup          .string()          .required(() => 'Debe de colocar una contraseña ${path}')          .test(            'password is valid',            'La contraseña debe de contener por lo menos una letra en mayúscula, una en minúscula y al menos un dígito',            (pass: string | undefined | null) => {              if (!pass) {                return false;              }              return validatePassword(pass);            },          ),        gender: yup.mixed().oneOf(genderValues),        // The order in the attendance that must not change        birthDate: yup.date().notRequired(),        allergies: yup.string().notRequired(),        diseases: yup.string().notRequired(),        toGrade: toGradeSchema,      })      .notRequired(),  );    const existingStudentSchema = yup.array().of(    yup.object().shape({      studentId: yup.string().required('Debe de colocar el ID del estudiante'),      toGrade: toGradeSchema,    }),  );    export const bulkStudentCreateSchema = yup.object().shape({    students: yup.object().shape({      newStudents: newStudentsSchema,      existingStudents: existingStudentSchema,    }),  });  

Any ideas?

Google API mail merge to pdf with email

Posted: 18 Apr 2021 08:22 AM PDT

I am working on a project The current code and document i have only send an email of what the data in the row is.

I would like that the data in columns B - G be merged to a PDF and then it is sent with the email template to an email address in column H.

I am currently stuck on how to add the code for creating the PDF Here is the Link to the folder with the google sheets data document FOLDER LINK

below is the current code

 function sendEmails() {    var ss = SpreadsheetApp.getActiveSpreadsheet();    var dataSheet = ss.getSheets()[0];    var dataRange = dataSheet.getRange(2, 1, dataSheet.getMaxRows() - 1, 4);      var templateSheet = ss.getSheets()[1];    var emailTemplate = templateSheet.getRange("A1").getValue();      // Create one JavaScript object per row of data.    objects = getRowsData(dataSheet, dataRange);      // For every row object, create a personalized email from a template and send    // it to the appropriate person.    for (var i = 0; i < objects.length; ++i) {      // Get a row object      var rowData = objects[i];        // Generate a personalized email.      // Given a template string, replace markers (for instance ${"First Name"}) with      // the corresponding value in a row object (for instance rowData.firstName).      var emailText = fillInTemplateFromObject(emailTemplate, rowData);      var emailSubject = "Tutorial: Simple Mail Merge";        MailApp.sendEmail(rowData.emailAddress, emailSubject, emailText);    }   }      // Replaces markers in a template string with values define in a JavaScript data object.  // Arguments:  //   - template: string containing markers, for instance ${"Column name"}  //   - data: JavaScript object with values to that will replace markers. For instance  //           data.columnName will replace marker ${"Column name"}  // Returns a string without markers. If no data is found to replace a marker, it is  // simply removed.  function fillInTemplateFromObject(template, data) {    var email = template;    // Search for all the variables to be replaced, for instance ${"Column name"}    var templateVars = template.match(/\$\{\"[^\"]+\"\}/g);      // Replace variables from the template with the actual values from the data object.    // If no value is available, replace with the empty string.    for (var i = 0; i < templateVars.length; ++i) {      // normalizeHeader ignores ${"} so we can call it directly here.      var variableData = data[normalizeHeader(templateVars[i])];      email = email.replace(templateVars[i], variableData || "");    }      return email;  }            //////////////////////////////////////////////////////////////////////////////////////////  //  // The code below is reused from the 'Reading Spreadsheet data using JavaScript Objects'  // tutorial.  //  //////////////////////////////////////////////////////////////////////////////////////////    // getRowsData iterates row by row in the input range and returns an array of objects.  // Each object contains all the data for a given row, indexed by its normalized column name.  // Arguments:  //   - sheet: the sheet object that contains the data to be processed  //   - range: the exact range of cells where the data is stored  //   - columnHeadersRowIndex: specifies the row number where the column names are stored.  //       This argument is optional and it defaults to the row immediately above range;   // Returns an Array of objects.  function getRowsData(sheet, range, columnHeadersRowIndex) {    columnHeadersRowIndex = columnHeadersRowIndex || range.getRowIndex() - 1;    var numColumns = range.getEndColumn() - range.getColumn() + 1;    var headersRange = sheet.getRange(columnHeadersRowIndex, range.getColumn(), 1, numColumns);    var headers = headersRange.getValues()[0];    return getObjects(range.getValues(), normalizeHeaders(headers));  }    // For every row of data in data, generates an object that contains the data. Names of  // object fields are defined in keys.  // Arguments:  //   - data: JavaScript 2d array  //   - keys: Array of Strings that define the property names for the objects to create  function getObjects(data, keys) {    var objects = [];    for (var i = 0; i < data.length; ++i) {      var object = {};      var hasData = false;      for (var j = 0; j < data[i].length; ++j) {        var cellData = data[i][j];        if (isCellEmpty(cellData)) {          continue;        }        object[keys[j]] = cellData;        hasData = true;      }      if (hasData) {        objects.push(object);      }    }    return objects;  }    // Returns an Array of normalized Strings.  // Arguments:  //   - headers: Array of Strings to normalize  function normalizeHeaders(headers) {    var keys = [];    for (var i = 0; i < headers.length; ++i) {      var key = normalizeHeader(headers[i]);      if (key.length > 0) {        keys.push(key);      }    }    return keys;  }    // Normalizes a string, by removing all alphanumeric characters and using mixed case  // to separate words. The output will always start with a lower case letter.  // This function is designed to produce JavaScript object property names.  // Arguments:  //   - header: string to normalize  // Examples:  //   "First Name" -> "firstName"  //   "Market Cap (millions) -> "marketCapMillions  //   "1 number at the beginning is ignored" -> "numberAtTheBeginningIsIgnored"  function normalizeHeader(header) {    var key = "";    var upperCase = false;    for (var i = 0; i < header.length; ++i) {      var letter = header[i];      if (letter == " " && key.length > 0) {        upperCase = true;        continue;      }      if (!isAlnum(letter)) {        continue;      }      if (key.length == 0 && isDigit(letter)) {        continue; // first character must be a letter      }      if (upperCase) {        upperCase = false;        key += letter.toUpperCase();      } else {        key += letter.toLowerCase();      }    }    return key;  }    // Returns true if the cell where cellData was read from is empty.  // Arguments:  //   - cellData: string  function isCellEmpty(cellData) {    return typeof(cellData) == "string" && cellData == "";  }    // Returns true if the character char is alphabetical, false otherwise.  function isAlnum(char) {    return char >= 'A' && char <= 'Z' ||      char >= 'a' && char <= 'z' ||      isDigit(char);  }    // Returns true if the character char is a digit, false otherwise.  function isDigit(char) {    return char >= '0' && char <= '9';  }  

THANK YOU. I HOPE YOU WILL ASSIST ME

x86 ASM: useless conditional jump?

Posted: 18 Apr 2021 08:21 AM PDT

I am looking at the following piece of x86 assembly code (Intel syntax):

movzx   eax, al  and     eax, 3  cmp     eax, 3  ja      loc_6BE9A0  

In my understanding, this should equal something like this in C:

eax &= 0xFF;  eax &= 3;  if (eax > 3)     loc_6BE9A0();  

This does not seem to make much sense since this condition will never be true (because eax will never be greater than 3 if it got and-ed with 3 before). Am I missing something here or is this really just an unnecessary condition?

And also: the movzx eax, al should not be necessary either if it gets and-ed with 3 right after that, is it?

I am asking this because I am not so familiar with assembly language and so I am not entirely sure if I am missing something here.

Error during execution of npx react-native run-android

Posted: 18 Apr 2021 08:21 AM PDT

I am quite new to React native. I was trying to run the emulator but it shows "failed to launch emulator" and I am not sure how to resolve the error. What am I supposed to do to resolve the error? ..................................................................................................................................................................................................................

D:\hiban_work\react\AwesomeProject>npx react-native run-android  info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier"   flag.  Jetifier found 903 file(s) to forward-jetify. Using 4 workers...  info Starting JS server...  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  info Launching emulator...  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  'C:\Users\Hanim' is not recognized as an internal or external command,  operable program or batch file.  error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..  warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.  info Installing the app...  Starting a Gradle Daemon (subsequent builds will be faster)  > Task :app:checkDebugDuplicateClasses FAILED                                                                           > :app:checkDebugAarMetadata > Resolve files of  16 actionable tasks: 14 executed, 2 up-to-date    FAILURE: Build failed with an exception.    * What went wrong:  Execution failed for task ':app:checkDebugDuplicateClasses'.  > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.     > Failed to transform swiperefreshlayout-1.0.0.aar (androidx.swiperefreshlayout:swiperefreshlayout:1.0.0) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.        > Execution failed for AarToClassTransform: C:\Users\Hanim Omer\.gradle\caches\modules-2\files-2.1\androidx.swiperefreshlayout\swiperefreshlayout\1.0.0\4fd265b80a2b0fbeb062ab2bc4b1487521507762\swiperefreshlayout-1.0.0.aar.           > error in opening zip file    * Try:  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.    * Get more help at https://help.gradle.org    BUILD FAILED in 4m 56s    error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.  Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081    FAILURE: Build failed with an exception.    * What went wrong:  Execution failed for task ':app:checkDebugDuplicateClasses'.  > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.     > Failed to transform swiperefreshlayout-1.0.0.aar (androidx.swiperefreshlayout:swiperefreshlayout:1.0.0) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.        > Execution failed for AarToClassTransform: C:\Users\Hanim Omer\.gradle\caches\modules-2\files-2.1\androidx.swiperefreshlayout\swiperefreshlayout\1.0.0\4fd265b80a2b0fbeb062ab2bc4b1487521507762\swiperefreshlayout-1.0.0.aar.           > error in opening zip file    * Try:  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.    * Get more help at https://help.gradle.org    BUILD FAILED in 4m 56s        at makeError (D:\hiban_work\react\AwesomeProject\node_modules\execa\index.js:174:9)      at D:\hiban_work\react\AwesomeProject\node_modules\execa\index.js:278:16      at processTicksAndRejections (node:internal/process/task_queues:94:5)      at async runOnAllDevices (D:\hiban_work\react\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)      at async Command.handleAction (D:\hiban_work\react\AwesomeProject\node_modules\@react-native-community\cli\build\index.js:186:9)  info Run CLI with --verbose flag for more details.  

javascript object property assignment between different objects

Posted: 18 Apr 2021 08:21 AM PDT

I read a snippet and confusing and could not find the rules or principle to explain that,the output is Malibu,why not London,the adress: sherlock.address in let john = { surname: 'Watson', address: sherlock.address }; is to assign the value ofsherlock.adress to john.address,but not overwrite sherlock.adresswithjohn.address.How could I fiddle my hair.

let sherlock = {    surname: 'Holmes',    address: { city: 'London' }   };  let john = {    surname: 'Watson',    address: sherlock.address  };  john.surname = 'Lennon';  john.address.city = 'Malibu';  console.log(sherlock.address.city); //  

Quartz scheduler not working when i host the application on iis with c#

Posted: 18 Apr 2021 08:21 AM PDT

I have created an application which is web form application.I am using Quartz.net. In that I have class RequestToken which is as follows

***public partial class RequestToken : System.Web.UI.Page      {           public void Page_Load(object sender, EventArgs e)          {            Method1();            Method2();          }     public void Method1()     {     }     public void Method2()     {     }  }   public class job : IJob      {          public void Execute(IJobExecutionContext context)          {              RequestToken rs = new RequestToken();              rs.Page_Load(null, EventArgs.Empty);          }      }***  

Then I have another class Jobsceduler.cs

***public class JobScheduler      {          public static void Start()          {              IScheduler scheduler = (IScheduler)StdSchedulerFactory.GetDefaultScheduler();              scheduler.Start();              IJobDetail Jobs = JobBuilder.Create<job>().Build();              ITrigger trigger = TriggerBuilder.Create()                  .WithDailyTimeIntervalSchedule                    (s =>                       s.WithIntervalInHours(24)                      .OnEveryDay()                      .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(10,00))                    )                  .Build();              scheduler.ScheduleJob(Jobs, trigger);          }      }  

and in Global.asax

void Application_Start(object sender, EventArgs e)      {        JobScheduler.start();      }***  

Scheduler runs perfectly on given time

Issues in above code 1)It runs two times in local that is first on pageload() and second time after scheduler runs.

  1. when hosted on iis it requires classname to append to the url means the site should be like this "www.site.com/RequestToken.aspx" is it due to I have single page in my application that is RequestToken.aspx?

Should i need to remove the pageLoad() from the above code? should I need to add default.aspx and move the above code in that page to host in IIS?

Can anybody please provide the solution .

Limit maximum number of items in array jsonschema

Posted: 18 Apr 2021 08:20 AM PDT

I have a json-schema (draft-07) of type array to store multiple types of data like

{    "$schema": "http://json-schema.org/draft-07/schema#",    "type": "array",    "items": {      "type": "object",      "required": [        "type",        "data"      ],      "additionalProperties": false,      "properties": {        "type": {          "type": "string",          "enum": [            "banner_images",            "description_box",            "button"          ]        },        "data": {          "type": "object"        }      },      "allOf": [        {          "if": {            "properties": {              "type": {                "const": "banner_images"              }            }          },          "then": {            "properties": {              "data": {                "$ref": "components/banner_images.json"              }            }          }        },        {          "if": {            "properties": {              "type": {                "const": "description_box"              }            }          },          "then": {            "properties": {              "data": {                "$ref": "components/description_box.json"              }            }          }        },        {          "if": {            "properties": {              "type": {                "const": "button"              }            }          },          "then": {            "properties": {              "data": {                "$ref": "components/button.json"              }            }          }        }      ]    }  }  

Which validates the following data

[    {      "type": "banner_images",      "data": {        "images": [          {             "url": "https://example.com/image.jpg"          }        ]      }    },    {      "type": "description_box",      "data": {        "text": "Description box text"      }    },    {      "type": "button",      "data": {        "label": "Click here",        "color": {          "label": "#ff000ff",          "button": "#00ff00",          "border": "#00ff00"        },        "link": "https://example.com"      }    }  ]  

As of now, the user can provide any number of the components from banner_images, description_box, and button.

I want to limit each component based on the component type

  • banner_images -> 1
  • description_box -> 5
  • button -> 10

There is an option to set the length of the items in array type https://json-schema.org/understanding-json-schema/reference/array.html#id7

But how can I limit the length of the items based on the type?

How can a thread in a critical region experiences an unhandled exception?

Posted: 18 Apr 2021 08:20 AM PDT

I'm reading a book which says:

A thread that is in a critical region is a thread that has entered a thread synchronization lock that must be released by the same thread. When a thread is in a critical region, the CLR believes that the thread is accessing data that is shared by multiple threads in the same AppDomain. After all, this is probably why the thread took the lock. If the thread is accessing shared data, just terminating the thread isn't good enough, because other threads may then try to access the shared data that is now corrupt, causing the AppDomain to run unpredictably or with possible security vulnerabilities. So, when a thread in a critical region experiences an unhandled exception, the CLR first attempts to upgrade the exception to a graceful AppDomain unload in an effort to get rid of all of the threads and data objects that are currently in use.

my question is, how can a thread in a critical region experiences an unhandled exception? Because when the thread entered a lock, the thead is suspended and waits for other thread to release the lock, if the thread is at idle(suspended), it doesn't execute any code, then how it is going to experience an unhandled exception?

How I can provide callback functions inside a Runnable that affects the Current activity

Posted: 18 Apr 2021 08:20 AM PDT

I have the following class:

package com.example.vodafone_fu_h300s.logic;    import com.example.vodafone_fu_h300s.logic.exceptions.CsrfTokenNotFound;  import com.example.vodafone_fu_h300s.logic.exceptions.SettingsFailedException;    import com.example.vodafone_fu_h300s.logic.lambdas.ExceptionHandler;  import com.example.vodafone_fu_h300s.logic.lambdas.LoginHandler;  import com.example.vodafone_fu_h300s.logic.lambdas.RetrieveSettingsHandler;  import com.example.vodafone_fu_h300s.logic.lambdas.SettingsRetrievalFailedHandler;    import org.json.JSONArray;  import org.json.JSONObject;    import java.io.IOException;    import java.math.BigInteger;  import java.nio.charset.StandardCharsets;  import java.util.regex.Matcher;  import java.util.regex.Pattern;    import okhttp3.Call;  import okhttp3.OkHttpClient;  import okhttp3.Request;  import okhttp3.RequestBody;  import okhttp3.Response;  import okhttp3.FormBody.Builder;    import java.security.MessageDigest;    public class Η300sCredentialsRetriever {        private String url;        private OkHttpClient httpClient;        private String username;      private String password;        private LoginHandler loginHandler;      private ExceptionHandler exceptionHandler;      private RetrieveSettingsHandler settingsHandler;      private SettingsRetrievalFailedHandler failedHandler;        private String session_id;        public Η300sCredentialsRetriever()      {          this.exceptionHandler = (Exception e)->{};          this.loginHandler     = (boolean loginStatus)->{};          this.settingsHandler  = (H300sVoipSettings settings)->{};          this.failedHandler    = ()->{};            this.setHttpClient(new OkHttpClient());      }        public void setSettingsHandler(RetrieveSettingsHandler handler){          this.settingsHandler = handler;      }        public void setFailedHandler(SettingsRetrievalFailedHandler handler){          this.failedHandler = handler;      }        public void setExceptionHandler(ExceptionHandler handler){          this.exceptionHandler= handler;      }        public void setLoginHandler(LoginHandler handler){          this.loginHandler=handler;      }        public void setUrl(String url){          url = "http://"+url.replaceAll("http(s?)://","");          this.url = url;      }        public String getUrl(){          return this.url;      }        public void setHttpClient(OkHttpClient client)      {          this.httpClient = client;      }        public void setUsername(String username){          this.username = username.trim();      }        public void setPassword(String password){          this.password = password.trim();      }        public String getSessionId()      {          return this.session_id;      }        public String retrieveCSRFTokenFromHtml(String htmlPageUrl) throws IOException {            if(htmlPageUrl==null || htmlPageUrl.trim().equals("")){             return "";          }            Pattern csrfRegex = Pattern.compile("var csrf_token\\s*=\\s*'.+'");          Matcher match     = csrfRegex.matcher(htmlPageUrl);            if(match.find()){              String matched = match.group();              matched=matched.replaceAll("var|csrf_token|'|\\s|=","");              return matched;          }          return "";      }        public String retrieveUrlContents(String url, String csrfToken, String referer) throws Exception      {          url = this.url.replaceAll("/$","")+"/"+url.replaceAll("^/","");          csrfToken=(csrfToken == null)?"":csrfToken;            if(!csrfToken.equals("")){              long unixtime = System.currentTimeMillis() / 1000L;              // AJAX Calls also require to offer the _ with a unix timestamp alongside csrf token              url+="?_="+unixtime+"&csrf_token="+csrfToken;          }          Request.Builder request = new Request.Builder()                  .url(url)                  .header("User-Agent","Mozila/5.0 (X11;Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0")                  .header("Accept","text/html,application/xhtml+html;application/xml;q=0.9,image/webp,*/*;q=0.8")                  .header("Upgrade-Insecure-Requests","1")                  .header("Sec-GPC","1");            String session_id = this.getSessionId();          session_id = session_id==null?"":session_id;            if(!session_id.equals("")){              request.header("Cookie","login_uid="+Math.random()+"; session_id="+session_id);          }            referer = (referer==null)?"":referer;            if(!referer.trim().equals("")){              request.header("Referer",referer);          }            Response response = this.httpClient.newCall(request.build()).execute();            int code = response.code();          if( code != 200){              throw new Exception("The url "+url+" returned code "+code);          }          String responseBody = response.body().string();          return responseBody;      }        public String retrieveUrlContents(String url, String csrfToken) throws Exception      {          return retrieveUrlContents(url,csrfToken,"");      }        public String retrieveUrlContents(String url) throws Exception {         return retrieveUrlContents(url,"");      }        public String retrieveCsrfTokenFromUrl(String url,String referer) throws CsrfTokenNotFound {          try {              String html = retrieveUrlContents(url,"",referer);              return retrieveCSRFTokenFromHtml(html);          } catch (Exception e) {              exceptionHandler.handle(e);              throw new CsrfTokenNotFound(url);          }      }        public boolean login() {            if(                  username == null || username.equals("") ||                  password == null || password.equals("")){              return false;          }            try {              this.session_id = null;              String token = this.retrieveCsrfTokenFromUrl("/login.html",null);                if(token == null){                  return false;              }                if(token.trim().equals("")){                  return false;              }                String challengeJson = this.retrieveUrlContents("/data/login.json");                if(challengeJson == null){                  return false;              }                if(challengeJson.trim().equals("")){                  return false;              }                JSONObject json = (JSONObject) (new JSONArray(challengeJson)).get(0);                String challenge = json.getString("challenge");                if(challenge == null){                  return false;              }                if(challenge.trim().equals("")){                  return false;              }                MessageDigest md = MessageDigest.getInstance("SHA-256");              String stringToDigest = password+challenge;              byte []hash = md.digest(stringToDigest.getBytes(StandardCharsets.UTF_8));                BigInteger number = new BigInteger(1, hash);              StringBuilder hexString = new StringBuilder(number.toString(16));                String loginPwd = hexString.toString();                  RequestBody requestBody = new Builder()                      .add("LoginName", username)                      .add("LoginPWD", loginPwd)                      .add("challenge",challenge)                      .build();                long unixTime = System.currentTimeMillis() / 1000L;              Request request = new Request.Builder()                      .url(this.url+"/data/login.json?_="+unixTime+"&csrfToken="+token)                      .post(requestBody)                      .header("Cookie","login_uid="+Math.random())                      .header("Referer","http://192.158.2.1/login.html")                      .header("X-Requested-With","XMLHttpRequest")                      .header("Content-Type","application/x-www-form-urnencoded; charset=UTF-8")                      .header("User-Agent","Mozila/5.0 (X11;Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0")                      .header("Origin","http://192.168.2.1")                      .build();                Call call = this.httpClient.newCall(request);              Response response = call.execute();                String responseString = response.body().string();              String cookies = response.header("Set-Cookie");              if(cookies == null || cookies.trim().equals("")){                  return false;              }              cookies=cookies.replaceAll("path=/|session_id=|;","");              this.session_id=cookies;              return responseString.equals("1");          } catch (Exception e){              exceptionHandler.handle(e);              return false;          }      }        public H300sVoipSettings retrieveVOIPSettings()  throws Exception {          H300sVoipSettings settings;            String csrfToken = retrieveCsrfTokenFromUrl("/overview.html",this.url+"/login.html");            if(csrfToken == null || csrfToken.trim().equals("")){              throw new SettingsFailedException();          }            String contents = retrieveUrlContents("/data/phone_voip.json",csrfToken,this.url+"/phone.html");            if(contents == null || contents.trim().equals("")){              throw new SettingsFailedException();          }            try{              settings = H300sVoipSettings.createFromJson(contents);          } catch (Exception e){              this.exceptionHandler.handle(e);              throw new SettingsFailedException();          }              return settings;      }        public void retrieveVoipCredentials()      {          try {              boolean loginStatus = login();              loginHandler.loginCallback(loginStatus);              if (loginStatus) {                  H300sVoipSettings settings = retrieveVOIPSettings();                  settingsHandler.retrieveSettings(settings);              }          } catch (SettingsFailedException f){              failedHandler.handler();              exceptionHandler.handle(f);          } catch (Exception e){              exceptionHandler.handle(e);          }      }      }    

That its main purpoce it to perform a sequence of HttpCalls and retrieve the voip credentials of an H300s Sercomm router.

This class is run from the following activity:

package com.example.vodafone_fu_h300s.screens;    import androidx.appcompat.app.AppCompatActivity;    import android.content.Intent;  import android.os.Bundle;  import android.text.Editable;  import android.util.Log;  import android.view.View;  import android.widget.Button;  import android.widget.EditText;  import android.text.TextWatcher;    import com.example.vodafone_fu_h300s.R;  import com.example.vodafone_fu_h300s.logic.H300sVoipSettings;  import com.example.vodafone_fu_h300s.logic.Η300sCredentialsRetriever;    import kotlin.reflect.KFunction;    public class ConnectIntoRouterActivity extends AppCompatActivity implements View.OnClickListener, TextWatcher {        private CredentialsRetriever retriever;        private EditText url;      private EditText admin;      private EditText password;      private Button submit;          private class CredentialsRetriever extends Η300sCredentialsRetriever implements Runnable  {            private ConnectIntoRouterActivity activity;            public CredentialsRetriever(ConnectIntoRouterActivity activity)          {              super();              this.activity = activity;              this.setExceptionHandler((Exception e) -> {                  Log.e("Η300s",ConnectIntoRouterActivity.class+e.getMessage());              });                this.setLoginHandler((boolean loginStatus)->{                  if(!loginStatus){                      Log.e("Η300s",ConnectIntoRouterActivity.class+" Login Failed");                      this.activity.getSubmit().setEnabled(true);                  }              });                this.setSettingsHandler((H300sVoipSettings settings)->{                  this.activity.getSubmit().setEnabled(true);                  Intent displaySettings = new Intent(this.activity, DisplaySettingsActivity.class);                  displaySettings.putExtra("settings",settings);                  startActivity(displaySettings);              });          }            public void run() {              this.retrieveVoipCredentials();          }        }        public Button getSubmit()      {          return this.submit;      }        @Override      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.activity_connect_into_router);            Intent activityIntent = getIntent();            String menu_url = activityIntent.getStringExtra("router_url");            Button submit = (Button)findViewById(R.id.connect_btn);          submit.setOnClickListener(this);          this.submit = submit;            this.retriever = new CredentialsRetriever(this);            this.url = (EditText)findViewById(R.id.menu_url);          url.setText(menu_url);          url.addTextChangedListener(this);            this.admin = (EditText)findViewById(R.id.username);          admin.setText("admin");          admin.addTextChangedListener(this);            this.password = (EditText)findViewById(R.id.password);          password.addTextChangedListener(this);        }        private void onUpdateForm() {          String menu_url = this.url.getText().toString();          String admin = this.admin.getText().toString();          String password = this.password.getText().toString();            if(menu_url.equals("")||admin.equals("")||password.equals("")){              Button submit = (Button)findViewById(R.id.connect_btn);              submit.setEnabled(false);              return;          }            Button submit = (Button)findViewById(R.id.connect_btn);          submit.setEnabled(true);          this.retriever.setUrl(menu_url);          this.retriever.setUsername(admin);          this.retriever.setPassword(password);      }        @Override      public void beforeTextChanged(CharSequence s, int start, int count, int after) {}        @Override      public void onTextChanged(CharSequence s, int start, int before, int count) {}        @Override      public void afterTextChanged(Editable s) {          onUpdateForm();      }        @Override      public void onClick(View v){            Button submit = (Button)findViewById(R.id.connect_btn);          submit.setEnabled(false);            Thread thread = new Thread(this.retriever);          thread.start();      }  }  

But once I press submit on the following form that activity renders:

Form that ConnectIntoRouterActivity renders

I get the following error:

class com.example.vodafone_fu_h300s.screens.ConnectIntoRouterActivityOnly the original thread that created a view hierarchy can touch its views.  

I also tried the following:

package com.example.vodafone_fu_h300s.screens;    import androidx.appcompat.app.AppCompatActivity;    import android.content.Intent;  import android.os.Bundle;  import android.text.Editable;  import android.util.Log;  import android.view.View;  import android.widget.Button;  import android.widget.EditText;  import android.text.TextWatcher;    import com.example.vodafone_fu_h300s.R;  import com.example.vodafone_fu_h300s.logic.H300sVoipSettings;  import com.example.vodafone_fu_h300s.logic.Η300sCredentialsRetriever;    import kotlin.reflect.KFunction;    public class ConnectIntoRouterActivity extends AppCompatActivity implements View.OnClickListener, TextWatcher {        private CredentialsRetriever retriever;        private EditText url;      private EditText admin;      private EditText password;      private Button submit;          private class CredentialsRetriever extends Η300sCredentialsRetriever implements Runnable  {            private ConnectIntoRouterActivity activity;            public CredentialsRetriever(ConnectIntoRouterActivity activity)          {              super();              this.activity = activity;              this.setExceptionHandler((Exception e) -> {                  Log.e("Η300s",ConnectIntoRouterActivity.class+e.getMessage());              });                this.setLoginHandler((boolean loginStatus)->{                  if(!loginStatus){                      Log.e("Η300s",ConnectIntoRouterActivity.class+" Login Failed");                      this.activity.getSubmit().setEnabled(true);                  }              });                this.setSettingsHandler((H300sVoipSettings settings)->{                  this.activity.getSubmit().setEnabled(true);                  Intent displaySettings = new Intent(this.activity, DisplaySettingsActivity.class);                  displaySettings.putExtra("settings",settings);                  startActivity(displaySettings);              });          }            public void run() {              this.retrieveVoipCredentials();          }        }        public Button getSubmit()      {          return this.submit;      }        @Override      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.activity_connect_into_router);            Intent activityIntent = getIntent();            String menu_url = activityIntent.getStringExtra("router_url");            Button submit = (Button)findViewById(R.id.connect_btn);          submit.setOnClickListener(this);          this.submit = submit;            this.retriever = new CredentialsRetriever(this);            this.url = (EditText)findViewById(R.id.menu_url);          url.setText(menu_url);          url.addTextChangedListener(this);            this.admin = (EditText)findViewById(R.id.username);          admin.setText("admin");          admin.addTextChangedListener(this);            this.password = (EditText)findViewById(R.id.password);          password.addTextChangedListener(this);        }        private void onUpdateForm() {          String menu_url = this.url.getText().toString();          String admin = this.admin.getText().toString();          String password = this.password.getText().toString();            if(menu_url.equals("")||admin.equals("")||password.equals("")){              Button submit = (Button)findViewById(R.id.connect_btn);              submit.setEnabled(false);              return;          }            Button submit = (Button)findViewById(R.id.connect_btn);          submit.setEnabled(true);          this.retriever.setUrl(menu_url);          this.retriever.setUsername(admin);          this.retriever.setPassword(password);      }        @Override      public void beforeTextChanged(CharSequence s, int start, int count, int after) {}        @Override      public void onTextChanged(CharSequence s, int start, int before, int count) {}        @Override      public void afterTextChanged(Editable s) {          onUpdateForm();      }        @Override      public void onClick(View v){            Button submit = (Button)findViewById(R.id.connect_btn);          submit.setEnabled(false);            runOnUiThread(this.retriever);      }  }  

But I get the following error:

E/Η300s: class com.example.vodafone_fu_h300s.screens.ConnectIntoRouterActivityOnly the original thread that created a view hierarchy can touch its views.

So how I can run an thread and provide Callbacks for any event such as In case that an error occurs of an Event for example a sucessfull credentials retrieval?

Is it possible to upload folder with Paramiko?

Posted: 18 Apr 2021 08:20 AM PDT

I'm trying to upload a folder from my local pc to my synology NAS with SSH and Paramiko. It's working perfectly for files, but not for folders.

Here is my code :

# imports  import paramiko  import os  # connection variables  ip_address = "xxx.xxx.xxxx.xxx"  username = "xxxxxxxx"  password = "xxxxxx"  local_user = os.getenv("USERNAME") # session Windows variable  remote_path = f"/homes/lmeyer/{local_user}" # absolute remote path  print(remote_path)  local_path = "d:" # absolute local path  print(local_path)  # SSH connection  ssh_client = paramiko.SSHClient()  ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())  ssh_client.connect(hostname=ip_address,username=username,password=password)  print("Connection OK >", ip_address)  # SFTP connection  sftp = ssh_client.open_sftp()  # folder creation with the Windows session variable  sftp.mkdir(remote_path)  # folder upload on the server  sftp.put(f"{local_path}/images",f"{remote_path}/imgs")  sftp.close()  ssh_client.close()  

If I try to upload toto.txt with :

sftp.put(f"{local_path}/toto.txt",f"{remote_path}/toto2.txt")  

it works perfectly. But if I try to do it as expected in my code, it give me a permission error :

Traceback (most recent call last):      File "D:\Programmation\Python\RecupData\RecupData.py", line 23, in <module>  sftp.put(f"{local_path}/images",f"{remote_path}/imgs")  File "C:\Users\Louis\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\sftp_client.py", line 758, in put  with open(localpath, "rb") as fl:  PermissionError: [Errno 13] Permission denied: 'd:/images'  

Is there a fix to get folders uploading ? Thanks a lot

Missing required parameters for [Route: Kategori.destroy] [URI: Model/Kategori/{Kategori}]

Posted: 18 Apr 2021 08:20 AM PDT

I use the resource route all sections are successful only on route Category.destroy this is not successful. after I overcome the white screen appears

My sh script always run after entrypoint DOCKERFILE

Posted: 18 Apr 2021 08:22 AM PDT

I tried to set up a wordpress solution (installing by myself and not using an official image). I have one container with apache, php and mariadb-client (to interrogate mariadb-server from another container)

I have another container with mariadb on it.

I use wp-cli to configure wordpress website but when i build my docker image, I can't execute the command (inside sh file) which is

wp core config --allow-root --dbname=$MYSQL_DATABASE --dbuser=$MYSQL_USER --dbpass=$MYSQL_PASSWORD --dbhost=172.20.0.2 --dbprefix=wp --path=/var/www/html/wordpress  

because my mariadb container isn't up.

So I tried to run this script with entrypoint parameters and when I do my docker-compose up, my script is played and I have the message:

apache-php_SDV | Success: Generated 'wp-config.php' file.    apache-php_SDV | Error: The 'wp-config.php' file already exists.  

My script is played every second, I tried to use CMD before and it doesn't work, it's like CMD wasn't run

I have the same result if I want to put CMD after ENTRYPOINT, I can run my script only when both containers are up.

I also tried to use command on my docker-compose.yml but not helpful. Does anyone have a solution?

Laravel Error - Controller not found, but it is there

Posted: 18 Apr 2021 08:21 AM PDT

I kept getting this error

enter image description here

As you guys can see I have that file in my project.

enter image description here

I also tried restarting my local MAMP server and clear the cache

php artisan view:clear  php artisan route:clear  php artisan cache:clear  php artisan config:clear  

I also did

⚡️  mybabies  composer dumpauto                                                                                          Generating optimized autoload files                                                                                     > Illuminate\Foundation\ComposerScripts::postAutoloadDump                                                               > @php artisan package:discover --ansi                                                                                  Discovered Package: facade/ignition                                                                                     Discovered Package: fideloper/proxy                                                                                     Discovered Package: fruitcake/laravel-cors                                                                              Discovered Package: laravel/sail                                                                                        Discovered Package: laravel/tinker                                                                                      Discovered Package: nesbot/carbon                                                                                       Discovered Package: nunomaduro/collision                                                                                Package manifest generated successfully.                                                                                Generated optimized autoload files containing 4683 classes   

Please let me know what else I can do.


route

Route::get('/', function(){ return Redirect::to('/baby/signin'); }); Route::get('/baby/signin','BabyAccountController@signin');

firebase - Log in again after the user has registered for the first time

Posted: 18 Apr 2021 08:21 AM PDT

Hi everyone I have such a problem, After a user signs up for my site, for the first time, I want to log in with the user one more time.

I want that after he registers, connect again.

I tried to do it asynchronously, but it does not always work, sometimes I try to log in before the user is registers, I do not know why it does not work.

I want there to be a login only after registration, to force it.

  handleSubmit = async () => {            const newUserData = {        email: 'test@mail.com',        password: '123456',        confirmPassword: '123456',        handle: 'test'      };        await signupUser(newUserData);      await signinChat(newUserData);    }

export const signupUser = (newUserData) => (dispatch) => {    axios      .post('/signup', newUserData)      .then((res) => {        console.log(res);      })      .catch((err) => {        console.log(err);      });  };        //basically call to this function to signup    exports.signup = (req, res) => {    const newUser = {      email: req.body.email,      password: req.body.password,      confirmPassword: req.body.confirmPassword,      handle: req.body.handle,    };      db.doc(`/users/${newUser.handle}`)      .get()      .then((doc) => {        if (doc.exists) {          return res.status(400).json({ handle: "this handle is already taken" });        } else {          return firebase            .auth()            .createUserWithEmailAndPassword(newUser.email, newUser.password);        }      })      .then((data) => {        userId = data.user.uid;        return data.user.getIdToken();      })      .then((idToken) => {        token = idToken;        const userCredentials = {          handle: newUser.handle,          email: newUser.email,        };        const userPreferences = {          handle: newUser.handle        };          return db.doc(`/users/${newUser.handle}`).set(userCredentials);      })      .then(() => {        return res.status(201).json({ token });      })      .catch((err) => {        console.error(err);        if (err.code === "auth/email-already-in-use") {          return res.status(400).json({ email: "Email is already is use" });        } else {          return res            .status(500)            .json({ general: "Something went wrong, please try again" });        }      });  };

export const signinChat = (user) => {      return async (dispatch) => {          const db = firebase.firestore();          firebase.auth()              .signInWithEmailAndPassword(user.email, user.password)              .then(data => {                  console.log(data);                  const currentUser = firebase.auth().currentUser;                  const name = `${user.handle}`;                  currentUser.updateProfile({                      displayName: name,                  })                      .then(() => {                          db.collection('users')                              .doc(data.user.displayName)                              .update({                                  isOnline: true,                              })                              .then(() => {                                  const loggedInUser = {                                      handle: user.handle,                                      uid: data.user.uid,                                      email: user.email                                  }                                  localStorage.setItem('user', JSON.stringify(loggedInUser));                                  console.log('User logged in successfully...!');                              })                              .catch(error => {                                  console.log(error);                              });                      });              })              .catch(error => {                  console.log(error);              })      }  }

R package "feather" give me error "Error in check_dots_empty(action = signal) : unused argument (action = signal)"

Posted: 18 Apr 2021 08:23 AM PDT

I start getting a very strange error from the "feather" package in R:

Let say I write and read file

write_feather(mtcars, 'm')  read_feather('m')  

The last one gives me

Error in check_dots_empty(action = signal) :     unused argument (action = signal)  

I reinstalled the package, restarted sessions, and still have no idea how to fix it. R version 3.6.1 (2019-07-05)

Please, help me

Why does an IF condition with no statements inside removes the border of an element?

Posted: 18 Apr 2021 08:22 AM PDT

I can't tell if this is a bug or not.

function moncheck() {         if($(".mon").attr("style", "border")) {               }        $(this).attr("style", "border: 1px solid red")    }      $(".mon").on("click", moncheck)
.mon {       width:100px;      margin: 5px;  }    .mon:hover {       border: 1px solid;      cursor: pointer;  }
      <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>        <link rel="stylesheet" href="jquery-ui-1.12.1.custom/jquery-ui.min.css">      <script src="jquery-ui-1.12.1.custom/external/jquery/jquery.js"></script>      <script src="jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>            <div id="monlist">                           <img src="https://cloudinary-a.akamaihd.net/ufn/image/upload/u7cdzxvxu69pmubmtltc.jpg" class="mon">              <img src="https://fyf.tac-cdn.net/images/products/large/F-898.jpg" class="mon">              <img src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/close-up-of-tulips-blooming-in-field-royalty-free-image-1584131616.jpg?crop=0.630xw:1.00xh;0.186xw,0&resize=640:*" class="mon">                       </div>

As you can see, the if condition has no statements, and you click on an image, it gets a red border, then when you click on another image, what is expected to happen is for that second image to also get a red border, and now both images should have a red border, since at no point was the border of the first image removed. Yet, it does get removed because of the if condition. If you go ahead and comment out the if condition, you will see that the border remains on all images as you click. Why?

Example:

function moncheck() {       imgurl = this.src;        //if($(".mon").attr("style", "border")) {               //}        $(this).attr("style", "border: 1px solid red")    }      $(".mon").on("click", moncheck)        
.mon {       width:100px;      margin: 5px;  }    .mon:hover {       border: 1px solid;      cursor: pointer;  }
  <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>        <link rel="stylesheet" href="jquery-ui-1.12.1.custom/jquery-ui.min.css">      <script src="jquery-ui-1.12.1.custom/external/jquery/jquery.js"></script>      <script src="jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>                <div id="monlist">                           <img src="https://cloudinary-a.akamaihd.net/ufn/image/upload/u7cdzxvxu69pmubmtltc.jpg" class="mon">              <img src="https://fyf.tac-cdn.net/images/products/large/F-898.jpg" class="mon">              <img src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/close-up-of-tulips-blooming-in-field-royalty-free-image-1584131616.jpg?crop=0.630xw:1.00xh;0.186xw,0&resize=640:*" class="mon">                       </div>

This does not happen if I use css, instead of attr.

 if($(".mon").css("border")) {               }  

This will result in each img retaining the border. Why?

And another behavior I can't explain is the removal of the hover effect when I remove the border on click.

function moncheck() {         if($(".mon").css("border")) {           $(".mon").css("border", "none")      }        $(this).css("border", "1px solid red")  }      $(".mon").on("click", moncheck)
.mon {       width:100px;      margin: 5px;  }    .mon:hover {       border: 1px solid;      cursor: pointer;  }
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>        <link rel="stylesheet" href="jquery-ui-1.12.1.custom/jquery-ui.min.css">      <script src="jquery-ui-1.12.1.custom/external/jquery/jquery.js"></script>      <script src="jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>            <div id="monlist">                           <img src="https://cloudinary-a.akamaihd.net/ufn/image/upload/u7cdzxvxu69pmubmtltc.jpg" class="mon">              <img src="https://fyf.tac-cdn.net/images/products/large/F-898.jpg" class="mon">              <img src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/close-up-of-tulips-blooming-in-field-royalty-free-image-1584131616.jpg?crop=0.630xw:1.00xh;0.186xw,0&resize=640:*" class="mon">                       </div>

As you can see, when I use css to remove the border, the hover effect is removed as well. Why? The hover should not be removed.

Tailwind css height issue

Posted: 18 Apr 2021 08:21 AM PDT

When I navigate to Shop route, this screen has created a white space at the top of the page.

<div className="h-screen bg-black text-white flex flex-col text-center justify-center items-center uppercase ">      <div className="text-2xl md:text-3xl lg:text-4xl font-bold mb-3">          shop coming soon      </div>      <Link          to="/"          className="whitespace-nowrap text-base border-solid border-white border-b-2"      >          go back to home page      </Link>  </div>  

Can anyone tell me how to resolve and explain why?

enter image description here

2d Fourier Transforms: FFT vs Fourier Optics

Posted: 18 Apr 2021 08:21 AM PDT

I am trying to use programming to increase my understanding of Fourier optics. I know that physically and mathematically the Fourier transform of a Fourier transform is inverted -> F{F{f(x)} = f(-x). I am having two problems 1) The second transform doesn't return anything like the original function except in the simple gaussian case (which makes it even more confusing), and 2) there seems to be some scaling factor that requires me to "zoom in" and distort the transformed image to a point that it is much less helpful (as illustrated below).

figs

#%% Playing with 2d Fouier Transform    import numpy as np  from scipy import fftpack  import matplotlib.pyplot as plt  import LightPipes    wavelength = 792*nm  size = 15*mm  N = 600  w0=3*mm    # Fields  sq = np.zeros([100,100])  sq[25:75, 25:75] = 1  F=Begin(size,wavelength,N)  I0 = Intensity(0,GaussBeam(F, w0, LG=True, n=0, m=0))  I1 = Intensity(0,GaussBeam(F, w0, LG=False, n=0, m=1))+Intensity(0,GaussBeam(F, w0, LG=False, n=1, m=0))    # Plot transforms  f = sq  F = np.fft.fftshift(fftpack.fft2(f))  F_F = np.fft.fftshift(fftpack.fft2(np.abs(F)))    plt.subplot(331), plt.imshow(f)  plt.title(r'f'), plt.xticks([]), plt.yticks([])  plt.subplot(332), plt.imshow(np.abs(F))  plt.title(r'F\{f\}'), plt.xticks([]), plt.yticks([])  plt.subplot(333), plt.imshow(np.abs(F_F))  plt.title('F\{F\{f\}\}'), plt.xticks([]), plt.yticks([])    f = I0  F = np.fft.fftshift(fftpack.fft2(f))  F_F = np.fft.fftshift(fftpack.fft2(np.abs(F)))    plt.subplot(334), plt.imshow(f)  plt.title(r'f'), plt.xticks([]), plt.yticks([])  plt.subplot(335), plt.imshow(np.abs(F))  plt.title(r'F\{f\}'), plt.xticks([]), plt.yticks([])  plt.subplot(336), plt.imshow(np.abs(F_F))  plt.title('F\{F\{f\}\}'), plt.xticks([]), plt.yticks([])    f = I1  F = np.fft.fftshift(fftpack.fft2(f))  F_F = np.fft.fftshift(fftpack.fft2(np.abs(F)))    plt.subplot(337), plt.imshow(f)  plt.title(r'f'), plt.xticks([]), plt.yticks([])  plt.subplot(338), plt.imshow(np.abs(F))  plt.title(r'F\{f\}'), plt.xticks([]), plt.yticks([])  plt.subplot(339), plt.imshow(np.abs(F_F))  plt.title('F\{F\{f\}\}'), plt.xticks([]), plt.yticks([])    plt.tight_layout()  plt.show()  

SCRAPY PAGINATION: Infinite Scrolling Pagination

Posted: 18 Apr 2021 08:20 AM PDT

I'm trying to fetch the data from the website. I have managed to scrape the data from the first page of the website.

But for the next page website loads data using AJAX, for that, I set headers but couldn't able to get the data from the next page.

If we send requests to the website without headers the same data we get. So maybe I didn't set headers in the right way to move to the next page. I used CRUL for headers.

Where I did wrong?

enter image description here

class MenSpider(scrapy.Spider):      name = "MenCrawler"      allowed_domains = ['monark.com.pk']        #define headers and 'custom_constraint' as page      headers = {                  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36',          'accept-language': 'en-PK,en-US;q=0.9,en;q=0.8',          'key':'274246071',          'custom_constraint':'custom-filter page=1',          'view' : 'ajax',          '_':'1618681277011'      }         #send request      def start_requests(self):          yield scrapy.Request(              url = 'https://monark.com.pk/collections/t-shirts',              method = 'GET',                     headers=self.headers,              callback=self.update_headers          )                  #response      def update_headers(self,response):            #extract all the 12 URLS from the page                     urls = response.xpath('//h4[@class="h6 m-0 ff-main"]/a/@href').getall()          for url in urls:                 yield response.follow(url=url, callback=self.parse)            #extract the infinite text as 'LOADING'          load = response.xpath('//div[@class="pagination"]//span/text()').get()            #Use if Condition for pagination          if load == 'LOADING':              page = 1                #define page no as key form dictionary                         key = self.headers['custom_constraint']                   current_page = key.split('=')[-1]              next_pag = page+int(current_page)              filters = 'custom-filter page='+str(next_pag)                              self.headers['custom_constraint'] = filters                        #request againg to page for next page BUT THIS IS NOT WORKING FOR ME              yield scrapy.Request(              url = 'https://monark.com.pk/collections/t-shirts',              method = 'GET',                      headers=self.headers,              callback=self.update_headers                          )        def parse(self, response):          ........  

PHP - feedback form not working on the site [closed]

Posted: 18 Apr 2021 08:20 AM PDT

I have a feedback form on my site which isn't working in the sense that I can fill it out and it seems to be connecting to the DB but the info doesn't go through the DB, I'm not sure where I'm going wrong.
Below is the DB connections using PHP

   <div>         <?php                      require_once('config.php');                echo isset($_POST['create']);                  if(isset($_POST['create'])){                                             $qone    = $_PSOT['qone'];           $qtwo    = $_PSOT['qtwo'];           $qthree  = $_PSOT['qthree'];           $qfour   = $_PSOT['qfour'];           $message        = $_POST['message'];                                        $sql = "INSERT INTO feedbackform (qone , qtwo , qthree , qfour , message) VALUES (?,?,?,?,?)";                     $stmtinsert = $db->prepare($sql);                  $names=array( $qone , $qtwo , $qthree , $qfour , $message);        $result = $stmtinsert->execute($names);                   if ($result){                      echo 'successfully saved';                        }else {                           echo 'there were errors';        }                                        //echo   $qone , " " , $qtwo , " " , $qthree , " " , $qfour , " " ,  $message ;                    }        ?>      </div>                               

Ruby: bracket notation for immediate call of returned procedure

Posted: 18 Apr 2021 08:21 AM PDT

In Ruby, when I'm doing an immediate callback of a returned Proc, I normally use #call:

def multiplier(factor)    Proc.new { |number| factor * number }  end    puts multiplier(10).call(5) # 50  

But I've just run across this bracket shorthand, which has the same result as far as I can see:

def multiplier(factor)    Proc.new { |number| factor * number }  end    puts multiplier(10)[5] # 50  

This strikes me as very similar to JavaScript's immediate call of a returned function:

const multiplier = (factor) => (number) => factor * number;    console.log(multiplier(10)(5)); // 50  

But I've never seen the syntax before, and I can't seem to find it documented anywhere. Is this just syntax sugar for using #call, or is there more to it? And I can't seem to find any doc on it. Is there some somewhere?

How To Crop An Image Following Its Outline Border With Python

Posted: 18 Apr 2021 08:21 AM PDT

I basically have thousands of images of characters with black outlines, all of these images either have a white background or some graphic background, usually just a wood texture behind.

What I want is to create a function (opencv/pil/whatever) that will allow me to just autocrop these images, basically remove everything outside the character's outline.

Here's an example

On The left is the original, uncropped image, on the right is the cropped image. Is this even possible?

Spring Webflux Webclient Blocks on SSL Connection

Posted: 18 Apr 2021 08:22 AM PDT

Blockhound detected a blocking call in WebClient for an SSL connection, specifically at java.io.FileInputStream.readBytes(FileInputStream.java) where, I believed, it read the trust store for CA certificates. Does WebClient have an alternative/fix to this? Or, this is not an issue? Thanks

I am using Adopt JDK 1.8.0-275 and Spring Boot 2.3.2.RELEASE

Update 1

I tried the suggestion in https://github.com/reactor/reactor-netty/issues/1550,

WebClient.builder().clientConnector(new ReactorClientHttpConnector(HttpClient.create().compress(true).secure())).build();  

but it didn't work as expected. I didn't the other suggestion to use SslContext instead of SslContextBuilder because I don't know how to do it.

Pyinstaller gives Fatal error failed to execute script bot

Posted: 18 Apr 2021 08:21 AM PDT

Fatal error

The program works fine as a Python script (.py file) but doesn't work when I convert it to a Windows Executable file (.exe file) using Pyinstaller. Pyinstaller keeps giving me the error: Fatal error detected. Failed to execute script bot. I looked at some other posts but they didn't help me.

Note: I did pyinstaller -w -F --onefile bot.py.

How to devise this solution to Non-Constructible Change challenge from Algoexpert.io

Posted: 18 Apr 2021 08:22 AM PDT

I'm working through algoexpert.io coding challenges and I'm having trouble undersatnding the suggested solution to one of the questions titled Non-Constructible Change

Here's the challenge question:

Given an array of positive integers representing the values of coins in your possession, write a function that returns the minimum amount of change (the minimum sum of money) that you cannot create. The given coins can have any positive integer value and aren't necessarily unique (i.e., you can have multiple coins of the same value).

For example, if you're given coins = [1, 2, 5], the minimum amount of change that you can't create is 4. If you're given no coins, the minimum amount of change that you can't create is 1.

// O(nlogn) time, O(n) size.  function nonConstructibleChange(coins) {    coins = coins.sort((a, b) => a - b); // O(nlogn) time operation    let change = 0;      for (coin of coins) {      if (coin > change + 1) return change + 1;      change += coin;    }      return change + 1;  }  

My problem

I am not completely sure how did the author of the solution come up with the intuition that

if the current coin is greater than `change + 1`, the smallest impossible change is equal to `change + 1`.  

I can see how it tracks, and indeed the algorithm passes all tests, but I'd like to know more about a process I could use to devise this rule.

Thank you for taking the time to read the question!

Typescript - flat a JSON model using Class-transformer

Posted: 18 Apr 2021 08:20 AM PDT

I am trying to use the class transformer in typescript (node.js): https://github.com/typestack/class-transformer

I would like to flat a JSON using only 1 model , 1 Dto that will go to the DB

if I have the following json :

{   "data":{"test":"123"}   "name":"x"  }  

the DB service should receive the following object:

 {     "test":"123",     "name":"x"   }  

This what I tried to define but it's not working :

@Expose()  export class Dto{    name:string,    @Expose({name: "data.test"})    test: string  }  

the result on the test field is undefined how can I achieve that? I don't want to create a "mediator" model

How to set null for DateTimePicker

Posted: 18 Apr 2021 08:21 AM PDT

I'm using DateTimePicker(@react-native-community/datetimepicker).

How to set null as default value for DateTimePicker?

Because in the first time , value of DateTimePicker should be null. When I set it to null ,get the following error :

Invariant Violation: A date or time should be specified as 'value'.

 <DateTimePicker       testID="dateTimePicker"       timeZoneOffsetInMinutes={0}       value={null}       mode='date'       is24Hour={true}       display="default"       onChange={onChange}    />  

Edward Lance Lorilla

Posted: 18 Apr 2021 04:51 AM PDT

Edward Lance Lorilla


【VUEJS】video playback speed

Posted: 18 Apr 2021 02:53 AM PDT

<div id="wrapper">
<video width="765" height="430" controls class="flex">
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
Your browser does not support HTML video.
</video>
<div class="speed">
<div class="speed-bar">1x</div>
</div>
</div>
view raw index.html hosted with ❤ by GitHub
//1. Get the dom structure to be operated
//2. Get the distance of the mouse sliding on the dom
//3. Change the height of the dom
//4. Change the playback speed of the video
//Get the corresponding dom structure
var speed=document.querySelector('.speed')//Supplement: getElementsByClassName is to get the class selector
var bar=document.querySelector('.speed-bar')
var video=document.querySelector('.flex')
speed.addEventListener('mousemove',function(e){ //In simple terms, it points to the current event (click, mouseover, etc.), and saves the current event information. For example, mouse click events, there is mouse coordinate information .
//console.log(e);
var y=e.pageY-speed.offsetTop //The distance of the mouse in the right container offsetTop is the distance from a certain dom structure to the top of the browser
var percent = y / speed.offsetHeight //offsetHeight is to get the height of a certain dom structure itself
var min = 0.4 //Set the speed limit
var max = 4
var playbackRate = percent * (max-min)+min //Double speed calculation
var height = Math.round(percent * 100)+'%'//Math.abs() also takes the absolute value
bar.textContent = playbackRate.toFixed(2)+'' //Change the text content in the dom toFixed(x) Keep x decimal places
video.playbackRate = playbackRate //Adjust the video playback speed
bar.style.height = height //Adjust the display height of the multiple text
})
//Note: The functions of the two parameters of the function are: monitor mouse click events. Define the function in the function and become the callback function.
view raw script.js hosted with ❤ by GitHub
*{
margin: 0;
padding: 0;
}
body{
min-height: 100vh;/* vh relative unit, relative to the browser size change*/
background: #4c4c4c url('https://unsplash.it/1500/900?image=1021');
background-size: cover;/*Taking the container as the reference, cover the container to the full, even if the picture is distorted or blurred*/
/*margin: auto;/* margin:auto and margin:0 auto but don’t know the width and height of the parent container, which is not suitable*/
display: flex;/*Set the container as a flexible container*/
justify-content: center; /*center in the X direction*/
align-items: center; /*Center in the Y direction*/ /*Extracurricular expansion: all the ways to center the box in the vertical direction*/
}
#wrapper{
width: 850px;
display: flex;
}
.speed{
flex: 1;/*Proportional inheritance, originally it should be 1:1 inheritance, but vedio has a fixed width, so speed takes the remaining width*/
margin: 10px;
background-color: #fff;
border-radius: 50px;
display: flex;
overflow: hidden;/*Play: stipulate that the child container cannot exceed, can maintain the parent class rounded corner effect*/
align-items: flex-start;/* */
}
.speed-bar{
width: 100%;
height: 16.3%;
background:linear-gradient(-170deg,#2376ae 0%,#c16ecf 100%); /*Set gradient color style*/
display: flex; /*Make the container set the next two styles*/
justify-content: center;
align-items: center;
color: #fff;
cursor: pointer;
}
view raw style.css hosted with ❤ by GitHub

【GAMEMAKER】 items that can be picked up and inventory

Posted: 17 Apr 2021 09:14 AM PDT

 Information about object: obj_inventory

Sprite:
Solid: false
Visible: true
Depth: -1000
Persistent: true
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

///Set Up
global.showInv=true; //Display the inventory?

global.maxItems=4;//total item slots

for (var i = 0; i < 12; i += 1)
{
global.inventory[i] = -1;
button[i] = instance_create(0,0,obj_invbutton)
button[i].slot = i;
}

global.mouseItem=-1;
instance_create(0,0,obj_mouseitem);


Step Event:
execute code:

///Visible switch
if keyboard_check_pressed(ord('V'))
{
global.showInv=!global.showInv;
}
Draw Event:
execute code:

///draw the inventory
if (global.showInv)
{
var x1,x2,y1,y2;
x1 = view_xview[0]+75;
x2 = x1 + view_wview[0];
y1 = view_yview[0]+30;
y2 = y1 + 64;

draw_set_color(c_black);
draw_set_alpha(0.8);
draw_sprite(spr_inv_bg,0,x1-50,y1+15);

for (var i = 0; i < global.maxItems; i += 1)
{
var ix = x1+24+(i * 40);
var iy = y2-24;

draw_sprite(spr_border,0,ix,iy)
button[i].x = ix;
button[i].y = iy;
}
draw_text(x1+100,y1+100,"V to show / hide - Click and Drag Items With Mouse##P to Pick Up##Pick Up Bag For Extra Room To Store Items");
}

Information about object: obj_mouseitem
Sprite:
Solid: false
Visible: true
Depth:
-1002
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Draw Event:
execute code:

if (global.showInv)
{
var item = global.mouseItem;
if (item != -1)
{
x = mouse_x;
y = mouse_y;
draw_sprite(spr_items,item,x,y);
}
}

Information about object: obj_invbutton
Sprite:
Solid: false
Visible: true
Depth:
-1001
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Draw Event:
execute code:

if (global.showInv)
{
var item = global.inventory[slot];
var click = mouse_check_button_pressed(mb_left);

if (abs(mouse_x - x) < 16) && (abs(mouse_y - y) < 16)
{
draw_set_colour(c_white);
draw_rectangle(x-16,y-16,x+16,y+16,0);
if (click)
{
if (item != -1)
{
scr_itemdrop_slot(slot);
}
if (global.mouseItem != -1)
{
scr_itempickup_slot(global.mouseItem,slot)
}
global.mouseItem = item;
}
}

if (item != -1)
{
draw_sprite(spr_items,item,x,y);
}
}
Information about object: obj_player
Sprite: spr_idle_down
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

///set up
enum state {
idle,
up,
down,
left,
right
}

dir=state.down;
is_moving=false;
image_speed=0.5;

Step Event:
execute code:

///keypress code
if (keyboard_check(vk_left))
{
dir=state.left;
is_moving=true;
}
else
if (keyboard_check(vk_right))
{
dir=state.right;
is_moving=true;
}
else
if (keyboard_check(vk_up))
{
dir=state.up;
is_moving=true;
}
else
if (keyboard_check(vk_down))
{
dir=state.down;
is_moving=true;
}
else
{
dir=dir;
is_moving=false;
}

execute code:

///movement
if is_moving
{
switch (dir)
{
case state.up:
y -= 4;
break;

case state.down:
y += 4;
break;

case state.left:
x -= 4;
break;

case state.right:
x += 4;
break;
}
}



execute code:

///animation
if is_moving
{
switch (dir)
{
case state.up:
sprite_index=spr_walk_up;
break;

case state.down:
sprite_index=spr_walk_down;
break;

case state.left:
sprite_index=spr_walk_left;
break;

case state.right:
sprite_index=spr_walk_right;
break;
}
}
if !is_moving
{
switch (dir)
{
case state.up:
sprite_index=spr_idle_up;
break;

case state.down:
sprite_index=spr_idle_down;
break;

case state.left:
sprite_index=spr_idle_left;
break;

case state.right:
sprite_index=spr_idle_right;
break;
}
}

Information about object: obj_pickup
Sprite: spr_pickup
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

///set up
my_id=irandom_range(1,4);
image_speed=0;
image_index=my_id;

Collision Event with object obj_player:
execute code:

///Detect Keypress & Check For Empty Slot
if keyboard_check_pressed(ord('P')) && scr_itempickup(my_id)//if slot available, add to slot
{
instance_destroy();//then destroy instance]
}

Information about object: obj_bag
Sprite: spr_bag
Solid: false
Visible: true
Depth: 0
Persistent:
false
Parent:
Children:
Mask:

No Physics Object

Collision Event with object obj_player:
execute code:

///Detect Keypress
if keyboard_check_pressed(ord('P'))
{
global.maxItems+=4;// add four inventory slots
instance_destroy();
}



【PYTHON OPENCV】dlib library to calculate the 128D descriptor to be used for face

Posted: 17 Apr 2021 09:05 AM PDT

 """

This script makes used of dlib library to calculate the 128-dimensional (128D) descriptor to be used for face recognition. Face recognition model can be downloaded from: https://github.com/davisking/dlib-models/blob/master/dlib_face_recognition_resnet_model_v1.dat.bz2 """ # Import required packages:import cv2import dlibimport numpy as np # Load shape predictor, face enconder and face detector using dlib library:pose_predictor_5_point = dlib.shape_predictor("shape_predictor_5_face_landmarks.dat")face_encoder = dlib.face_recognition_model_v1("dlib_face_recognition_resnet_model_v1.dat")detector = dlib.get_frontal_face_detector() def face_encodings(face_image, number_of_times_to_upsample=1, num_jitters=1): """Returns the 128D descriptor for each face in the image""" # Detect faces: face_locations = detector(face_image, number_of_times_to_upsample) # Detected landmarks: raw_landmarks = [pose_predictor_5_point(face_image, face_location) for face_location in face_locations] # Calculate the face encoding for every detected face using the detected landmarks for each one: return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks] # Load image:image = cv2.imread("jared_1.jpg") # Convert image from BGR (OpenCV format) to RGB (dlib format):rgb = image[:, :, ::-1] # Calculate the encodings for every face of the image:encodings = face_encodings(rgb) # Show the first encoding:print(encodings[0])

【VISUAL VB.NET】Download file via HTTP

Posted: 17 Apr 2021 08:58 AM PDT

 Imports System

Imports System.Collections.GenericImports System.ComponentModelImports System.DataImports System.DrawingImports System.LinqImports System.TextImports System.Threading.TasksImports System.Windows.Forms' make sure that using System.Diagnostics; is included Imports System.Diagnostics' make sure that using System.Security.Principal; is included Imports System.Security.Principal ' make sure that using System.Net; is included Imports System.Net Public Class Form1Public Sub New() MyBase.New InitializeComponent End Sub Private webClient As New WebClient() Private Sub webClient_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Dim bytesIn As Double = Double.Parse(e.BytesReceived.ToString()) Dim totalBytes As Double = Double.Parse(e.TotalBytesToReceive.ToString()) Dim percentage As Double = bytesIn / totalBytes * 100 progressBar1.Value = Integer.Parse(Math.Truncate(percentage).ToString()) End Sub Private Sub webclient_DownloadFileCompleted(sender As Object, e As AsyncCompletedEventArgs) MessageBox.Show("Saved as C:\MYRAR.EXE", "Httpdownload") End Sub#Region "basic function for app" Private Sub lblLink_Click_1(sender As Object, e As EventArgs) Handles lblLink.Click Process.Start("www.vclexamples.com") End Sub Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean If (keyData = Keys.Escape) Then Me.Close() Return True End If Return MyBase.ProcessCmdKey(msg, keyData) End Function#End Region Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click AddHandler WebClient.DownloadProgressChanged, New DownloadProgressChangedEventHandler(AddressOf webClient_DownloadProgressChanged) AddHandler WebClient.DownloadFileCompleted, New AsyncCompletedEventHandler(AddressOf webclient_DownloadFileCompleted) ' start download WebClient.DownloadFileAsync(New Uri(textBox1.Text), "C:\\MYRAR.EXE") End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End SubEnd Class

Recent Questions - Arqade

Posted: 18 Apr 2021 04:50 AM PDT

Recent Questions - Arqade


How do I disable weapon switching using the right stick in Borderlands 2 VR

Posted: 18 Apr 2021 03:40 AM PDT

Borderlands 2 VR has a very irritating setup where if you set your right stick to free turn (as you almost certainly want to for seated play) it does not remove the bindings to allow weapon selection using the right stick. This is super inconvenient as generally you don't want to change weapons when you turn. There is a sort of workaround of only equipping two weapon slots, but generally speaking, it's useful to be able to equip all four weapons.

Is there any way to disable weapon swapping using the rick stick, and just have the B button cycle weapons? There doesn't seem to be a UI option to do this, but maybe it's achievable by editing config files?

Restore saved worlds from PS4 Minecraft to new copy of the game

Posted: 18 Apr 2021 04:29 AM PDT

Our old Minecraft disk is scratched and hardly readable (needs toothpaste treatment on every insert) so we bought a new disk, thinking we could switch to that without problem. But the console (PS5, but the games are PS4 version) treats them as two separate applications.

The problem is that the old worlds are only visible when playing from the old disk, and it treats the new disk as a completely different save folder - nothing visible there.

How can I move the old worlds to the new copy of the game?

I tried backing up to a USB from old and new, and I can see that the saved worlds from each version are in two separate folders, CUSA00744 and CUSA00265. I tried to move the old worlds to the new folder, but if I do that it complains that the save data is corrupt.

Just to be clear: both the old worlds and the new worlds are in Bedrock format, so that is not the issue.

How do I complete all the side-ops in metal-gear solid

Posted: 18 Apr 2021 02:01 AM PDT

I just completed all the side-ops in MGSV. As discussed in this post some side-ops are light up again after you complete them so you can always do a side-op again even after completing all of them. However there is a challenge task, "complete all side-ops" that I would like to check off. But even though I have completed all the side-ops there is a caption in the lower right of the side-ops list that says "Completion 135/157".

How do I finish all the side-ops?

How can you show text in-game?

Posted: 18 Apr 2021 04:22 AM PDT

I downloaded a Minecraft map but when I open the the doors there is a text that comes on the screen that says "open and close". How do they do this? Do they use commands?

How to pick select loot items in Titan Quest on PS4

Posted: 18 Apr 2021 12:35 AM PDT

It is very common after large battles to see the screen cluttered with loot items.

Is there a way to pick up only select ones?

Is there a way to collect all of them at once from a certain level of rarity upward?

Bluetooth module not working

Posted: 18 Apr 2021 12:30 AM PDT

this is a wireless gamepad receiver board
the problem is the LINK LED doesn't blink and so the gamepad can't connect.
can somebody give me a clue where to check or where could be the problem?
no physical accident happen to it btw

enter image description here

How to detect if there is a player near my house in Minecraft 1.6.5

Posted: 17 Apr 2021 11:49 PM PDT

So the thing is I want to ban the players who try to break into a house from my server. How can I do that I also want it to be automatic and I tried test for but it did not work

How do I kill all mobs in a world without being in it?

Posted: 17 Apr 2021 07:11 PM PDT

I used a command block that was set to repeat with the command /summon slime and accidentally turned on a lever next to it. Now my screen is full of slimes, the world is lagging, and I can't turn off the lever as the game won't completely load. Is there a way to stop the mobs?

What's the fastest way to level up buddies without bringing them on quests?

Posted: 17 Apr 2021 06:14 PM PDT

Palicoes and palamutes (aka buddies) are used for a variety of things, including trading via the Argosy. There are several skill for buddies to use when trading, but they all have a level requirement. Due to this, I'd like to level up my buddies as quickly as possible. However, I only like bringing my "original" buddies along with me on quests (I named them both after IRL pets, so I just can't see the look of rejection in their eyes when I leave them behind while I go off killing monsters without them).

Due to all of the above, I'm trying to figure out what's the fastest way to level up my buddies, without bringing them on quests. I suspect it's sending them along on meowcenaries quests, but I haven't been paying close enough attention to my buddy levels to be sure. Even if meowcenries is the fastest, I'm forced to wonder if factors such as the type of quests they're sent on will make a difference in the amount of experience they gain.

What's the fastest non-quest way to level up my buddies?

Minecraft (advanced ) command question - how do I use quotes in an extremely nested command?

Posted: 17 Apr 2021 12:35 PM PDT

Basically, I'm trying to make a "One command creation", which is, if you don't know, when you have an entire creation/project in one long command.

My creation makes a box, and then puts command blocks inside that box that will do stuff, all generating from a single command. One of the command blocks in that box has some quotes in it that it needs to be able to run, but the long command that makes the command block can't have those quotes for some reason. How can I get around this?

Here's the entire command (I believe some parts of it might be useful to this but I'm not sure):

summon falling_block ~ ~1 ~ {Time:1,BlockState:{Name:redstone_block},Passengers:[{id:armor_stand,Health:0,Passengers:[{id:falling_block,Time:1,BlockState:{Name:activator_rail},Passengers:[{id:command_block_minecart,Command:'gamerule commandBlockOutput false'},{id:command_block_minecart,Command:'data merge block ~ ~-2 ~ {auto:0}'},{id:command_block_minecart,Command:'fill ~3 ~-2 ~-2 ~9 ~3 ~2 white_concrete hollow'},{id:command_block_minecart,Command:'fill ~3 ~-1 ~-2 ~9 ~2 ~2 light_gray_stained_glass replace white_concrete'},{id:command_block_minecart,Command:'setblock ~4 ~-1 ~-1 repeating_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:"minecraft:iron_block",Count:3b}}] add irondoor1"}'},{id:command_block_minecart,Command:'data merge block ~4 ~-1 ~-1 {auto:1b}'},{id:command_block_minecart,Command:'setblock ~ ~1 ~ command_block{auto:1,Command:"fill ~ ~ ~ ~ ~-2 ~ air"}'},{id:command_block_minecart,Command:'kill @e[type=command_block_minecart,distance=..1]'}]}]}]}

And here is the bit of it that makes the command block in question:

{id:command_block_minecart,Command:'setblock ~4 ~-1 ~-1 repeating_command_block[facing=east]{Command:"tag @e[nbt={OnGround:1b,Item:{id:"minecraft:iron_block",Count:3b}}] add irondoor1"}'}

Little explanation - It summons a redstone block with an activator rail on top, thus powering the activator rail. Then it spawns a command block in a minecart (CBM) which goes on a powered activator rail, thus activating the command in the CBM. That command sets a block inside my box to be a repeating command block with a command. The problem is in this command - specifically, at id:"minecraft:iron_block". The problem is that the repeating command block needs those quote marks, but the long command can't have those quotes or it doesn't work.

Apologies if anything was confusing. If anyone can solve this issue I'd greatly appreciate it, as this is only one of many times this has happened.

My game looks weird and had a error when I bring it up

Posted: 17 Apr 2021 01:23 PM PDT

I have a picture of what it looks like but it says its to big, it says java sprit error and my game looks like I turned on a super secret setting from 1.8 the staticky one. enter image description here

What is the best way to get large amounts of bone blocks?

Posted: 17 Apr 2021 04:55 PM PDT

I plan on building a large base in Minecraft that will involve some white and gold in some parts, and while a gold farm in the nether will do for the gold blocks, I still want to have some bone blocks in place of white concrete for some texture. I know that I can make automated villager carrot or potato farms, then have the food go into an autocomposter which would make bone meal that I could craft into bone blocks, or have a mob farm to produce bones to craft into bone blocks. I need to know which one would be more efficient, but I would like it to be fairly cheap and I am still early in the game, without many resources. Does anyone have any suggestions or designs for a bone/bone meal farm that would work best for this?

How to stop grass spreading

Posted: 17 Apr 2021 09:07 PM PDT

Im trying to make Minecraft Dungeons in vanilla Minecraft but I just realised something: "Since grass spreads how am I going to keep the dirt as dirt?", so is there some sort of gamerule or something to keep the dirt I place AS dirt. This is in java 1.16.5, and no I cant use coarse dirt.

Why doesn't my mob grinder work?

Posted: 18 Apr 2021 01:56 AM PDT

inside of the mob grinder i have full bright and there isn't any torches inside

coords of the spawn platform

above the mob grinder i have it maxed out with torches

coords for above the mob grinder

afk spot and coords of it

This is my 10th failed mob grinder i havent got one to work i've followed multiple tutorials all leading to nothing. Caves in the area have been lit up and this was built near land but above the ocean. The close land has also torches and mobs don't spawn there. My friend built one on land no cave lighting or anyhting this was also built in survival if that changes anything. The spwan platforms are 9X8X4. I read that i should build it higher up, my previous attempts were higher up and they didnt work either

Why can't my friend move when he joins my server?

Posted: 18 Apr 2021 04:15 AM PDT

I'm trying to have a friend join my Minecraft server. For some reason, when he joins the server, his avatar just stays in one place and then after about 15 seconds he is kicked off the server. The weird thing is, he is able to move around on his end for a little bit but all I see on my end is him trapped in one spot.

We both have official Minecraft licenses (As I paid for them both) and are playing on the latest version. The server is a Linux server running on AWS and is running the java dedicated server version 1.16.5. I've been using this server successfully with other players for over a year and I haven't seen this problem. No firewall rules are enabled on the server. I'm wondering if there is some setting that I'm missing. Any ideas?

GTA 5 disc on PS4

Posted: 18 Apr 2021 02:16 AM PDT

Can you play GTA 5 disc on PS4 online? I know you need to have PS+ if you're buying game from PSN to play it but I want to buy disc so I don't have to get PS+.Is it possible?

How do I summon something with velocity in Minecraft?

Posted: 18 Apr 2021 02:57 AM PDT

How do I summon something with velocity in Minecraft? I tried searching it on google and click the links I can find. When I tried them, it didn't work. How do I do it?

Minecraft scoreboards: how do I track how many times a player kills another specific player?

Posted: 17 Apr 2021 08:54 PM PDT

So I'm trying to create a scoreboard that tracks the kills of players, but I only want it to increase when they kill a specific player, in this case just the player IGN would do.

I was thinking it would be something like:

/scoreboard objectives add (scoreboardName) minecraft.killed:(player)  

but I haven't got it working.

What command should I use?

Btw this is in 1.16.4

Where are Minecraft: Education Edition files stored?

Posted: 18 Apr 2021 01:09 AM PDT

We all know where Minecraft: Java Edition files are stored (Windows 10):

C:\Users\ExpertCoder14\AppData\Roaming\.minecraft\saves  

It's a little harder to find, but Bedrock Edition players can find their world saves here:

C:\Users\ExpertCoder14\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\games\com.mojang\minecraftWorlds  

Surprisingly, there is no documentation online found on where files are stored for Minecraft: Education Edition.

I would expect, since MCEE is based off of MCBE, the files are stored as another folder in Packages:

C:\Users\ExpertCoder14\AppData\Local\Packages\Microsoft.MinecraftEducationEdition  

or something of the like.

But I don't see an extra folder for MCEE there.

If not there, then where?

How to make a checkpoint commandblock but make it only go once

Posted: 17 Apr 2021 11:52 PM PDT

I am trying to make a map and I have a command block to detect when the player is on a gold block and a chain command block to say the message in chat but it spams it until I get off the gold block, Is it possible to make so it'll only say it once? (The repeating command block command is: execute as @a at @s if block ~ ~-0.35~ gold_block run spawnpoint @s ~ ~ ~ -90) enter image description here enter image description here

How can I repair a Nintendo handheld device if there isn't a service center in my country?

Posted: 17 Apr 2021 02:23 PM PDT

Disclaimer: I'm not sure if this is on topic but I'll try anyway. If not, tell me and I'll delete this question.

I have a Nintendo handheld console (New 2DS XL in my case) and the upper screen is broken. Obviously warranty doesn't cover this but I'd still like to get it repaired. Unfortunately I cannot find anyone in my country (Latvia) who would be willing to do it. I found YouTube instructions and 3rd party replacement parts on ebay, but I'd like to keep that as the last option. Seemed risky.

I tried contacting Nintendo in their support chat, but they're split in webpages for specific countries and I couldn't find a "global" webpage. So I went for the UK page (still close and speaks English), but they said they only repair devices from the UK and they cannot speak for other countries. So basically, no help there either.

Has anyone had a similar experience and have you found any solutions beyond self-repair or buying a new console?

How does difficulty affect XP rewards in Co-op Vs. AI matches?

Posted: 17 Apr 2021 03:42 PM PDT

Previously, in League of Legends, Co-op Vs. AI games would give different XP rewards based on the player's summoner level and the difficulty level of the bots. The old rates can still be see on the League of Legends Wiki here.

However, the table shown on that page is out of date, as it does not include the "intro" difficulty level or summoner levels beyond 30. The Riot Support page provides updated numbers for how summoner level affects XP rewards (assuming that "Level 30" means "Level 30+"), but makes no mention of how difficulty might affect those rewards.

Does difficulty still affect XP rewards from Co-op Vs. AI games in any way, or are rewards now consistent across all difficulty levels?

How to pass the "Key To Her Heart" mission (Hot Coffee mod)?

Posted: 18 Apr 2021 02:16 AM PDT

In GTA: San Andreas, I see several people are having problems passing the "Key To Her Heart" mission (Hot Coffee mod):

I can't spank the girl (Millie) hard enough to pass the mission. Some say turn on the Frame Limiter but I have tried more than 2 times and I still can't pass it.

Can a Pokémon be both Shiny and Lucky?

Posted: 17 Apr 2021 05:03 PM PDT

With the newest update, traded Pokémon have a chance to be Lucky. Can Shiny Pokémon also become Lucky?

So far all I have found is speculation, some saying that it is possible, and others saying it is not possible.

Why is discord displaying what I’m playing when I have no connections?

Posted: 17 Apr 2021 04:57 PM PDT

I connected discord to my xbox live account and I played a game. I got out of it, later disconnected my xbox live account from discord, and it still says I'm playing the game I was playing even though I wasn't even on the xbox. It said I was playing a certain game for 22 hours, and I can't turn it off. I have the discord mobile app, and my friend took it off. Later I went back on that game and the same thing happened. How do I fix this?

Making Arrows Fly Faster [1.12]

Posted: 18 Apr 2021 04:43 AM PDT

I'm making a sniper with 1.12 commands. It's working very well (except for the fact that bows don't shoot perfectly) but I have a problem: arrow speed.

If you shoot an arrow at minimum speed, you can literally overtake the arrow and jump into it. That's not a very nice sniper -_- So I searched on internet and I only found one solution that blew up my world and is not survival friendly. So I'm asking you if you know anything to speed up an arrow (the arrows already have the tag of {Nogravity:1b}) you don't know in which direction the arrow is flying so I can't use the Direction:[0.0,0.0,0.0] tag. I also tried effect @e[type=arrow] 1 1 10 in a repeating command block.

I'm not a noob so you can trust me I didn't make [always active] mistakes or something.

btw this is how it looks enter image description here

How does the passive item Unity add damage from your other guns?

Posted: 18 Apr 2021 02:29 AM PDT

The passive item Unity supposedly adds 2% of the damage of every other gun you're carrying to your currently equipped gun. How does it handle things like shotguns (which have multiple bullets that consist of most of their damage), charged weapons (which have different damage ratings), or explosive weapons (which deal at least part of their damage as an explosion)? How does it calculate the damage from beam weapons? The exact damage calculation is sure to be less than straightforward.

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 04:41 AM PDT

OSCHINA 社区最新专区文章


mac系统如何执行命令行解压

Posted: 17 Apr 2021 07:32 PM PDT

苹果系统如何在任意位置执行命令行执行解压命令 对文件解压到任意位置 不是在解压文件所在目录进行解压

Linux 5.13 或将引入 WWAN 框架

Posted: 17 Apr 2021 06:12 PM PDT

开发已久的 WWAN(无线局域网) 子系统框架已经合并到 Linux 网络子系统 "net-next" 分支,或将于 Linux 5.13 推出。 该补丁引入了对 WWAN 框架的初步支持。此前,鉴于现有的 WWAN 硬件和接口的复杂性和异构性,对于什么是 WWAN 设备以及如何表示它并没有严格的定义,因此其通常是执行全局 WWAN 功能的多个设备的集合(如...

Wine 5.0.4 发布,Windows 应用的兼容层

Posted: 24 Mar 2021 04:09 PM PDT

Wine 5.0.4 已经发布。Wine(Wine Is Not an Emulator)是一个能够在多种兼容 POSIX 接口的操作系统(诸如 Linux、macOS 与 BSD 等)上运行 Windows 应用的兼容层。它不是像虚拟机或者模拟器一样模仿内部的 Windows 逻辑,而是将 Windows API 调用翻译成为动态的 POSIX 调用,免除了性能和其它一些行为的内存占用,让你能...

Boost 1.76.0 发布,可移植的 C++ “后备”标准库

Posted: 17 Apr 2021 04:39 PM PDT

可移植的 C++ "后备"标准库 Boost 发布了 1.76.0 版本,Boost 库是一个经过千锤百炼、可移植、提供源代码的 C++ 库,作为标准库的后备,是 C++ 标准化进程的发动机之一,由 C++ 标准委员会库工作组成员发起。 主要更新内容 Asio 添加了 ip::scope_id_type 类型别名 添加了 ip::port_type 类型别名 重构 SFINAE 用法以缩...

Apache Groovy 4.0.0-alpha-3 发布,JVM 动态脚本语言

Posted: 17 Apr 2021 04:16 PM PDT

Apache Groovy 4.0.0-alpha-3 已经发布,这是 Groovy 4.00 的最后一个 alpha 版本。 主要更新内容 在没有类名前缀的情况下,无法从另一个静态闭包中引用一个静态闭包 在嵌套的 switch 语句中自动添加 return 从静态工厂访问私有构造函数 修复匿名内部枚举问题 修复在 enum 构造函数中对父类静态成员的引用在运行时失败的...

Redis是如何做到访问速度很快的

Posted: 03 Feb 2021 05:00 AM PST

对于Redis这种内存数据库来说,除了访问的是内存之外,Redis访问速度飞快还取决于其他的一些因素,而这些都跟Redis的高可用性有很大关系。下面是衡量Redis的三个纬度: 1.高性能:线程模型、网络I/O模型、数据结构,合理的数据编码2.高可用性:主从复制、哨兵模式、Cluster分片集群和持久化机制3.高拓展性:负载均衡 本篇...

V2EX - 技术

Posted: 18 Apr 2021 04:29 AM PDT

V2EX - 技术


小米 MIUI 12.5.1 系统正式版上手体验: UI 和功能变化系统梳理

Posted: 18 Apr 2021 04:23 AM PDT

本期视频我们将对 miui 12.5.1 正式版的 ui 和功能上的变化,做一个简单而系统的梳理 视频: https://www.bilibili.com/video/BV1rK4y1P7d7/ 文字稿: https://www.uso.cn/post/view/57892

求助一个前端加密后端解密的问题?

Posted: 18 Apr 2021 04:02 AM PDT

本人菜鸟一枚,今天做模拟登录遇到了一个前端加密后端解密的问题,自己根据谷歌搜索出来的代码片段倒腾了一个上午也没搞出来,所以这只能厚着脸皮来这里问大佬们了,下面这个 JavaScript 编码函数编码后的字符串,在后端如何用 php 解码出来提交的字符串。

如果问题太低端,望大佬们别怼我,真心求助,求大佬们不吝赐教!

function Ye() { 	return 256 * Math.random() | 0 } var rn = [3, 7]; function on(e, t) { 	void 0 === t && (t = Ye); 	var n = t() % 4, 		r = function(e) { 			if ("function" == typeof TextEncoder){ 				return (new TextEncoder).encode(e); 			} 			for (var t = unescape(encodeURI(e)), n = new Uint8Array(t.length), r = 0; r < t.length; ++r) 				n[r] = t.charCodeAt(r); 			return n 		}(JSON.stringify(e)); 	console.log("17",r); 	var i = 1 + rn.length + 1 + n + 7 + r.length; 		console.log("19",t.length,rn.length,n,r.length,i); 	var o = new ArrayBuffer(i); 		console.log("21",o) 	var a = new Uint8Array(o) 	  , u = 0 	  , s = t(); 	a[u++] = s; 	for (var c = 0, l = rn; c < l.length; c++) { 		var d = l[c]; 		a[u++] = s + d 	} 	a[u++] = s + n; 	for (var f = 0; f < n; ++f) 		a[u++] = t(); 	var v = new Uint8Array(7); 	for (f = 0; f < 7; ++f) 		v[f] = t(), 		a[u++] = v[f]; 	for (f = 0; f < r.length; ++f) 		a[u++] = r[f] ^ v[f % 7]; 	console.log("39",o); 	return o }  on('{"name":"abcde","password":"15e2b0d3c33891ebb0f1ef609ec419420c20e320ce94c65fbc8c3312448eb225"}') 

基于 Vite + React 构建 Chrome Extension (MV3) 开发环境

Posted: 18 Apr 2021 03:05 AM PDT

前言

此前一直想做一个 bilibili 的弹幕插件,最近借着研究 Vite 的契机实操了一下,花了两天时间算是搭好了基于 Vite + React 的 Chrome Extension (MV3) 开发环境,核心功能如下:

  • 📦️ JS 打包成单文件
  • 🎨 自动引入 CSS
  • 🔨 打包 service worker
  • 🚀 开发环境热更新

这里重点介绍一下当前热更新的实现,其他功能相对而言简单很多,详情可参考 theprimone/violet

一次偶然的机会在 B 站看了 《紫罗兰永恒花园》,给人印象深刻,刚好这次打算做个 bilibili 的弹幕插件,索性就取了女主名字中的 violet 😃

实操

热更新大致的流程如下图所示:

hot-reload-flow

启动

通过 npm run dev 同时执行三个命令:

  • tsc 编译 service worker 并监听变化
  • vite 编译 extension
  • websocket 服务监听打包后目录 /dist 的变化

其中,由于 vite build --watch 还未发布,暂时通过自定义脚本监听源码变化,待 vite 该功能发布后可移除。

热更新

浏览器页面加载 content scripts 后会创建一个 websocket 链接,服务端收到请求后会开启对 /dist 目录的监听,websocket 服务监听到 /dist 的变化后主动发起通知。

content scripts 收到需要更新 Extension 的通知,通过 chrome.runtime.sendMessage 触发 service worker 中通过 chrome.runtime.onMessage 注册的事件,依次触发 chrome.runtime.reloadchrome.tabs.reload 更新 Extension 和当前页面。实现了所写即所得,无需任何手动介入 🚀

可能会有读者有个疑问,为什么不直接在 service worker 中监听 websocket 的通知呢?

此前一直也是这么想的,在 Manifest V3 下使用 service worker 提倡 Thinking with events,通过 chrome.runtime.onInstalledchrome.runtime.onStartup 创建 websocket 客户端会被意外的关闭,即便是使用定时器轮询也会在执行多次之后被关闭再启动。因此,当前找到的最佳方案是在 service worker 中监听 chrome.runtime.onMessage 事件。

这样就实现了当页面加载目标插件时才会触发热更新的流程。

总结

由于现在的 Chrome Extension 大多是低于 MV3 版本的,两天下来,踩了不少坑,对于此前没有接触过的浏览器插件开发也有了一定程度的了解。现在只是针对 Chrome Extension 的场景,后续会在不断完善当前场景的情况下,完成对其他浏览器插件的支持。最终应该可以封装一个浏览器插件开发的工具。

如果手工对 AES-GCM 算法的明文(和密文)分段,用上一段的 Authentication tag 作为下一段的 Associated data,是否会带来额外安全风险?

Posted: 18 Apr 2021 02:17 AM PDT

需求是这样的,用.NET 和带认证(AEAD)的算法加密合理长度的文件(几 KB 到一二百 G 不等)。

问题是:

我不可能把整个文件都加载进内存,一次性传给AesGcm.Encrypt()方法。

但是.NET 库没有为 AES-GCM 提供流式操作方法。

(因为 AES-GCM 解密时,必须在所有块处理完毕后才能验证 Authentication tag 的有效性,而流式操作会在验证 Authentication tag 前返回解密后的明文。这时无法确定已经解密的部分是否曾遭到篡改,Github 讨论如下。)

https://github.com/dotnet/runtime/issues/23365

我的想法是:

1.把文件切分成 1M 的数据段处理。

2.对于每个文件,使用唯一的 key 。

3.使用每一段的序号作为加密这一段时使用的 nonce 。

4.对第 n 段加密操作产生的 Authentication tag,作为 n+1 段的 Associated data 。第 1 段的 Associated data 使用 128 位 0 。

5.记录第 1 段的 Authentication tag 以启动加密过程,记录最后一段的 Authentication tag 以验证密文是否遭到篡改。

6.保证在最后一段验证完成前,除了写入到临时文件中,不对已经解密的文件进行任何处理。

tag1, cipherText1 = AES-GCM(plainText1, key, nonce=1, associatedData=0)

tag2, cipherText2 = AES-GCM(plainText2, key, nonce=2, associatedData=tag1)

...

tagN, cipherTextN = AES-GCM(plainTextN-1, key, nonce=n, associatedData=tagN-1)

然后 tag1,tagN,cipherText 1-N 作为密文存储。

这样操作除了失去并行计算能力外,是否会带来额外的脆弱性,使最终的安全性比一次性使用 AES-GCM 算法加密所有数据差?(不考虑文件大于 64GB 时一次性使用 AES-GCM 加密的 counter 重复问题)

关于 zap 的使用方法问题

Posted: 18 Apr 2021 01:40 AM PDT

我想用 zap 来记录日志,我现在设计的是,每一种类型的日志分别用一个 logger 来记录,如下

type Logger struct { 	DebugLogger	*zap.Logger 	InfoLogger	*zap.Logger 	WarnLogger	*zap.Logger 	ErrorLogger	*zap.Logger 	PanicLogger	*zap.Logger 	DPanicLogger	*zap.Logger 	FatalLogger	*zap.Logger } 

这样我就可以用多个文件分别存放不同类型的日志了。但是我疑惑这样 performance 会不会变差。或者有没有什么方法能用一个 logger,然后根据不同的类型写入不同文件。

功能测试想往测试开发方向发展,应该学习哪些东西

Posted: 18 Apr 2021 01:26 AM PDT

如题:目前工作中主要还是功能测试,但是感觉到了瓶颈期了,想往更高的方向去走,但是很迷茫,之前都是小公司就几个测试,没有测试开发这种岗位,请教的人都没有,感觉特别迷茫,有没有这方面的大佬能给点建议参考下,小弟感激不尽

Clion 2020.2 怎么导入远程头文件。

Posted: 18 Apr 2021 12:52 AM PDT

windows clion 远程连接到 linux 服务器,有的头文件只有服务器上有,百度都是通过 tool->resync with remote hosts,但是我的 clion 没有这个选项,设置了快捷键也没反应。

还是 NAS 卡顿问题,这次来问丢包问题了,求大神分析

Posted: 18 Apr 2021 12:13 AM PDT

前帖 https://www.v2ex.com/t/764650

这里大致再说下:

主力机:AQC107 万兆网卡

服务器:R720xd, Esxi 7.0 U2, Intel X540 万兆 SR-IOV 给 WinServer 2019 作为 NAS 使用

局域网内主力机无论 iscsi 还是 smb 访问均卡顿,wireshark 抓包发现总是有规律的丢包

截图

抓包文件:

链接: https://pan.baidu.com/s/1OOVrJ6TMMY_9OGiW9EOGqQ 提取码: 7m4w

补充:

  1. 局域网内各个环节开启 9K 巨帧,貌似就没有重传问题了,看视频也不再卡顿,但前提是 NAS 必须禁用 Ipv6,因为 ipv6 每次联网都会将 MTU 重置为 1480,且此时也不能用手机访问 NAS 文件了,感觉损失过大
  2. 试了用笔记本( Ubuntu20.04 )无线访问 NAS,却不会卡顿

windows arm 镜像下载

Posted: 17 Apr 2021 11:49 PM PDT

求各位老大指导一下,有没有 windows 7 ARM 或者 windows 10 ARM 版本的镜像下载地址,求分享一下下载链接地址。谢谢!

使用 MBP m1 进行 C++开发可以吗?会有坑吗?

Posted: 17 Apr 2021 11:14 PM PDT

rt,面临实习,打算更新设备,看到网上很多测评,感觉 m1 太强了。目前用的是 iPhone 但是没有用过 mac 本,想问问大家,现阶段使用 mbp m1 进行 C++的开发能行吗?不知道 m2 啥时候出,用不用等 m2 再入手呢?

Javascript 数组及其方法详解

Posted: 17 Apr 2021 09:32 PM PDT

本文详细讲解 Javascript 数组对象及其各种方法

直接文章略长 直接贴个链接:https://www.liuxing.io/blog/javascript-array-methods-tutorial/

kotlin lazy 形式的 grouping and mapping 应该怎么写, sequence 里 grouping + aggregate 怎么比 Java stream 还复杂得多

Posted: 17 Apr 2021 04:04 PM PDT

是不是我姿势不对,有没有更好的写法?

val kotlin = "ABCDEF".asSequence()     .groupingBy {         println("grouping")         it.toInt() / 10     }     .aggregate { _, accumulator: MutableList<String>?, element, first ->         println("aggregate")         if (first) {             val tmp = MutableList(0) { "" }             tmp.add(element.toString() + "X")             tmp         } else {             accumulator!!.add(element.toString() + "X")             accumulator         }     } println(kotlin)   val java = "ABCDEF".toList().stream()     .collect(         Collectors.groupingBy(             { println("java grouping"); it.toInt() / 10 },             Collectors.mapping({ println("java mapping"); it.toString() + "X" }, Collectors.toList())         )     ) println(java)   

怎么获取 dev insider 版本 windows 呢

Posted: 17 Apr 2021 10:18 AM PDT

在官网注册了,在设置-更新-预览版计划里无限出现错误提示,那串代码也看不懂只说是更新功能 bug,想要最新的 icon,求赐教

写了一个类似 fastapi 的可以用于几种 web 框架的参数检验库

Posted: 17 Apr 2021 09:09 AM PDT

因为一开始用 fastapi 觉得很不错,但又觉得不是很完美,自己更喜欢 starlette,所以才写了这个库—pait。这个库核心逻辑很简单,但写了快一年,库名还被我写错了,去年 8.9 月的时候主体逻辑就写完了,然后就经历了一段 996 停了下来。经过最近不断的修修补补,勉强能用了。

pait依赖于Pydantic(但支持延迟注解)和inspect,主要功能是参数检验和文档生成。 参数检验用法跟 fastapi 差不多,文档输出功能还在逐渐完善中,理论上可以支持很多 web 框架,不过我现在基本只用 flaskstarlette

import uvicorn from pydantic import BaseModel, conint, constr from starlette.applications import Starlette from starlette.responses import JSONResponse from starlette.routing import Route  from pait.app.starlette import pait from pait.field import Body   # 创建一个基于 Pydantic.BaseModel 的 Model class PydanticModel(BaseModel):     uid: conint(gt=10, lt=1000)  # 自动校验类型是否为 int,且是否大于 10 小于 1000     user_name: constr(min_length=2, max_length=4)  # 自动校验类型是否为 str, 且长度是否大于等于 2,小于等于 4   # 使用 pait 装饰器装饰函数 @pait() async def demo_post(     # pait 通过 Body()知道当前需要从请求中获取 body 的值,并赋值到 model 中,      # 而这个 model 的结构正是上面的 PydanticModel,他会根据我们定义的字段自动获取值并进行转换和判断     model: PydanticModel = Body.i() ):     # 获取对应的值进行返回     return JSONResponse({'result': model.dict()})   app = Starlette(     routes=[         Route('/api', demo_post, methods=['POST']),     ] )  uvicorn.run(app) 

请教, 搞一台备用机, 3000 以内的预算, Android 的.有什么推荐吗?

Posted: 17 Apr 2021 03:43 AM PDT

小米和华为买过, 使用的时候感觉触屏很灵敏, 误触几率高, 打字的感觉不是很舒服. 很强的脱离感?? 比如我使用 ios 的时候, 我会被骗到误认为我按到了这个按钮. 但是使用华为 Nove8 和小米忘了哪款的时候, 我触摸屏幕的时候就没有那种被骗的感觉... 描述的挺粗糙, 表达能力不够..

现在看一加 9R, 据说一加都挺好的, 想试试. 有没有前辈能不能在备用机的选择上给点意见?

主要用来:

  1. 替代车载导航.
  2. 做 Appium 的应用开发.
  3. 会用来刷视频和阅读把.
  4. 试着安装一些奇奇怪怪的应用.

选择使用的是 ios 系统的设备.

大家有没有搞过有状态应用上 K8S

Posted: 16 Apr 2021 11:55 AM PDT

MySQL RabbitMQ Redis 等这种有状态中间件怎上 K8S ?是通过在上层使用开源的或者自己改的 operator,还是在底层二次开发这些中间件?存储用 local pv 还是 ceph 之类的?

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 03:51 AM PDT

OSCHINA 社区最新专区文章


鸿蒙开源第三方组件——MPAndroidChart图表绘制组件

Posted: 16 Apr 2021 12:57 AM PDT

目录: 1、前言 2、背景 3、组件效果展示 4、sample解析 5、library解析 6、《鸿蒙开源第三方组件》系列文章合集 前言 本组件是基于安卓平台的图表绘制组件MPAndroidChart( https://github.com/PhilJay/MPAndroidChart),实现了其核心功能的鸿蒙化迁移和重构。目前代码已经开源到(https://gitee.com/isrc_ohos/mpand...

鸿蒙内核源码分析(信号分发篇) | 生产异步通讯信号的过程 | 百篇博客分析HarmonyOS源码 | v48.02

Posted: 16 Apr 2021 02:22 AM PDT

[百万汉字注解 >> 精读鸿蒙源码,中文注解分析, 深挖地基工程,大脑永久记忆,四大码仓每日同步更新<](https://gitee.com/weharmony/kernel_liteos_a_note)[ gitee ](https://gitee.com/weharmony/kernel_liteos_a_note)[| github ](https://github.com/kuangyufei/kernel_liteos_a_note)[| csdn ](https://codechina.csdn....

HarmonyOS开发者日在上海举办 激发开发者无限潜能

Posted: 17 Apr 2021 01:27 AM PDT

4月17日,HarmonyOS开发者日于上海召开,活动吸引了大批开发者的关注与参与。现场华为技术专家向与会嘉宾分享了HarmonyOS的最新进展、全新技术特性以及开发实践。此外,还有丰富的创新技术体验,更有CodeLabs的HarmonyOS分布式开发挑战,开发者的热情超出预期。 HarmonyOS生态蓬勃发展 用户体验再上新台阶 在本次活动上,...

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 03:51 AM PDT

OSCHINA 社区最新专区文章


手写Vue2.0源码-Mixin混入原理

Posted: 16 Apr 2021 03:09 AM PDT

前言 此篇主要手写 Vue2.0 源码-Mixin 混入原理 上一篇咱们主要介绍了 Vue 异步更新原理 核心是运用 nextTick 实现异步队列 此篇主要包含 Mixin 混入 这是 Vue 里面非常关键的一个 api 在 Vue 初始化的时候起到了合并选项的重要作用 适用人群: 没时间去看官方源码或者看源码看的比较懵而不想去看的同学 正文 Vue.mixin(...

前端vue使用oss上传图片put作用域,data1能打印数据data2却没有,这是什么问题呢,有没有大佬解答一下

Posted: 17 Apr 2021 05:25 AM PDT

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 03:50 AM PDT

OSCHINA 社区最新专区文章


等你加入 | 活动运营组成员招募!

Posted: 22 Sep 2020 05:15 PM PDT

点击蓝字 关注我们,让开发变得更有趣 OpenVINO 中文社区的点滴成就 都离不开背后的志愿者团队 而我们的志愿者团队是一个非常有爱的大家庭 大家一起交流、学习、进步 也一起欢笑、玩耍 活动回顾 | 社区背后那些可爱的人儿 · 7月25日社区团建记录 为了社区更好的发展 我们将成立一个新的志愿者小组 活动运营组 你需要做到...

双11福利周 | 一大批技术干货向你走来!

Posted: 18 Oct 2020 05:30 AM PDT

👆关注我们,让开发变得有趣! 【往期干货活动回顾】 👉干货培训 | 图文教程 OpenVINO2020 + QT 配置 👉干货培训 | 使用OBS进行直播导播和推流(下) 👉干货培训 | 使用OBS进行直播导播和推流(上) 👉5月30日直播回顾 | OpenVINO 中文社区线上成立大会 👉6月20日直播回顾 | OpenVINO + ROS 加速机器人...

早餐|第二十期 · Model Optimizer 参数介绍 (二)

Posted: 14 Oct 2020 05:15 PM PDT

点击蓝字 关注我们,让开发变得更有趣 内容来源 | 曹慧燕 内容排版 | 谭诗弦 大家好, 这里是OpenVINO早餐 在上一期的节目中, 我们已经对模型优化器有了更加深入的了解 这一期让我们继续学习使用模型优化器吧~ 作者介绍 11 ○ 曹慧燕 英特尔 IOTG Edge AI 工程师 正餐部分 视频放映 文稿阅读 模型优化器通用参数: 什么...

分享 | OpenVINO环境部署与Bug修复

Posted: 13 Oct 2020 05:15 PM PDT

关注我们,让开发变得更有趣 内容来源 | 陈昊团队 排版 | 谭诗弦 原文链接 | https://mc.dfrobot.com.cn/thread-306542-1-1.html 01 安装 Visual Studio 2019 community 下载并运行以下 vs_community.exe 安装包 (下载链接: https://visualstudio.microsoft.com/zh-hans/downloads/) 在"工作负载" 选项卡中,勾选"使用...

活动预告 | 双十一特别活动 · 开发套件狂欢节

Posted: 12 Oct 2020 03:00 AM PDT

--------------------------------------- *OpenVINO and the OpenVINO logo are trademarks of Intel Corporation or its subsidiaries. ----------------------------- OpenVINO 中文社区 微信号 : openvinodev B站:OpenVINO中文社区 "开放、开源、共创" 致力于通过定期举办线上与线下的沙龙、动手实践及开发者交流...

分享 | OpenVINO human pose estimation例程运行

Posted: 12 Oct 2020 05:15 PM PDT

内容来源 | 陈昊 内容排版 | 温子涵 原文链接 | https://mc.dfrobot.com.cn/thread-306541-1-1.html 这篇教程详细介绍了如何在已经布置好环境的情况下运行openvino的例程,这里我拿openvino库的human pose estimation 作为范例,其它例程的操作都是类似的。 第一步:设置工程 1.在C:\Program Files (x86)\IntelSWTools\o...

直播预告 | BERT 推理的硬件加速

Posted: 02 Oct 2020 05:15 PM PDT

2020年的程序员节很快就要来临了 大家将用什么方式去庆祝呢? OpenVINO 中文社区为大家准备了一份请柬 邀请大家和我们一起"云过节" 直播主题 BERT推理的硬件加速 直播时间 10月24日(周六)13:00 - 15:30 讲师介绍 陈铁军 VMware OCTO 资深主任工程师 近年来,从事Linux、Unikernel、虚拟化、边缘计算和边缘AI、serve...

直播回顾 | OpenVINO与Movidius VPU助力工业边缘智能产业发展,研华与英特尔在工业AI领域的紧密合作

Posted: 25 Sep 2020 05:15 PM PDT

导读 2020年9月23日,研华携手英特尔举办了《OpenVINO与Movidius VPU 助力工业边缘智能产业发展》主题论坛,围绕Intel OpenVINO技术、以及研华基于Intel 平台的边缘AI解决方案、案例进行了分享。本文带您回顾此次会议精彩内容,文末附本次会议互动获奖名单! (▼扫码进入直播间回看视频) 近年来,受益于算法、算力技术...

分享 | OpenVINO 配置系统环境变量

Posted: 26 Sep 2020 05:15 PM PDT

关注我们 让开发变得更有趣 来源| 陈昊团队 排版| 晏杨 原文链接| https://mc.dfrobot.com.cn/thread-306540-1-1.html 在编译和运行 OpenVINO 的应用程序时,需要先更改几个系统环境变量。环境变量的作用是给到系统一个程序所在的完整路径,帮助系统更好地运行程序。而假如没有配置环境变量,系统在运行程序时会由于无法...

等你加入 | OpenVINO 中文社区 讲师招募

Posted: 24 Sep 2020 05:15 PM PDT

关于我们 OpenVINO是英特尔基于自身现有的硬件平台开发的一种可以加快高性能计算机视觉和深度学习视觉应用开发速度工具套件,最显著的3个特点是:高性能深度学习推理;简化开发,易于使用;一次编写,任意部署。 2020年5月16日,OpenVINO 中文社区正式成立。本着开放、开源、共创的理念,社区致力于通过定期举办线上与线...

OSCHINA 社区最新新闻

Posted: 18 Apr 2021 01:53 AM PDT

OSCHINA 社区最新新闻


为什么 uBlock Origin 在 Firefox 上运行效果最好?

Posted: 17 Apr 2021 07:23 PM PDT

uBlock Origin 作者 Raymond Hill 解释了为什么他开发的广告屏蔽扩展插件(以下简称 uBO)在 Firefox 上的运行效果最好,主要原因包括支持使用 CNAME 记录、独家支持webRequest.filterResponseData()API、可靠地阻止预取,以及使用 WebAssembly 作为核心的过滤代码路径等。 支持使用 CNAME 记录 Firefox 支持曝光利用 CN...

超级账本 (Hyperledger) 2021年第一季度中国贡献榜

Posted: 17 Apr 2021 06:23 PM PDT

超级账本项目 (Hyperledger) 公布了中国籍开发者于2021年1月1日至3月31日对超级账本项目的贡献情况。 一、代码贡献榜 说明: 所有项目代码托管于Github上,贡献次数为代码合并到主干的次数; 已知问题:偶见贡献者姓名没有出现在Contributors页面,造成统计不到信息; Hyperledger-TWGC 下所做贡献的统计信息,采用commi...

Node-RED 1.3 发布,基于流的低代码编程工具

Posted: 17 Apr 2021 06:12 PM PDT

Node-RED,一个基于流的编程工具,已经在 2021 年 4 月发布了 1.3 版。Node-RED 是OpenJS 基金会的一个成长(growth)项目。 Node-RED 是一种编程事件驱动应用程序的低代码方法。基于流的编程创建网络,使其能够可视化表示,从而使其成为一种更容易访问的编程方式。JavaScript 函数可以使用富文本编辑器构建,内置库允许...

Linux 5.13 或将引入 WWAN 框架

Posted: 17 Apr 2021 06:12 PM PDT

开发已久的 WWAN(无线局域网) 子系统框架已经合并到 Linux 网络子系统 "net-next" 分支,或将于 Linux 5.13 推出。 该补丁引入了对 WWAN 框架的初步支持。此前,鉴于现有的 WWAN 硬件和接口的复杂性和异构性,对于什么是 WWAN 设备以及如何表示它并没有严格的定义,因此其通常是执行全局 WWAN 功能的多个设备的集合(如...

图查询语言的历史回顾短文

Posted: 17 Apr 2021 06:04 PM PDT

本短文会涉及到的图查询语言有 Cypher、Gremlin、PGQL 和 G-CORE

RapiDoc —— 生成基于 OpenAPI 规范的 API 文档

Posted: 17 Apr 2021 05:53 PM PDT

RapiDoc 是一个文档工具,可以基于 OpenAPI 规范创建漂亮的、可定制的、交互式的 API 文档。

每日一博 | 你可能不知道的 ZooKeeper 知识

Posted: 17 Apr 2021 05:51 PM PDT

介绍些 ZK 的隐藏功能,废话不多,让我们开始吧~

GNU 正式推出协作开发平台 GNU Assembly

Posted: 17 Apr 2021 05:21 PM PDT

GNU 宣布正式推出 GNU Assembly 及其网站,并表示该网站将成为 GNU 软件包开发人员的协作平台。 文中表示,该项目起源于 10 年前 GNU Guile 的 Andy Wingo 给 GNU 维护人员发的一封电子邮件,希望能有一个 GNU 项目的集体决策论坛。如今该愿景已成为现实。 Assembly 是 GNU 工具链项目的新平台,目前容纳了大约 30 个 GN...

高手问答 260 期 —— 技术人修炼之道

Posted: 17 Apr 2021 09:10 AM PDT

技术人如何在职场上"升级打怪"?做技术本身工具性非常强,然而除了掌握必须依赖的技术工具,技术人对其他维度的工具常常视而不见。那么如何从一名普通技术从业者,修炼成为"技术职场超级个体",通过全面升级底层操作系统,更从容地应对快速变化的世界。

Martian 4.0,架构大幅调整

Posted: 17 Apr 2021 02:14 AM PDT

Martian4.0 是啥 Martian4.0 是一个 最新的主线版本,内部架构产生了巨大的变化,之前的版本 里面大部分功能都是Martian自带的,属于一个高度内聚的项目。而从4.0开始 不再以这种方式进行开发了。 而是基于Magician开发,定位成一个Magician项目的超集,整合了Magician的大部分组件,并进行了少量的二次封装,使其可以快...

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 01:48 AM PDT

OSCHINA 社区最新专区文章


Service Mesh 从“趋势”走向“无聊”

Posted: 16 Apr 2021 05:09 AM PDT

![头图.png](https://ucc.alicdn.com/pic/developer-ecology/6c0ec29129554535a40dd788a7e06394.png) 作者 | 李云(至简) 来源 | [阿里巴巴云原生公众号](https://mp.weixin.qq.com/s/J34ujEMq5V-5ADZnxOsELw) 过去一年,阿里巴巴在 Service Mesh 的探索道路上依旧扎实前行,这种坚定并非只因坚信 Service Mesh 未来一定...

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 12:48 AM PDT

OSCHINA 社区最新专区文章


终于等到你,小程序开源啦~

Posted: 12 Apr 2021 03:20 AM PDT

回复 PDF 领取资料 这是悟空的第 93 篇原创文章 作者 | 悟空聊架构 来源 | 悟空聊架构(ID:PassJava666) 转载请联系授权(微信ID:PassJava) 本文主要内容如下: 一、缘起 PassJava 开源项目是一个面试刷题的开源系统,后端采用 Spring Cloud 微服务可以用零碎时间利用小程序查看常见面试题,夯实Java 技术栈,当然题...

Linux 5.13 或将引入 WWAN 框架

Posted: 17 Apr 2021 06:12 PM PDT

开发已久的 WWAN(无线局域网) 子系统框架已经合并到 Linux 网络子系统 "net-next" 分支,或将于 Linux 5.13 推出。 该补丁引入了对 WWAN 框架的初步支持。此前,鉴于现有的 WWAN 硬件和接口的复杂性和异构性,对于什么是 WWAN 设备以及如何表示它并没有严格的定义,因此其通常是执行全局 WWAN 功能的多个设备的集合(如...

算法很美,听我讲完这些Java经典算法包你爱上她

Posted: 13 Apr 2021 09:02 PM PDT

大家好,我是小羽。 对于编程来说的话,只有掌握了算法才是了解了编程的灵魂,算法对于新手来说的话,属实有点难度,但是以后想有更好的发展,得到更好的进阶的话,对算法进行系统的学习是重中之重的。 对于 Java 程序员来说,这一门后端语言只是我们的外功,我们更多的是学习它的语法,框架以及一些工具的使用。而算法才...

OSCHINA 社区最新专区文章

Posted: 18 Apr 2021 12:38 AM PDT

OSCHINA 社区最新专区文章


GNU 正式推出协作开发平台 GNU Assembly

Posted: 17 Apr 2021 05:21 PM PDT

GNU 宣布正式推出 GNU Assembly 及其网站,并表示该网站将成为 GNU 软件包开发人员的协作平台。 文中表示,该项目起源于 10 年前 GNU Guile 的 Andy Wingo 给 GNU 维护人员发的一封电子邮件,希望能有一个 GNU 项目的集体决策论坛。如今该愿景已成为现实。 Assembly 是 GNU 工具链项目的新平台,目前容纳了大约 30 个 GN...

C++开发,选择进入音视频行业,前景看好吗?

Posted: 16 Apr 2021 10:24 PM PDT

就如今以及未来几年音视频行业发展情况来看,值得作为C++开发比较好的一个方向吗?

Recent Questions - Ask Different

Posted: 17 Apr 2021 11:54 PM PDT

Recent Questions - Ask Different


MacOSX Big Sur - Terminal ZSH Shell Command's Execute Sometimes With "!" Exclamation Symbol In Front

Posted: 17 Apr 2021 11:40 PM PDT

Is this normal behavior for MacOS Big Sur ZSH (Z Shell) terminal behavior? Sometime's shell commands such as find and or launchd as just a simple example execute properly. This is with the exclamation symbol "!" in front, leading with the expected output and no privilege escalation.

For example, running: !find / will still work. Or !sudo will execute.

But !echo '@' will not. But lead to the next command sometimes.

Output for !echo

zsh: event not found: echo

Output for !launchd

launchd

launchd cannot be run directly.

It seem's weird !sudo output's sudo syscallbypid.d

Delete picture prompt in Keynote

Posted: 17 Apr 2021 11:24 PM PDT

Hi I am creating Keynote masters and every time I insert a picture it puts an icon on it, helpfully to allow you to insert a photo from your file. It doesn't show up in the final keynote but it is a pain in the neck. How do I delete it enter image description here

iOS Simulator is not simulator technically on Apple Silicon M1 Machine

Posted: 17 Apr 2021 08:40 PM PDT

iOS simulator available in Xcode is not simulator technically on Apple Silicon M1 Machine. As it builds ARM build on it. Am I right?

Where in System Preferences do I find how to enable extensions?

Posted: 17 Apr 2021 08:00 PM PDT

A friend of mine has a Mid 2012 MacBook Air running Catalina, and he's trying to get the Android emulator BlueStacks running on it. He gets an error saying "System extension blocked. Enable the extension from Security & Privacy System Preferences pane by clicking 'Allow' button and BlueStacks will launch again." I looked in that pane, and couldn't find anything like that. I'm obviously missing something here but I don't know what!

A screenshot of the error is attached:

enter image description here

iCloud Notes - back up to Time Machine or Optimise Mac storage

Posted: 17 Apr 2021 06:59 PM PDT

my original question was,

are my iCloud notes automatically backed up to Time Machine?

online I came upon the answer, yes, as long as Optimise Mac Storage is turned off

is this true?

But Optimise Mac Storage means full content of the iCloud Drive will be stored on the Mac

So it seems that's already a way to backup the iCloud

Does this mean I have to choose whether to back it up to the Mac or to Time Machine ?

Which would be better ?

Thank you !

My Apple Script Editor code doesn't work gives "Syntax Error Expected end of line but found identifier."

Posted: 17 Apr 2021 06:48 PM PDT

I insert this code:

tell application "Notes"    set theMessages to every note    repeat with thisMessage in theMessages      set myTitle to the name of thisMessage      set myText to the body of thisMessage      set myCreateDate to the creation date of thisMessage      set myModDate to the modification date of thisMessage      tell application "Evernote"        set myNote to create note1 with text myTitle title myTitle notebook "Imported Notes" tags ["imported_from_notes"]        set the HTML content of myNote to myText        set the creation date of myNote to myCreateDate        set the modification date of myNote to myModDate      end tell    end repeat   end tell  

And it gives me the error: Syntax Error Expected end of line but found identifier.

Any idea what the problem with the code is?

How to tell what Safari tab requires high performance GPU?

Posted: 17 Apr 2021 04:28 PM PDT

I'm experiencing lower than expected battery life on my 2015 Macbook Pro. I believe that part of the problem is that the High Performance GPU is being activated when not needed by some tab in Safari: Activity Monitor Energy Pane

This is NOT a CPU related problem, as the CPU tab in Activity Monitor shows little activity: Activity Monitor CPU pane

How can I tell which tab is requiring the high-performance GPU?

macOS 11: Get system information (GPU, resolution) programmatically (in C)

Posted: 17 Apr 2021 04:14 PM PDT

I need to access data about GPU and screen resolution in C, not using system_profiler, because it takes too long(.3s-.5s system_profiler SPDisplaysDataType), and needs greping and cutting, which is not that fast either.

Caching would be answer, but very short-sighted as someone can use different monitors etc.

Unfortunately system_profiler is closed source.

Contacts and calendars only sync from iPhone to Mac, not Mac to iPhone

Posted: 17 Apr 2021 03:03 PM PDT

When my friend syncs their iPhone over USB with their Mac, contacts and calendar entries they create on their Mac are not copied to their iPhone, but contacts and calendar entries they create on their iPhone do get copied to their Mac. How can we get this data syncing bidirectionally again?

This data used to sync in both directions correctly, but stopped doing so around the time they updated to iOS 14.4.2 (it may very well have started before the update; they first noticed about a day after updating). It's hard to tell when exactly it started exhibiting this behavior because there's no error message when they sync. The behavior we do observe is that once the sync gets to the calendar step, it sits there indefinitely until the sync is cancelled. If we turn off calendar sync, it gets to the contacts step and similarly sits there indefinitely until the sync is cancelled.

They do not use iCloud. They're running macOS Big Sur 11.2.3 and sync using the Finder. They use Apple's Contacts and Calendar apps on both their phone and computer. "Sync contacts onto iPhone", Sync "All Groups" is selected, and "Sync Calendars onto iPhone", Sync "All Calendars" is selected.

We've tried booting the Mac into safe mode, but this appears to completely disable whatever Finder component handles iOS syncing. We also tried performing a sync while streaming the AMPDevicesAgent logs, but when the sync hangs, the logs just show a bunch of "sending Ping for device" and "got Ping message for device" messages with no errors until we cancel or disconnect the phone.

Something strange we noticed that may or may not be relevant is that in the Finder sync settings, the box for "Add new contacts from this phone to 'ALC Board'" is checked (this is one of their groups in Contacts) even though they never chose it. However, when they try to pick a different group for the destination, it only shows a list containing their other groups but not the All Contacts folder. If they uncheck this box, and click Apply, after syncing the box comes back checked (sometimes a different group name will appear). I am unsure whether this is relevant because they can sync from their phone to their Mac.

Similarly strange, in the settings from Calendar sync, the 'Do not sync events older that — days' is currently unchecked. However, originally it was checked and set to 730 days. When they set it to 0, it was supposed to transfer all calendar entries from Mac to phone, but it did not (and did not show an error message).

Thank you for your help!

MacBook M1 Big Sur crashes every time when I open "About This Mac -> Storage -> Manage"

Posted: 17 Apr 2021 10:41 PM PDT

Background: I'm using a MacBook Pro with M1 chip and Big Sur V11.1 (got it last month). One thing really annoys me is that when I connect my iphone, sync starts automatically and it takes up 20GB to when all iphone files are backed up.

Issue: So I wanted to delete the sync files using "Reduce Clutter" in "About This Mac -> Storage". It worked fine for two weeks after I purchased the MacBook, but recently it starts to crash every time when I open "About This Mac -> Storage -> Manage" and I wasn't even able to get the time to click "Review Files" under "Manage". I tried to restart the system but had no luck at all. See screenshots below for crash report.

screenshot1

screenshot2

Help: Does anyone else encounter the same issue? How to resolve it? Is there a way (say, command line) to delete synced iphone files without clicking "About This Mac -> Storage"?

"Manage-> Review Files" is a really convenient way to view and remove redundant files to save storage. It would be great if there is a way to revive that functionality if possible.

Thanks in advance!

Gamepad Button Mapping

Posted: 17 Apr 2021 02:23 PM PDT

For some reason, my gamepad has wrong mappings, and I need a software to remap the joystick. Is there any free tool for that? Or a workaround maybe?

macOS error: The application is not open anymore

Posted: 17 Apr 2021 11:51 PM PDT

I'm attempting to launch a macOS application.

When I select the file from Applications, or double-click the app's icon, I get the alert message:

The application "APP_NAME.app" is not open anymore.

The application "APP_NAME.app" is not open anymore.

I know it's not open... I want to launch the app!

What is the meaning of this error? How can I launch the application?

How to replace newline in Excel for Mac

Posted: 17 Apr 2021 11:45 PM PDT

As it seems there are suggestions for how to replace a character or a string with newline in Excel for Mac, like this one. But trying to reverse the process does not work; e.g., to type CTRL+J or ALT+0010 etc. Any advice on how to replace newlines in cells with, for example, space?

Mirroring display in Recovery Mode with faulty lid sensor and LCD?

Posted: 17 Apr 2021 11:08 PM PDT

Today I bought a 2017 Macbook that has a water damaged LCD and a faulty closed-lid sensor. My intention is to factory reset it and use it as a build system (i.e. develop my app on my desktop, then remotely connect into the machine to compile / distribute).

When in MacOS, I can ⌘ Command+F1 to mirror to an external display, but obviously that doesn't work in recovery mode. One suggestion was to boot to recovery, then simply close the lid to make the external display the primary display, but with a faulty "lid closed" sensor, I can't do that.

Another suggestion was to close the lid, then run a fridge magnet over the corner of the unit to activate the closed-lid sensor. I tried this, but it just puts the unit to sleep, and I need to open the lid to start it back up.

Someone else suggested attempting to drag the window over from one screen to another, but I tried a bunch of times and had no luck because it's a bit of a stab in the dark to hit something that thin.

I have a dock at work that I intend to try (so I can close the lid, do the magnet, then use an external keyboard to try and wake the device), but until I can get to it, I'm wondering if there's a way to mirror the display, or at least move the window so I can proceed with reinstallation of MacOS?

What exactly are the files . and .. on mac?

Posted: 17 Apr 2021 06:51 PM PDT

Anecdotally, files called . and .. seem to often (always?) be present inside otherwise 'empty' directories on macOS.

Example

Create a new directory (with nothing in it)

mkdir test  

cd into it

cd test  

and list its contents

ls -a  .   ..  

What exactly are these files . and ..?

Transfer accounts from Mac or iPhone to new iPad?

Posted: 17 Apr 2021 05:11 PM PDT

I have 8 different email accounts configured on my iPhone. It's a pain to move them one-by-one to the iPad. If I wipe the iPad I can move them all over at the same time. Is there any way to do this without wiping the iPad? I just got a new email account and don't want to manually configure each device.

Unity: How can I run Unity builds created in High Sierra & Verify they run on Mojave without a Mojave computer?

Posted: 17 Apr 2021 07:43 PM PDT

I have Unity 2020.3.0f1 Mac apps that were created on end-of-life High Sierra computers. I recently purchased a Mac Mini M1 computer. The apps run on both computers. I have to execute a terminal command on them to get them to open on the M1 computer.

Apple changed the App Store Upload process so that now we have to notarize that new apps will run on Mojave. I don't have a computer that runs Mojave. From my understanding you can't test Unity builds using the Apple Simulators. Is there another option to test my apps to see if they will run on Mojave?

Connecting a MacBook Air with Thunderbolt 2 to a Monitor with HDMI and USB-C

Posted: 17 Apr 2021 06:48 PM PDT

I have a 13-inch MacBook Air Early 2015, resolution 1440 × 900 with thunderbolt 2 and USB-A. I want to connect it to a bigger display. Right now I am considering to buy an LG 27UK850-W 4K 27 inch Monitor (resolution 3840x2160) which has HDMI, USB-C, DisplayPort and USB Downstream Port. Can I connect my MacBook and the monitor with the following connections:

  1. MacBook Air -> Thunderbolt 2 Cable -> Thunderbolt 3 (USB-C) to Thunderbolt 2 adapter -> LG 27UK850-W 4K Monitor

  2. MacBook Air -> USB-A to HDMI adapter -> HDMI -> LG 27UK850-W 4K Monitor

Would there be any limitations with the display quality? Which one is the best way to connect the devices or do you have any other suggestions?

Permanently allow Chrome to access location

Posted: 17 Apr 2021 02:33 PM PDT

Recently, Google Chrome keeps loosing the ability to detect my location. When I open Google Maps, it has the icon indicating This site has been blocked from accessing your location and when I click it, a dialog containing Location is turned off in Mac system preferences is shown:

Location is turned off in Mac system preferences, This site has been blocked from accessing your location

So I have to go to Enable Location Services:

Need to Enable Location Services for Google Chrome again

But I am sure that I have done this several times recently. It seems that this setting is lost regularly (maybe for every Chrome auto-update?). How can I make this setting permanent?

Chrome's location setting constantly disabled

Posted: 17 Apr 2021 03:23 PM PDT

Whenever I open Google Chrome (including Chromium and Canary) on my Mac the location is set to off. So I must go to Preferences -> Security & Privacy -> Privacy -> Location Services and set Canary's location setting on.

However, I'm not sure why Chrome's location setting is set to off whenever I quit the app. How can I make the location setting permanent?

I lock the key icon on the privacy setting once I checked on the Chrome's location setting but it didn't work... I use macOS 11.0.1 (updated to 11.2 now) and found this is true on multiple macs.


UPDATE

I found out that this problem happens on all Chrome variants. Also, this even happened while I'm running the app.

How do I add the chapters title in Pages (Mac)?

Posted: 17 Apr 2021 04:49 PM PDT

I can add date, links, page numbers, but I would like to display as well the chapter titles in the header and it should be updated automatically when a chapter's title changes. Any ideas? I'm using pages 10.2 (7028.0.88)

How copy text into Terminal command line zsh?

Posted: 17 Apr 2021 02:43 PM PDT

Somehow something seems to have been changed with my Zsh configuration or Terminal settings under macOS Catalina (10.15.7). If I copy some text, say from a TextEdit window, the usual paste command and shortcut-key (⌘ CommandV) no longer paste that text onto the command line in Terminal.

How to fix this so it works as expected?

Why are some PDFs scrambled when opened with Preview on Mac?

Posted: 17 Apr 2021 08:30 PM PDT

Consider this PDF file for example. The text in this file appears scrambled when opened with Safari or Preview. However, the PDF is formatted fine when opened with Adobe Acrobat Reader DC or most 3rd party web browsers including but not limited to Gecko-based Firefox and Chromium-based Google Chrome, Microsoft Edge and Opera.

I wondered if it is because of some of the embedded fonts in the PDF file which perhaps I needed to install on my mac. So, I searched for these fonts and installed them on my system but to no avail. Perhaps it is a bug?

How would you deal with such PDF files when you want to primarily use Preview?


EDIT: I am using macOS Catalina 10.15.6 and Preview 11.0. In the attached screenshot, the left rendering is by Preview and the right one is by Adobe Acrobat Reader DC.

Comparison of Preview and Acrobat Reader DC

XCode crashes at start (at launch)

Posted: 17 Apr 2021 03:42 PM PDT

My XCode crashes with the following error

Process:               Xcode [972]  Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode  Identifier:            com.apple.dt.Xcode  Version:               11.2.1 (15526.1)  Build Info:            IDEFrameworks-15526001000000000~4 (11B500)  Code Type:             X86-64 (Native)  Parent Process:        ??? [1]  Responsible:           Xcode [972]  User ID:               167860746    Date/Time:             2020-07-20 16:14:09.203 +0300  OS Version:            Mac OS X 10.15.5 (19F101)  Report Version:        12  Anonymous UUID:        0B196765-5F42-FDBE-EF0C-E0879215BB57    Sleep/Wake UUID:       EF4EEF31-7B40-43FF-B0D2-316C16B8E1AE    Time Awake Since Boot: 970 seconds  Time Since Wake:       270 seconds    System Integrity Protection: enabled    Crashed Thread:        28  Dispatch queue: Diff queue for DVTDiffContext <0x7fe80b26e9a0>    Exception Type:        EXC_BAD_ACCESS (SIGBUS)  Exception Codes:       KERN_PROTECTION_FAILURE at 0x0000700003400000  Exception Note:        EXC_CORPSE_NOTIFY    Termination Signal:    Bus error: 10  Termination Reason:    Namespace SIGNAL, Code 0xa  Terminating Process:   exc handler [972]    VM Regions Near 0x700003400000:      Stack                  000070000337e000-0000700003400000 [  520K] rw-/rwx SM=COW  thread 28  --> STACK GUARD            0000700003400000-0000700003401000 [    4K] ---/rwx SM=NUL  stack guard for thread 25      Stack                  0000700003401000-0000700003483000 [  520K] rw-/rwx SM=COW  thread 25    Application Specific Information:  ProductBuildVersion: 11B500    Thread 0:: Dispatch queue: com.apple.main-thread  0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10  1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60  2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247  3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319  4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462  5   com.apple.HIToolbox             0x00007fff2c26eabd RunCurrentEventLoopInMode + 292  6   com.apple.HIToolbox             0x00007fff2c26e7d5 ReceiveNextEventCommon + 584  7   com.apple.HIToolbox             0x00007fff2c26e579 _BlockUntilNextEventMatchingListInModeWithFilter + 64  8   com.apple.AppKit                0x00007fff2a8b6829 _DPSNextEvent + 883  9   com.apple.AppKit                0x00007fff2a8b5070 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352  10  com.apple.dt.DVTKit             0x0000000102f8dfeb -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 390  11  com.apple.AppKit                0x00007fff2a8a6d7e -[NSApplication run] + 658  12  com.apple.AppKit                0x00007fff2a878b86 NSApplicationMain + 777  13  com.apple.dt.Xcode              0x0000000102667e8d main + 541  14  libdyld.dylib                   0x00007fff6763ccc9 start + 1    Thread 1:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 2:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 3:: Dispatch queue: <IDEXCBuildSupport.IDEXCBuildServiceBuildOperation:0x7fe80b473cd0:REfc>-builder-queue (QOS: UNSPECIFIED)  0   libsystem_kernel.dylib          0x00007fff6777de36 semaphore_wait_trap + 10  1   libdispatch.dylib               0x00007fff675e3aed _dispatch_sema4_wait + 16  2   libdispatch.dylib               0x00007fff675e3fbf _dispatch_semaphore_wait_slow + 98  3   libswiftDispatch.dylib          0x00007fff670ab17f OS_dispatch_semaphore.wait(wallTimeout:) + 15  4   com.apple.dt.IDE.XCBuildSupport 0x000000012900b8a2 closure #1 in IDEXCBuildServiceBuildOperation.addOperations(to:) + 306  5   com.apple.dt.IDE.XCBuildSupport 0x0000000129002829 thunk for @escaping @callee_guaranteed () -> () + 25  6   com.apple.Foundation            0x00007fff2fcb9ac5 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7  7   com.apple.Foundation            0x00007fff2fcb99e6 -[NSBlockOperation main] + 80  8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17  9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722  10  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17  11  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182  12  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83  13  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  14  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414  15  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703  16  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326  17  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92  18  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220  19  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 4:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 5:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 6:: Dispatch queue: -[IDEExecutionEnvironment initWithWorkspaceArena:] (QOS: UNSPECIFIED)  0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10  1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698  2   com.apple.Foundation            0x00007fff2fcc8ecb -[NSOperation waitUntilFinished] + 697  3   com.apple.Foundation            0x00007fff2fe5b270 __NSOPERATIONQUEUE_IS_WAITING_ON_AN_OPERATION__ + 17  4   com.apple.Foundation            0x00007fff2fd87df0 -[NSOperationQueue waitUntilAllOperationsAreFinished] + 229  5   com.apple.dt.IDEFoundation      0x000000010352738f __61-[IDEScheme _groupAndImposeDependenciesForOrderedOperations:]_block_invoke + 10  6   com.apple.dt.DVTFoundation      0x000000010280bf2d __DVTOPERATIONGROUP_CREATED_BY_CALLEE_IS_WAITING_ON_SUBOPERATIONS__ + 164  7   com.apple.dt.DVTFoundation      0x000000010280c196 -[DVTOperationGroup main] + 69  8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17  9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722  10  com.apple.dt.DVTFoundation      0x000000010280c146 -[DVTOperationGroup start] + 113  11  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17  12  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182  13  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83  14  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  15  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414  16  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703  17  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326  18  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92  19  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220  20  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 7:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 8:: Dispatch queue: NSOperationQueue 0x7fe80b4709b0 (QOS: UNSPECIFIED)  0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10  1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698  2   com.apple.Foundation            0x00007fff2fcc8ecb -[NSOperation waitUntilFinished] + 697  3   com.apple.Foundation            0x00007fff2fe5b270 __NSOPERATIONQUEUE_IS_WAITING_ON_AN_OPERATION__ + 17  4   com.apple.Foundation            0x00007fff2fd87df0 -[NSOperationQueue waitUntilAllOperationsAreFinished] + 229  5   com.apple.dt.IDEFoundation      0x00000001035a0c2f __75-[IDEBuildOperationGroup initWithBuildOperations:otherOperations:buildLog:]_block_invoke + 10  6   com.apple.dt.DVTFoundation      0x000000010280bf2d __DVTOPERATIONGROUP_CREATED_BY_CALLEE_IS_WAITING_ON_SUBOPERATIONS__ + 164  7   com.apple.dt.DVTFoundation      0x000000010280c196 -[DVTOperationGroup main] + 69  8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17  9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722  10  com.apple.dt.DVTFoundation      0x000000010280c146 -[DVTOperationGroup start] + 113  11  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17  12  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182  13  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83  14  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  15  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414  16  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703  17  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326  18  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92  19  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220  20  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 9:  0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10  1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60  2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247  3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319  4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462  5   com.apple.Foundation            0x00007fff2fcd81c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212  6   com.apple.DTDeviceKitBase       0x000000011acd844e +[DTDKRemoteDeviceConnection startServiceBrowsers] + 204  7   com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064  8   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148  9   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15    Thread 10:  0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10  1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60  2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247  3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319  4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462  5   com.apple.Foundation            0x00007fff2fcd81c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212  6   com.apple.DTDeviceKitBase       0x000000011ace5f7d -[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 636  7   com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064  8   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148  9   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15    Thread 11:: com.apple.CFSocket.private  0   libsystem_kernel.dylib          0x00007fff677860fe __select + 10  1   com.apple.CoreFoundation        0x00007fff2d66ace3 __CFSocketManager + 641  2   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148  3   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15    Thread 12:: JavaScriptCore bmalloc scavenger  0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10  1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698  2   libc++.1.dylib                  0x00007fff64910592 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 18  3   com.apple.JavaScriptCore        0x00007fff31e3c224 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 84  4   com.apple.JavaScriptCore        0x00007fff31e40a2b bmalloc::Scavenger::threadRunLoop() + 299  5   com.apple.JavaScriptCore        0x00007fff31e405f9 bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 9  6   com.apple.JavaScriptCore        0x00007fff31e42cd7 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::Scavenger*), bmalloc::Scavenger*> >(void*) + 39  7   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148  8   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15    Thread 13:: com.apple.NSEventThread  0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10  1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60  2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247  3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319  4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462  5   com.apple.AppKit                0x00007fff2aa58144 _NSEventThread + 132  6   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148  7   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15    Thread 14:: Dispatch queue: NSOperationQueue 0x7fe80b46bfb0 (QOS: UNSPECIFIED)  0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10  1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698  2   com.apple.Foundation            0x00007fff2fcc8ecb -[NSOperation waitUntilFinished] + 697  3   com.apple.Foundation            0x00007fff2fe5b270 __NSOPERATIONQUEUE_IS_WAITING_ON_AN_OPERATION__ + 17  4   com.apple.Foundation            0x00007fff2fd87df0 -[NSOperationQueue waitUntilAllOperationsAreFinished] + 229  5   com.apple.dt.IDEFoundation      0x00000001035a0c3b __75-[IDEBuildOperationGroup initWithBuildOperations:otherOperations:buildLog:]_block_invoke_2 + 10  6   com.apple.dt.DVTFoundation      0x000000010280bf2d __DVTOPERATIONGROUP_CREATED_BY_CALLEE_IS_WAITING_ON_SUBOPERATIONS__ + 164  7   com.apple.dt.DVTFoundation      0x000000010280c196 -[DVTOperationGroup main] + 69  8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17  9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722  10  com.apple.dt.DVTFoundation      0x000000010280c146 -[DVTOperationGroup start] + 113  11  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17  12  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182  13  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83  14  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  15  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414  16  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703  17  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326  18  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92  19  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220  20  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 15:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 16:: DYMobileDeviceManager  0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10  1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60  2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247  3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319  4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462  5   com.apple.Foundation            0x00007fff2fcd81c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212  6   com.apple.Foundation            0x00007fff2fd8ac6f -[NSRunLoop(NSRunLoop) run] + 76  7   com.apple.GPUToolsMobileFoundation  0x00000001205245a9 -[DYMobileDeviceManager _deviceNotificationThread:] + 126  8   com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064  9   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148  10  libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15    Thread 17:  0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10  1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60  2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247  3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319  4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462  5   com.apple.CoreFoundation        0x00007fff2d6c8519 CFRunLoopRun + 40  6   libSwiftPM.dylib                0x000000012479e146 closure #1 in FSEventStream.start() + 262  7   libSwiftPM.dylib                0x000000012461c7a2 closure #1 in Thread.init(task:) + 146  8   libSwiftPM.dylib                0x000000012461c8f9 thunk for @escaping @callee_guaranteed () -> () + 25  9   libSwiftPM.dylib                0x000000012461c8be @objc ThreadImpl.main() + 46  10  com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064  11  libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148  12  libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15    Thread 18:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 19:: Dispatch queue: Working Copy Cached Location Queue (QOS: UTILITY)  0   libsystem_kernel.dylib          0x00007fff6777de36 semaphore_wait_trap + 10  1   libdispatch.dylib               0x00007fff675e3aed _dispatch_sema4_wait + 16  2   libdispatch.dylib               0x00007fff675e3fbf _dispatch_semaphore_wait_slow + 98  3   com.apple.dt.Xcode.DVTSourceControl 0x000000010f04d5d3 __52-[DVTSourceControlWorkingCopy updateCachedLocations]_block_invoke + 141  4   com.apple.Foundation            0x00007fff2fcb9ac5 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7  5   com.apple.Foundation            0x00007fff2fcb99e6 -[NSBlockOperation main] + 80  6   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17  7   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722  8   com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17  9   com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182  10  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83  11  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  12  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414  13  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703  14  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326  15  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92  16  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220  17  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 20:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 21:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 22:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 23:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 24:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 25:: Dispatch queue: IDE Source Control File Path Processesing Queue  0   libsystem_kernel.dylib          0x00007fff6777e672 __getattrlist + 10  1   com.apple.Foundation            0x00007fff2fc7caa7 _NSResolveSymlinksInPathUsingCache + 1009  2   com.apple.Foundation            0x00007fff2fc7c56b -[NSString(NSPathUtilities) _stringByResolvingSymlinksInPathUsingCache:] + 155  3   com.apple.dt.IDEFoundation      0x00000001035b7f30 __64-[IDESourceControlWorkspaceMonitor addWorkspaceFilePathToCheck:]_block_invoke + 280  4   com.apple.dt.DVTFoundation      0x00000001029803ba __DVT_CALLING_CLIENT_BLOCK__ + 7  5   com.apple.dt.DVTFoundation      0x0000000102981a92 __DVTDispatchAsync_block_invoke + 809  6   libdispatch.dylib               0x00007fff675e26c4 _dispatch_call_block_and_release + 12  7   libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  8   libdispatch.dylib               0x00007fff675e8c44 _dispatch_lane_serial_drain + 597  9   libdispatch.dylib               0x00007fff675e95d6 _dispatch_lane_invoke + 363  10  libdispatch.dylib               0x00007fff675f2c09 _dispatch_workloop_worker_thread + 596  11  libsystem_pthread.dylib         0x00007fff6783da3d _pthread_wqthread + 290  12  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 26:: Dispatch queue: IDE Source Control Fetch File Reference Status Processing Queue (QOS: BACKGROUND)  0   libsystem_kernel.dylib          0x00007fff6777de4e semaphore_timedwait_trap + 10  1   libdispatch.dylib               0x00007fff675e3b6b _dispatch_sema4_timedwait + 76  2   libdispatch.dylib               0x00007fff675e3f97 _dispatch_semaphore_wait_slow + 58  3   com.apple.dt.IDEFoundation      0x000000010328dd79 __91-[IDESourceControlWorkingTree _updateStatus:forceAuthentication:workspace:completionBlock:]_block_invoke_2 + 807  4   com.apple.dt.DVTFoundation      0x0000000102952375 -[DVTOperation main] + 287  5   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17  6   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722  7   com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17  8   com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182  9   libdispatch.dylib               0x00007fff675e26c4 _dispatch_call_block_and_release + 12  10  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  11  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414  12  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703  13  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326  14  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92  15  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220  16  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 27:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 28 Crashed:: Dispatch queue: Diff queue for DVTDiffContext <0x7fe80b26e9a0>  0   com.apple.CoreFoundation        0x00007fff2d5cddcb __CFStrConvertBytesToUnicode + 23  1   com.apple.CoreFoundation        0x00007fff2d5d4633 _CFStringCheckAndGetCharacters + 128  2   com.apple.CoreFoundation        0x00007fff2d5d4594 -[__NSCFString getCharacters:range:] + 30  3   com.apple.dt.DVTFoundation      0x00000001027d05df __FNVHash_block_invoke + 229  4   com.apple.dt.DVTFoundation      0x00000001027d04bb FNVHash + 364  5   com.apple.dt.DVTFoundation      0x00000001027d001b -[DVTDiffContextOperation _buildDiffDescriptors] + 958  6   com.apple.dt.DVTFoundation      0x00000001027cf88e -[DVTDiffContextOperation main] + 734  7   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17  8   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722  9   com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17  10  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182  11  libdispatch.dylib               0x00007fff675e26c4 _dispatch_call_block_and_release + 12  12  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8  13  libdispatch.dylib               0x00007fff675e8c44 _dispatch_lane_serial_drain + 597  14  libdispatch.dylib               0x00007fff675e95d6 _dispatch_lane_invoke + 363  15  libdispatch.dylib               0x00007fff675f2c09 _dispatch_workloop_worker_thread + 596  16  libsystem_pthread.dylib         0x00007fff6783da3d _pthread_wqthread + 290  17  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15    Thread 29:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 30:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 31:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 32:  0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0    Thread 28 crashed with X86 Thread State (64-bit):    rax: 0x00000000000132b0  rbx: 0x00007fe815500000  rcx: 0x0000000000000066  rdx: 0x0000000000117d76    rdi: 0x00007fe815500018  rsi: 0x00007000033d9aa0  rbp: 0x00007000033d9a70  rsp: 0x00007000033d9a68     r8: 0x00007fff84fc23a0   r9: 0x0000000000117d76  r10: 0x0000000000117d76  r11: 0x00007fff2d5d4576    r12: 0x00007fe815500000  r13: 0x0000000000117d76  r14: 0x00007fff7194908d  r15: 0x00007fe80d2859b0    rip: 0x00007fff2d5cddcb  rfl: 0x0000000000010206  cr2: 0x0000700003400000      Logical CPU:     6  Error Code:      0x00000006 (no mapping for user data write)  Trap Number:     14      Binary Images:         0x102666000 -        0x102668fff  com.apple.dt.Xcode (11.2.1 - 15526.1) <615B5CCD-2B93-3F76-826B-8205D032D0E1> /Applications/Xcode.app/Contents/MacOS/Xcode         0x102671000 -        0x102699fff  com.apple.dt.DVTCocoaAdditionsKit (11.2.1 - 15513) <DBA5A0F1-54DE-3CC0-89EA-4E33075A0253> /Applications/Xcode.app/Contents/SharedFrameworks/DVTCocoaAdditionsKit.framework/Versions/A/DVTCocoaAdditionsKit         0x1026c1000 -        0x102cc0ff7  com.apple.dt.DVTFoundation (11.2.1 - 15513) <E922EEB1-FDC0-3233-93DF-195446D2DAD4> /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation         0x102f78000 -        0x10311ffff  com.apple.dt.DVTKit (11.2.1 - 15513) <A0941A35-13EC-32B0-8A09-4696E758480D> /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/DVTKit         0x10324b000 -        0x103b2ffff  com.apple.dt.IDEFoundation (11.2.1 - 15526.1) <42FBCB43-0A9E-3012-9270-6D42F08BCD14> /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation         0x10422f000 -        0x104be3fff  com.apple.dt.IDEKit (11.2.1 - 15526.1) <D2BA1164-38BD-3373-8A09-17DDB8157E01> /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/IDEKit         0x10537e000 -        0x1053bdff3  com.apple.DebugSymbols (194 - 194) <9B2838A7-E292-3008-B7B0-4A4CCBA423F6> /Applications/Xcode.app/Contents/SharedFrameworks/DebugSymbolsDT.framework/Versions/A/DebugSymbolsDT         0x1053df000 -        0x105465ffb  com.apple.CoreSymbolicationDT (11.2.1 - 64531.4) <340FC7F4-7582-38D1-BB9E-D05B0BE241C3> /Applications/Xcode.app/Contents/SharedFrameworks/CoreSymbolicationDT.framework/Versions/A/CoreSymbolicationDT         0x1054b9000 -        0x1054b9ff7  com.apple.contentdelivery.ContentDeliveryServices (4.00 - 1181) <1C5E9577-E8B8-30FB-92DE-BB90F77EF40A> /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/ContentDeliveryServices         0x1054c0000 -        0x1054e7ff3  com.apple.dt.instruments.DTXConnectionServices (11.2.1 - 64531.2) <56DECC43-6C08-3086-86CA-982830D32A5D> /Applications/Xcode.app/Contents/SharedFrameworks/DTXConnectionServices.framework/Versions/A/DTXConnectionServices  

I tried to google and found this question https://stackoverflow.com/questions/34451126/xcode-crashes-on-launch and tried to delete DerivedData folder but this hasn't resolved the problem and it keeps crashing. I don't have admin credentials on my machine, so I'm severely limited in what I can change.

Do I have to reinstall XCode or is there any other solution or workaround?

New MacBook with USB-C does not recognize an older DVD drive via USB to USB-C adapter

Posted: 17 Apr 2021 02:16 PM PDT

I just got a new MacBook and a QGeeM adapter between USB and USB-C. Trying to connect an older Apple DVD drive that has the usual USB connector. The new MacBook doesn't recognize that a device has been connected.

Tried restarting MacBook, connecting QGeeM to different USB-C and the DVD drive to different USB ports of QGeeM. At some point a popup appeared that the external device needs power and should be connected to a USB port, which makes no sense because it is. Tried to chat with Apple, but they were extremely unhelpful and dropped the chat.

Please suggest how to proceed.

Does Apple save a (hashed) version of my device passwords?

Posted: 17 Apr 2021 09:53 PM PDT

As earlier described in this question, I was asked today by my iPad to enter the user account password of my MacBook, and my MacBook later asked me to provide the passcode of my iPad. I'm specifically not talking about my iCloud password, the actual device passwords were requested and this behaviour is kind of known.

Now my question is: What happens to these passwords? Are they sent over to Apple? Are they used locally to decrypt something that has been encryted with that passcode?

So is Apple in possession of data that can be used to run brute-force attacks agains my device passwords? This would be totally against the idea of the T2-chip limiting brute-force attacks and I never agreed that such information is sent over to Apple and at no point was I informed about that. I'm not sharing my KeyChain with iCloud and do not wish to.

I couldn't find any exact information on that matter, anybody shedding some light on it is highly welcomed.

Can "ld" add the rpaths automatically to an executable if it can find the needed dylibs at link time?

Posted: 17 Apr 2021 08:45 PM PDT

The question is in the title, but anyway, let me explain it a bit more:

The most accepted way for correctly defining the install name for a dylib in MacOS is by making it relative to the rpath. For example:

otool -L ./LLVM/7.0.0/lib/libomp.dylib   ./LLVM/7.0.0/lib/libomp.dylib:        @rpath/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)     /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)  

Here, libomp.dylib has @rpath/libomp.dylib as its install name. So far so good.

The problem is when you create an executable linked to such a dylib. Even if you pass the correct -L/path/to/libomp.dylib flag at link time, so that ld can successfully link the executable, then you try to execute it, and obviously you get the following:

dyld: Library not loaded: @rpath/libomp.dylib    Referenced from: mydumbexecutable    Reason: image not found  Abort trap: 6  

This of course can be fixed by using install_name_tool on either the dylib (changing its install name so that it doesn't depend on the rpath, and linking the executable again, but this is not considered good practice), or, the recommended way, to use install_name_tool on the executable, adding to it the proper rpath so that the dylib can be found.

But... just wondering... isn't there a flag in ld that automatically adds the rpath for you? I mean, if ld is able to link the executable because it did find the dylibs, why cannot automatically store the proper rpath in the executable?

I understand this should be optional behaviour, as sometimes you prefer to define the rpaths yourself, but... a flag for doing it automatically would make my life a lot easier.

Can I disable pinch to show all open tabs in Safari?

Posted: 17 Apr 2021 11:49 PM PDT

Too often, when I try to move my cursor and click, or try to drag something or select text, and my two fingers end up on the trackpad at the same time, all my open tabs shrink into this view:

enter image description here

This is extremely disruptive as it makes me lose my focus and then I have to locate the page I was currently on, click it and then resume working.

I can't tell what this specific feature in Safari is called (I want to still be able to pinch to zoom in and out of a page), and couldn't find info anywhere on how to completely disable it.

Can I disable this? (or I can use another browser, obviously...)

How to convert a .pkg into an .app

Posted: 17 Apr 2021 02:34 PM PDT

Is it possible to convert a Package into an App? I have a complete installer of El Capitan as a pkg file and I need to install it. But first I need to make it an app.
I can't do it through the MAS because el Capitan is no longer available.

What programs have trouble with case-sensitive (HFSX) filesystems, and how to fix them?

Posted: 17 Apr 2021 02:57 PM PDT

There are some programs that require a case-sensitive filesystem, and others that require case-insensitive. Even though Apple warns against using case sensitive file systems, in some situations it is useful.

What programs have trouble with Case Sensitive (HFSX) systems?

What are the work-arounds?

In general, the problem is that the developers have a file in their app called FOO, but try to access the file by the name foo. In an HFS+ system that is case preserving but case insensitive, searching for foo will find FOO. That is not the case in HFSX. The general solution is therefore to

  1. Find the misnamed file or folder
  2. Make a copy, a link, or rename so the expected name is found

Recent Questions - Server Fault

Posted: 17 Apr 2021 10:38 PM PDT

Recent Questions - Server Fault


Windows AD OU Block (Read/List) Objects from other OU

Posted: 17 Apr 2021 07:38 PM PDT

I have a Root OU that has an OU called "Clients" and under I have multiple OU's and the client's PC's/User Accounts in sub-OU's.

The issue is, my clients can see other groups' user accounts/computers and need to prevent this as if they're on completely different machines and not under the same Domain. I am guessing I have to go make Deny rules for every single OU Group about every Client OU Group?

Currently, they can search AD for users and see other clients (not within a said company).

Any thoughts on how to do it and potentially with Powershell or just in general?

ESXi esxcli Error: Unknown command or namespace vm process kill –t=soft –w=67909

Posted: 17 Apr 2021 07:32 PM PDT

I'm running ESXi 6.5 embedded host client. When i ssh into the system I can run esxcli vm process list and get the expected output:

testserver1     World ID: 67909     Process ID: 0     VMX Cartel ID: 67908     UUID: someuuid     Display Name: testserver1     Config File: /vmfs/volumes/somelocation/testserver1/testserver1.vmx  

But if i run esxcli vm process kill –t=soft –w=67909 I get the error Error: Unknown command or namespace vm process kill –t=soft –w=67909

To confirm i'm running the correct command, i ran esxcli vm process kill -help and get

Error: Invalid option -h    Usage: esxcli vm process kill [cmd options]    Description:     kill                  Used to forcibly kill Virtual Machines that are stuck and not responding to normal stop operations.    Cmd options:    -t|--type=<str>       The type of kill operation to attempt. There are three types of VM kills that can be attempted:   [soft, hard, force]. Users should always                          attempt 'soft' kills first, which will give the VMX process a chance to shutdown cleanly (like kill or kill -SIGTERM). If that does not work                          move to 'hard' kills which will shutdown the process immediately (like kill -9 or kill -SIGKILL). 'force' should be used as a last resort                          attempt to kill the VM. If all three fail then a reboot is required. (required)    -w|--world-id=<long>  The World ID of the Virtual Machine to kill. This can be obtained from the 'vm process list' command (required)  

Can you see anything i'm doing wrong that might be preventing this command from working? I realize there's vim-cmd alternative in docs but i'm trying to figure out why the first option from the docs is responding like it's not even a valid command.

GITLAB AZURE PORTAL DEPLOYMENT

Posted: 17 Apr 2021 07:25 PM PDT

Before the update on Microsoft Azure deployment Center i can connect my gitlab repository and the portal successfully fetched the commits. But after the update i cannot deploy my gitlab repository to the Azure portal the same way. Does anyone know how to fix this?

Image for reference. Thanks!

LOGS SHOWS

Overlapping certificates

Posted: 17 Apr 2021 06:58 PM PDT

I came across two hosts which have overlapping certificates:

host 1: www.redacted.com    CN       = *.redacted.com                              AltNames = {*.redacted.com, redacted.com}  host 2: foo.redacted.com    CN       = foo.redacted.com                              AltNames = {foo.redacted.com}  

My problem is with caching. In my own proxy I cache the first certificate for both *.redacted.com and redacted.com, but then, when I visit the second host, I reuse the first certificate because *.redacted.com matches foo.redacted.com.

I can easily add a sort of "specificity rule", since foo.redacted.com seems more specific than *.redacted.com, but I'd like to know whether there is such a rule or the two certificates shouldn't overlap.

how to change user privileges from 'Y' to 'N' im mysql Server?

Posted: 17 Apr 2021 06:56 PM PDT

i want to change a privilege to my glpiuser from 'N' to 'Y' in mysql server what is the command to do this task her's the image that display my users i'm using Ubuntu 20.04.1

What happens if you make a mistake when you change the authoritative nameservers for a domain?

Posted: 17 Apr 2021 10:27 PM PDT

Say for example during a DNS migration to cloudflare, rather than transfering to "fred.ns.cloudflare.com" you typo'd "ferd.ns.cloudflare.com" or something similar for NS1, and the same kind of thing for NS2.

You realise this after the change has propagated, so you can no longer edit DNS on your original DNS host, but cloudflare never receives the domains.

Is there a way to recover from that kind of situation / would the transfer fail in the first place or something similar, or would you effectively just lose control of your DNS?

-- Not something that's actually happened to me, but something of a potential nightmare scenario that I can't find any information on, which makes me think I may be overly worried about nothing?

Unable to open PHP script files, even though I own them and have permissions

Posted: 17 Apr 2021 05:04 PM PDT

I'm using RHEL 8, and I have run into a crazy problem. My user account is unable to open PHP files.

If I have a file, owned by my user, and readable by my user, and I add <?php as the first line, I'm suddenly unable to open, edit, or view the file, even though I have not otherwise changed my permissions. It tells me: cat: test.txt: Operation not permitted

If I look at the file using file, I see the file reported as PHP Script once I add the above line.

It doesn't appear to be an SELinux problem, since setenforce 0 doesn't change the behavior, and audit2allow doesn't see anything.

It's possible this is happening to all script files, but on this server, I only need to use PHP scripts. Help!

EC2 instance doesn't show up in AWS Systems Manager

Posted: 17 Apr 2021 04:26 PM PDT

I am trying to create an EC2 instance (Amazon Linux, so I shouldn't have to configure the SSM agent as it should be autoconfigured) in a private subnet, and want to be able to SSH into it. According to this post I have to use AWS Systems Manager for this. I've done quite a bit with codestar/beanstalk before, but now simply want to be able to create and delete everything via the AWS CLI manually for learning purposes.

Here are the commands I'm able to run fine (the ec2 instance is created succesfully with my role)

aws iam create-role --role-name ec2-role --assume-role-policy-document file://roles/ec2-role.json  aws iam attach-role-policy --role-name ec2-role --policy-arn "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"  aws iam create-instance-profile --instance-profile-name ssm-instance-profile-for-ec2-instances  aws iam add-role-to-instance-profile --instance-profile-name ssm-instance-profile-for-ec2-instances --role-name ec2-role    // Creating the EC2 instance  aws ec2 run-instances --image-id ami-0db9040eb3ab74509 --count 1 --instance-type t2.micro --key-name key-pair-for-instance1 --subnet-id <my_valid_subnet_id> --iam-instance-profile Name=ssm-instance-profile-for-ec2-instances  

I took parts of these commands from this post.

My json file for ec2-role:

{    "Version": "2012-10-17",    "Statement": [      {        "Effect": "Allow",        "Principal": { "Service": "ec2.amazonaws.com"},        "Action": "sts:AssumeRole"      }    ]  }    

Unfortunately this instance isn't visible in the SSM (Systems Manager):

aws ssm describe-instance-information  {      "InstanceInformationList": []  }    

I have been following the main documentation on SSM and from what I understand from the page below is that all you would need is the AmazonSSMManagedInstanceCore policy: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-instance-profile.html

The web console hasn't been any help so far, according to this page it treats roles and instance-profiles as the same thing.

What am I missing here to be able to use the aws ssm command to start an ssh session?

Windows OpenVPN client 3.2.3 can only ping using FQDN. While OpenVPN client 2.5.1 can ping by both hostname and by FQDN

Posted: 17 Apr 2021 04:01 PM PDT

On my personal computer, I can only ping hostnames using the FQDN when using version 3.2.3 and version 2.7.1. Yet I am able to ping by hostname and by FQDN when using version 2.5.1.

However, one of my field co-worker's computer can ping hostnames without using the FQDN when using version 3.2.3. Sadly, they can't ping hostnames without using the FQDN when using version 2.5.1. I didn't try version 2.7.1, since version 3.2.3 worked.

enter image description here

Both of these computers are running Windows 10 and fully updated.

enough free pages but high number of major page faults and page reclaims

Posted: 17 Apr 2021 03:56 PM PDT

We find that for some servers io disk read is very high. We also notice that there are many major page faults on those servers. But we checked the /proc/zoneinfo, there are enough free pages. Here is the content of /proc/zoneinfo:

pages free     3913507          min      11333          low      14166          high     16999          scanned  0          spanned  16777216          present  16777216          managed  16507043      nr_free_pages 3913507  

We also use "perf" to monitor the event of "mm_filemap_delete_from_page_cache". Here is the result of perf:

7fff81189dd0 __delete_from_page_cache ([kernel.kallsyms])          7fff8119b771 __remove_mapping ([kernel.kallsyms])          7fff8119c8e8 shrink_page_list ([kernel.kallsyms])          7fff8119d45a shrink_inactive_list ([kernel.kallsyms])          7fff8119df55 shrink_lruvec ([kernel.kallsyms])          7fff8119e376 shrink_zone ([kernel.kallsyms])          7fff8119e880 do_try_to_free_pages ([kernel.kallsyms])          7fff8119ed6c try_to_free_pages ([kernel.kallsyms])          7fff816ac515 __alloc_pages_slowpath ([kernel.kallsyms])          7fff811932d5 __alloc_pages_nodemask ([kernel.kallsyms])          7fff811d7a68 alloc_pages_current ([kernel.kallsyms])          7fff811e27f5 new_slab ([kernel.kallsyms])          7fff811e40fc ___slab_alloc ([kernel.kallsyms])          7fff816adaf1 __slab_alloc ([kernel.kallsyms])          7fff811e609b kmem_cache_alloc ([kernel.kallsyms])          7fff812778ed proc_alloc_inode ([kernel.kallsyms])          7fff812234d0 alloc_inode ([kernel.kallsyms])          7fff81225771 new_inode_pseudo ([kernel.kallsyms])          7fff812257d9 new_inode ([kernel.kallsyms])          7fff8127bc1e proc_pid_make_inode ([kernel.kallsyms])          7fff812800e5 proc_fd_instantiate ([kernel.kallsyms])          7fff8127c54c proc_fill_cache ([kernel.kallsyms])          7fff812802dd proc_readfd_common ([kernel.kallsyms])          7fff812803f5 proc_readfd ([kernel.kallsyms])          7fff8121c246 vfs_readdir ([kernel.kallsyms])          7fff8121c665 sys_getdents ([kernel.kallsyms])          7fff816c2715 system_call_fastpath ([kernel.kallsyms])                 bab95 __getdents64 (/usr/lib64/libc-2.17.so)  

It seems that os is carrying on page reclaim. But I don't know since there are enough free pages, why could page reclaim ocurr?

SSH hanging after sending env LANG, only on one computer on network

Posted: 17 Apr 2021 03:41 PM PDT

I'm unable to SSH into a server from one machine on my network. I can successfully SSH using the exact same port, address, user, and ssh key from other machines on my network. When I try to connect, half of my MOTD is printed out and then the connection hangs. I figured it might be an issue with my terminal reading the MOTD, but I've tried several different terminals with the WSL bash shell and the problem is consistent.

What could the issue be, or what would be the next step to diagnosing this?

The server is running Ubuntu 20.04.2 LTS and OpenSSH 8.2p1


Desired

enter image description here

Actual

enter image description here


Successful Output

debug1: Authentication succeeded (publickey).  Authenticated to REDACTED ([REDACTED]:22).  debug1: channel 0: new [client-session]  debug1: Requesting no-more-sessions@openssh.com  debug1: Entering interactive session.  debug1: pledge: network  debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0  debug1: Sending environment.  debug1: Sending env LANG = en_US.UTF-8  debug1: Sending env LC_TERMINAL = iTerm2  debug1: Sending env LC_TERMINAL_VERSION = 3.3.7                           _              _   ___ _    ___   ___ | | ___   _  | | _____     / | '_ \ / _ \ / _ \| |/ / | | |/ _` |/ _ \ \ / /  \__ \ |_) | (_) | (_) |   <| |_| | (_| |  /\ V /  |___/ ./ \___/ \___/|_|\_\\__, |\__,_|\___| \_/      |_|                     |___/     Last login..........: root at Sat Apr 17 18:25 from REDACTED  

Failure Output

debug1: Authentication succeeded (publickey).  Authenticated to REDACTED ([REDACTED]:22).  debug1: channel 0: new [client-session]  debug1: Requesting no-more-sessions@openssh.com  debug1: Entering interactive session.  debug1: pledge: network  debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0  debug1: Sending environment.  debug1: Sending env LANG = en_US.UTF-8                           _              _   ___ _ __   ___   ___ | | ___   _  __| | _____   __  / __| '_ \ / _ \ / _ \| |/ / | | |/ _` |/ _ \ \ / /  \__ \ |_) | (_) | (_) |   <| |_| | (_| |  __/\ V /  

Nameserver invalid warning

Posted: 17 Apr 2021 02:54 PM PDT

I made my own nameserver configuration, but as you can see in the picture and the link, I am getting a (hostname) warning.

WARNING: At least one of your NS name does not seem a valid host name  The ones that do not seem valid:  ns2.bo(*).works ns1.bo(*).works  

Hosting provider nameserver IPs:

5.250.241.34  5.250.242.34  

My dedicated IP:

5.250.252.52  

My DNS Records:

Domain Provider DNS Settings:

Where am I making a mistake? Do I enter the dedicated IP in the fields? I could not understand! Why am I getting this error? How should it be properly configured?

Debian: LVM cache pool slows down WD Red HDD to 12 MB/s (no RAID)

Posted: 17 Apr 2021 03:54 PM PDT

I've a brand new WD RED 6 TB HDD (WD50EFAX) in my HP Microserver Gen 8 running Debian 10. I used LVM caching for years, to improve reading performance.

Today, I investigated a performance bottleneck when copying large files over SMB. It resulted in a dd test

dd if=/dev/zero of=test.xx bs=16M count=100  speedup 12 MB/s  

Disabling the LVM caching of the WD RED, this value was increased to 120 MB/s which is usual for such HDDs, I guess. The bottleneck occurs after a few hundred MB have been written. My cache size is 10G as you can see below.

The HDDs own write cache is disabled hdparm -W0 /dev/sdb I double checked this.

So, what could cause the LVM cache to slow down write performance? The cache type is write-through so it should work as pure read cache.

$ lvs -a    LV                 VG        Attr       LSize   Pool         Origin       Data%  Meta%  Move Log Cpy%Sync Convert    data               server-vg Cwi-aoC---  <5,47t [data_cache] [data_corig] 0,01   6,66            0,00    [data_cache]       server-vg Cwi---C---  10,00g                           0,01   6,66            0,00    [data_cache_cdata] server-vg Cwi-ao----  10,00g    [data_cache_cmeta] server-vg ewi-ao----  20,00m    [data_corig]       server-vg owi-aoC---  <5,47t    [lvol0_pmspare]    server-vg ewi-------  20,00m    root               server-vg -wi-ao---- <27,94g    swap_1             server-vg -wi-ao----3,96g                                                                                                                                                                                                                 

Does anyone have an idea what could cause this? With my old HDD (2 TB WD red) the performance was quite good.

I used thie tutorial (German, sorry) https://www.thomas-krenn.com/de/wiki/LVM_Caching_mit_SSDs_einrichten

lvs -o name,cache_policy,cache_settings,chunk_size,cache_used_blocks,cache_dirty_blocks /dev/server-vg/data  LV   CachePolicy CacheSettings Chunk  CacheUsedBlocks  CacheDirtyBlocks  data smq                       64,00k                2                0  

P.S. I know my disk uses SMR but I don't use a RAID So I don't think this "bug" could affect me.

How to install snapd on Oracle Linux 7.9

Posted: 17 Apr 2021 02:47 PM PDT

I am trying to install snapd on Oracle Linux Server 7.9 On many sites I have seen that it has been advised to install spand as follows

 sudo yum install epel-release   sudo yum -y install snapd  

But I am not able to install this repo on Oracle Linux (No package epel-release available.) Following repos are available in the system

ol7_MySQL80/x86_64   ol7_UEKR6/x86_64   ol7_addons/x86_64   ol7_developer_php74/x86_64  ol7_ksplice   ol7_latest/x86_64   ol7_oci_included/x86_64   ol7_optional_latest/x86_64   ol7_software_collections/x86_64   

Can someone tell me how to install snapd on Oracle Linux 7.9?

How do production web applications make backups? [closed]

Posted: 17 Apr 2021 09:26 PM PDT

So, I'm almost finished building my first major production web app, and am wondering how to manage the backup protocol.

Cold backups via my hosting control panel seem ideal - but daily downtime sounds awful for UX. Hot backups seem pointless as they cannot be trusted to not be corrupt.

My server runs Debian.

Is there a way to SSH in and clone the filesystem on my local machine, before encrypting with Veracrypt, before posting it to the moon, as an off-planet backup? (Lol.)

I suppose I don't need to backup the entire fs on a daily basis, but definitely Mongodb. What's the easiest way to automate a mongodb backup?

Thanks so much for reading :)

How to create an ansible-vault file from a task

Posted: 17 Apr 2021 02:52 PM PDT

I need to create an ansible-vault file to store credentials in a task in a playbook. This file would be used by another playbook. Is there an internal ansible method/module to accomplish this? I would prefer not to do it invoking shell/command. Any help would be highly appreciated.

How do I Pipe in Skip or Overwrite All when running the following bat?

Posted: 17 Apr 2021 02:54 PM PDT

How would I Pipe in Skip or Overwrite All (Always) to the following code?

NB! the code recursively extracts archives with folders and sub-archives.

FOR /D /r %%F in ("*") DO (   pushd %CD%   cd %%F       FOR %%X in (*.rar *.zip) DO (           "C:\Program Files\7-zip\7z.exe" x "%%X"       )   popd  )  

See below an example of the prompt:

zabbix agent vs agent2

Posted: 17 Apr 2021 10:17 PM PDT

I am working on deploying Zabbix in our organization and comparing zabbix agent vs agent2

I found following link which is useful,

https://www.zabbix.com/documentation...ent_comparison

I just have a couple of questions:

  • For agent2 "Daemonization" is "no". Does it mean agent2 service does not run in background? That does not seem right...
  • Similarly "Drop user privileges" is "no". To me it sounds like the service would run as "root". However on testing, I can see that service is running as "zabbix" user.

Also, is there anything else I should know when using agent2? e.g. any limitations, gotchas?

Thank you J

NFS server daemon fails to start at boot

Posted: 17 Apr 2021 04:47 PM PDT

I´m trying to export an external disk, so, I configured my nfs-server service to wait for disk1 to mount, however it fails.

This is the situation after boot:

$ systemctl status nfs-server.service  ● nfs-server.service - NFS server and services     Loaded: loaded (/etc/systemd/system/nfs-server.service; enabled; vendor preset: enabled)     Active: failed (Result: exit-code) since Sun 2020-04-26 14:46:28 CEST; 3min 7s ago    Process: 307 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)    Process: 312 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)    Process: 314 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)    abr 26 14:46:28 raspberrypi systemd[1]: Starting NFS server and services...  abr 26 14:46:28 raspberrypi exportfs[307]: exportfs: Failed to stat /media/pi/disk1: No such file or directory  abr 26 14:46:28 raspberrypi systemd[1]: nfs-server.service: Control process exited, code=exited, status=1/FAILURE  abr 26 14:46:28 raspberrypi systemd[1]: nfs-server.service: Failed with result 'exit-code'.  abr 26 14:46:28 raspberrypi systemd[1]: Failed to start NFS server and services.  

If I just restart the service it just works smoothly

$ sudo systemctl restart nfs-server.service  $ systemctl status nfs-server.service  ● nfs-server.service - NFS server and services     Loaded: loaded (/etc/systemd/system/nfs-server.service; enabled; vendor preset: enabled)     Active: active (exited) since Sun 2020-04-26 14:59:51 CEST; 4s ago    Process: 943 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)    Process: 944 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)   Main PID: 944 (code=exited, status=0/SUCCESS)    abr 26 14:59:51 raspberrypi systemd[1]: Starting NFS server and services...  abr 26 14:59:51 raspberrypi systemd[1]: Started NFS server and services.    

I configured the service to "Requires" and "After" disk1 mounts, but it didn´t work:

# /etc/systemd/system/nfs-server.service  [Unit]  Description=NFS server and services  DefaultDependencies=no  Requires=network.target proc-fs-nfsd.mount media-pi-disk1.mount  Requires=nfs-mountd.service  Wants=rpcbind.socket  Wants=nfs-idmapd.service    After=local-fs.target media-pi-disk1.mount  After=network.target proc-fs-nfsd.mount rpcbind.socket nfs-mountd.service  After=nfs-idmapd.service rpc-statd.service  Before=rpc-statd-notify.service    

Extra info requested:

  $ systemctl status media-pi-disk1.mount  ● media-pi-disk1.mount - /media/pi/disk1     Loaded: loaded     Active: active (mounted) since Sun 2020-04-26 14:47:34 CEST; 3h 22min ago      Where: /media/pi/disk1       What: /dev/sda1         $ egrep -v '^#|^$' /etc/fstab  proc            /proc           proc    defaults          0       0  /dev/mmcblk0p8  /boot           vfat    defaults          0       2  /dev/mmcblk0p9  /         $ lsblk  NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT  sda           8:0    0 931,5G  0 disk  └─sda1        8:1    0 931,5G  0 part /media/pi/disk1  mmcblk0     179:0    0  29,7G  0 disk  ├─mmcblk0p1 179:1    0   2,4G  0 part  ├─mmcblk0p2 179:2    0     1K  0 part  ├─mmcblk0p5 179:5    0    32M  0 part  ├─mmcblk0p6 179:6    0   512M  0 part /media/pi/System  ├─mmcblk0p7 179:7    0  12,1G  0 part /media/pi/Storage  ├─mmcblk0p8 179:8    0   256M  0 part /boot  └─mmcblk0p9 179:9    0  14,5G  0 part /        $ mount  /dev/mmcblk0p9 on / type ext4 (rw,noatime)  devtmpfs on /dev type devtmpfs (rw,relatime,size=217076k,nr_inodes=54269,mode=755)  sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)  proc on /proc type proc (rw,relatime)  tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)  devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)  tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)  tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)  tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)  cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)  cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)  bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)  cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)  cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)  cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)  cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)  cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)  cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)  systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)  debugfs on /sys/kernel/debug type debugfs (rw,relatime)  mqueue on /dev/mqueue type mqueue (rw,relatime)  sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)  nfsd on /proc/fs/nfsd type nfsd (rw,relatime)  configfs on /sys/kernel/config type configfs (rw,relatime)  /dev/mmcblk0p8 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)  tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=44280k,mode=700,uid=1000,gid=1000)  gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)  fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)  /dev/sda1 on /media/pi/disk1 type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)  /dev/mmcblk0p7 on /media/pi/Storage type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)  /dev/mmcblk0p6 on /media/pi/System type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)      

rewrite URL in htaccess and remove everything but parameter

Posted: 17 Apr 2021 04:47 PM PDT

Is it possible to turn this URL:

example.com/send.php?url=google.com&name=&submit=submit  

Into this URL:

example.com/google.com  

When I try I just keep getting 404 or 500 errors and it's frustrating.

Here's a few thing's I've tried.

RewriteRule ^([^/]*)$ /send.php?url=$1&name=&submit=submit [NC,L]  RewriteRule ^([-\w\.]*)$ /send.php?url=$1&name=&submit=submit [NC,L]  RewriteRule ^(.*)$ /send.php?url=$1&name=&submit=submit [NC,L]  

If it's not possible then please could you tell me why it's not. I'm rather new to mod_rewrite and want to learn.

Error using mod_jk in httpd: undefined symbol: ap_get_server_version

Posted: 17 Apr 2021 06:52 PM PDT

We just recently installed a new RHEL7 server. Inside of this server, we have a bunch of vhosts, and inside the vhosts there is a couple of lines that looks like this -

JkMount /rules_engine/rulesApi/rules/* rulesEngine  JkMount /api/* rulesEngine  JkMount /rules_editor/* rulesEngine  

So in order to handle this, we use mod_jk inside of our apache configuration. However, when I try to start apache, I get the following error -

Syntax error on line 1 of /etc/httpd/conf.d/mod_jk.conf: Cannot load /etc/httpd/modules/mod_jk.so into server: /etc/httpd/modules/mod_jk.so: undefined symbol: ap_get_server_version  

The mod_jk.conf file is inside of /etc/httpd/conf.d, and it looks like this -

LoadModule jk_module /etc/httpd/modules/mod_jk.so  JkWorkersFile /etc/httpd/conf.d/workers.properties  JkLogFile /var/log/httpd/mod_jk.log  Change to WARN or ERROR for Prod  JkLogLevel info  JkShmFile /var/log/httpd/mod_jk.shm  JkMount /rulesApi/rules/* rulesEngine  JkMount /api/* rulesEngine  JkMount /* rulesEditor  JkMount /rules_editor/* rulesEditor  

Any ideas as to what that error means, and how I can get httpd to start?

Thanks.

MySQL [ERROR] Can't start server: can't create PID file: No such fie or directory

Posted: 17 Apr 2021 03:44 PM PDT

I'm having trouble starting mysql and mysqld.

Output of sudo service mysql start command is mysql : Unrecognized service

Same way output of sudo service mysqld start is nothing

When I tried sudo service mysqld status it says stopped

I went through /var/log/mysql.log found this error :

2015-10-20 08:00:54 23694 [Note] InnoDB: 128 rollback segment(s) are active.  2015-10-20 08:00:54 23694 [Note] InnoDB: Waiting for purge to start  2015-10-20 08:00:54 23694 [Note] InnoDB: 5.6.21 started; log sequence number 1600607  2015-10-20 08:00:54 23694 [Note] Server hostname (bind-address): '*'; port: 3306  2015-10-20 08:00:54 23694 [Note] IPv6 is available.  2015-10-20 08:00:54 23694 [Note]   - '::' resolves to '::';  2015-10-20 08:00:54 23694 [Note] Server socket created on IP: '::'.  2015-10-20 08:00:54 23694 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to fie '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)  2015-10-20 08:00:54 23694 [ERROR] Can't start server: can't create PID file: No such fie or directory  151020 08:00:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended  

For which I looked online and tried to fix issue which said to be of the permission, So I created to fix this error which /var/run/mysqld for mysql.pid and I did chown the directory to mysql:mysql

But still the problem persist. Can anyone help me out with this!

Thanks

Apache: Request exceeded the limit of 10 internal redirects due to probable configuration error - WooCommerce

Posted: 17 Apr 2021 03:44 PM PDT

I have a woocommerce site. I have a recursive error in the Apache error.log:

[Mon Nov 02 17:04:58.723578 2015] [core:error] [pid 2922] [client 172.31.12.207:19044] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://gremyo.com/wp-content/themes/bishop/woocommerce/style.css  [Mon Nov 02 17:04:58.812460 2015] [core:error] [pid 2928] [client 172.31.12.207:19045] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://gremyo.com/wp-content/themes/bishop/woocommerce/style.css  [Mon Nov 02 17:13:58.112870 2015] [core:error] [pid 3100] [client 172.31.27.233:39991] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.  [Mon Nov 02 17:13:58.430530 2015] [core:error] [pid 2905] [client 172.31.27.233:39992] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.  [Mon Nov 02 17:23:23.530340 2015] [core:error] [pid 3205] [client 172.31.11.223:48080] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://gremyo.com/wp-signup.php?new=publisherweb  [Mon Nov 02 17:25:08.819153 2015] [core:error] [pid 3244] [client 172.31.27.233:40380] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://muyinteresante.gremyo.com/  

I have seen the error happens when a javascript fires up a window with the detailed images (referer ...style.css) in the single product page. The google-chrome console registers these errors:

Failed to load resource: the server responded with a status of 500 (Internal Server Error) https://gremyo.com/wp-content/themes/bishop/fonts/WooCommerce.woff   Failed to load resource: the server responded with a status of 500 (Internal Server Error) https://gremyo.com/wp-content/themes/bishop/fonts/WooCommerce.ttf   

I have this in the .htaccess file, related to chrome errors.

<IfModule mod_headers.c>  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">  Header set Access-Control-Allow-Origin "*"  </FilesMatch>  </IfModule>  

However, the error appear in more places of the site (I haven't identified them yet).

The reason to investigate this is the site doesn't load properly CSS in some product pages when they're cached. I use wp-super-cache and autoptimize plugins.

Do you have an idea to help me?

Thanks!

Openvas ldap authentication configuration

Posted: 17 Apr 2021 02:43 PM PDT

I'm stuck in the process of Openvas ldap authentication configuration.

I use the following openvas components version from upstream:

openvas libraries - 8.0.3    openvas manager - 6.0.3    

(both installed from self made ppa repo openvas8)

Distro - Ubuntu 14.04.2 LTS

I found example.auth.conf in libraries sources tarball. With the help of strace i found the directory where openvasmd expected to find it's auth config:

PREFIX/var/lib/openvas/openvasmd/auth.conf    

Due to empty PREFIX variable for me the path is following:

/var/lib/openvas/openvasmd/auth.conf  

Then i raised the logging level 127=>128 for openvasmd (also runnig in verbose mode -v, cause without that flag interesting info could not be found in logs)

Following the information a found in mailing list archives (example yeah it's rather outdated =\) i added to the config:

[method:ldap]    order=2    enable=false    ldaphost=my_ldap_server_hostname    authdn=uid=%s,my_dn    allow-plaintext=false  

I also commented method:file section for test purposes. But after the service restart and login attempt (using GSAD web interface) i found in openvasmd.log:
lib auth:WARNING:2015-06-23 12h04.38 utc:15352: Unsupported authentication method: method:ldap.

And also the obvious result of login:

md    omp:  DEBUG:2015-06-23 14h33.05 utc:17775:    XML  start: authenticate (0)    

... - setting my creds, by the way password in log file was in plain text format

md    omp:  DEBUG:2015-06-23 14h33.05 utc:17775:    XML    end: authenticate      md   main: /<authenticate_response status="400" status_text="Authentication failed"/  

First of all, i thought it was misconfiguration issue while compiling the libraries (without ldap support flag). But both libraries and openvas manager are linked with ldap libs (i also added ldap dev libs to the debian/control file as build dependencies for packages):

ldd /usr/lib/libopenvas_misc.so.8.0.3 | grep ldap      libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007fc3529e9000)    ldd /usr/sbin/openvasmd | grep ldap      libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f83fdead000)  

And i found no references of method:ldap in libraries source files. Only method:ldap_connect was found but it's so called "Per-User ldap authentication". If i correctly understand the conception it is an authentication mechanism for already created users with the right to authenticate via ldap, i've tested it and it works fine (this fact confirms openvas libraries/manager were compiled with ldap support). But it's not a full ldap integration feature i need.

How to configure nDPI for iptables

Posted: 17 Apr 2021 08:54 PM PDT

I am new to nDPI, I have installed nDPI but when I add rules like;

iptables -I OUTPUT -m ndpi --http -j REJECT it shows error

iptables v1.4.7: Couldn't load match `ndpi':/lib64/xtables/libipt_ndpi.so: cannot open shared object file: No such file or directory

Try `iptables -h' or 'iptables --help' for more information.

Plz, if anyone can tell me how to configure iptables for nDPI. I am using centOS 6.5

Thanks;

mod_security2.so: undefined symbol: ap_unixd_set_gl

Posted: 17 Apr 2021 06:52 PM PDT

service httpd restart  Stopping httpd:                                            [  OK  ]  Starting httpd: httpd: Syntax error on line 205 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_security2.so into server: /etc/httpd/modules/mod_security2.so: undefined symbol: ap_unixd_set_global_mutex_perms                                                             [FAILED]  

my httpd file:

LoadModule unique_id_module modules/mod_unique_id.so  LoadFile /usr/lib/libxml2.so  #LoadFile /usr/lib/liblua5.1.so  LoadModule security2_module modules/mod_security2.so  

any ideas? google has nothing.

I followed these guidelines: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#wiki-SVN_Access

Apache is 2.2.15 PHP is 5.3.3

I installed apache/php via yum

Samba share, local group, AD users

Posted: 17 Apr 2021 07:49 PM PDT

I have a Debian 6 system running Samba 3.5.6 that has been successfully set up to authenticate against an Active Directory domain (via SSH that is). I have a directory (let's call it /foo) that I want to be editable by both local users and AD users. I have created a local group "fooedit" and added both the local users and domain users to it. I have set up the neccessary ACLs on /foo to allow fooedit users to edit the files and tested it to be functioning via SSH for both the local and AD users.

I would like the AD users to be able to edit via share as well, but can't seem to get the right configuration. They can see the share, but it prompts them for credentials when trying to access it and credentials don't work. Is this possible and if so what do I need to do it? I don't want to do this with an AD group if possible because I may need to do this on many machines with different users on each machine, so a local group would be cleaner.

smb.conf:

[foo]  path = /foo  writeable = yes  browseable = yes  valid users = @fooedit  

getfacl /foo:

# file: foo  # owner: bar  # group: fooedit  # flags: -s-  user::rwx  group::rwx  mask::rwx  other::---  default:user::rwx  default:group::rwx  default:other::---  

/etc/group:

...  fooedit:x:69:adsuser  ...  

... and go!

svn: Too many arguments to import command

Posted: 17 Apr 2021 07:49 PM PDT

Having a problem with the --message flag to the svn import command. On some servers it works, but on others it gets confused if the message contains spaces, even if you single or double quote the message string thus:

    svn import -m 'New stuff added' https://my-remote-repo/SVN/repo/path  

When it fails, I get the error:

    svn: Too many arguments to import command  

If I limit the message to one without any spaces, it succeeds everytime. Clearly the problem is with the command failing to recognise a quoted string, but why?

Differences between whether it succeeds or not seems to be down to the particular OS/Shell combination I'm using. The command works on SUSE 10.3 with Ksh Version M 93s+ 2008-01-31, but fails on RHEL 5.6 with Ksh Version AJM 93t+ 2010-02-02. Or perhaps that's a red herring, and the real problem is something else differing between environments?

Automating ssh-copy-id

Posted: 17 Apr 2021 02:50 PM PDT

I have some arbitrary number of servers with the same user/pass combination. I want to write a script (that I call once) so that

ssh-copy-id user@myserver

is called for each server. Since they all have the same user/pass this should be easy but ssh-copy-id wants me to type the password in separately each time which defeats the purpose of my script. There is no option for putting in a password, ie ssh-copy-id -p mypassword user@myserver.

How can I write a script that automatically fills in the password field when ssh-copy-id asks for it?

Exchange 2010 add mailbox server to DAG error

Posted: 17 Apr 2021 08:54 PM PDT

i'm having some problems when adding a second mailbox server to my DAG in Exchange 2010. The test setup goes like this: 1x windows server 2008 (DC/DNS) 2x windows server 2008 (Exchange 2010)

I have made sure all services are up and running and that the "Exchange Trusted Subsystem" account is set as a local admin.

When i create a DAG i can add the first mailbox server (A) without any problems, but when i go to add the second (B) it gives me an error saying "Unable to contact the Cluster service on 1 other members (member) of the Database availability group.

It does the same if i add (B) first and then try to add (A).

Here is a part of the log file:

[2010-04-05T15:00:27] GetRemoteCluster() for the mailbox server failed with exception = An Active Manager operation failed. Error: An error occurred while attempting a cluster operation. Error: Cluster API '"OpenCluster(EXCHANGE20102.area51.com) failed with 0x6d9. Error: There are no more endpoints available from the endpoint mapper"' failed.. This is OK.

[2010-04-05T15:00:27] Ignoring previous error, as it is acceptable if the cluster does not exist yet. [2010-04-05T15:00:27] DumpClusterTopology: Opening remote cluster AREA51DAG01. [2010-04-05T15:00:27] DumpClusterTopology: Failed opening with Microsoft.Exchange.Cluster.Replay.AmClusterApiException: An Active Manager operation failed. Error: An error occurred while attempting a cluster operation. Error: Cluster API '"OpenCluster(AREA51DAG01.area51.com) failed with 0x5. Error: Access is denied"' failed. ---> System.ComponentModel.Win32Exception: Access is denied --- End of inner exception stack trace ---

Any help would be really appreciated, thanks.

OSCHINA 社区最新推荐博客

Posted: 17 Apr 2021 10:26 PM PDT

OSCHINA 社区最新推荐博客


HarmonyOS开发者日在上海举办 激发开发者无限潜能

Posted: 17 Apr 2021 01:27 AM PDT

4月17日,HarmonyOS开发者日于上海召开,活动吸引了大批开发者的关注与参与。现场华为技术专家向与会嘉宾分享了HarmonyOS的最新进展、全新技术特性以及开发实践。此外,还有丰富的创新技术体验,更有CodeLabs的HarmonyOS分布式开发挑战,开发者的热情超出预期。 HarmonyOS生态蓬勃发展 用户体验再上新台阶 在本次活动上,...

Service Mesh 从“趋势”走向“无聊”

Posted: 16 Apr 2021 05:09 AM PDT

![头图.png](https://ucc.alicdn.com/pic/developer-ecology/6c0ec29129554535a40dd788a7e06394.png) 作者 | 李云(至简) 来源 | [阿里巴巴云原生公众号](https://mp.weixin.qq.com/s/J34ujEMq5V-5ADZnxOsELw) 过去一年,阿里巴巴在 Service Mesh 的探索道路上依旧扎实前行,这种坚定并非只因坚信 Service Mesh 未来一定...

手写Vue2.0源码-Mixin混入原理

Posted: 16 Apr 2021 03:09 AM PDT

前言 此篇主要手写 Vue2.0 源码-Mixin 混入原理 上一篇咱们主要介绍了 Vue 异步更新原理 核心是运用 nextTick 实现异步队列 此篇主要包含 Mixin 混入 这是 Vue 里面非常关键的一个 api 在 Vue 初始化的时候起到了合并选项的重要作用 适用人群: 没时间去看官方源码或者看源码看的比较懵而不想去看的同学 正文 Vue.mixin(...

鸿蒙内核源码分析(信号分发篇) | 任务和信号能比喻成什么关系? | 百篇博客分析HarmonyOS源码 | v48.01

Posted: 16 Apr 2021 02:22 AM PDT

[百万汉字注解 >> 精读鸿蒙源码,中文注解分析, 深挖地基工程,大脑永久记忆,四大码仓每日同步更新<](https://gitee.com/weharmony/kernel_liteos_a_note)[ gitee ](https://gitee.com/weharmony/kernel_liteos_a_note)[| github ](https://github.com/kuangyufei/kernel_liteos_a_note)[| csdn ](https://codechina.csdn....

鸿蒙开源第三方组件——MPAndroidChart图表绘制组件

Posted: 16 Apr 2021 12:57 AM PDT

目录: 1、前言 2、背景 3、组件效果展示 4、sample解析 5、library解析 6、《鸿蒙开源第三方组件》系列文章合集 前言 本组件是基于安卓平台的图表绘制组件MPAndroidChart( https://github.com/PhilJay/MPAndroidChart),实现了其核心功能的鸿蒙化迁移和重构。目前代码已经开源到(https://gitee.com/isrc_ohos/mpand...

算法很美,听我讲完这些Java经典算法包你爱上她

Posted: 13 Apr 2021 09:02 PM PDT

大家好,我是小羽。 对于编程来说的话,只有掌握了算法才是了解了编程的灵魂,算法对于新手来说的话,属实有点难度,但是以后想有更好的发展,得到更好的进阶的话,对算法进行系统的学习是重中之重的。 对于 Java 程序员来说,这一门后端语言只是我们的外功,我们更多的是学习它的语法,框架以及一些工具的使用。而算法才...

No comments:

Post a Comment

End of Summer Sale ☀️😎

20% OFF Inside!🤯 ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏...