What does XProtect protect/secure on Mac OS X?

Question: My research so far has found XProtect appears at first glance to be a basic AV engine that scans DMG & apps through Safari, Chrome and Firefox. I'm looking to understand what does it actually do and what does it exactly monitor outside of DMG and apps? I've read it doesn't provide protection from BitTorrent and removable USB thumb drives. What else?
Answer: The Xprotect "system" is not really an AV engine as such. It looks for a very limited number of text strings, or "signatures," in specific types of files. For this reason, it is far less useful than a real AV program (up to you if you think one is necessary). In addition, it only checks files downloaded with certain apps: Safari, Mail, Messages, and third-party apps that have activated a setting to use Xprotect to check their files as well. Also, it only sets a flag on files, and depends on user interaction for protection. So an un-savvy user may see the dialog warning that a file is dangerous, but still click the necessary button to open it.
As you say, it doesn't protect against BitTorrent downloads (though specific BitTorrent clients could use the feature), and doesn't protect from files copied from any kind of removable media or files copied over a network.
Comment: I work in the security industry and couldn't find technical specifics. You have more or less answered my question - thanks again!
Comment: Apple used to have a page giving some of the above information, but I can't find it right now.
Comment: @Kirk - Is this the page that you mean? [About the "Are you sure you want to open it?" alert (File Quarantine / Known Malware Detection) in OS X](http://support.apple.com/en-us/HT201940)
Answer: This is Apple's explanation:

About the "Are you sure you want to open it?" alert (File Quarantine / Known Malware Detection) in OS X
OS X improves download validation by providing file quarantine in applications that download files from the Internet. This means that
  downloads are checked for safety (known malware) when you try to open
  them.
File Quarantine
File quarantine-aware applications that download files from the
  Internet, or receive files from external sources (such as email
  attachments), attach quarantine attributes.

Quarantine-aware applications include Safari, Messages, iChat and    Mail.
These attributes include date, time, and a record of where the file    was downloaded from.

When you open a file received through a quarantine-aware application,
  OS X warns you where the file came from. You receive an alert asking,
  "Are you sure you want to open it?" You should click Cancel if you
  have any doubts about its safety.

If you have multiple user accounts on your Mac, the user account that
  downloaded the file is the only user account that can remove the
  quarantine attribute on a file. All other user accounts can open a
  quarantined file, but they are still presented with an alert asking
  "Are you sure you want to open it?" every time they open the file.
Known malware check
Mac OS X Snow Leopard v10.6 and later also check for known instances
  of "malware", or malicious software. When you open a quarantined
  file, OS X checks to see if it includes known malware. If so, an alert
  message similar to the following appears:
If you see "(file name) will damage your computer." You should click
  Move to Trash.

If the file is a disk image, you should click Eject Disk Image and
  then delete the source file.

Tip: Click the Help icon in the lower left corner of the alert message
  for more information about malware.
Blocking web plug-ins
To help limit exposure to potential "zero day" exploits from web
  plug-in enabled content, OS X also blocks specific versions of web
  plug-ins from functioning – including Java web apps, or Adobe Flash
  content. Typically an update to the web plug-in is available on the
  same day, or shortly after OS X blocks the web plug-in. Install the
  new update to restore web plug-in function.
Gatekeeper
OS X Lion v10.7.5 and later include Gatekeeper, a technology that
  allows developers to sign applications. Signed applications normally
  don't present an alert when you download and open them. Internet files
  downloaded from other applications get file quarantine attributes but
  without date, time, and link of the file downloaded.
Advanced users only
You can toggle the ability of File Quarantine to receive updates from
  Apple about malware and web plug-ins.
Important: Deselecting this option disables the ability to identify
  new malware, and leaves your Mac vulnerable to new malware without
  notification.

Source: About the "Are you sure you want to open it?" alert (File Quarantine / Known Malware Detection) in OS X


Disk block per table?

Question:
At T1, insert comes for table_1, goes to disk block_1.
At T2, insert comes for table_2, can it go to same disk block_1(provided block_1 has space) or new block will be created per table ?
At T3, again insert comes for table_1, can it go either block_1 or block_2 based on available space ?
Comment: If by "disk block" you mean the database file page, a page can belong to one table only; you can't have records from different tables in the same page.
Answer: InnoDB (the default Engine in MySQL) allocates separate "blocks" for each table.
A "block" is 16KB, regardless of what size the OS or disk controller does.
Yes, a table with one small row is "wasting" a lot of disk space.  But if you have a million rows, the percentage waste will be lower.
Similarly, each INDEX (except for leaf nodes of the PRIMARY KEY) will use disk in blocks of 16KB.
Use this to see the "Data_length" and "Index_length":
SHOW TABLE STATUS LIKE 'T1';

I created a table with 2 secondary indexes, but have not put any rows in it yet:
mysql> SHOW TABLE STATUS LIKE 'mod%'\G
*************************** 1. row ***************************
           Name: modification
         Engine: InnoDB
        Version: 10
     Row_format: Compact
           Rows: 0
 Avg_row_length: 0
    Data_length: 16384        -- one 16KB block for data
Max_data_length: 0
   Index_length: 32768        -- two 16KB blocks, one per index
      Data_free: 0
  ...

Those 3 blocks belong to that one table; no sharing.

Disk block per table?


Pork tenderloin was put into hot oven which was accidentally turned off for 1 and 1/2 hours. Was it safe to finish cooking?

Question: I had a partially frozen pork tenderloin that I browned on all sides, then put into a hot oven at 365 degrees.  At some point the oven was accidentally turned off.  An hour and a half later I discovered the oven was warm, but off.  The internal temp of the pork at this point was 120 degrees.  I then turned the oven back on and finished cooking to an internal temp of 180 degrees. It was actually very tender.  Is it safe to eat?
Answer: I don't think anyone will want to tell you that your meat is definitely safe, but there are a couple of factors that lead me to believe you're just fine.

It's generally recommended that pork be cooked to 145°F. However, that doesn't mean that at 145° suddenly all the bacteria die at once. It's actually more of a curve, so the longer the meat is at a particular temperature the more bacteria will be killed. You can sous vide pork for at least an hour at 130° and it will be safe to eat.
Because you cooked it to 180° (well above the necessary temp to kill bacteria), you surely killed off everything and its brother. The risk factor is going to be instead any toxins created by the bacteria during the time it was in the "danger zone" of 40°-140°F, which in your case probably wasn't very long.

Other factors that will come into play is how the meat was handled and stored before cooking. Was it flash frozen by the butcher? Did it ever thaw and then refreeze? Was was the health of the animal before it was slaughtered? Also very important: you say it was partially thawed. Do you buy it frozen and then partially thaw it in the fridge or on the counter (you should thaw in the fridge)?


Static noise when NO audio playing

Question: I have this issue where I hear a static noise coming from my speakers that goes away when I start playing any audio and comes back after a few seconds when I am not playing any audio.
Answer: Following these instructions, I ran pulseaudio in verbose mode:
$ systemctl --user stop pulseaudio.socket
$ systemctl --user stop pulseaudio.service
$ pulseaudio -v

And I found the following output each time the static noise started:
I: [pulseaudio] module-suspend-on-idle.c: Source alsa_input.usb-Logitech_Logitech_Wireless_Headset_88C626977831-00.multichannel-input idle for too long, suspending ...
I: [alsa-source-USB Audio] alsa-source.c: Device suspended...
I: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-0000_07_00.6.analog-stereo idle for too long, suspending ...
I: [alsa-sink-ALC887-VD Analog] alsa-sink.c: Device suspended...
I: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-0000_07_00.1.hdmi-stereo idle for too long, suspending ...
I: [alsa-sink-HDMI 0] alsa-sink.c: Device suspended...
I: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.usb-Logitech_Logitech_Wireless_Headset_88C626977831-00.analog-stereo idle for too long, suspending ...
I: [alsa-sink-USB Audio] alsa-sink.c: Device suspended...

Then, I commented out this line from /etc/pulse/default.pa:
### load-module module-suspend-on-idle

Finally, I reboot my computer and the static noise was gone :)
Comment: On behalf of user @BlackThorne: "I didn't have a static noise, I had a pulse-like waveform audio, but same behavior, similar output in verbose, solved using this answer".
Answer: The issue is caused by the audio going into power-save mode. There are two ways that I know of to work around the issue:

Disable audio power-save for pulseaudio by editing the file /etc/pulse/default.pa, and comment out the line

load-module module-suspend-on-idle

You can comment a line by prepending a '#' to the beginning of the line.
This seems to be the most popular solution, as I found it in many places including Fabian's answer.

Disable power save for the audio device system-wide by running the command

echo 0 | sudo tee /sys/module/snd_hda_intel/parameters/power_save

This solution I found at https://www.makeuseof.com/fix-static-noise-from-speakers-linux/.
At the end of the day, I don't think it matters how you workaround the issue. Personally, I prefer the second option because it is more general as it does not depend on pulseaudio.
Comment: `snd_hda_intel` - that seems hardware-specific? Is it possible that for some people with different audio hardware, and accordingly, a different driver / module, this measure wouldn't work?
Comment: It might be hardware-specific, but I wouldn't know. From the link I shared, there was no indication that it is hardware-specific. In any case, it worked for me, so I figured I would share it.

Static noise when NO audio playing


Where can I find a searchable text of Valmiki Ramayana online?

Question: I want to be able to search across the entire Valmiki Ramayana for certain words or phrases. The IIT Kanpur webpage has divided the text across sargas which you have to click to different pages to navigate through. But I want to be able to search across the entire text at once. Is there any such resource available?
Answer: The search can be done in the Bombay Indology website. Here, the text is divided based on Kandas, rather than sargas, which makes the search easier. However, this is the Critical Edition of the Valmiki Ramayana and this is not the same as the IIT edition.
In the Bombay Indology website, the sloka search in can be done both in Devanagari and English.


What is the word for "a series of two related works"?

