## Why won’t my onClick Event always fire when clicked?

My main menu shows differently for different screen sizes. It’s not finished, but for now if the viewport is bigger than 1220px, it shows a horizontal menu bar. If the viewport is smaller than 1220px, it shows an icon on the right side and when clicked, this icon gets a class of “open” applied to it, it’s height changes from 0 to ‘auto’ and thus, it shows its menu content.

I’m using jQuery for the menu icon:

``\$  (".burger-nav").on("click", function() { \$  ("#main-nav ul").toggleClass("open"); }); ``

Now the thing is that sometimes this function fires when the icon gets clicked, and sometimes it doesn’t. I’ve tried a lot of scenarios (scroll up/down, expand/close menu while scrolling, resize screen, tried different pages, …) but I can’t find a consistency that could point me towards the source of the error.

I’ve started out with JavaScript and jQuery not too long ago and learned a lot since then (I think), but by no means am I an expert (as I’m sure my coding shows).

Anyway, this is the code for the function for my main menu.

``function checkWidth() {     let windowWidth = \$  (window).width();     let maxWidth = 1220;     var menu = document.getElementById("main_menu");     var logo = document.getElementById("mad-logo");      if (windowWidth < maxWidth) {       if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10) {         //mobile menu-icon         \$  (".burger-nav").on("click", function(event) {           event.preventDefault();           \$  ("#main-nav ul").toggleClass("open");         });          logo.width = '180';         menu.style.backgroundColor = 'rgba(0,0,0,0.8)';        } else {         //menu-icon         \$  (".burger-nav").on("click", function() {           \$  ("#main-nav ul").toggleClass("open");         });          logo.width = '250';         menu.style.backgroundColor = 'rgba(0,0,0,0.8)';       }      } else if (windowWidth > maxWidth) {        if (document.body.scrollTop > 80 || document.documentElement.scrollTop > 80) {         menu.style.backgroundColor = 'rgba(0,0,0,0.8)';         logo.width = '200';       } else {         menu.style.backgroundColor = 'rgba(0,0,0,0)';         logo.width = '300';       }     }   } ``

The function gets called on document.ready, on ‘resize’ and on window.onscroll.

``\$  (document).ready(function() {   checkWidth(); }    \$  (window).on('resize', function() {     checkWidth();   });    window.onscroll = function() {     checkWidth();   }; ``

The menu.style and logo.width lines seem to be working. Also, when I console.log windowWidth, that value seems correct.

Why won’t my on.click event always fire when the icon with the class .burger-nav gets clicked?

If you have other kinds of tips for my code, please feel free to share it. I appreciate it.

## Do any two spanning trees of a simple graph always have some common edges?

I tried few cases and found any two spanning tree of a simple graph has some common edges. I mean I couldn’t find any counter example so far. But I couldn’t prove or disprove this either. How to prove or disprove this conjecture?

## Does this equation E[X+Y]=E[X]+E[Y] always apply?

I am a student studying statistics and I have some questions about $$E(X)$$.

Am I right in understanding that $$E[X+Y]=E[X]+E[Y]$$ for every random variable $$X$$ and $$Y$$, but $$V[X+Y]=V[X]+V[Y]$$ only when $$X$$ and $$Y$$ are independent?

## Can I make capslock always switch to the same language input?

My MacBook 12′ has the Chinese (Simplified, pinyin) hardware keyboard and it has the default function on capslock that lets you switch the language input between Chinese and English.

However, I also use Japanese, Korean and Russian keyboards and found out that the capslock doesn’t let you switch between Chinese and English. It just switches to the last used keyboard. So for example, if you type in English, switch to Korean, switch to English, and tap on the capslock, you get the Korean keyboard, not Chinese.

I always want Chinese keyboard on whenever I tap capslock. Is it possible on macOS?

## SPUtility.SendEmail() always returns false

I have one application which will create task form for each level based on the prior level approval. While creating each tasks I have to send the email to the users who all are involved in the task. For this I am using SPUtility.SendEmail() method. But unfortunately, it didn’t work so far. The debugger successfully passed through the SendEmail method without any exception. but the value will always false. The SMTP server is working for the application other than the SP Applications. My code is shown below.

``  SPSecurity.RunWithElevatedPrivileges(delegate()             {                 using (SPSite spSite = new SPSite(SiteURL))                 {                     using (SPWeb spWeb = spSite.OpenWeb())                     {                         headers = new StringDictionary();                         headers.Add("to", To);                         headers.Add("from", From);                         headers.Add("cc", CC);                         headers.Add("bcc", BCC);                         if (Priority.Equals("High"))                         {                             headers.Add("X-Priority", "1 (Highest)");                             headers.Add("X-MSMail-Priority", "High");                             headers.Add("Importance", "High");                         }                         headers.Add("subject", Subject);                         headers.Add("content-type", "text/html");                         Status= SPUtility.SendEmail(spWeb, headers, Body);                     }                 }             }); ``

## Facebook – If I send a message request to someone who is not my friend, do they always get notified?

I have searched online for an answer to this question, however, the answers seem to be quite ambiguous.

Basically, if I message request someone who is not my friend on Facebook (but who is friends with some of my friends) will they be notified that I have messaged them?

It seems that Facebook has 2 folders, the main “inbox” and another folder where message requests get deposited, some of which are filtered into a memory hole, never to be seen again (if the Facebook algorithm suspects it is spam) and another “quiet” inbox where message requests that Facebook suspects the recipient might want to read are deposited. However, it is unclear whether the recipient gets any kind of notification, alert or (1) appears on the tab by this folder.

Can anyone confirm their experiences of whether they have been alerted to message requests on Facebook from people who are not their friends?

Thank you.

## What triggers Always On Display’s display of seconds?

I’m using a Samsung A320F/DS with AOD in “show always” mode. Android is 8.0.0, AOD has only a single page (without the player). Clock style is set up as

``  22:59 TUE 3 JULY   84%🔋 ``

But one day, when I extracted my phone from the pocket, I found it displaying time as `12:00:41`, changing seconds every second. I didn’t pay attention at first, and hid the phone back into the pocket. After some time, when I extracted it again to use, the seconds appeared to have gone.

But now I wonder: what triggered this display of seconds? How do I reproduce this? I’ve tried tapping everywhere, pressing sensor buttons at the bottom, holding them, pressing/holding menu button, volume buttons, but the phone didn’t react.

EDIT: I’ve found that on the Lock Screen, I can get seconds by tapping the clock area. Then the screen dims a bit, and the clock begins to display seconds — until the screen turns off. I still wonder how I triggered this in the Always On Display.

## Getting always the same Hash with Node.js and Multer

I’ve tried to change multer/storage/disk.js file so I can storage a hash everytime I upload a file, but the fact is that I’m always getting the same hash even uploading different files.

This is what I’ve done.

``DiskStorage.prototype._handleFile = function _handleFile (req, file, cb) {    var that = this   var hash = crypto.createHash('sha256')    that.getDestination(req, file, function (err, destination) {     if (err) return cb(err)      that.getFilename(req, file, function (err, filename) {       if (err) return cb(err)        var finalPath = path.join(destination, filename)       var outStream = fs.createWriteStream(finalPath)        file.stream.pipe(outStream)       outStream.on('error', cb)       outStream.on('data', function (chunk) {         hash.update(chunk)       })        outStream.on('finish', function () {         cb(null, {           destination: destination,           filename: filename,           path: finalPath,           size: outStream.bytesWritten,           hash: hash.digest('hex')          })       })     })   }) } ``

It’ s like this section isn’t doing anything

``outStream.on('data', function (chunk) {         hash.update(chunk)       }) ``

## Assuming that everyone always performs a revocation check, do we still need expiration time in each certificate?

I understand that each public key certificate includes an expiration time, and a CRL is issued periodically, listing all currently revoked certificates. However, in class we were told to think about whether or not we still needed expiration time in each certificate assuming a revocation check is always performed. I feel like we would still need an expiration time in each certificate because then, how would we know when a certificate is revoked?

If anyone could help broaden my mindset, it would be much appreciated

## Crop image by horizontal lines, but they are not always straight using command line

I have a lot of images looking like this

Is there a way to follow the horizontal lines and make a new image from to top of the line to the bottom of the horizontal line and between the end of the image and next horizontal line? I have research using ImageMagick, but i didnt find anything that will work for me. The is the code that it is currently not working for me

``./multicrop -f 10 -m save [Source] [Destination] ``