Question: Here dilogy is defined as "a series of two related works". I can't shake off the feeling that there is a more commonly used word for this. Is there? If yes, what is it?
Comment: *Duology* is much more commonly used, but that is a miscegenous word mixing a Latin prefix with a Greek root, and such words obviously must be avoided, even at the cost of making oneself incomprehensible. ;-)
Comment: An unfinished Trilogy? ;)
Comment: Yep, that's helpful. Apparently this is as good as it gets: http://en.wikipedia.org/wiki/Trilogy#Other_numbered_series
Comment: What is it for just one?
Comment: Related: http://english.stackexchange.com/questions/323221/can-i-say-two-series-to-describe-a-series-of-two-events?noredirect=1&lq=1
Answer: A duology is a pair of related novels, plays or films.
Comment: +1 to this because it's what popped into my mind, and is the  most likely one of the answers so far a layperson will both recognize as a word and understand the meaning of (do to the prevalence of "trilogy")
Answer: "diptych",  sense 3 : a work made up of two matching parts (ref: Merriam-Webster).
Answer: Two works do not a series make.  In fact, two of anything do not a series make.
Carlo, however, has the correct answer here: it's a diptych, which is like a triptych but with two pieces instead of three.  Wikipedia has a brief article on it.
Here is more about its etymology, from the OED:

Latin diptycha (pl.), a. late Greek δίπτυχα pair of writing-tablets, neut. pl. of δίπτυχος double-folded, f. δι-, δίς twice + πτυχή fold. Cf. mod. French diptyque, C. 1700 in Hatz.-Darm.

Diptych does enjoy some currency as a work comprising two halves.  For example:

The 2nd, and darker portion, of this volume devotes most of its space to lamentations for the poets estranged daughter, for his deceased parents, and for a enigmatic hell-raiser of a perplexing but beloved cat, a very human quadruped. — Diptych: Voyage to Ernie Spirit, Swell a Large Lament and Other Fictions

Furthermore, award-winning author Dan Simmons often refers to his two-volume stories as diptychs, such as the Ilium and Olympos pair.  For example, from Dan's own website:

Page 284 This long quote from Marcel Proust–which figures twice in the text, here and on page 459–comes from LE CÔTÉ DE GUERMANTES. This might be the crux of the ILIUM/OLYMPOS diptych, if not of Dan's entire œuvre.

And it's not just Simmons.  Here is one critic writing about another pair of novels of Dan's:

[A] Simmons fan will note that a similar problem affected the Endymion diptych: The first volume wasn't terribly useful, but the second one was the whole point of the setup. — [citation]
Comment: @FeralOink: If you mean *oeuvre*, it's more commonly used to refer to a writer's total output; best avoided, if only to reduce confusion.
Comment: In Art History, both diptych and especially triptych are used to refer to two or three panels or leaves of a painted work. I have seen diptych used to describe two related works of fiction by the same author, though it isn't common. The reason it isn't common is because it isn't standard usage in publishing or literature to refer to two books as a series. Ouvre might work if both were published as one volume, but that's more formal and should be used with care so as to avoid pretense.
Comment: @TimLymington Yes, yes! That is what I meant! Oeuvre, as a body of work. If the entire output were two works, then it could be used, but that is unlikely and rather a special case. Thank you!
Answer: Dyad is commonly used for pairs of things.
Here is a dyad of definitions:

Dictionary online
and
Webster's historical dictionaries

There's a whole set of related words with increasing valence: monad, dyad, triad, tetrad, pentad, hexad, etc.
Comment: The second definition is a great resource, however, it explicitly states that it uses Webster's 1828 and 1913 versions, and doesn't contain modern usages of language. The first link is good, but it confirmed my impression that dyad is used for two of something in chemistry or astronomy etc., with no explicit mention of two books or works of literature.
Comment: @Feral: Sure, for literature I'd go with the more specific duology, but the original question does not expressly mention books or works of literature.
Comment: Yes, I did mean literature, but did not mention it in the question, so you are quite right.
Answer: A common pair of words in usage is prequel and sequel.
Comment: That would require a third work in-between.
Comment: I do not think that that word means what you think it means.
Comment: @RegDwighт: I agree, good point!


Can't write text into textbox in ASP.NET web app

Question: I have an ASP.NET web application.
In the codebehind for the .ascx page (which I embed as below), I attempt to write a string to a textbox in a method like this:
Code for embedding control:
Control ctrl = Page.LoadControl("/RackRecable.ascx");
            PlaceHolder1.Controls.Add(ctrl);
Method to make string for inserting into textbox:
<code>   string AppendDetails()
    {
        StringBuilder sb = new StringBuilder();

        sb.Append("msg" + "    " + textbox1.Text etc etc );

        return sb.ToString();
    }
</code>
Called as (in codebehind event handler for button click):
<code>            this.TextBox4.Text = AppendDetails();
</code>
I call it by using ATextBox.Text = AppendDetails (in the button click event handler). The textbox TextBox4 is in the designer file so I am confused why the text does not get written into this textbox (it is readonly and enabled).
When stepping through, the textbox4 control will successfully show the text I want it to display in quick watch but not in the actual page, it won't.
Any ideas?
Thanks
Answer: I think that's because the textbox is readonly. Remove the readonly property before applying the text, then put it back afterwards.
Answer: I fixed this by placing the textbox inside of the Panel.
Comment: This would be much better if you showed the code you used. Obviously, given that it is 4.5 years later, that may not be easy to do at this point.


BaseX Database Add in Java

Question: I am quite new to developing using the BaseX api, and I keep running into some trouble with one of the methods. I have a database created and opened, but when I try to use the Add method it throws an exception. See this page for an example from BaseX.
I have created the Database in another section of the code, and the file I am trying to add also exists on my computer. My snippet of code looks like this:
<code>//Opens the database
new Open(databaseName).execute(context);

//adds file to database
new Add("", directoryPath + indexName + "/" + catalog.getInternalID() + ".Catalog.xml").execute(context);
</code>
The error I am getting is this:

org.basex.core.BaseXException: "~/cdsp.Catalog.xml" (Line 1):
  whitespace expected, attribute name found.

I do not really know what this means, when I try to add other xml files to the database they work and I have not found much googleing this exception. Any help would be much appreciated. Thanks!
Answer: I am not sure if you are still running in this problem.
Anyway it looks like your XML file contains an attribute where white space is expected.
You could try opening cdsp.Catalog.xml in an editor of your choice and see what is there at line 1.
Hope this helps,
Michael

BaseX Database Add in Java


prevent user with ID 1 edit

Question: I would like to prevent admin site (user id 2) to remove or change password user with id 1 although i need to admin add users and edit another users.
how to do this?
Answer: This is a Drupal no, no.  Leave root user alone. Just leave it.  If you are worry about security, change the username admin, to something else (admin is the most commonly use name hacker try to use).   Then just use uid 2 to administrate the site.
Comment: it doesnt solve my problem. beacuase  admin site check user list at first. site have 2 users. himself and main admin(with any idea). he edit my pass and login with my id. and now he is administrator. do u mean i delete record id 1?
Comment: ah I think I know what you are talking about now,  I'll submit another answer
Answer: The User Protect module helped me.
Comment: If I have other role with permissions for edit users, the User Protect module prevent other role modify the user admin?  How can I configurate it the module?  I did a test with the other role and can modify the admin user.

prevent user with ID 1 edit


Performance of Google Desktop Search on Windows 7

Question: I have read that that installing Google Desktop Search on Vista can slow down the computer because Vista already has a search indexing feature, and adding Google's separate indexing feature results in a performance hit. (Google hints at this in their FAQ here.) Does this problem also exist in Win 7? Is there a workaround that improves performance?
Answer: I don't have any experience with Google Desktop on Windows 7 but I would suggest you try it out with the Windows indexer disabled. Hit Winkey+R, type services.msc, find Windows Search in the list, right click and hit properties, change startup type to disabled and reboot.
Answer: RexE,
Windows 7 improves the users experience by changing the way performance is delivered (I.E. Resource consumption). To learn more about Windows 7, please see the following link: http://windows.microsoft.com/en-US/windows7/Optimize-Windows-7-for-better-performance


How are these components called?

Question: I need to build a structure like the one in the picture below. Basically, it is a pendulum that holds a measurement hammer and lets it oscillate without friction. I don't know how to find the two necessary components (the one that holds the hammer and the one that is fixed on the shaft). How are they called?
Comment: Are you talking about the entire assembly? A subassembly? One part? It isn't clear from the image what you want named. Part of this may be because certain components are visually overlapping. (The image is appreciated, but may be insufficient to answer the question.)
Answer: There are a few identifiable things in the picture

The large P shaped object would be called a 'bearing housing', this looks like it may have been custom manufactured for this application, it is certainly not  a very common component although it is broadly similar to a pillow block which are readily available. The one in the example is probably machined from billet of steel or aluminium (possibly based on some other component but I'm not sure what).
the o shaped component holding the horizontal shaft is a needle roller bearing. This class of bearing has the rolling elements bearing directly onto the shaft they support rather than having an inner shell.
The horizontal shaft is probably silver steel or similar, this is convenient for shafts fitted to bearings as it is available precision ground to standard sizes and has good wear and mechanical properties.

This would be a fairy simple job for any machine shop as the important operations are just drilling and tapping holes. Machining the P shape is a bit more involved but that is not strictly necessary for the basic functionality. at  a push you could do it with a pillar drill and a hacksaw.

How are these components called?


Mouse grips: How much will I benefit from using a claw or fingertip grip over a palm grip, and is it worth the additional fatigue?

Question: I've been reading about several different ways to use a mouse for gaming, including palm, claw, and fingertip grips.  I understand that the claw and fingertip grips allow for more precise movement and faster button presses than the palm grip, but how much of a difference in game-play performance can I expect, as measured by K/D ratios or other similar metrics?  Is this worth the additional fatigue?
Comment: What has happened to me is that my mid-finger knuckles have locked up, making it difficult to press the buttons, like a hyper-extension cramp. I must be a palmer. I use a Deathadder. The further side mouse button (A.K.A. XButton2/mouse5) is hard to press (without risk of hitting the closer) without palming. It seems that the top of my mouse has been worn down, so I have to be between palming and fingertipping.
Comment: Hmmm, the strange thing about this is that there is still another difference in gripping, you could use your left mouse button with your trigger finger and your middle finger on the right. Or you could use the ring finger on the scroller and ring finger on the right.
Comment: before I saw this question, i never thought about it, but now I realize that I've naturally evolved to a fingertip grip, just felt natural to me.
Comment: Anecdotally, I use a fingertip grip I adopted without conscious effort from years of using relatively small mice, e.g. Logitech Mini Optical, Logitech VX Nano. Contacting a mouse with my palm feels very strange to me. I notice no hand fatigue except for occasional soreness in my middle finger joint during days of heavy mouse wheel usage. (I don't know how this grip affects my mousing performance.)
Answer: I (being a great Razer fan) looked this question up on the Razer website. THIS is what I found.
In a nutshell:
Advantages of the palm grip: the user is able to move the mouse at higher speeds, and achieve higher Inches Per Second (IPS) ratings. The palm grip is also considered one of the most comfortable grip styles for gaming where the gamer is able to continue playing for extended hours without experiencing fatigue.
Disadvantages of the palm grip: in order to keep the point of contact with their palm and the back of the mouse intact, users will find it difficult to perform fine tuning with their fingers.
Advantages of the claw grip: Precise and quick movement, fast access to the 4th and 5th mouse button.
Disadvantages of the claw grip:  Does not feel natural, your hand gets tired faster.
Advantages of the fingertip grip: Same as claw grip but with more agility.
Disadvantages of the fingertip grip:  Most hand fatigue of any technique hardest one to learn.
Personally I started off using the claw grip method on a fingertip designed mouse and after I got used to the claw grip I switched to the fingertip grip. This probably took me around 2 weeks.
I also would like to add that if you don't use a high sensitivity setting for example under 6/10 I would suggest the palm grip, otherwise you would have to move your wrist while turning around and that is not the most enjoyable thing to do with fingertip grip. I use a sensitivity of 9 so I only need to move my mouse for 1 or 2 inches and I'm across the screen and turned 2 circles.
Comment: It depends on your mouse aswell IMO, I'm using the palmgrip on the Cyborg Rat 9 mouse, and because the mouse allows for alot of customization I can reach the side buttons without a problem.
Comment: this is true but as you can see on the website i provided the difference in the differed grips is the speed and accuracy of the movement not the actual grip.
Comment: I know, but the Razers have had a standard setup, so while it is true for most mouses that the accuracy is less, it is not for all. Btw maybe you can add this paragraph in your awnser aswell : The palm grip is also considered one of the most comfortable grip styles for gaming where the gamer is able to continue playing for extended hours without experiencing fatigue.


Which verbs cannot be used in the progressive form in any case?

Question: We know for a fact that if a stative predicate is used in the progressive form, it will change the meaning of the sentence, e.g. 'I have a car' / 'I'm having a headache', where in the former a possessive meaning is given, and in the latter an experience meaning is given. According to the official IELTS grammar book, there are some verbs which cannot absolutely be used in the progressive form. Is it because they do not change meaning in the progressive form and thus don't make grammatical sense? If so, would 'own' be a good example? In this case would you be able to share a list of verbs that don't make grammatical sense in the progressive form?
Comment: https://www.ecenglish.com/learnenglish/lessons/non-continuous-verbs
Comment: Related and I'd say an essential starting point: [I am having ...](https://english.stackexchange.com/questions/284151/i-am-having) (especially John Lawler's answer).
Comment: @KarlG I was not asking for that, rather a list of verbs which can't, in any case be used in continuous form. (I'm loving x can be used, for instance)
Comment: @EdwinAshworth indeed, my question was based off of his answer, but I wanted an answer containing verbs which cannot change meaning, and therefore cannot, in any case, be used in continuous form, if that makes sense.
Comment: Note the caveat (to the point of contradiction) in the article KarlG gives: 'verbs that _cannot_ be used in continuous forms are usually verbs that you cannot see somebody doing. These verbs _are rarely_ used in continuous forms....'
Answer: Practically speaking, every verb can be used in the continuing form.  If you're speaking English as a second language and don't want to sound outlandish, there are some simple rules, as noted by the commenters above.
However, the continuing form of a verb allows you to convey a slightly different message to your reader or listener.
For example, abstract verbs can be used in the continuing form if you want to describe a state of being in contrast to a preceding or subsequent state:

The experience changed her.  She is appreciating what she still has.
When he looked back, it all seemed so simple.  He was owning his house, having his friends in for parties on the weekends, fearing The Big One, but disliking intensely his neighbor with the basement full of survival kit. Then it all changed.

By using a verb form that normally gets used in describing concrete and visible actions, you distance yourself slightly from the subject.
Comment: I suggest that using such a list is a pathway to madness. You arrive at the choice of a continuous tense by considering the meaning you need, not via any rules for how certain verbs may or may not be used.


Bounded variation functions have jump-type discontinuities

Question: I read on the Wikipedia page that bounded variation (BV) functions have only jump-type discontinuities. Why is that? Suppose at some $a\in\mathbb{R}$, the limit $\lim_{x\rightarrow a^+}f(x)$ doesn't exist (or is infinite). Why would such a function $f$ not be BV?
Comment: A BV function can be expressed as sum of two monotone functions (each with different direction of growth). So the problem reduces to showing that a monotone function can only have jump kind of discontinuity. See the answer http://math.stackexchange.com/a/581672/ for more details.
Answer: If $f$ is unbounded near $a$, it can clearly not have bounded variation, since
$$V(f,[a,b]) \geqslant \lvert f(x)-f(a)\rvert$$
for all $x \in (a,b]$.
If $-\infty < m = \liminf\limits_{x \searrow a} f(x) < \limsup\limits_{x\searrow a} f(x) = M < +\infty$, let $\varepsilon = (M-m)/3$. Then we can find sequences $x_n \searrow a$ and $y_n \searrow a$ with $x_n > y_n > x_{n+1}$ and $f(y_n) < m+\varepsilon$, $f(x_n) > M-\varepsilon$ for all $n$, so
$$V(f,[a,b]) \geqslant \sum_{n=1}^N \lvert f(x_n) - f(y_n)\rvert \geqslant N\cdot \varepsilon.$$
Letting $N\to \infty$, we see that then $V(f,[a,b]) = +\infty$.
Comment: This is cool as you have directly shown how non-existence of left and right limits interferes with bounded variation. As mentioned in my comment to the question I normally reduce any BV function to monotone function. So essentially this proof of yours is very simple and smart.(+1)


10.8.4 pretending updates don't exist

Question: I just upgraded to 10.8.4; I had to do this by downloading the update .dmg from Apple as my computer has decided on its own to opt-out of software updates. Both the App Store and softwareupdate report that there are no updates available even though I know full well that there is a Java update and iTunes is not the latest version. What is wrong with it?
Answer: Do you have a non admin user account? Then available system updates and updates for Apple software will not show in the Mac App Store when invoking Software Update. What you can do is the following: Open Mac App Store, click on "Updates" and then press cmd-R. A dialogue will open asking for your admin name and password. Then all available updates for OS X and Apple software will be listed.
Comment: Sadly, no, I'm using an admin account. The softwareupdate command line tool I tried even requires sudo.

10.8.4 pretending updates don't exist


How does Windows NCSI Passive Probing work?

Question: I am on Windows 10.
When connected to a new network, Windows checks for internet connectivity using Active Probing which I know is a series of tasks. After determining internet connection Windows switches to Passive Probing until connection remains active. I can't find anything related to it anywhere. Would be helpful if someone with fair knowledge of the working sheds light. TIA.
Comment: Already gone through it but it does not cover the said issue.
Answer: Windows uses active probing to validate that internet connectivity is possible on each network interface, then updates the Network Connectivity Status Indicator (NCSI).  During active probing, Windows probes several Microsoft DNS servers and uses the responses to determine an active internet connection.  The computer has an active polling loop where it continually polls dns.msftncsi.com until the next packet to process becomes available.
In passive probing, live network traffic is captured and analyzed, without interfering with the network, i.e. not sending any packets out.  Passive probing looks at the TTL (Time To Live) in the IP header of TCP/UDP packets which can determine how many "hops" the packet has taken to reach the computer.  A packet with more than 8 hops is considered to have Internet Connectivity.
From the Windows Security Encyclopedia, passive polling is defined as:

This Policy setting enables you to specify passive polling behavior.
  NCSI polls various measurements throughout the network stack on a
  frequent interval to determine if network connectivity has been lost.
  Use the options to control the passive polling behavior.

source
Comment: Thanks for your response. Where does the "8 hop rule" come from? Is it a standard?
Comment: Network connectivity can be defined as the probability that a given node in a network has an N-hop route.  The greater the hop count, the better the network connectivity, and the more stable the network.  However, the more hops there are, the less likely a packet is to be discovered.  So a hop count too high will cause networks which may have network connectivity to not be discovered. But a hop count too low may cause networks with low connectivity and stability to be deemed connectable.

https://journals.sagepub.com/doi/pdf/10.1177/1550147716683606
Comment: The 8 hop rule was likely influenced by this, though I am unaware of how Microsoft arrived at 8 specifically or if it is a standard.
Comment: I have upvoted already.
Comment: To configure the 8 hop rule, you can add DWORD `MinimumInternetHopCount` under `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet` in the registry, and set it to a lower hop count such as 1 or 2 if you feel you have connectivity and your network connectivity indicator doesn't think so.  However, 8 should be low enough for most people freely accessing various servers on the Internet, and also high enough so that if your connectivity is cut somewhere within the same building or at your only uplink, there will be less than 8 devices between you and the silence.


Bringing code to an interview?

Question: Is bringing printed code or code on a USB to an interview a good idea? If so, what kind of code should I bring. Should I avoid big projects and just show small snippets which show off my skills?
Comment: No. What a company can do is give you a take-home exam after an interview, and then have you back in 2 days or so to explain what you did and why.
Answer: Rather not. I would only do this when explicitely requested, and of course you can't bring code that's in any way confidential, which usually applies to everything you wrote in your previous job, so you are basically restricted to code you created in your spare time. (Most interviewers would immediately have you escorted to the door if you come with confidental code from your current employer...)
Anyway, as the interviewer, I'd rather want to see you write code during the interview, so I can be sure you are the one who has the skills. It's just too easy to have good friends help you write a most impressing piece of code, and memorize the explanations.
Answer: I think it's a great idea!  It's a pity code reviews are not done more frequently as it is one of the few ways of recognize good programmers (except actually having them code something). Looking at someone's code you pretty quickly get a sense of how good a programmer is just because how much "cleaner" their code is.
If I was interviewing I would be looking at two things that probably would be good to cover in the code you bring
a) The quality of some implementation/method/algorithm. Show some code that you found especially elegant
b) The overall architecture of a larger program. How has the programmer handled dependencies, can he explain the design decisions he's made
The goal is not to go through all code so it really doesn't matter how long the code you bring actually is, but what you chose to highlight about it.
Comment: There's always the problem of actually knowing that the code *is* written by the interviewee. In that sense, maybe a code review of someone else's code could teach you as much, if not more - as the interviewee won't have been able to prep in advance?
Comment: Let's not forget the potential (or probability) that the piece you wrote is the IP of your former employer (unless it's a side project or personal piece written) and I'd avoid crossing that line as much as possible, innocent or otherwise.
Comment: I wouldn't think that was much of a problem, since you're judging the person on the ability to explain his code and thinking. That's pretty hard to do if it's not your own code. How can you explain something well that you don't fully understand?
Comment: Brad, that's a good point. Normally you're not allowed to retain copies of work done as a consultant so it might be hard to use code like that. Another reason to hire programmers who work on pet projects! :)
Answer: A variation on this is to provide the interviewer with the URL for the repository for some open-source project that you've made a major contribution to.
Answer: No.
Unless you are scheduled to give a reasonable length presentation in your interview, the kind of code you have the time to show and they have the time to appreciate; cannot be representative of your skill, regardless of where you are in your career.
If they want to see evidence that you are a mature software developer, then that won't be found in the size of program that you can effectively walk through in the AOB section of an interview.
If they want you to demonstrate that you can program at all, they'll have a proper test, or get you to do something small like a linked list on-the-spot.  If you bring along a linked list implementation on a USB key, they have no idea how much of it you copied from a book; whether it took you 10 minutes or two weeks; or whether you had to ask stackoverflow what a pointer is.
Moreover, what would you show?  Clean, well-written code that is easily understandable is boring. Your interviewers won't sit there marvelling at how clearly they can grasp the intent of your snippet, they will be wondering why you consider it to be the jewel in your crown.  On the other hand, Imagine you invented something clever like Duff's Device, and wanted to show that off. The interviewers would likely consider you an enemy of readability.
Comment: Clean, well-written code that solves a tricky problem can be extremely interesting. And if the interviewer doesn't think so, it tells you one of two things: either you're not at the level they're looking for, or they're not at the level you want for colleagues. Either way (and hopefully the discussion would highlight which), it's time to look somewhere else.
Comment: What I mean is that clean, well-written code that solves a tricky problem makes the problem appear considerably less tricky, thereby making the code itself appear considerably less interesting.
Answer: The code you show should generally be small enough to be talked about within 5 minutes, and the code should take up no more than 2 printed pages.  Even if it's just a method that you wrote to parse phone numbers from a phone book, it's useful.
Answer: If you want carry the design. Don't carry the code. More than seeing the cleanness, the interviewer will start pointing out the errors. There certainly would be (many) errors (which you haven't thought of) if the project is some high school project. And if it is some company code, it is illegal to carry the copyrighted code and show to other people.
Showing the code you have already written may not carry much weight if you fail to answer the questions asked by interviewer. And if you don't carry it, then also there are no -ve points. So why bother.
Answer: Yes!

Any fool can write code that a
  computer can understand, it takes a
  great programmer to write code that a
  human can understand.

For that reason alone you should show off
Comment: If you code is actually human understandable. Otherwise, don't :)
Answer: If you have a piece of code that is particularly interesting, then by all means bring it (assuming, of course, that it's not protected intellectual property). But don't force it on the interviewer. If s/he is interested in looking at your code, s/he'll ask if you have anything to show.
Be prepared to explain why it's interesting, and better, what you'd do differently in the future.
Answer: If you have done any open-source development (either business or personal), I think this would be a great idea.  I sent code snippets along with the application materials for the job I currently have, so I'd venture a guess that it worked out OK for me.  Make sure to respect confidentiality/copyright and give attribution to others who were involved (if it was a collaborative project).

Bringing code to an interview?


I saw the Gadget "Speed Test" and "Stock" in some Windows 7 books, but don't find it on Win 7?

Question: I saw the Gadget "Speed Test" and "Stock" in some Windows 7 books, but don't find it on Win 7?
There is a "Get more gadgets online" but they look quite 3rd party... and installing them might have some security risk?
Answer: Speed Test is here.
Several Stock quote gadgets are available here. Just take your pick.
As for the risk of installing them : There's always a risk, but you can minimize that by choosing gadgets that have good reviews, which means that they have passed some tests by other users.


Special relativity mirror experiment

Question: There's an experiment in special relativity that involves a light source and a mirror, both placed in a moving object. It is used to derive the time dilation equation. I'm having serious doubts about it's validity. It implies that light from the source hits the mirror in its exact center, although the mirror has moved a certain distance from the time the light source emits the wave and until it hits the mirror. If, hypothetically, the mirror had moved very fast, then light should have passed by it. But this doesn't happen in the experiment, as if light also had a velocity component in the direction of the train. But it doesn't, since that would imply that the constant speed of light postulate breaks.
Comment: If both comoving observers agreed on the direction and path of the light, there would be no path difference and thus no time dilation or length contraction. And thus no relativity. Either that or you'd be forced to accept a variable speed of light or absolute motion, which are not supported by experiment.
Comment: Sorry, I can't understand your answer. What do you mean by "comoving observers"? I'm not understanding what your refer to by path difference either. Remember that I've just started studying relativity. I haven't yet learned about length contraction for example.
Comment: Sorry, *relatively* moving, not comoving. In any case, in one frame the light travels in one direction and in another frame it travels at an angle to that direction. This is a consequence of the consistency of the laws of physics across various frames.
Comment: I too am confused by this experiment regarding the trajectory of light. The observer in the train should se the light go perpendicular to its motion on a straight into the mirror. Why doesn't the observer in the platform also see the light perpendicular to the movement of the train (and thus miss the mirror)? how come light has a velocity component along the train's movement?
Answer: Let us dive into the light clock thought experiment,
Special relativity is based on two postulates,

There is no such thing as absolute motion. Phrased another way, all laws of physics should be invariant under changes in inertial frame.
The speed of light is measured to be the same value in all inertial reference frames.

Let's say you are on the train and have light source aimed at a mirror in such a way that the light is traveling perpendicular to the motion of the train. According to postulate 1, there is no way for an observer on the train to tell that they are in motion as the train is an inertial reference frame. Thus the laws of physics should be the same for the observer on the train as it would be for an observer at rest.
From this one can conclude that the light does not miss the mirror and indeed hits it dead center as if the mirror was standing still. If this wasn't the case, then there would be a way to distinguish absolute speed and relative speed, harshly violating the first postulate.
The second postulate leads one (forces one) to the understanding that the amount of time experienced is dependent on motion. Since the speed of light must be constant in all frames of reference and the light travels between two fixed events with different lengths for the moving and stationary reference frames, we conclude that the moving and stationary references frames must have experienced different amounts of time between the two fixed events.
Comment: I think that when the first postulate was devised, it did not take into account wave phenomena. If instead of light, the source was a ball being thrown upwards, then that ball would also have a speed component in the direction of the train and only then we could imply that it would hit the center of the mirror. If relative motion was always true, than me moving away from a standing sound source at the speed of sound would be the same as me standing still and a sound source moving away from me. In the first case, I wouldn't hear any sound. But in the second, I definitely would.

Special relativity mirror experiment


Prove: $(a + b)^{n} \geq a^{n} + b^{n}$

Question: Struggling with yet another proof:

Prove that, for any positive integer $n: (a + b)^n \geq a^n + b^n$ for all $a, b > 0:$

I wasted $3$ pages of notebook paper on this problem, and I'm getting nowhere slowly. So I need some hints.
$1.$ What technique would you use to prove this (e.g. induction, direct, counter example)
$2.$ Are there any tricks to the proof? I've seen some crazy stuff pulled out of nowhere when it comes to proofs...
Comment: If you look at the binomial formula, you will see it pretty shortly.
Comment: You don't even need the binomial. It is pretty clear that these terms have to occur in the expansion.
Answer: Hint: Use the binomial theorem.
This states that
$(a + b)^n = \sum \limits_{k = 0}^n {n \choose k} a^{n-k} b^k = a^n + b^n + \sum \limits_{k=1}^{n-1} {n \choose k} a^{n-k} b^k$.
Now, note that every term in the second sum is positive; this is because a, b, and the binomial coefficients are all positive. Therefore, $(a+b)^n=a^n+b^n+\text{ (sum of positive terms) }\geqslant a^n+b^n\;.$
Comment: Please continue. I expanded the left side, and it has an a^n summed with a b^n term (along with a whole bunch of other terms). Is that proof enough?
Comment: Matt: remember, a and b are both positive (that should answer your question)
Answer: This follows directly from the binomial theorem.
Alternatively, you can prove it inductively (which is probably more fun): suppose the inequality true for $n-1$. Then $(a+b)^n = (a+b)(a+b)^{n-1} \geq (a+b)(a^{n-1} + b^{n-1})$ by the inductive hypothesis. So $(a+b)^n \geq  a(a^{n-1}+ b^{n-1}) + b(b^{n-1} + a^{n-1})$, and this is at least $a^n + b^n$.
Answer: You can write $n=m+1$ where $m \geq 0$, then
$(a+b)^n = (a+b)^{m+1} = (a+b) (a+b)^m = a(a+b)^m +b(a+b)^m \geq a^{m+1} + b^{m+1}$
no induction and works for any real $n \geq 1$.
Comment: So simple!${}{}$
Answer: It might also be helpful for you to think a little about the geometry of the inequality.
For $n=2$, find a way to put an $a \times a$ square and a $b \times b$ square into a $(a+b) \times (a+b)$ square without any
overlaps. For $n=3$, see if you can fit an $a \times a \times a$ cube and a $b \times b \times b$ cube within an $(a+b) \times (a+b) \times (a+b)$ cube without overlaps.
Next, the notion of having more than three dimensions might seem a little weird, but
think of the box in $n$ dimensions whose sides have length $a+b$. Can you fit two boxes within it, one with side length $a$ and one with side length $b$?
Answer: Here is another way to look at the inequality.  Pick the larger of $a^n$ and $b^n$ and divide through by that quantity.  This reduces the problem to showing that $(1+r)^n \ge 1 + r^n$ for
some positive real number $r \le 1$.  If $r < 1$, we have $r^n < r$, so $1 + r^n < 1 + r < (1+r)^n$.
I leave the case $r = 1$ (and $n$ rational and $\ge 1$)  to others.
Answer: Let's have a precalculus answer: Consider the function of $a$ depending on the parameter $b$ that is $f_b(a)=(a+b)^n-a^n-b^n$. Its derivative relative to $a$ is $f'_b(a)=n((a+b)^{n-1}-a^{n-1})$ because $b>0$ $f'_b(a,b)$ is nonnegative and $f_b$ is an increasing function of $a$ and you can conclude.
Comment: A precalculus answer? But yours is the only answer that uses calculus, while the others are more elementary! :-)  (BTW, it should be $n((a+b)^{n-1}-a^{n-1})$.)
Comment: Sorry I am French and we make no distinction between "analyse" (calculus) and anything like "pré-analyse" (precalculus). But now thanks to you, I know the difference.
Answer: Induction.
For $n=1$ it is trivially true
Assume true for $n=k$
i.e. $$(a + b)^k \ge a^k + b^k$$
Consider case $n=k+1$
\begin{align}&(a+b)^{k+1}
=(a+b)(a+b)^k\\
&\ge(a+b)(a^k+b^k)\\
&=a^{k+1}+b^{k+1}+ab^k+ba^k\\
&\ge a^{k+1}+b^{k+1}\end{align}

Prove: $(a + b)^{n} \geq a^{n} + b^{n}$


in OpenZeppelin's ERC721 why are tokenapprovals more restrictive that operatorApprovals

Question: In OpenZeppelin's ERC721 contract what was the design decision behind making _tokenapprovals a mapping, but _operatorApprovals a multidimensional mapping? Why restrict the ability to approve transfer of a single token, to only one address (_tokenapprovals), but create a data structure that gives multiple external addresses control over ALL account owned tokens (_operatorApprovals).  What where the practical scenarios envisaged to arrive at this pattern?
Answer: This is a requirement of the ERC-721 standard.

Token approvals are a one-per-token data model.
Approvals-for-all are a one-per-operator-and
Answer: _tokenapprovals is related to the function approve andapprove is an approval specific to a tokenID
but
_operatorApprovals is related to the function setApprovalForAll and setApprovalForAll is for all tokenIds for a given ERC721 contract.


Empty World in Minecraft

Question: I know that you can create an empty world in Minecraft Java Edition, but is there a way to do it in Minecraft Bedrock?
I have looked in many places, and not found the answer.
Answer: Create a superflat then just put something like:
<code>/fill ~-50 0 ~-50 ~50 3 ~50 air
</code>
to clear the area around you. Just run around and run that command wherever you need an empty spot.
Custom superflats are not available in Bedrock Edition, only legacy console (general & PS4) & Java.
Comment: Is it possible to have the *whole* world empty?
Comment: @EmojiMaker sadly not. What you are asking for is custom superflats and unfortunately even though so many people want them they haven't been added to Bedrock. I can't see them coming in the too near future, but maybe somtime?
Comment: I haven't tried it, but in [this video](https://www.youtube.com/watch?v=_imjIrt_UI4), it says that if you create a flat world with the seed `-94187608`, it will be a complete void.
Comment: @EmojiMaker that's not what that video is saying; it is distributing a world download, that seed was just the random seed he used for the world. You can definitely download that map though, but it's not built into the game
Comment: I'll try that world.

Empty World in Minecraft


ASP.NET Web Config Write, Remove .ASPX and Ignore Filenames with periods.

Question: I've written a simple rewrite rule so I can remove the .aspx from all my page paths.
That way if someone types in http://www.domain.com/Contact, they will be taken to the contact page rather than having to type in http://www.domain.com/contact.aspx.
The following rule works fine, except that if the file name contains a period. I don't want the rule to apply, because even thought I have a condition to negate when the url is a file or directory, this doesn't apply to handlers and other special files. To avoid this issue I'm negated the special files by adding a condition for each one, this is no longer worker however as there are quite a bit of special circumstances that this comes up and I don't want to have to write a new one for each special case.
Basically I just need to add a condition that when there is a period in the file name to negate it. Can anyone help? I'm not that good at regular expressions.
<rule name="RewriteASPX" stopProcessing="true" enabled="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="{R:1}.aspx" />
            </rule>

Answer: Try this in the match field:
<match url="^(.*/[^.]*)$" />

It should match all url's that don't have a '.' after the last '/'.


How to check if the managed package is installed for admin or for all users or for specific profile?

Question: My client has 2 production orgs for different requirements. They asked me to install and set up one of the managed packages from App Exchange in 2nd org as it was in 1st org. How would I find that the 1st org package is installed for just admin, for all users, or for a specific profile?
Answer: Strictly speaking, you can't; this information isn't recorded as such anywhere.
Installing for admins or all users or specific profiles actually just grants the selected profiles access to all managed components. That permissioning can be changed by administrators after the package is installed.
You can attempt to guess what initial setting was used by looking at each profile to see if managed package components are enabled for that profile.
However, this suggestion points to a broader need on your project: you need a source of truth for what permissions are correct other than the current state of the org. What is the business goal?
Answer: That is actually stored somewhere, I believe
select ApexCompileType,ProfileMappings, SecurityType, CreatedDate,PackageInstallSource,SubscriberPackageVersionKey, UpgradeType from PackageInstallRequest (Tooling API)
Security Type will be "Full" if installed for All Users. It will be "None" if just for admins.
Answer: Dave Pattison's solution seems correct. We had a similar situation and this query helped. Object reference https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_packageinstallrequest.htm?q=packageinstallrequest


Master ASP.NET MVC

Question: Recently i am started working on ASP.NET MVC ( along with Linq to SQL).I am finding it difficult and confusing ( concepts like repository , controller , view are confusing me.).
Can someone please tell me how to move or rather  how can i master MVC.
Answer: After I watched all the tutorials at http://www.asp.net/mvc (don't miss out on Scott Hanselman's "show"!), I used the book "Professional ASP.NET MVC 2". I worked through most of the text cover to cover and learned heaps along the way. The book is very well structured and provides new material in small enough increments. It was easy to follow and good to read.
The source code for all of it is available on the internet. The system is even live, see http://www.nerddinner.com.
Good luck!
Answer: I would recommend that you follow this tutorial.  Also, there are plenty of other tutorials and information on the www.asp.net/mvc site.
Also, download the NerdDinner or Music Store examples from the MVC site. You can look through the code, step through the code and get a general feel of how it works.
Try doing some test projects too - it will help you a lot.
Answer: Read books, read blogs, read msdn, practice. Only way to learn is by trying.
Answer: You could read my blog post to help get you started with the main concepts, then switch to books about ASP.NET MVC. I learned from Apress "Pro ASP.NET MVC Framework", but there are many more on this topic from Wrox, available on Amazon, eBay, bestbargainbook, etc.
Also, check out NerdDinner. It's an OpenSource project, with a tutorial in it, meant to help beginners get started.
Answer: Besides the mentioned Nerddinner and music store examples I found this one also to be very interesting: Tailspin travel. I used it as base for one of my presentations about MVC2 as well.
Answer: get a Tekpub.com subscription, and check out the series on ASP.NET MVC. it's brilliant! :)

Master ASP.NET MVC


Maya 3D to CryEngine3 Problem

Question: I have an object that I am trying to export from Maya 3D to CryEngine3. In Maya the object appears fine but when I export it and place it in-game there are two problems.
1) The roof material seems to dissapear and is just a white surface which reads the standard "replace me" when you walk on it (it's still physicallised as default) and although the outside of the building appears fine (again its a solid object) the inside is "transparent" and you can see through the walls.
(after I render the default phongs)

After the materials are applied (notice the "inside" looks solid)

in-game the external walls are solid with the material. However the roof turns white and the inside appears "transparent" yet is still solid and can not be walked through.

If anyone has had this problem and found a solution, or can point me in the right direction I would be grateful for the input.
Answer: Figured it out... the internal face normals needed to be reversed. For anyone else with the same problem go to the "lighting" tab and deselect two sided lighting. Black surfaces indicate normals that have been reversed.

Maya 3D to CryEngine3 Problem


"Zero-inflated" predictors in regression?

Question: I know that zero-inflated models (e.g. zero-inflated Poisson or negative binomial models) can be used for dependent variables. I also know that in general there are no assumptions for the independent variables (i.e. predictors) in regression analyses. However, I have a quantitative (continuous or count) predictor which has many (say, 40-60%) zeros. When I used it as a quantitative predictor in regression (linear or logistic) I got a small P value (i.e. P<0.01), but when I used it as a binary predictor (zero or not) I got a P value>0.05. Why did it happen? How do I interpret this result?
Comment: There is no assumption for the _distribution_ of the independent variables, but if you simply add that variable to your model you do assume _linearity of its effect_. If you have that many 0s, then it is reasonable to suspect that there is something special about that value, and you'll probably want to incorporate that in your model. Here is a discussion on how to do that: http://stats.stackexchange.com/questions/56306/
Comment: In my example $\beta_1$ refers to the linear effect, while $\beta_2$ refers to the discrete jump at 0. So, the null hypothesis for the second test is that there is no discrete jump, i.e. you could just as well describe the relationship with just a linear effect. With the $p$-values you report you cannot reject that hypothesis.
Comment: @ Maarten Buis: Recently I find that your suggestion is implemented in an article "On the implication of structural zeros as independent variables in regression analysis: applications to alcohol research (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5628625/)".
Comment: I suggest you plot the two sets of fitted vs actual on the same plot (with y=x line marked lightly). You should see why quite quickly. If it doesn't show on that, try actual-fitted vs fitted on the same plot (with y=0 line marked in)
Comment: @Maarten Buis: Thanks for the illuminating answer. Regarding the breastfeeding example with beta1 (for weeks breastfeeding) and beta2 (for non-breastfeeding) coefficients, suppose that the outcome is baby health:
If I get a significant beta1 (e.g. P=0.001) and a non-significant beta2 (e.g. P=0.1), should I interpret the result that more breastfeeding is good for the baby but non-breastfeeding does not affect the baby?
Comment: @Maarten Buis: Could you teach me how to replace the sentence "I found that there was a linear effect of breastfeeding. However, I cannot reject the null hypothesis that there was a discrete jump at zero breastfeeding" with a non-technical sentence so that the non-statisticians can understand? Does this finding mean that there was no non-linear effect (or should I check for linearity by a residual plot?) Could I use splines or fractional polynomials for the non-linear effect
Comment: You checked for a very particular form of non-linearity, a jump at 0 and after that a linear effect, and did not find that jump. What remains is just the linear effect. If you want a more non-technical explanation, than I would use a graph like the one in the answer I linked to above. Obviously insufficient evidence for a jump at 0 does not rule out other forms of non-linearity, but that is a completely different question.
Comment: With just a linear effect you assume that going from 0 to 1 has the same effect as going from 1 to 2, 2 to 3, etc. With the discrete jump you say that there is something special about going from 0 to 1. You seem to have found insufficient evidence for that. This still means that going from 0 to 1 has an effect; it is exactly the same effect as going from 1 to 2, 2 to 3, etc.
Comment: @Maarten Buis: Thank you for your detailed explanations. I finally understand the meaning of the result.
Comment: Thank you so much for your helpful advice @MaartenBuis! Can we reference your recent article for use of the above model? Thanks in advance! http://smr.sagepub.com/content/early/2015/07/07/0049124115591014.full.pdf+html
Comment: @JafarBakhshaie As much as I like that paper, it is not a reference for that specific way of modeling.
Comment: @MaartenBuis While I agree that there are no, for example, **normality** assumptions for independent variables, there certainly are **i.i.d.** assumptions for independent variables. Granger & Engle won the Nobel prize in economics in part for illuminating the consequences of violating that kind of assumption. :)
Answer: So it's important to think of the source of zero-inflation. Two sources that come to mind are:

floor effect: your measurement instrument cannot detect values below a certain threshold and so the instrument simply returns zero. Think of a scale with 40 questions supposedly measuring "high-end math knowledge", so the test is really difficult. For each question, you could be incorrect (0 score) or correct (1 score). A test-taker could be incorrect on all 40 questions resulting in a total score of 0. Assuming the scale is indeed unidimensional/valid for high end math knowledge, this 0 score does not mean the respondent has zero math knowledge. But it suggests their math knowledge is at a level below which the test can detect. If someone administered this test to the general population, you might get a high proportion of zero scores. This scenario can occur in many different contexts. Sometimes, a measurement instrument can only detect differences beyond a threshold, and several respondents are below that threshold. Instruments for physical quantities might simply return a < X score, where X is that threshold.
true zero: Sometimes, people really have a zero score. For example, this can happen with counts, e.g. how many homes do you own? And sometimes, there is something fundamentally different between someone who does not own their home and someone who owns one or more homes.

So it's important to think of the source of zeroes and what you're trying to measure.
In the floor effect situation, I might claim that the math scores would be approximately normally distributed but for the floor effect. So I'd assume we have a normally distributed variable that has been censored at 0. The effect of analyzing with the predictor as is is range restriction which - all other factors held constant - can reduce power. So you could build a model that accommodates a censored predictor - Bayesian modeling should make this easy.
In the true zero situation, I might decide to dichotomize the variable to create two predictors: one binary (homeowner or not) and one continuous (how many homes). Then use both predictors in my model, allowing you to measure the effect of home ownership separate from owning more homes.
These are just two scenarios that come to mind. Also, it's never clear cut. Number of homes could also be a proxy for another variable, where number of homes is a proxy that cannot detect levels of that variable beneath a threshold. If your interest is in measuring the relation between the outcome and the true variable number of homes is a proxy for, you have another example of a censored predictor.
In all, having a predictor with many zeroes welcomes you to think about why that might be happening. And what you might want to do about it. Also, the easiest viewpoint to take is regression places no assumption on predictor distributions and just proceed with the predictor as is.
Answer: Zero-inflation is a probabilistic concept, and it means something different than "the distribution has a lot of zeroes". For instance, a Poisson or negative binomial model can use parameters so that 90% or 99% of the values are 0, but that doesn't "make" it zero-inflated. Zero-inflation is a mixture of a known probability model and a 0 constant "variable".
In statistics, when you consider the whole host of multimodal distributions out there, and collecting a sample like what you describe, and declaring a. that you know what distribution it's supposed to be and b. that it did not fit that distribution because it's zero-inflated... well the plausibility goes almost surely to 0.
If we broaden the scope, there's a more illustrative question to consider: when do we care about the impact of the distribution of the covariates $X$ when conducting a regression analysis? The answer is: almost never. More precisely, most default regression methods make no use whatsoever of the distribution of the covariates. The exceptions would be in cases of correcting biased sampling with weights, measurement error methods, indirect standardization, performing expectation maximization to handle truncation, or parametric bootstrap: i.e. advanced methods. However OLS, for instance, geometrically is a projection so that the residuals are orthogonal to the predictors, this does not guarantee that the error term and the regressors are independent hence the need for detailed diagnostic plots and analyses.
Lastly, your finding is not surprising. Dichotomizing a variable is still a bad idea for irregular covariates for the same reason it's a bad idea for nicely behaved covariates. Reducing the variability of $X$ reduces the precision of the analysis. In fact, a nice formula to recall is the following:
$$ \text{SE}(\hat{\beta}) = \sigma^{2} / \text{var}(X)$$
(a bivariate result that extends more or less to higher dimensional analyses).
In other words, the confidence interval for $\hat{\beta}$ and $p$-value for the statistical test of the hypothesis $\mathcal{H}_0: \beta=0$ shrink when considering designs where $X$ is more variable. Dichotomizing a variable fundamentally reduces its variability.


highlight html elements

Question: How can highlight html elements, with javascript, for inspection of html and css selectors linked to that element. The highlighting could be just a change of borders or background (so it doesnt break the layout) and a tool tip revealing the html element and css selectors conected to that element.
Comment: How about using the developer-tools in your browser, all of them have it these days?
Comment: If you want a custom solution you have to be more specific about where you are stuck.
Comment: Have you attempted this on your own? I would give it a try first then post when you cannot solve a more specific problem. Here is a good place to start: http://api.jquery.com/category/selectors/
Answer: You could do something like this:
<code>$('div, a, span, p').hover(function(){
    $(this).css({ "border": "2px solid red" });
    console.log($(this));
},function(){
    $(this).css({ "border": "none" });
});
</code>
I'd use Firebug (FF) or Console (Chrome) to inspect elements though.
Comment: You should at least mention that you are using jQuery.
Answer: If I understand you correctly, it sounds like you just need to be using something like Firebug for Firefox or Developer tools (F12) for IE.  Every browser has them.
They let you highlight anything and play around with any css selectors.  Absolute must tools for the web developer.
Answer: Have you considered using a tool like Firebug? This does an excellent job, showing the source of the page and highlighting elements on mouseover. Also, in recent versions of the three major browsers (Chrome, FF, IE) there is a built-in inspector. In FF 10, right click anything and click Inspect Element. In Chrome, the process is the same. In IE 9, press F12, then Ctrl+B and click the desired element.
Answer: If you use google chrome, you can enable developer tools in View / Developer / Developer Tools.
When choosing this menu, on the bottom part of the browser will apear a frame with a menu, (here you should click the Elements button).
Under this menu you'll see the source of your document.
When hovering on certain tags (ie:  ) in the browser the element will be highlighted, and you'll be able to see properties of the highlighted tag.

highlight html elements


Where are the item dialogue boxes in OS X?

Question: I thought Blender would work the same on a Mac as it does on a PC, but I cannot seem to find the item 'dialogue boxes' that exist on the PC version. Anyone know how to bring up an item dialogue box in OSX version of Blender?
Comment: What do you mean by dialogue boxes? can you post an image of the missing item?
Comment: On a PC version, you right click an object (like a cube or cylinder) and can bring up a dialogue box to edit the number of vertices, etc.  Can't find a similar thing on the Mac version. Can't post a picture of it because I can't find it?  Thanks
Comment: awesome. thanks.  I will give that a try when I get back to it.  thanks for the help.
Answer: Press T to open the Toolbox.
N for the Properties
F6 to bring the poup-up (that shows the same options as the ones on the Toolbox).

If the keyboard shortcuts conflict with the ones in blender you can re-assign them using the User Properties (or better still by changing the preferences on your OS)


Is there any action against ignorance of an answer

Question: If someone asks a question and does not look at any comments or answers that come up, how should I treat such people? Also he or she still logged in.
Comment: How can you possibly know that they haven't looked at comments or answers? Not responding to them doesn't mean they haven't seen them.
Comment: if there last seen was boosting.its sure that they might get a notification regarding the comment or answer
Answer:
Accepting an answer is not mandatory

There is no obligation to accept an answer or follow up on comments*.
You can of course comment and ask if the answer helped solve the problem or ask the user in chat if they are active there, for example—but other than that there is nothing to do and users are well within their rights not to accept an answer or respond to comments.

how should I treat such people?

Exactly as you would any other user.
*One of the main reasons for comments is to communicate issues with questions, so the question may be closed if the asker doesn't respond to requests for clarification on an unclear or otherwise off-topic question—but that is a different issue.
Answer: Usually you comment because the question is unclear or needs more information. In that case, you could comment to ask for clarification. But if the user doesn't care at all, a downvote and a close vote (or flag if you don't have enough reputation) would do.
If a user receives ends up having quite some downvotes, closed or deleted question, they will be banned for asking more questions.
If the user just ignores you because they think your comment isn't useful, and the post is perfectly okay, there is nothing you can or should do. Just move on.


Why are there no Stainless Steel wheels to prevent Corrosion in Winter?

Question: Steel wheels are often used in Winter due to its low cost, however, it is very prone to rust. Why are Stainless Steel wheels, more specifically 316 Stainless Steel not being more popular as the material it is being use in marine environments where corrosion is even higher than salt in Winter?
Comment: I will guess cost is an issue and how many they will sell of theses. If it was profitable I'm sure someone will have done it. I do not have any facts on that so this is posted as a comment...
Answer: I second Gabriel's comment: Probably cost. Nickel Moly Chromium Stainless (316) is very expensive, this random kitchen sink is just a sheet of stainless stamped into a cube, and it's $500+ retail. Given the price I have to assume it's 316, otherwise it would be even more.
I can only imagine what a single wheel would cost a manufacturer. Even using Powdered metal for casting is still expensive, from this place 45 micron 316 will run you $350 for 2kg, which is only about 4.5 lbs. Not sure how much you need to make a wheel, but you can see where I'm going. Even buying crazy amounts in bulk probably steel (!) wouldn't break the cost-benefit ratio (profit-trouble ratio?).
You may however take a page out of the exhaust manufacturer's book, and coat your wheels with aluminum some sort of way, maybe elctroplating or something. It may not be the most stylish (then again, maybe it might), but it would certainly be cost effective to go the diy route.
Disclosure: I'm not a metallurgist, but I have an intro to metallurgy class this semester, and we just talked about stainless steel the other day, so that and the fact I'm into cars peaked my interest in this question :-)
Comment: I wouldn't choose to coat them with Al.  Al wheels are worse than steel in the Winter as far as corrosion.  Salt pitting happens very rapidly.
Comment: Keep them clean, but don't use any harsh abrasives/chemicals.  Factory should have them sealed to prevent pitting, but if you damage that sealing, it's going to go downhill rapidly...
Comment: Good Point, I've never owned aluminum wheels, but my wife has them now (haven't corroded yet) so we'll see.
Comment: Would plastidip on all surfaces of the steel rim help at all?
Answer: Largely because it's unnecessary.  Steel wheels are so incredibly cheap compared to stainless that there's no benefit.  Steel wheels are heavy enough that it takes way beyond the normal life of a car for them to rust out too (I have a 22 year old car that I drive in the winters on original steel wheels and the wheels are in better shape than the car body).  It's also normal to use wheelcovers on steel wheels to hide the unsightly surface rust that does sometimes appear over the years.
Comment: Wheels mounted on the vehicle rarely rust to the point it is a safety issue. However spares that are mounted under the vehicle (mini vans, pick ups, etc ) can rust to the point they are unusable. The salt spray chips the paint and doesn't get washed off accelerating the rust.
Comment: I would be concerned that moisture would be trapped under the cover accelerating the rust. Covered wheels mounted on the back of an SUV or van are exposed to sunlight where the moisture has a chance to evaporate.
Comment: Pro-tip: some Rustoleum (or similar heat-resistant, rust-busting paint) as a base coat and a high-gloss black to finish protects wheels and drum brakes from rust and makes them look a bit better, especially if you add a wheel cover in a contrasting colour.
Comment: @mikes I wonder if a cloth wheel cover would be effective in protecting that under care spare, maybe one with elastic around the opening so it 'wraps around' the spare after it's been mounted.
Answer: Steel wheels will inevitably rust if significant measures aren't taken, especially if you live in the 'Canadian Rust Belt" - the Maritimes, as do I. I just completed restoring a set of 6 bolt steel wheels that I picked up for my minivan. I have a couple sets of aftermarket steel wheels that are 5 - 6 years old without a speck of rust. They do however require a good annual or bi-annual de-greasing as I spray them several times throughout the winter with a rustproofing spray like Rust Check or Fluid Film. Sometimes I'll spray on old atf as I have gallons of that in my shop. The wheels get quite a build-up of 'grease' on them. Some will claim that the oily substance will attract dirt and moisture and accelerate rust. This has not been my experience. Key, I believe, is to reapply the product fairly regularly.
To refinish my 6-bolt rims, I coarse wire wheeled all the flaking paint off and as much rust as was possible, de-greased, applied phosphoric acid gel a few times for a couple hours each time with wire brushing between coats, washed, sanded, de-greased again, 3 layers of high build primer, scotchbrite scuff, twice alcohol rub and 3 coats of enamel paint. I hope to never see rust on these wheels as I'll spray them throughout the winter with rustproofing spray. Fairly high maintenance, but worth it to me as I loath even the slightest hint of rust anywhere on my vehicles. My vehicle body rustproofing regimen is a whole other story in and of itself.
Comment: While this is all very interesting and, as you say, a story in itself, it doesn't address the question.


How to create Complex Form, similar to Nintex in SharePoint Online?

Question: What do you recommend to use in SharePoint Online to create Complex Forms? Right now we are using Nintex On-Premise to all of current workflows and since we already have SPO we need to move/migrate our Workflows to Online.
Answer: In the long run, in SharePoint online, the recommendation is PowerApps for forms development and Power Automate (Microsoft Flow) for the workflows.
Having said these, for SharePoint Online, there are two types of forms and workflow version available from Nintex:

Nintex Office 365 (separate license needed)
Nintex Cloud (part of the office 365 tenant, no separate license is needed) - it is like Microsoft Flow and PowerApps which has lots of third party connectors, using that we can connect to any other third application, update or new releases come every two weeks.

To conclude, you can have PowerApps, PowerAutomate, and Nintex Cloud - based on the needs you can choose any of these tools.
Comment: Hi @BizApps - Just wondering, are sure you enquired for Nintex cloud because there are two products for SharePoint online - 1) Nintex 365 2)Nintex Cloud - as per my knowledge nintex cloud is the part of Office 365 tenant license, so if you have tenant, that will be part of that. Coming to your second question - yes, using the combination of SPFx and React we can develop any complex form but will be expensive as it needs purely development works - I have not done, but it is possible using SPFx and React.
Comment: Hi we reached out to Nintex and their cloud platform and their pricing is too high , did you developed work around like creating custom html / spfx as power apps is not good for complex form design as it is for mobile.
Answer: Just like Habibur said, if you want to create complex forms, PowerApps and Power Automate(MS flow) will be an option. You can consider them as the new and much more powerful InfoPath and workflow, highly integrated with SharePoint Online.
For migration you may better to contact with Nintex. Per my knowledge there are no tools to migrate Nintex workflows to Power Automate. You may need to keep using Nintex products if you do not want to re-construct all workflows and forms.
Introduction About PowerApps and Power Automate:
https://powerapps.microsoft.com/en-us/automate-processes/
https://products.office.com/en-us/business/microsoft-powerapps


How can one sign a serialized transaction?

Question: Do they have to deserialize that to tx object again and then sign ? Any way to sign without deserializing the tx ?
Answer: It depends on your use case. It's possible to arbitrarily sign any message (serialized transaction).
e.g. with the tweet NaCl library:
// imports
import * as nacl from "tweetnacl";

const tx = new Transaction().add(//some instruction);
const serializedTx = tx.serializeMessage();

// Sign Transaction
const signature = nacl.sign.detached(
  serializedTx,
  some.secretKey // The private key you want to sign the transaction with
);

You can use this signature to verify later that the transaction hasn't been modified/changed.
Though it's equally trivial to deserialize the transaction and signing it (via partialSign() or sign()).
// serializedTx = some serialized transaction

const deserializedTx = Transaction.from(
  Buffer.from(serializedTx, "base64")
);

You will have to call sign or partialSign if an instruction that's part of the transaction requires the authority on that account to sign.
Answer: No, you cannot sign a serialized transaction without deserializing it first.
Actually the funny thing, all signers need to sign a serialized message.
But, the serialized message is not the only thing what is in the transaction. A transaction also contains other metadata and information about the signers which does not need to be signed. Therefore you always first need to deserialize the tx, extract the message (containing the instructions, feepayer and such data you need to sign), serialize that message, and sign it.
Deserializing a transaction can be done with the static from() method.
Comment: you've rightly pointed out a flaw that exists specifically in the data structures design of `@solana/web3.js`.  none of the signing operations should ever have been implemented on `Transaction`, rather they should all be on `Keypair` (or `Signer`? I forget) and take `Message` as an argument


WinForm Application Security

Question: I wanted to create a winform application that have a centralized security database. This application is portable, can be save to any PC and simply run the .exe to use, hence there will be many copies of this software. However, it will require a User login, this login account credentials will refer to centralized security database(centralized DB is for security purpose only). If the PC does not have a Internet connection, the software will not be able to identify the credentials. Hence, i came up with an ideal is to put a time stamp, if the last connection to centralized is DB is < 24h, local credential(DB copy from centralized DB) login is granted. But the problem i face now is, the time stamp and 24H limit will have to refer to current system time in the PC(which can be change easily to bypass the time stamp). what is the solution? Any other method that can control the User while the application goes offline?
Comment: Can the attacker setup his own decoy server that will act like the centralized database, and make the local software always happy?
Answer: Your scheme is vulnerable to replay attack: an attacker can manipulate the time and date setting of the local system in order to fool your app into accepting an expired security token.
Furthermore, since you're placing all security element inside your local storage, you simply cannot protect it against the local user: he could, for instance, run your app in a debugger, stop it right when it query your local DB and grab your authentication data from memory.
In other word, there is no foolproof way to protect your data in the way you want. All you can do it try to make it less easy through obfuscation.
Answer: There are several attack vectors here if someone wanted to pirate this software. They could modify the binary or replace the remote server with a fake one.
In general, DotNET binaries can easily be disassembled or decompiled back to readable source code, for free, see http://www.jetbrains.com/decompiler/. Even worse, the code can also be edited and recompiled almost just as easily. So if you have any secrets or symmetric encryption keys in your sources, they will be compromised. This can be only mitigated a bit by using some 3rd party obfuscator but that is just delaying the inevitable. If you already have a method to bypass authentication based on timestamp in your code, you're actually making it even easier to abuse. Also the local copy of db could be used to set up a fake auth server.

WinForm Application Security


Can I break a betta food feeder in half?

Question: Can I break a betta food feeder in half? I have a 7 day feeder but I will only be away for 2-3 days.
Answer: You can break these up but remember that if it's one you apply to the glass, you'll need enough surface area for it to stick. I've done this before with the smaller tropical tabs for shrimp and as long as there is still enough flat space to stick to the glass it will be fine.
I'm sure you already know (but it's worth saying for future visitors) - these types of food can be problematic in terms of water quality. Owing to the fact the food is exposed to the water for a prolonged time, you can get a build up of ammonia as the food starts to decompose (often accelerated by the water temperature being raised). It can also lead to some fish overeating because a lot of fish will eat any food available regardless of the damage it could do to then.
I agree with Karl Richter - your fish will not need to be fed every day (unless you're aggressively attempting to make a discus put on weight or something). A lot of fish keepers will overfeed their fish because they look hungry. As Karl also pointed out, in the wild, a fish is unlikely to feed every day without fail. I've personally left my tank (180L tropical community) for just under a week with no food and they've been fine. They nibble on algae and plants (if you have any).
This is an interesting video about preparations for leaving your aquarium which might help you feel more comfortable with the idea of not feeding your fish.
Answer: I guess you can. It's not important. Did you check the wrapping? Fish can remain without food for 2 or 3 days. That's probably why the feeder comes for 7 days and has no break lines. 1 day per week and 1 week per year without food is recommended because it is natural for fish to not find food every day and motivates them to eat algae in the tank. They probably have a feeling of hunger, but they don't starve and adjust their body size after longer periods of absence of food.
Answer: Your betta could survive not eating for 2-3 days since normally they are fed every other day at pet stores. Feeding blocks are great if you have a bunch of fish in the tank and awful if you don't. They create this fuzzy residu on the bottom where your gravel is that is a pain to clean and since it is food, anything that is uneaten can cause ammonia levels to rise.


MC Realms on PE - How do you do it?

Question: I'm in Meopham and I'm trying to connect to someone in Longfield and we're not on the same wifi. I've looked it up on various websites and they have all said that you should use realms. Is this true and if so is it possible to access it here? We've tried connecting to servers and we can't get on the same port. I think my external reach to servers has been blocked since I have somebody younger than me in the household (he's in primary) and we don't want him interacting freely with any strangers, especially if the chat's not moderated.
Comment: I don't think that's how Realms works.
Answer: As of right now, Minecraft Pocket Edition does not have Realms. There are unofficial versions but these are nowhere near complete to the normal game via Wi-Fi.
If you cannot connect to external servers, there is no way to connect to any unofficial servers.

MC Realms on PE - How do you do it?


Checking ERC721 token approvals in a for loop works in Hardhat Script but fails in React

Question: Here is my function, event and modifier:
event TransferComplete();

modifier isApproved(address[] memory contractArr) {
    require(contractArr.length > 0, "Length Zero");
    for (uint256 i = 0; i < contractArr.length; i++) {
        address currAddr = contractArr[i];
        require(currAddr != zero, "Contract address is ZERO");
        bool isApproved = IERC721(currAddr).isApprovedForAll(_msgSender(), address(this));
        require(isApproved == true, "Not Approved");
    }
    _;
}

function sendTokens(address[] memory contractAddrs, uint256[] memory tokenIds, address otherAddress) external isApproved(contractAddrs) {
    for (uint256 i = 0; i < contractAddrs.length; i++) {
        IERC721 tokenContract = IERC721(contractAddrs[i]);
        tokenContract.safeTransferFrom(_msgSender(), otherAddress, tokenIds[i]);
    }
    emit TransferComplete;
}

The sendTokens function has isApproved modifier which checks if the contractAddrs being passed have approved my contract for transferring their ERC721 tokens. I setup a hardhat deploy script which deploys this contract on my hardhat node with mainnet fork, sets approvals for a NFT contract address, and then calls sendTokens function with approved contract address and a token ID. Everything works as expected and and I see the TransferComplete event in my transaction receipt.
The problem is that when I call the same sendTokens function from my React frontend using metamask, the transaction fails with a couple of different reasons. Console logs show that execution reverts on the IERC721(currAddr).isApprovedForAll line in the modifier during the first loop.
Most times the error is
Error: Transaction reverted without a reason string

But sometimes its also
Error: Transaction reverted: function selector was not recognized and there's no fallback function

I have double checked everything and tried various things but none worked. Here is what I tried which didn't work:
Verify if the ABI and Bytecode being generated by Hardhat runtime environment during deployment match the ones I'm importing in React frontend.
Set manual gasLimits
Use Ganache or Anvil instead of Hardhat node
Use Frame and Brave wallets to make sure its not a metamask issue
Verify that ethers version being used by Hardhat runtime environment is the same being used on the frontend
Deployed on Goerli, same results -> HRE function call succeeds but React one fails

Any insights would be helpful and appreciated. Thank you.
Answer: I was passing an incorrect address from UI but passing the correct address in the Hardhat script. Since the address being passed wasn't an ERC721 contract, the transaction was failing.


Mac won't connect to internet

Question: I have an interesting problem and I believe I may be halfway to understanding it but don't know how to fix it. My home network has two routers. One is the main one and is in a cabinet so I do not have wifi enabled as the cabinet limits the range of the wifi. I have a second router placed elsewhere which runs my wifi. Currently Ethernet shows connected but no access To the internet. My guess is there is an issue with the iP address as the internet works on wifi with the Ethernet cable disconnected and slowly with it connected. With wifi off the Ethernet still doesn't connect to internet even though shows green. I guess there is a conflict and would appreciate some advice. Thanks in advance
Comment: There's so many details missing like how this entire network is configured.  As written, this doesn't seem to be an Apple related question/issue.  Can you please clarify?
Comment: make sure to do a terminal "ping" and a terminal "traceroute" if its macOS specific then its likely in your "grep wifi /var/log/system.log" file and related to some installed software or conflict with a program that is connecting to the internet using the same IP.
Answer: Apple covers the basics in troubleshooting internet connections.

Solve internet connection problems on Mac
https://support.apple.com/guide/mac-help/solve-internet-connection-problems-on-mac-mh11395/mac

This is a nice resource since it is specific to several versions of macOS and if it's too technical, you can refine your problem by working through it and asking a follow on question with details of where you got stuck or what sort of information doesn't make sense.
Here's the how to connect which also might help: https://support.apple.com/en-us/HT201735

Mac won’t connect to internet


Calculating the expected number of visits to a state by a DTMC

Question: Suppose we have a DTMC $X$ : $\{X_n : n = 0, 1,2,\dots\}$, a transition probability matrix $P$, and state space $S = \{1,2,3\}$. Suppose I want to calculate the expected amount of times we visit state $3$ in $T$ periods given that we start our chain at $X_0=1$. Let's also assume we have some function $C$ that maps values of $X$ to some "cost". We will define $C$ as such: $C(1) = 0, C(2) = 0, C(3) = 1$.
Then to calculate expected amount of times we reach state $3$, using this cost funtion we have:
$$E[\sum\limits_{i=1}^{T}C(X_i)|X_0=1]$$
in which case we would get an answer of something like:
$$[P+P^2+\dots+P^T] \begin{bmatrix} C(1) \\ C(2) \\ C(3) \end{bmatrix}$$
If this is not the case, what flaws are in my logic and what would a proper setup look like?
Comment: I don't follow your equations: the first (expectation) doesn't even reference state $3$ while the second one multiplies a $3\times 3$ matrix by a $T$-vector, which is not possible unless $T=3$ or $T=1.$
Comment: good point, I can fix the second one at least
Comment: I made some structural changes to the problem @whuber, let me know if this helps at all.
Answer: For a target state $s$ and any state $a,$ let $v_a(s,T)$ be the expected number of visits to state $s$ (not counting the current state) upon making $T\ge 0$ transitions from state $a.$  From basic properties of expectation and the Markov property, we know

$v_a(s,0)=0$ for all $a.$

$v_a(s,T) = \sum_{r\in S} P_{ar} v_r(s,T-1)+ \mathcal{I}(r=s) .$

This is conveniently expressed in matrix notation by letting $\mathbf{v}(s,T)$ be the vector $(v_a(s,0))_{a\in S}:$

$\mathbf{v}(s,0) = \mathbf{0}.$

$\mathbf{v}(s,T) = \mathbb{P} \mathbf{v}(s,T-1) + \mathbf{e}_s.$

$\mathbf{e}_s = (0,\ldots, 0,1,0,\ldots,0)^\prime$ has its unique $1$ at position $s.$
By inspection, the solution (easily verified) is
$$\mathbf{v}(s,T) = \mathbb{P}\left(\mathbb{P}\left(\cdots \mathbf{e}_s\right) + \cdots\right) + \mathbf{e}_s = \left(\mathbb{P}^T + \mathbb{P}^{T-1} + \cdots + \mathbb{P} + \mathbb{I}_3\right)\mathbf{e}_s.$$
In the question with $s=3$ and $a=1$ you would take the first entry in this vector, $v_1(3,T).$

To illustrate, here is brute-force R code to compute $\mathbf{v}(s,n):$
v <- e <- rep(0,dim(P)[1])
e[s] <- 1
for (i in seq_len(n)) v <- P %*% v + e

(For long sequences of transitions you would want to diagonalize $\mathbb{P}$ and sum the resulting geometric series appearing the diagonal--but that's standard Markov Chain machinery which we needn't discuss here.)
Here is R code to simulate 10,000 transitions starting at state a:
sim <- replicate(1e4, {
  x <- a
  count <- 0
  for (i in seq_len(n)) {
    if (x == s) count <- count + 1
    x <- sample.int(dim(P)[1], 1, prob=P[x,])
  }
  count
})
mean(sim)

Run these calculations with your favorite transition matrix to compare the results.  If you don't have a favorite, here is code to generate interesting ones (they have a bunch of zeros in them):
d <- 5 # Number of states
P <- cbind(rexp(d), matrix(ifelse(runif(d*(d-1)) <= 2/d, 0, rexp(d^2)), d))
P <- P / rowSums(P)
a <- 1 # Start state
s <- d # Target
n <- 8 # Transitions

For instance, after setting the seed with set.seed(17), the output was
> c(mean(sim), v[a])
[1] 2.132200 2.137539

showing good agreement between the observed frequency and computed value.


Does the AirPods case need to be around while listening via an iOS Device?

Question: When using an iOS device with a set of AirPods that have previously been paired, is the case also required whilst wearing them or can the buds be used without it?
Answer: No you don't need the case to continue listening!

The case is only used for charging/storage and the initial (one time) pairing with your devices.
You can leave the case at home and get full usage out of the AirPods until the battery dies. This includes switching devices, monitoring battery levels, using Find My AirPods, etc.
I typically take the case with me unless I'm going for a quick jog/walk. I don't recommend storing the AirPods anywhere other than the case or in your ears, to avoid losing them. Obviously the charging case prolongs the overall battery life as well.
Answer: Once you have paired the AirPods to an iOS device, you don't the case anymore to reconnect it to the device. The box helps in switching automatically to the nearby device and charging the AirPods.


Word footer social media icons and info

Question: Hope everyone is doing good.
I want to add FB and IG icons to the footer of a printed letter with the pages name next to each icon and add a customer service line at the bottom and the website URL. so far i managed to insert the icons but they remain stick to each other and i can't move them apart and when i write next to the logo, i can't make the text appear higher.
https://i.imgur.com/Bgr7O7w.jpg[][1]
Answer: The footer in a Word doc allows same formatting as the main body. In this case you can add spaces, tabs, alignment, and the Layout Tools for embedded images.
Show/Hide symbols, the ¶ button or Ctrl+Shift+8, can be helpful for tweaking.
Also, note that images in the header and footer will appear desaturated while working in Word but will appear normal in page preview, when printed or exported to pdf.

Word footer social media icons and info