meaning of m34 of CATransform3D

Question: What's the meaning of m34 of the structure CATransform3D, I only know it can change the perspective, but what's the meaning when the value is -0.001 and 0.001?
Comment: m34 means "The entry at position 3,4 in the matrix." https://developer.apple.com/documentation/quartzcore/catransform3d/1436566-m34
Answer: You can find the full details here. Note that Apple uses the reversed multiplication order for projection (relative to the given link) so all matrix multiplications are reversed and all matrices are transposed.
A short description of the meaning:

m34 = 1/z distance to projection plane (the 1/ez term in the reference link)
+ for the z axis is towards the viewer, resulting in a "looking in the mirror" feel when using -
projection center is (0,0,0) plus any translations you set up
Comment: z is the distance to your projection plane, m43 = 1/z. I've updated the answer to make this point a bit clearer. Changes change the distance and make the perspective look different on the same scene.
Comment: What is ``1/z``? I still don't get your explanation. What means m34? What does changes do?
Answer: The following is some background knowledge about the topics which I think readers should know before answering the questions:

iOS coordinate system: Imagine you are holding your phone vertically with the screen facing you. For each view, its coordinate system has origin at its center. x-axis from left to right, y-axis from top to bottom, z-axis from back of the phone to you face.

Homogenouse coordinates: when doing 3D transformation with iOS, you are working with homogenous coordinates or projective coordinates instead of traditional Cartesian coordinates. In short, the new coordinate system use one more dimension w compared to the old one. The beauty of this system is that it allow doing rotation/translation/scale by doing vector-matrix-multiplication.

To convert a vector in homogenous coordinate to Catersian coordinate, you divide x, y, z to w.

Now, let's get to the answer. Consider an example as following:
    var transform = CATransform3DIdentity
    transform.m34 = -1 / 500
    transform = CATransform3DRotate(transform, Double.pi/4, 0, 1, 0)
    transform = CATransform3DTranslate(transform, 0, 0, 200)
    imageLayer.transform = transform

To know what the code above does, you must read it in reversed order. Firstly, the image is moved 200px in z-axis toward (positive sign mean its direction is from the screen toward your face). Secondly, the image is rotate 45 degree relative to the y-axis (tilted to your right). If you stop here, you'll have a image with smaller width and shifted to your right. But some operations is done at step 3 and "magically" give the image perspective. Here lies the mystery of m34 element.
Here is the sequence of operations expressed in term of matrix multiplications:
 [x' y' z' w'] = ([x y z w] * translation_matrix * rotation_matrix) * perspective_matrix

Transformation with perspective matrix
Now, focus on the operation with the perspective_matrix

Convert to Catersian coordinates:

Transformation with scale factor
To model 3D perspective on 2D screen, you want to objects closer to your eye appear bigger than objects further away. To do that, you project objects from 3D space to the screen, i.e, draw imaginary lines from your eyes passthrough the objects and intercept with the screen. Let's calculate scaling factor for that projections:
z = the object's z-coordinate which is its distance to the screen
eye2screen #distance from your eyes to the screens
scaleFactor = eye2screen / (eye2Screen - z) #Thales's intercept theorem

A quick calculation can confirm our intuition. As z get smaller (i.e objects further away from the eyes), scaleFactor get smaller.
Reconcile our scaleFactor with perspective_matrix multiplication above we have:
scaleFactor = 1 / (1 + m34 * z)
1 / (1 - z / eye2screen) = 1 / (1 + m34 * z)
-1 / eye2screen = m34
m34 = -1 / eye2screen

Pick a reasonable distance between eyes and screen (like 500), you can calculate m34 and you've got yourself a new perspective_matrix.
Conclusions:

Perspective matrix is a math trick to scale objects base on their distance to your eyes.
Compute m34 = -1 / eye2screen give you a perspective_matrix
perspective_matrix operation must be applied only once at the end of your transform pipeline.
Answer: I read some articles including this one: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/AdvancedAnimationTricks/AdvancedAnimationTricks.html#//apple_ref/doc/uid/TP40004514-CH8-SW13
My solutions is here:
Entities:

eye - distance from screen to eye
scale - visual scale of transformed object
distance - distance to transformed object

Connecting formulas:

scale = eye / (eye + distance)
distance = eye * (1.0/scale - scale)
eye = distance / (1.0/scale - scale)

Example of computing z-distance for desized scale of selected eye distance:
CATransform3D transformByScaleAndEye(CGFloat scale, CGFloat eye) {
    CATransform3D t = CATransform3DIdentity;
    t.m34 = -1.0 / eye;
    CGFloat distance = -eye*(1.0/scale - scale);
    return CATransform3DTranslate(t, 0, 0, distance);
}

meaning of m34 of CATransform3D


Recommended to Ubuntu, downloaded to a saved file on desktop

Question: So now what?
Old HP with XP, running IE8 and had to put Chrome into the mix because Yahoo quit working in IE. Still use the IE, because my online shop won't load with Chrome.
My AVG antivirus began having conniptions and to get System Restore to work again, Microsoft said to erase the antivirus software, which doesn't want to go (maybe another problem in itself?).
How do I open U and 'run it alongside' the others? I downloaded the 32 bit 12 LTS.
Not as tech savvy as I should be for this, but was hoping to keep it all working at least until I can afford another computer.
Thank you!
Comment: A side note: if your website only work in IE, you might want to hire someone to fix it for you, just saying
Comment: I have an online shop using someone else's website (Etsy). Their website will not work on my computer if I go to it using Google Chrome. I had to download Chrome in order to run Yahoo for my email, as Yahoo quit working in IE8.
Comment: Sorry, Ubuntu has no support for IE8. However, you can run IE6 on Wine. If this is enough, you can switch to Ubuntu.
Comment: @Danatela  The website where I have my online shop will not support less than IE8. Thank you, tho!
Answer: You can use the Ubuntu Windows Installer to install Ubuntu just like another program in Windows.  The link I provided has some instructions as well as a download link.
Once this is installed and configured, you can reboot into Ubuntu and switch back to Windows whenever you want to by rebooting and selecting Windows from your boot menu.


Ringlike artifacts produced by rays bouncing off a light source

Question: I recently set up a (very basic) ray-marched path-tracer, and I'm getting strange surface patterns on my area light [link]. I'm using known-valid analytical normals for the light's surface, and the same patterns appear when I use a well-tested gradient estimator anyway.
Ray bounce directions are calculated with amietia's diffuse BRDF, and regenerated after each bounce. The random numbers in each bounce are uncorrelated (hashed integer versions of the intersecting ray positions) and I'm offsetting ray distances at the start of each bounce by [0.01f] to avoid shadow acne.
The last time I saw this bug was several months ago, and that time it was (probably) caused by shadow acne. What could it be now?
Answer: Fixed this today.
The artifacts were produced by shadow acne and worsened by dodgy averages (assuming every ray would complete the maximum number of bounces before returning or exiting the scene) + an undersized PRNG state buffer; maybe I was just really tired, but I still don't know why bouncing rays off my light sources by default seemed like a good idea. The point of backward path tracing is to trace paths from the camera back to the light source(s) in a scene, and there's no reason to continue following a path (=> evaluate bounces) if rays immediately intersect with a source after leaving the camera.
Comment: It's possible to have a surface that's both reflective and emissive, eg the glass surface of a dim light bulb. (Dim, so you can actually _see_ some reflection on top of the emission.) So this maybe isn't as much of a mistake as you thought. Although if the material on the light source is _purely_ emissive then certainly stop tracing there.
Comment: Ahh...no, sorry. :)
My light sources are stars (slowly building a space exploration game), and I haven't made any hybrid surfaces yet :P.
Wouldn't it be more correct to construct a lightbulb as an emissive filament inside a reflective/refractive volume?


"user is not in the sudoers file. this incident will be reported" when trying to run as an admin

Question: Just recently installed Ubuntu 20.04.1 LTS replacing entirely Windows 10.
I set up everything the way I wanted and I also installed Timeshift and made a backup successfully.
I tried to go into Timeshift today and it requested my password to login, so I put the one and only password I have, which is the same password I log into Ubuntu with. The password is not accepted.
I assumed it was because I wasn't a root user so I tried to become one using sudo -i and sudo -s (I read that here) and I got a Password prompt and here, again, I inputted the one and only password I have which is the same one I use to log into Ubuntu.
That's when I got the message "user is not in the sudoers file. this incident will be reported".
So I investigated the problem and tried this link https://www.tecmint.com/fix-user-is-not-in-the-sudoers-file-the-incident-will-be-reported-ubuntu/.
All seemed to have gone well with no problems or errors and I've also found the same information in multiple websites but the problem still persists.
Does anybody have any ideas as to what else I can try? I don't care about being root in general, I just want to be able to open my apps like Timeshift and my Firewall app.
Any help much appreciated.
Note: I am entirely new to Ubuntu so forgive me if I haven't performed some basic actions. Also, the website brings this question as suggested but does not help my situation. Most questions I came across containing the specific error message are solved by running some simple commands such as sudo -i and sudo -s but in my case that approach is not sufficient.
Comment: It has the solution but it doesn't mention the actual error message I got about the user not being in the sudoers file so I probably wouldn't have found it as I was searching specifically for that error. Nevertheless, it does contain the same solution. Thanks for that.
Comment: Sorry just a quick question. Why is this question considered a duplicate with the provided question in the link? One question asks about what to do when a specific error message is presented and the other question asks about what specific actions are required to add a user to the sudo group. Different question, same solution. Why is the question considered a duplicate?
Answer: OK, so I tried again, this time instead of trying to act with a sudo role, I simply had to re-add myself to the sudo group. I'm still not sure how I was removed though.
The solution for this was simply to add my user to the sudo group using #adduser username sudo.
So, if you ever get the message "user is not in the sudoers file. this incident will be reported" do check if you are in the sudo group first before attempting commands like sudo -i and sudo -s.
Full instructions and steps here.


How to make it clear to users, that they can write on our platform?

Question: I have build a publishing platform where users can write. I have the problem, that for "logged out" users it doesn't get clear, that they can write on eese (http://eese.com)
Here are some screenshots:
Screenshot 1: Landing page for logged out users

Screenshot 2:No headerbar - when the user scrolls the buttons get smaller

Screenshot 3: Open sidebar (menu)

Screenshot 4: Logged in users (in this case me). When you click the top right button you can create a story.

My metrics tells me, that users don't understand, that they can write on eese - obviously because there is no sign that u can do so.
How can i achieve this? Any ideas?
Answer: Two suggestions to try,
1) change the wording "new" to the wording you use in your question.  E.g "write on ease", or "write an article".
2) try some highlighting techniques, maybe a subtle bit of animation, transition or some other such "look at me" technique (colour, size, position).  You could make this personal, even if they are anonymous.  E.g only do it if they haven't logged in before or submitted anything.  Probably have to look into if you can achieve this with some type of state, e.g local storage or cookie - cookies are probably worth trying to avoid if possible.
It is possible I have missed the point of the "new" button.  If I have and actually you do need to be logged in to create a story, but you want anonymous people to know this.  Do pretty much the same as above, but when they click to create a new story - politely ask for their details (login / register). I.e offer the same experience regardless of being logged in or not, and only make people login / register when they need to.
Comment: I've ammended my answer. Maybe try putting a create story action pride of place next to newest and only ask to log in / register after they choose it.
Comment: Very interesting. This gave me new insight :)
You thought, that on the "New" button you can create a new story. Actually the "New" button sorts the stream to the "Newest" stories. So maybe it should be renamed to "Newest"? This would make it more distinct.

Also for logged in users (see last picture) the "Create a new story" button is the top right button (pen). For logged out users we have no idea where to show this button because there are already two buttons ("login" and "register").
Comment: Do you think, that users understand that on the one hand they can sort a stream and on the other hand create a story?

If so - could be something worth considering!
Comment: Maybe, a good way to test it is to conduct a usability test. Either way, I would make sure the create action is always available, regardless of being logged in, so users know they can do it.


How to remove postgres user password for rails?

Question: how to remove default password for postgres user?
config/database.yml
default: &default
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000
  adapter: postgresql

development:
  <<: *default
  database: app_dev

/etc/postgresql/11/main/pg_hba.conf
local   all             postgres                                trust
local   all             all                                     md5

Error: no password supplied on rails s
That's why I use custom login/password for every new rails project
How to fix this? I want to use default postgres user without password
Answer: Your given ERROR message seems to be approximate, I don't think PostgreSQL would provide that exact error message.
You don't appear to be specifying a username to connect as.  So by default it is probably attempting to connect as the PostgreSQL user which has the same spelling as the OS user running your app process.  This is unlikely to be 'postgres'.  If you want to connect as the PostgreSQL user 'postgres', specify that as the username. Don't rely on the default, which is not what you think it is.
Answer: Try to Change all USER status to trust in pg_hba.conf. In this way it will not require any password and will work fine. Although it is not a good practice but it is ok on the local server.
pg_hba.conf
Or you can change the password by typing these following commands from your terminal.
psql -U postgres
\password
Enter new password: ***
Enter it again: ***


UITableView: user interaction with section's footer

Question: For one of UITableView sections I have put a view with a UIDatePicker into it's footer (using tableview:viewForFooterInSection:). The problem is that UIDatePicker receives only single touch events (tapping) and doesn't receive scroll events, so I am unable to set appropriate time inside it. Instead of scrolling UIDatePicker's hours or minutes spinners, UITableView scrolls.
How can I make UIDatePicker respond to user "drag" events and make it spin instead of scrolling UITableView?
Comment: It seems that iOS 2.x had problems with scrollviews inside scrollviews.
Comment: possible duplicate of [UITableView footerView with button, button doesn't work](http://stackoverflow.com/questions/3989740/uitableview-footerview-with-button-button-doesnt-work)
Answer: iOS 2 had problems with scrollviews inside scrollviews. Same thing works fine on iOS 3+.
Answer: You can subclass UITableViewCell and then add UIDatePicker view as a subview on that subclassed UITableViewCell. Then you will get the way your requirement is.
As example.
UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:self.frame];
[self addSubview:datePicker];
[datePicker release];

Here self refers to UITableViewCell subclass object.


Wifi is not working in Dell Vostro 2420 after reinstalling Ubuntu 12.04

Question: I have a Dell Vostro 2420 pre-installed with Ubuntu, now re-installed manually, but wifi stopped working, I tried some of the methods shown in other threads for similar problems. One of the method I tried is as per this thread: Wireless Not at all working, but wifi is still not working:
<code>if I do `ifconfig` it shows the following
eth0      Link encap:Ethernet  HWaddr
          inet addr:192.168.1.6  Bcast:192.168.l1.255  Mask:255.255.255.0
          inet6 addr: fe80::e2db:55ff:feaa:6a25/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3341 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3685 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2658691 (2.6 MB)  TX bytes:531140 (531.1 KB)
          Interrupt:41 Base address:0xc000
eth1      Link encap:Ethernet  HWaddr
          inet6 addr: fe80::9e2a:70ff:fed9:c6e9/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:3114
          TX packets:0 errors:11 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:19
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:927 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:86581 (86.5 KB)  TX bytes:86581 (86.5 KB)
</code>
and the following command shows:
<code>$ rfkill` list
0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: brcmwl-0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
2: dell-wifi: Wireless LAN
    Soft blocked: no
    Hard blocked: no
3: dell-bluetooth: Bluetooth
    Soft blocked: no
    Hard blocked: no
</code>
I haven't got a clue about how to bring up the wifi. I'm awaiting a favorable solution so that I can connect to wifi without hassles.
Comment: Please do what is in the accepted answer in the link below so we may see the information needed to help diagnose the issue.
Comment: Hi @WildMan I have added the result of wireless-info.txt at http://pastebin.ubuntu.com/7353939/ Is there a solution for this? can I still connect to wifi? any method to connect please suggest!
Comment: Please post the output of: `modprobe -c | grep -i "14e4.*4365"`
Comment: Hi @WildMan no go when I type the given command in terminal nothing is getting displayed!
Answer: That is what I thought, your device is not supportd in 12.04 without a lot of extra work.
When dell installed 12.04 on your system they added the driver and the pci id for the device that is why it worked when you first received it before you reinstalled.
The best thing to do is to install ubuntu 14.04 your device should work after installing the driver without issues.
Comment: Hi @WildMan Initially I tried intalling ubuntu 14.04 some drivers didn't worked that is the reason I installed back the ubuntu 12.04 from the link http://www.ubuntu.com/certification/hardware/201202-10593/  Now I did sudo apt-get update and rebooted.. unbelievably WiFi is getting connected but one thing I want to ask is ifconfig is showing eth0 eth1 instead of eth0 and wlan0! But that should not affect my WiFi I guess
Comment: eth1 is what it is called when the wl driver is installed, if you were able to use the b43 driver it would be called wlan0.


Validator is called but error message is not displayed

Question: when i click on the command button. validate method is getting called but the error message is not getting displayed..
here is my code..
<h:form id="form">
    <h:body>

            <h:outputLabel for="year" value="Select Year: *" style="font-weight:bold" />

                <f:selectItem itemLabel="Select One" itemValue="null" />
                <f:selectItems value="#{leaveBean.yearDTO}" var="currentUser" itemValue="#{currentUser.name}" itemLabel="#{currentUser.name}" />
                <f:validator validatorId="LeaveCardValidator" />

       <h:message for="year" style="color:red"/>

Comment: are you sure your input was not valid? if input is valid so there will be no message.
Comment: am sure my input is invalid .. and also my action is also getting called even though validation fails...
Comment: Don't forget the form, as a seperate naming container so if you name your message id msg and try to update it it will be form:msg
Comment: I tried with   .. it didnt worked..
Answer: You seem to expect that JSF auto-updates the <h:message> on every ajax request. This is untrue. Perhaps you're confusing with PrimeFaces
 or
 which have each an autoUpdate attribute which enables you to tell them to auto-update themselves on every ajax request.
You really need to make sure that the <h:message> is covered by the ajax update. Just give it an ID
<h:message id="yearMessage" ... />

and include it in the client ID collection of the ajax update

An alternative would be to replace <h:message> by
.
Answer: Not sure where are the updateList and updateDetails are located but in the example give above you should use update="@form" instead or in addtion like this:
update="updateList updateDetails @form"

so that the form will be rendered again...
Comment: No its not, you need to make sure you render/update the `h:message` with you commandButton.
Comment: Yes @Daniel you are right. update is necessary for `p:commandButton`.
Comment: @erencan, try with plain `h:commandButton` with simple empty `f:ajax` , cause `p:commandButton` is boosted with default update of `@form` or something like this
Comment: @erencan, I don't what have you tried and based on what you are saying this thigs, but read this: http://balusc.blogspot.co.il/2006/09/debug-jsf-lifecycle.html#ValidationError , even when validation fails the RENDER_RESPONSE will be called.
Comment: rendering the form is not required for showing error messages as in the examples given by jsf..
Answer: just use one of these :
update the whole form in order to update the content of
<h:message />

or give the <h:message /> an id and id this id to the

<h:message id="msg" for="year" style="color:red"/>

Comment: use firebug in firefox and get the correct clientId instead of year
Comment: clientId's are always random generated, if you give every element an id it will always be the same.


Do interfaces evolve?

Question: People often use the word evolution to describe the change over time that can be seen in human computer interfaces.
Is there any research that looks at whether human computer interfaces evolve over time, following principles such as survival of the interface best suited to the task or gradual refinement through generations resulting in an interface really well tuned to a particular task?
I'm looking for specific researched examples that demonstrate principles from the theory of evolution evident in the progression of an interface.
Comment: I think you are mixing evolutionary science with UX. There is zero correlation with the principles since they principles of evolution are based on biology. (though...maybe there'll be a crossover once we figure out organic computing and AI...)
Comment: this describes what I mean: http://rationalwiki.org/wiki/Evolution#Non-biological_evolution
Comment: @DA01 - evolution can apply to much more than biological systems.
Comment: Are you asking for examples of softwares which have evolved ?
Comment: yes, or better still studies that look for evidence of evolution in the development of general purpose interfaces, such as a GUI or, outside HCI, car controls
Comment: Your question is still vague. I could give you examples of how the mouse has evolved or even computer GUI's have evolved but what is the objective of the question
Comment: the question is whether anyone has studied the change over time of any given interface to look at whether the principles of the theory of evolution are evident, rather than asking for examples of what is called evolution in any given product - possibly a bit philosophical I admit
Comment: i happen to think the principles held in the theory of evolution are pretty universal, I was curious about whether any academics had looked for them in the field of interface design and development, i.e. do the most usable survive ? I fear this might get closed, but it was worth a try !
Comment: @obelia evolution as a generic term, can. The "Theory of Evolution", however, is something rather specific and is in a different scientific field. If there is research out there that compares it to other fields, it would likely be philosophical in nature--rather than scientific.
Comment: But in regards to "do the most usable survive" I'd say, no. At least, there's no consistency with that. Quite often, the "most marketed" is what survives--regardless of how bad the UI is (see: anything PeopleSoft makes, anything IBM makes, SharePoint, etc)
Comment: @DA01 - I disagree. The theoretical principles of evolution originated in the field of biology but have since been applied in many other areas.  Richard Dawkins pioneered this in this first few books. Some of this thinking/research can be considered philosophy, but much of it is firmly in the domain of science, both theoretical and applied.
Comment: Ah, sorry Colin...I missed your latter comment. So yes, it sounds like you are talking about non-biological evolution so I'd suggest revising the question slightly so that it doesn't mention "theory of evolution" which tends to be the biological definition. (I would agree that interfaces evolve all the time...but aren't obeying the biological theory of evolution in doing so)
Comment: @obelia I'm with you. I think it's the phrase "theory of evolution" that was my hang up.
Answer: Genetic algorithms have been used to successfully find solutions to complex optimization problems. The algorithms rely on the same basic principles of "survival of the fittest" to improve the solution over time (many hundreds or thousands of iterations). On a basic level, many candidate solutions are generated, then scored, and the worst scoring ones are discarded while the better scoring ones are combined in some way (called cross-over, to simulate "breeding") to form new solutions. The better solutions get to survive to the next iteration (generation), and everything is performed again and again.
The challenge here, is to frame interface design as an optimization problem. Firefox performed an experiment recently with exactly this in mind. Some highlights:

Creating the perfect Firefox interface is a challenging problem. Every
  user has their own set of common tasks. The challenge is in defining a
  common "default" interface that maximizes task success for the most
  people, on the most tasks. Using designer insight alone, it's not
  always easy to know the impact of each design element!
...
Within 700 generations, good candidates started emerging, and by
  generation 1100, convergence was achieved. We then chose the most
  visually appealing one as our candidate.

There have been other experiments with generating visual art and music (among others). You should look up "interactive evolutionary computation" for some more papers and background material. The major challenge usually involves scoring the solution quality. For problems that can be framed in a mathematical way, this is quite easy. But for more creative pursuits this is much harder, and you have to encode some underlying set of rules or evaluation criteria (algorithmically determine good design from bad design). If your rules are too simplistic, you could end up with thousands of different solutions that all meet the criteria. If they are too strict, you could end up with no solutions, or all the generated solutions will look the same. That is what makes it so difficult to encode problems rooted in creativity/subjectivity/aesthetics. Interactive evolutionary algorithms usually rely on humans to assign a score ("fitness") to each candidate solution, but this is very labor intensive.
It is an interesting field that has been around for decades, even though it doesn't often get applied to interface design (for the aforementioned reasons).
Comment: Well spotted :-) The post made sense from the perspective of an experiment, given that the results were 'odd'. That is actually one of the major critiques of GAs - they are not always easily applicable to real-world problems. I have found some other academic material about using GAs to evolve UIs, but it won't really affect my answer. The principles remain the same. The usefulness will always be up for debate :-)
Comment: Very interesting, now, can the processes be observed in the wild, so to speak :-)
Comment: @ColinSharpe In principle, yes. Lets look at browsers. You have a population of interfaces (different browsers). Each browser has a fitness (number of users, or popularity). Each browser has many offspring (alpha and beta tests, new versions). Sometimes these offspring mutate (introduce a new feature found to be popular by users of other browsers). Each offspring either survives or dies (popularity improves, fitness increases), and the interface is said to have evolved. The challenge is in how you define and measure fitness :-)
Comment: Um... About that Mozilla experiment... Does that post make a lot of sense to you? Did you by any chance notice the date it was posted? :)
Answer: This is a soft science answer, but think about how symbols are added to the collective vocabulary. Symbols indicating new actions are often (and should be) accompanied by words at first:

As people learn a symbol's meaning, the clarifying text becomes red. Sometimes the descriptive text is replaced/removed too soon, and designers provide options to maintain clarity.

You may be able to argue that the words are gone for space constraints, but there's a familiarity with the actions prior to removing/replacing the words.
This idea of collective vocabulary is similar to the patterns learned in culture.

Culture consists of patterns, explicit and implicit, of and for
  behavior acquired and transmitted by symbols, constituting the
  distinctive achievement of human groups, including their embodiments
  in artifacts; the essential core of culture consists of traditional
  ideas and especially their attached values; culture systems may, on
  the one hand, be considered as products of action, on the other hand,
  as conditioning influences upon further action.

This question about learned design patterns is similar (conceptually at least).
Answer: Microsoft, Google, and Adobe present examples where interfaces evolve (they change over time) but are selected mainly by engineering pressures rather than pressures encountered "in the wild" (feedback effects from end-users).

There had been a trend in Windows versions, from 3.1 to 7, to improve consistency throughout the interface and to make Windows a more effective tool for performing computer tasks.  This might be "evolution" as intended to mean in the question.  At the same time, Microsoft has been pursuing experimental software projects to maintain a presence in markets it cannot control (examples: .NET, Silverlight), and pursuing these tends to override usability interests.  From a usability perspective, it is better to improve existing options than to offer more of similar quality.  .NET, especially, drifts because it competes with other versions of itself and cannot be killed, despite end-user concerns about its cancerous size, frequency of security updates, and unclear role in getting work done.  Because their goal is probably to win in Apple's market, Microsoft is still pushing Windows 8 and its colored boxes.
Google thinks Chrome and Javascript are the greatest things ever, and it has been growing increasingly obnoxious if you don't use them.  Worse, their web search mainly uses Javascript to hide the interface.  Google typically makes design choices by fiat rather than in response to feedback or anticipation of it (somebody in the company really likes spellchecking, so it is ubiquitous despite its decreasing accuracy).  Their response to feedback is to ignore or remove channels for it (try to obtain technical support for Gmail).  Google interfaces seem unable to evolve in the intended sense.
The Adobe Reader interface is evolving, but not in response to selection by end-users.  It is unclear how most features of the program could be useful, why they persist, or why they are introduced (and often mandatory).
There seems to be a recent trend toward smaller, less comprehensible icons and more non-interactive animation.  That might have an explanation in terms of competing forms of selection.
Comment: If you could add some screenshots or links to your answer, it would be much better.
Answer: In the lab, evolutionary analysis can be applied to things like A/B testing.  Note here the fitness test is not market share, but something well specified by the experiments designers (e.g. user task success rate or sign-up rate). I would imagine this kind of analysis mainly applies to specific narrow aspects of the UI (e.g. the shade of blue), but this approach could be scaled up/composited to encompass the whole UI, but I don't thing the state-of-the-art is there yet.
In the wild  there is some research on the theoretical evolution of software, but I don't think you'll find anything specific to UIs.
Scientifically, it would be difficult to isolate the UI from the software package as a whole in order to apply evolutionary driven analysis to just the UI. This is because it would be difficult to come up with a fitness test that applies mainly to the UI.  The most obvious fitness test for software is market acceptance, or simply amount of usage, and an arguably great UI can be paired with a bad backend and the package as a whole will fail. To further muddy the waters, the overall quality of the software is sometimes a minor factor in a fitness test based on market share - bad software can be successfully marketed, and vice versa.

Do interfaces evolve?


When is a separate vent not needed?

Question: I was of the understanding that every trap needs a vent and that all the vents for all the traps tie into the vent portion of the main stack which vents through the roof.
I came across this diagram in a plumbing book and am confused why the laundry sink in the basement doesn't have its own vent? Instead, unlike the other fixtures in the image, it seems to rely on the vent portion of the main stack for its venting needs. What allows it to do this?
(uploading image isn't working right now, I'll try again later)
Comment: Not all sinks , showers or other drains have an individual vent. If another device is vented in the area it would be common to only have 1 . I often see 2 bathrooms with only 1 vent.
Answer: It could be that you have a single stack vent system:

The Single Stack Vent System was introduced into the IPC in the 2012 Edition and is based
  on a drainage stack system in the City of Philadelphia (Pennsylvania) Plumbing Code which
  has been used successfully in many multi-story and high-rise buildings for over 100 years.

https://wabo.memberclicks.net/assets/pdfs/Plumbing_Venting_Brochure_2018.pdf (pages 17-19)

When is a separate vent not needed?


ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: [None, 32, 32]

Question: import imageio
import glob
import numpy as np
import tensorflow as tf
from tensorflow.keras import datasets, layers, models
import matplotlib.pyplot as plt

trainImages = []
for imagePath in glob.glob('C:/Users/razva/*.png'):
     image = imageio.imread(imagePath)
     trainImages.append(image)
trainImages = np.array(trainImages)

f = open('C:/Users/razva/train.txt')
trainLabels = f.readlines()
for i in range(len(trainLabels)):
     trainLabels[i] = int(trainLabels[i][11])
trainLabels = np.array(trainLabels)

validationImages = []
for imagePath in glob.glob('C:/Users/razva/*.png'):
     image = imageio.imread(imagePath)
     validationImages.append(image)
validationImages = np.array(validationImages)
f = open('C:/Users/razva/validation.txt')
validationLabels = f.readlines()
for i in range(len(validationLabels)):
     validationLabels[i] = int(validationLabels[i][11])
validationLabels = np.array(validationLabels)

mean_image = np.mean(trainImages, axis = 0)
sd = np.std(trainImages)
trainImages = (trainImages - mean_image) / sd

mean_image1 = np.mean(validationImages, axis = 0)
sd1 = np.std(validationImages)
validationImages = (validationImages - mean_image1) / sd1

model = models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(32, 32, 3)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))

model.add(layers.Flatten())
model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(10))

model.compile(optimizer='adam', loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True), metrics=['accuracy'])

history = model.fit(trainImages, trainLabels, epochs=10, validation_data=(validationImages, validationLabels))

I have this cnn for image classification, trainImages and trainLabel(from 0 to 8) are training data, validationImages and validationLabels are for test. Images are 32 * 32. I cant make this algorithm work, tell me if u observe more errors pls.
Answer: I can't tell exactly where the problem is since I have no access to the loaded images, but the issue is that you are providing samples without the "channel" axis which in the specified input_shape=(32, 32, 3) is indicated as having size 3. Each sample (image) must have 3 dimensions (width, height, channels) but, on the contrary, you are passing samples with just 2 dimensions (width and height).
This is most likely due to the fact that you are probably loading gray-scale images with just one channel, which is not explicitly assigned an axis by numpy. If this is the case, make sure that both trainImages and validationImages have shape (32, 32, 1), otherwise just expand the last dimension with np.expand_dims(_trainImages_, axis=-1) (same for the validation set) before feeding them to the model. Accordingly, adjust to (32, 32, 1) the input_shape in the first Conv2D layer.
Hope it helps, otherwise let me have further details.
Comment: @Babenco5 Just call `model.predict(.)` on a batch of images you want to classify. Then, since you are outputting logits, you need to apply `np.argmax(prediction_result, axis=-1)` to obtain a batch of predicted labels corresponding to the given inputs. With regard to this, since you have 9 labels (from 0 to 8, as you said), I believe you should have 9 neurons in the last Dense layer (not 10, as you do).

P.S. If my answer was helpful, please accept it.


how to remove plastic stuck inside core drill bit

Question: I use a 1/4" diamond tip core drill bit to make holes in the bottom of bowls to   use them as plant pots with drainage.  I bought the diamond core drill bit to drill ceramic bowls, however I also used it to drill 1/4" into plastic bowls, and this was a mistake. The plastic is wedged so tightly inside the bit that I cannot get it out.  I have tried getting it out with an awl, a safety pin, a nail, a knife, etc. and no luck.
Any ideas?  All I can think of is to secure the bit in a vise, and try to drill out the plastic with a smaller bit.
Comment: can you post a picture ?
Answer: I would first try driving a screw into the plastic and then pulling it out. You could clamp the screw in a vice and pull on the bit so that you don't damage the bit with the clamp.
If it's tightly wedged in it might be easiest to drill out the center of it with the largest bit you have and then crack/break the rest of it out.
Answer: I'm not sure if there are any surefire ways to get it out, but I have an idea.
Put the bit into a bench vise, and then find a small screw or bolt that will fit inside the bit. Clamp down the screw with locking pliers and then heat it with a torch until it is red hot. Insert the end of it inside of the bit. Wait for everything to cool down and then try pulling the screw out.
You want to avoid heating the bit directly because that could cause it to lose its temper.
Answer: Throw the bit in the oven or on the barbeque.  The plastic will shrink as it heats up, and if you get lucky, you can melt it out. Otherwise you'll have enough room to get the awl/pin/whatever into it, and you'll have broken the suction.


How and when must I satisfy NEC 2020 requirements for outdoor disconnect?

Question: Context:
I'll start with some context. As a single-family homeowner intending to replace an interior main panel with a 200A panel under permit, I am interpreting the National Electric Code (NEC) 2020 as adopted by my jurisdiction and attempting to satisfy section 230.85 "Emergency Disconnects."
Although I do not have a full copy of the 2020 NEC at this time, this snippet is available from online sources claiming it is from the 2020 NEC:

For one- and two-family dwelling units, all service conductors shall
terminate in disconnecting means having a short-circuit current rating
equal to or greater than the available fault current, installed in a
readily accessible outdoor location. If more than one disconnect is
provided, they shall be grouped. Each disconnect shall be one of the
following:
(1) Service disconnects marked as follows:
EMERGENCY DISCONNECT,
SERVICE DISCONNECT
(2) Meter disconnects installed per 230.82(3) and marked as follows:
EMERGENCY DISCONNECT,
METER DISCONNECT, NOT SERVICE EQUIPMENT
(3) Other listed disconnect switches or circuit breakers on the supply
side of each service disconnect that are suitable for use as service
equipment and marked as follows:
EMERGENCY DISCONNECT, NOT SERVICE EQUIPMENT
Markings shall comply with 110.21(B).

An electrician working for my jurisdiction said, paraphrased: you will need a "meter main," an exterior disconnect. What I wasn't sure on was whether this is required if I don't have to replace my meter base as part of my upgrade.
Questions:

What are some real-world devices available for purchase that would satisfy this code requirement for exterior disconnect? Examples of different types of products/solutions rated for 200A would be very helpful.
If I used a combo meter main panel outside, would that designate my "main" panel inside as a sub-panel? What if I used a disconnect switch instead?
Does the code not require me to install this disconnect if I can reuse my meter base (i.e. if it's already 200A rated)? If I don't do it now, would I then have to if I later replaced my buried cable?
Comment: You need to get definitive answers from your local permitting office. In my area (Maryland), every county is different - some on 2020, some not yet, some requiring disconnect, some not yet. But in particular, at least around here, each jurisdiction has very *specific* meter sockets and meter mains that they allow, with very slow changes and even some extra *temporary* alternatives allowed due to parts shortages. So you need to find out **from your local jurisdiction** what you specifically can/can't use. Ideally your electrician should be on top of this, maybe they are, maybe they aren't
Comment: OK, so you have a small-ish Rule of Six panel that is overstuffed. Aside from the 240V breaker feeding the lower 8 spaces, are there other 240V breakers in that panel?  Any chance it's a Murray/ITE/Gould panel (good)?  How about Zinsco of Federal Pacific (bad)?  Any reason you don't want a meter-main other than penny pinching?  Would you prefer a panel in a different location?
Comment: Wait, are you doing a service *upgrade* from <200A to 200A?
Comment: If you'd provide more info (description and/or photo) about how the existing service terminates on the house and how the feed arrives into the existing interior main panel, that could help inform the responses.
Comment: @Harper-ReinstateMonica I am not upgrading my service yet because my buried cable only has 1/0 aluminum. However, I am preparing everything so that I may do that in the future, yes. Current box is rated for 200, but city won't raise me over 120 with that setup. Severely overcrowded panel full of half-height breakers.
Comment: @GregHill My setup is circa 1967, buried 1/0 aluminum through meter head on the garage wall. That punches through to the main panel which is rated for 200A, but only has 8 lower slots protected by a main breaker. Has 8 additional upper slots connected directly to the service, two of which serve as a 2-pole main for the lower 8. The lower 8 are loaded with half-height breakers, some of which power two circuits. First order of business.. more space so every circuit gets one breaker, can put things on AFCI for some better protection. Second order of business, increase service to 200A.
Comment: @Harper-ReinstateMonica Cost, complexity, and availability of parts are my main concerns, as a homeowner. In principle I'm all for it. I have a GE panel, the way the main feeds the lower breakers is through some fairly girthy (sorry, don't know the AWG) leads hammered flat and slid tightly below the breakers, screwed to the rails with stripped screws I can't torque down. There's evidence of heat issues in several places. I cleaned it up once to improve connectivity, but not being able to torque the connection powering all of my branch circuits is concerning. Extra nails in the coffin, right
Comment: Mine is - and he told me plenty of stories in the run-up to finally doing my heavy-up. No outside disconnect required, but he told me it came very close to that. Grabbing a spare meter socket from his preferred supplier when they suddenly had a case in stock and 1 or 2 to spare, etc. Anything from your panel on can be "whatever" but that first piece (disconnect or not) must be **exactly** what your jurisdiction and/or utility wants or you will have problems.
Comment: @manassehkatz-Moving2Codidact Thank you, I have been in touch with them, but as I am doing the work myself, I am trying to do my research as much as possible beforehand. They told me they are on 2020 strictly speaking in these areas so I am starting there and compiling a list of clarifications to make with them afterwards. It's a balancing act where I want their critical advice but I don't want to treat the city electrician as my unpaid professor
Comment: That sounds like a good plan. So they are clearly on 2020 which means outside disconnect. And a small meter main is likely the way to go. But you need to find out if they have an "approved list". They might, they might not. But if they do then it is critical. If they don't then the experts here will give you suggestions.
Comment: Merely being old doesn't mean parts won't be available. If it were CH, QO, BR, HOM, Challenger, BRyant, Westinghouse, Murray or ITE you'd be fine. But GE in particular has serious issues with panels that old.  Regardless, the un-torque-able terminal is a fire-starter that has to go ASAP.
Comment: @Harper-ReinstateMonica I completely agree. My lights everywhere flicker both dim and bright regularly too, even if the load causing it is on its own dedicated breaker. I also just learned a panel needs 15 inches of clearance from center on either side; mine is wedged in a corner with only 12 inches on the left. I will likely need to move my panel over by a stud cavity
Comment: @BitFracture Yeah, kill that bad connection with fire before it kills you with fire.  "15 inches on either side" is incorrect; what is correct is "the width of all the various panels *but at least 30 inches* and it does not need to be centered".   However, that working space, including 36" depth of stand-back room and 78" floor-ceiling, must be kept clear ***at ALL times*** and not turned into stuff storage.  As such, panels are happiest in hallways and thresholds where no one will block it because it's a passageway.  Anyway if you're moving the panel, permit a 2nd panel and move circuits 1x1.
Comment: @Harper-ReinstateMonica Very good to know it does not need to be centered
Answer: Wait. You're planning To DIY a main panel replacement???
And you don't like meter-mains?
That doesn't make any -- um, just read on.
TLDR: don't merely get a meter-main, get a Ranch Panel and a nice big'un.  Solar-ready if you're into that sort of thing lol. I would pay to replace the meter with that, and tell them to leave the main panel alone.  Then, I'd DIY the main panel.  Because that's relatively easy/dumb make-work with little risk, which is why the electrician is so "on fire" to do that work and not any other.

What are some real-world devices available for purchase that would satisfy this code requirement for exterior disconnect? Examples of different types of products/solutions rated for 200A would be very helpful.

A meter-main, a plain old disconnect switch, or a main breaker in a box.  Price the various options if you want to, but the "meter main" is generally the cheapest if you're replacing your meter pan anyway.  Which you will need to do, in order to exploit 200A service.
When NEC says "disconnect", in practical terms they mean "main breaker" because a breaker is a disconnect and it would be money-wasteful to have a discrete disconnect and also breaker.
And having multiple enclosures is not only costly, it's ugly too - so a single "meter+main" enclosure becomes a cost and aesthetics optimization.
That's why NEC says "disconnect" but everyone says "meter-main".
Another rather useful thing for many people is the "Ranch Panel", which takes the meter-main and adds 4-12 breaker spaces.  Just like that, things like solar, generator/interlock, surge suppressor, shed feeder and EV charging become easier.
Now with the Ranch Panel, a future panel can be fed 200A off the "thru lugs". However a legacy 60-125A panel and its feed wires can be fed from a same-size branch circuit breaker.  This removes the urgency from replacing a panel that isn't actually dangerous or broken.  The Ranch Panel's main breaker can also be swapped for a 100-125A main to match the existing service size; at that point you can freely fill it with whatever.
For what it's worth, AFCIs don't need to be breakers; they can be AFCI receptacles or deadfronts at the first outlet. However I prefer to run EMT metal conduit to 4-11/16" square boxes (for the space) near the panel, and mount dual AFCIs there. That qualifies for the standards for entirely new work, since the run from panel to first outlet is inside metal conduit. It's also easy to wire since the AFCI-protected hot+neutral can simply use the same conduit to go back into the panel and tie to the circuit hot/neutral.

If I used a combo meter main panel outside, would that designate my "main" panel inside as a sub-panel? What if I used a disconnect switch instead?

The former "main" becomes a subpanel in all cases.  The main panel is the first disconnect past the meter.
There are also solar-ready meter-mains which provide a separate utility-side breaker for solar. This removes all amp limits on the size of the solar system.

Does the code not require me to install this disconnect if I can reuse my meter base (i.e. if it's already 200A rated)? If I don't do it now, would I then have to if I later replaced my buried cable?

The triggering event will definitely be if you had to replace your meter pan for other reasons. Whether it's required as a main panel upgrade is up to the AHJ.   I would expect the requirement to land if you are doing something more than a straight repair of a broken pan, and if you are disturbing the meter pan in a way the power company must de-energize the pan for service. A panel replacement wouldn't qualify, since the power company can simply pull the meter for that.  It's really up to the AHJ.
But why on earth would you resist a meter-main if you are doing DIY replacement of the main panel?  What do you think they're going to do, let you work "live" or that work+inspection+hookup can happen in a day with no snags or gotchas? You are better off installing a meter-main-ish-sort-of-thing like a Ranch Panel, as a single one-shot operation, probably for hire... get re-energized, and then you're now in a great position to DIY panel replacement.
Not least, think about how this changes the panel replacement task.  Before, it was a panel upgrade, which definitely needs the full rigmarole of permits and inspections.  But now, it's not an upgrade - it's a REPAIR.  Remember, it stopped being a "Rule of Six" panel the moment it got fed from a 125A breaker elsewhere. Now, it's just a random main-lug panel.  And you are replacing it in-kind with another main-lug panel.   Well, that's a repair.  There's nothing to permit there.
Sure, it's a 225A-bussed main-lug panel, but 125A-bussed panels were not available and nobody really cares. Sure, it's 40 spaces instead of 14, but you're not adding any circuits so it doesn't matter.
Or if there was "no sale" on that idea, I would propose adding a Critical Loads subpanel in a position where existing wires will reach, and say "I want to move some critical loads to that panel".  Now you're only messing with a few circuits in the house, so you're not taking your entire house down for the duration.
You have a split-bus panel with fatal defects
Split-bus panels operate under the Rule of Six, using an internal subpanel.  Rule of Six means that there is a "main breaker" area with up to 6 "main breakers".  This area cannot be de-energized. Further, nothing prevents this area from overloading, which means these panels are vulnerable to being overloaded when people do "upgrades" without re-calculating their NEC Article 220 Load Calculation.
This doesn't call for replacement, but it does need to have a main breaker in front of it to eliminate the "overload vulnerability".  Meter-mains do a fine job of that.
However yours has 2 additional problems.  #1 it's an ancient GE panel, for which availability of full-size breakers is hit-and-miss. (though you can get thins all day). #2 you mentioned a faulty lug that cannot be torqued - that is an instant deal-killer.  Right now I would remove those un-torque-able wires and feed the Lighting Area with a backfeed breaker, condensing circuits as needed to make it fit.  The risk of arcing and fire is severe.  Torque matters.
How I would stage the work
I would actually break it into three mini-projects.
The whole point of this is to "box in" project 2 so it is the smallest and simplest project it can be - to maximize the chance of getting it done in 1 morning, so the inspector will be confident you will be powered back up same day and won't have to ask uncomfortable questions about where you'll be sleeping the night (inspectors do not like people being in power-out houses).  Whole panel swaps are hard, especially for DIYers, with many complications.  By giving you the power to DIY shutoff the panel without power company intervention, it "sets you up for success" on project 3, the actual panel swap.
Project 1: Add a ground bar to the old panel, separate neutrals and grounds in that panel, and run a separate ground wire parallel to the service entrance wire (from panel to meter).
Project 2: Replace the old meter pan with a meter-main (full stop).  This will involve full permits and power company intervention.  Removing the old service drop, the house will be down for the duration, and then getting inspection/approval and then the power company turns the power back on.  However, because it's a small project, there's much less to go wrong so you are less likely to have a protracted "power out" situation.  I'm deliberately excluding the main panel swap from this, because that would make things much more complicated, especially given all the surprises you can find in a main panel swap.
But a meter-main isn't mandatory! Why should I do something that isn't mandatory? Because it allows you to break the project into smaller, simpler, more achievable bite-sized projects, thus making it all easier and increasing the chance of DIY success.
Now, you actually could go "above and beyond" on this in a couple of ways. #1 instead of a straight meter-main you could use a "Ranch Panel", which adds 8 breaker spaces to the meter-main. This could do things like allow you to feed the old main panel 100A while building a new main panel right next to it that is fed 200A. Then you can move circuits from the old to new panel 1 at a time at your leisure, if that would help your workflow.   Or the 8 breaker spaces could accommodate generator interlock, solar, surge suppressor, you name it.   #2 you could install a 400A meter-main, which includes a 200A breaker and a blank space for a second 200A breaker (to feed a second 200A panel - that is the normal way 400A services are done). Even if you're not buying 400A service today, the meter-main is ready to go the day you upgrade.  And they make 400A ranch panels too.
Project 3: (if needed) replace the former main panel (now main subpanel) with a better quality of main subpanel.  Because of project 2, the power company is NOT involved and this gives you maximum flexibility/choice on how to approach it. For instance you could leave the old panel in place and add a new panel next to it.  Move circuits over 1 at a time at your leisure, then scrap out the old panel at your leisure.
Comment: If it's new enough to take THQPs, it should darn well accept current production THQL -- the rejection issues with THQLs in really old GE panels only come into play with panels so old that their bussing is 5kAIC instead of >=10kAIC
Comment: I have combined this with the knowledge of a city electrician. The exception for my jurisdiction is: until the 2023 NEC is adopted on October 1, 2023, exterior means of disconnect is waved so long as the service is unchanged. I got confirmation my buried cable is 4/0 AL and meter+base are 200A. I learned the service cable is not governed by NEC and they'll run 4/0 AL at nearly 400A! That means no change to service for me, and if I can get this done soon, no disconnect requirement. I opt for this in order to decrease complexity so I as a homeowner have a greater chance of a successful result
Comment: @BitFracture I added a section explaining why sectioning the work into smaller projects (each of smaller scope) actually *simplifies* each project and makes them more DIY-achievable.   Main panel swaps are *hard* and have many complications. Being able to cut power to them *yourself* without having to involve the power company and post-work inspections is a huge, huge win for DIY.   And since even a DIYer can swap a meter pan in 1 day, the inspector won't be too concerned about where you'll be living during the project.


Approach on sum of $\binom{10+r}{r}\cdot\binom{20-r}{10-r}$

Question: The problem: Find $$\sum_{r=0}^{10} \binom{10+r}{r}\cdot\binom{20-r}{10-r}$$
I do not even know how to approach this problem. None of the standard binomials or their combinations that I consider like $(1+x)^n$ or $(1-x)^{-n}$ seem to work. Would anyone please provide a hint on how to approach this?
This is expected to be solved by only using high school techniques and considering basic polynomials of the form $(1+x)^n$ and $(1+x)^{-n}$.
Answer: First off, use the identity
$$\binom{n}{k} = \binom{n}{n - k}$$
to simplify the sum to
$$\sum_{r = 0}^{10} \binom{10 + r}{10} \binom{20 - r}{10}.$$
Now, using the convention that $\binom nk = 0$ if $k < 0$ or $k > n$, this can be simplified even further into
$$\sum_{r = -10}^{20}\binom{10 + r}{10} \binom{20 - r}{10} = \sum_{s = 0}^{30} \binom{s}{10}\binom{30 - s}{10},$$
where we've made the substitution $s = r + 10$. This sum count up the number of ways we can split a line of $30$ balls into a left and right group and choose $10$ balls from each group. Another way to do this would be to choose $21$ balls out of a line of $31$ balls, and split the groups according to the $11$th ball chosen (removing it from the line). This means that the answer is $$\binom{31}{21} = \binom{31}{10} = \boxed{44352165}.$$
Comment: Very nice. I did something very similar but messed up near the end by using $\binom{30}{20}$ instead.
Comment: Thank you very much for your answer. The part of changing the limits from -10 to 20 never occurred to me. The balls analogy was really eye opening too.
Answer: Your sum is an instance of the Rothe-Hagen identity
$$\sum_{r=0}^n \frac{x}{x + rz} \binom{x + rz}{r} \frac{y}{y+(n-r)z} \binom{y+(n-r)z}{n-r} = \frac{x+y}{x+y+nz} \binom{x+y+nz}{n} \tag{1}$$ for the choice $$x = y = 11, \quad n = 10, \quad z = 1.$$  In particular, this yields
$$\begin{align}
\sum_{r=0}^{10} \binom{10+r}{r} \binom{20-r}{10-r}
&= \sum_{r=0}^{10} \frac{11}{11+r} \binom{11+r}{r} \frac{11}{21-r} \binom{21-r}{10-r} \\
&= \frac{22}{32} \binom{32}{10} \\
&= \binom{31}{10}.
\end{align}$$
Comment: Thank you for this identity. Though I guess it's a real monster to memorize and apply correctly, especially at the level I am.
Answer: Here is an approach using two common binomial identities which might also be of interest.

We obtain
\begin{align*}
\color{blue}{\sum_{r=0}^{10}}\color{blue}{\binom{10+r}{r}\binom{20-r}{10-r}}
&=\sum_{r=0}^{10}\binom{-11}{r}\binom{-11}{10-r}(-1)^r(-1)^{10-r}\tag{1}\\
&=\binom{-22}{10}\tag{2}\\
&\,\,\color{blue}{=\binom{31}{10}=44\,352\,165}
\end{align*}
Comment:

In (1) we use the binomial identity $\binom{-n}{k}=\binom{n+k-1}{k}(-1)^k$.

In (2) we apply the Chu-Vandermonde identity
$\sum_{k=0}^n\binom{s}{k}\binom{t}{n-k}=\binom{s+t}{n}$ which corresponds to $(1+x)^s(1+x)^t=(1+x)^{s+t}$.
Comment: Absolutely beautiful solution, thank you so much! Could never have thought of converting from positive to negative exponents. Could you maybe explain the thought process that led you to try that?
Comment: @PopularPower: You're welcome. Many thanks for your nice comment. :-) A change of sign of the upper index $\binom{q+r}{r}$ to $\binom{-q-1}{r}(-1)^r$ comes into mind, when we see the variable $r$ being part of the lower index *and* upper index and we want to eliminate it from the upper index. This is a *[recurrent theme](https://math.stackexchange.com/search?q=user%3A132007+vandermonde+disguise)* in connection with the Chu-Vandermonde identity.


Show that if $ \theta: R \to S$ is a ring homomorphism, then $\theta$ is one-to-one provided it is onto.

Question: Let $R$ be a division ring and $S \neq \{0\}$ be a ring. Show that if $ \theta: R \to S$ is a ring homomorphism, then $\theta$ is one-to-one provided it is onto.
Proof: Assume, by way of contradiction, that $\theta$ is not one-to-one. Since $\theta$ is onto, there exists $s\in S$ and $r_1,r_2 \in R$ with $r_1 \neq r_2 $ and $r_1 \theta=s=r_2 \theta$.
Let $r_0=r_1-r_2 \neq 0$. Since $R$ is a division ring, $\exists y_0 \in R$ such that $y_0r_0=1$. Let $r \in R$, then $r \theta=(r \times 1)\theta=(r\theta)(1 \theta)=(r\theta)(y_0r_0 \theta)=(r \theta)(y_0\theta)(r_0 \theta)$
$r \theta=(r_1-r_2)\theta=r_1\theta-r_2\theta=0$
So, $(r \theta)(y_0\theta)(r_0 \theta)=0$ which implies that $0 \in S.$ However, $S \neq \{0\}$
Are there any problems with this proof? Any criticism would be appreciated.
Comment: $0 \in S$ does not cause any contradiction!
Comment: Hints to a correct proof: Introducing $y_0$ is a good idea. You want to show $1 = 0$ in $S$. The condition that $\theta$ be onto is useless, as far as showing the injectivity of $\theta$ is required.
Comment: @darijgrinberg Are you sure about that second part? It was made very clear to me that the onto part of this question was needed.
Comment: If you define rings to be nonunital, then yes, it's needed. But with the standard definition nowadays, it isn't.
Comment: @darijgrinberg We do use the nonunion definition of rings. I apologize for the misunderstanding.
Answer: No, your attempt at a proof is incorrect: concluding $0\in S$ is obviously not a contradiction. But it can be fixed: if $1\theta=0$, then $r\theta=0$ for every $r\in R$.

More simply, recall that the kernel of a ring homomorphism is an ideal. What are the ideals of a division ring?
We can note that the "onto" hypothesis is not necessary, it just suffices that $R\theta\ne\{0\}$, for, in this case, $\ker\theta\ne R$.
If your ring homomorphisms are required to map $1$ into $1$ the condition is for free. The hypothesis that $\theta$ is onto and $S\ne\{0\}$ also guarantees the condition.
Answer: Your idea is right. We have $$1\theta=(y_{0}r_{0})\theta=y_{0}(r_{1}-r_{2})\theta=(y_{0}\theta)(r_{1}-r_{2})\theta=(y_{0}\theta)(r_{1}\theta-r_{2}\theta)=(y_{0}\theta)(s-s)=0.$$
Now, $r\theta=(r.1)\theta=(r\theta)(1\theta)=(r\theta)0=0$, for every $r\in R$ and so $S=\{0\}$, contradiction. Hence, $\theta$ is one-to-one.
Comment: Thank you. I think my wording towards the end was poorly written. I'll structure my answer like you have.


Create/Update JIRA request based on results stored in CSV

Question: I have a Jenkins job that runs the Selenium tests. The results are then stored in a CSV file and then fed to Cassandra. My requirement is to create JIRA request if the test fails either by analyzing the CSV file or from Cassandra. Please suggest the possible approaches.
Answer: Jira API + CSV Reader or Cassandra API
https://docs.atlassian.com/jira/REST/latest/


How can I skip the intro videos on Master of Orion (2016)?

Question: There are a bunch of brief - but unskippable - movies playing when I launch Master of Orion. Is there some way to skip those, preferably permanently?
Comment: @Dulkan renaming them is safer. . .
Comment: As I haven't played the game yet, I won't give an answer; but in most games video files work the same view, so I'll give this general suggestion. Video files should be available in the game directory. Look for a video directory in the game folger. In genreal intro-videos are called intro.bik and logo.bik or something similar. Deleting those shouldn't create any problems, they will simply be skipped and you get the main menu.
Comment: @Namikaze Technically yes, but practically it doesn't make much of a difference. Whether you rename them back or get them out of the recycle bin, if something doesn't work, doesn't matter. If the game really wants them, they'll be redownloaded anyway(on steam or gog galaxy at least). And I've never experienced a patch so far, which refuses to work because video files are missing. Then again, the small amount of storage space you waste on keeping them doesn't matter as well.
Comment: It might be better to replace them with a zero length blank video instead of just deleting them. Less room for unexpected behavior.
Comment: ahaha . .. i always use shift+del when deleting small file, so i assume other do that too.
Comment: @Fambida Yep, that's the best way. I should have mentioned that.
Comment: @Dulkan there are no bik files, nor any other obvious stand-alone video files, in the game folder.
Comment: @Oak Are the game files all packed in some big archive? I.e. is there a single file, which is almost as big as the entire folder?
Comment: @Dulkan there are loads of small files and a few GB-sized files.
Comment: @Oak Then it's likely the video files are contained within the GB-files(archives). If you can open them with a standard packing tool, you can access them fairly easily. If not, you require a tool to access archives of that type. Replacing/Deleting them within the archive works the same, if you can simply open it. If you are forced to unpack and repack, then the required effort is considerably higher. This is a somewhat more risky operation, so I'd recommend making a backup before attempting. If you are unable to access the archives, you will have to wait for a mod.
Answer: To skip the intro movies, edit the file "sharedassets0.assets" with a HEX editor and search for the 1st occurrence of "DURATION=8.00" (mine is at 0x667C81), change it to "DURATION=0.00".
Next, search for the 1st occurrence of "DURATION=62.68" (mine is at 0x9058CC), change it to "DURATION=00.00" and save the file.
This will disable the WG LABS video and the introduction cinematic, but I couldn't find a way to get rid of the NGD logo, if anyone knows, please share.
HTH,
Og


What do you mean by "byte equivalent" ?

Question: I am bit new to assembly language and having difficulty understanding the term "byte equivalent".
It is used in the following context :-
The MOV instruction causes ambiguity at times. For example, look at the statements:
MOV  EBX, [MY_TABLE]  ; Effective Address of MY_TABLE in EBX
MOV  [EBX], 110       ; MY_TABLE[0] = 110

It is not clear whether you want to move a byte equivalent or word equivalent of the number 110. In such cases, it is wise to use a type specifier.
The link to the tutorial is here
It would be a great help if anybody could explain the term byte equivalent and  provide with a clear situation in which "type specifiers" may come in handy.
Answer: It just means that the size of 110 is ambiguous in the instruction MOV  [EBX], 110. There's no way of telling just by looking at that instruction if you intended to store the 8-bit (byte equivalent) value 0x6E, the 16-bit (word equivalent) value 0x006E or the 32-bit (dword equivalent) value 0x0000006E.
A size specifier would be used to tell the assembler how to interpret the instruction, and the exact syntax for such specifiers depends on which assembler you use. In NASM syntax you'd say mov byte [ebx],110 to specify that you wanted to store a byte. In MASM/TASM syntax you'd say mov byte ptr [ebx],110.

What do you mean by "byte equivalent" ?


On Ubuntu 14.04, the system switches off 2 minutes after started

Question: I was using Ubuntu to work and after an update where the system asked to restart I choose restart after. A few moments after that, my computer turned off by itself. And since then, each time I log on in Ubuntu, after a few minutes my computer turns off.
Any idea of what should I do besides reinstall Ubuntu?
Thanks in advance for your responses
Answer: I would suggest you to check your syslog.
You can find it going to
<code>/var/log
</code>
This file will give you more information about the issue that cause the switch off, and if you'd post it here it will provide useful information to analyze the problem.
You should check the events right before the switching off.
Comment: Thanks for your answer. Apparently the problem is solved without doing anything so it's good :).


How to indicate a group of required fields and single required fields in the same flow?

Question: I would like to hear your opinion on the matter. We do have a set-up wizard like that.

Let's say in step one we do have dropdowns with values from 0 to 10 and 0 being the default value. The user can only move forward if he chooses at least one of the dropdown values to be different than 0. He can choose all or only one (no matter which one).

In step two we have groups of 2 radion buttons per row. The user is required to select an option from every row to be able to continue. No row can be left without a selected option.

How would you suggest showing what is required for the user to select? Considering the differences between these two cases.
In my research what I found is the user should be able to see visual clues + error messages placed correctly. Is that the way to go? What do you think?

Currently what we do is indicate only with an error message placed the same way for both cases, but it is not clear what is actually required. Error messages are triggered after pressing the button (Next). That is a commonly used pattern in our product.

How would you solve this issue? I will be happy to read your opinions. Thanks in advance

EDIT: What you see presented in steps 1 and 2 is not the only thing that the user has to interact with to be able to proceed. I've only shown the sections from each step I have a problem with.
In the wizard there is a lot more going on than what I showed. There are between 5 and 7 steps and in each step, there are 3-4 sections all dependant on each other. What you see is only one section for a step.
Comment: Side note: Blank, or a dimmed "select a number 1 - 10", is a better default select option than "0" if a selection is required.
Comment: Step one: "Select at least one or more of the following. Step two: "Select one of each." Highlight the instructions upon error. Possibly pop up a message box, that either fades or is clicked away.
Answer: I understand the question is like about the difference between required step and required field inside a step and trying to find a single rendering mode.
Half the question is about how each step works and then the problem. I think both things can be simplified by unifying explanation and alert and switching from one to the other when needed.
The main window with an explanatory text:

The alert:

The main window with an explanatory text:

The alert:

As each step doesn't contain a large number of elements, this method helps to keep the interface clean of visual noise as seen in the example capture with the error messages and alerts in red in each item.
Comment: The suggestion is great. I personally would integrate the instructions into the flow of the form. So left aligned and positioned on top instead of below the form. Reading "Select one of each option" before you start processing the form might help prevent errors. The error message should be shown below as that happens at the end of the flow.
Comment: Something I forgot to mention is that in the wizard there is a lot more going on than what I showed. There are between 5 and 7 steps and in each step, there are 3-4 sections all dependant on each other. What you see is only one section for a step.
Answer: Add instructions for each section within a Step with a "progress" message:
Step one:
____________________________________________

Select one or more of the following options.
Currently 0 out of at least 1 required selection made.

Select #1: [select from 1 - 10]
Select #2: [select from 1 - 10]
Select #3: [select from 1 - 10]
Select #4: [select from 1 - 10]
Select #5: [select from 1 - 10]

[Next] (disabled)

Once a selection is made, change the "progress" message to:
Currently 1 out of at least 1 required selection made.

Possibly color the "progress" message green. Once all step requirements for each section are completed, enable the "Next" button.

Step two:
____________________________________________

Select one from each.
Currently 0 out of 3 required selections made.

Radio #1: () A  () B
Radio #2: () A  () B
Radio #3: () A  () B

[Next] (disabled)

In this case when a radio selection is made and the 0 changes to 1, it may be bolded to bring attention to it.
In the case some are required and others are not the instructions can read:
Complete the fields marked "required".
Currently 0 out of 4 required fields completed.

...and label the required selections.
An advantage of leaving the "Next" button enabled is if the user clicks it and the requirements are not met additional help can be provided. It is frustrating if the user thinks the requirements are met but the "Next" button is disabled. And the user must then hunt for a solution having already missed the meaning of the instructions and the "progress" message.
Answer: You are trying to use an inline validation (which is great, but may not necessarily apply for your specific case). What I recommend you to do is to separate your problem into parts:
1: Users are pressing the button "Next" without filling the required field
Possible solution:
Just disable the "Next" Button and add a message that says something like "Please, select at least one value from the list above to proceed". After the user has selected a value, you can enable the button for it to be clicked and voilá. Problem solved
2: User don't get to read the error message because is not well understood or is not in context.
Possible solution:
This can also be solved using the solution #1.
Pro tip: If you user attempts to click in the disabled "Next" button, you can also include a micro interaction that highlights the columns that you need your user to focus on to fill.
Additionally, I recommend you to check this article for error messages:
https://uxwritinghub.com/error-message-examples/
Hope it helps!
Comment: There are aspects I like about disabling the "Next" button until required selections are made, however, if I already missed the instructions it will be frustrating that the "Next" button remains disabled after I think I'm ready to move forward. By allowing me to click the "Next" button without having made the required selections makes it clear I need additional help, before I get frustrated and without me having to look for help.
Answer: Forms are always tricky! BUT I found this article https://www.nngroup.com/articles/required-fields/ and it says you should always mark (minimum) the required fields AND the optional fields before submitting a form.
This means in my opinion that you should show in your first and second screen, what the user needs to do all the time. A hint like Danielillo suggested would be nice, but maybe think about an other position because the reader is used to read the form from top to bottom.
Answer: What I understand is that the dropdowns are like a group
of checkbox without checkbox. You select the dropdown by changing the value instead of selecting a checkbox.
If before each dropdown you have a checkbox/toggle :

by default nothing selected : dropdowns value is 0 (or no value) and it's readonly
when selected : dropdown is active, the user selects a value
checkbox not selected : dropdown value is reset to 0 (or no value) and it's readonly

You have the error on the group level: at least one must be selected
You have error on the dropdown: if selected, the value must be different than 0.
If instead of 0, you can have no value, the dropdown becomes required when selected.
Answer: You can use visual clues + error messages. It is a classical solution in this case.
What you need to keep in mind are:

to show an error message near the problem. Don't place an error message at the center of the screen or near the beginning of the row. It confuses the user and follow in the wrong way.
keep a clear and simple message. Don't use long and stylistic advanced sentences. Your message should be short and clear for the user.
don't give the user to move on to the next step if the scenario is not finished. If the user doesn't finish your requirements or brake your rules don't give him the option to move on to the next step. Make "next" button disabled and add a message while hovering on it.
user testing. Try to make short user testing. You can evaluate how users understand your design and add rectify where it needs it.


Livecode can't test iPhone app: 'unable to find ibtool'

Question: Mac OS Big Sur 11.5  /  Livecode Community Edition 9.6.3-rc-2  / Xcode 12.5.1
I'm trying to test a small app for iPhone in the Livecode development app.
This very same app worked on my iPhone a few years ago. Now I open it in Livecode and use the Test button; it begins compiling then says:
"Unable to build app for simulation: failed to create launch screen: scrub: error: unable to find utility "ibtool", not a developper tool or in PATH"

That message makes no sense to me. I checked here and the Livecode site but could find no useful info. ibtool seems to be a nasty, recurring, problem.
What is the matter? What should I do?
Answer: Check in the Xcode Preferences under "Locations" that the version of the command line tools is the same as the version of Xcode you have selected in LiveCode Preferences under "Mobile Support".
These kind of issues often are caused by the wrong version of these command line tools that LiveCode uses to build the app.


What is the origin / meaning of the icon used for "database"?

Question: I've never really understood what this icon, that looks like an oil drum

and is commonly used to refer to a database, is actually supposed to represent.
What is it?
As a matter of fact, I've been searching for any kind of reading material about the history of the symbols commonly used in web app icons and haven't come up with anything helpful or interesting. Is there a good resource to read up on that?
Comment: three cans of chewing tobacco, alas not seen in workplaces anymore due to the tobacco-free laws. It means: you have to stay up late to fix the problems with the database, and you are not allowed to smoke in the machine room.
Comment: Answered on Stack Overflow: https://stackoverflow.com/questions/2822650/why-is-a-database-always-represented-with-a-cylinder
Comment: Maybe change your Accept checkmark to the actual answer?
Answer: It is a picture of a "disk pack" which is a stack of platters (usually 14 inch diameter) in a removable set. The original hard drives were the size of a washing machine, and had these swap-able packs. They had a clear plastic cover with a handle in the center, much like a cake carrier. You plopped it on to the drive, turned the handle to remove the cover, and then closed a door over the pack to enable the drive.
Amazing that people no longer know what they looked like. I made a clock where the dial was one of these big platters on which the head had crashed, leaving concentric marks in the orange surface (iron oxide). Of course, I had to be different, so I used a 168 hour motor and the "clock" showed the days of the week. Those synchronous motors are probably long gone also. They used to run all the stop lights.
Comment: Note distinction between "drive" and "disks" (platters). They didn't used to be one item, as today. The drive was a standalone unit, a motor and control mechanisms that spun platters & moved arms. In the 1970s when this icon started being used to represent databases in IS, (micro)computers lacked fixed secondary storage, and ran off main memory and temporary (floppy) storage. Mainframes, OTOH, were the go-to for any _real_ computing, and had these large _precursors_ to modern hard disks. Approximated as the physical incarnation of the DB; software was often bespoke before standardisation.
Answer: It represents a stack of hard disks.  For example, from wikipedia:
"RAID diagram icon symbolizing the array of disks"

Yes, this is talking about hard disks but the basic concept is the same.
Comment: Nothing to do with RAID. The depiction goes way further back than the emergence of RAID. Well back into at least the early eighties of last century and probably even further.
Comment: Thanks. I'm still not clear on what/why it is what it is, but at least I get there's some kind of real world thing being referred to.
Comment: @MarjanVenema yeah I know but it was the most relevant visual I could find that made the point
Comment: Answer by a younger person who doesn't remember the original context. See user67695's answer, below, which I've edited to include pictures. See [this image](https://regmedia.co.uk/2016/04/28/vintage_disk_platters.jpg?x=442&y=293&crop=1), or google "database stack platters".
Answer: Historical reasons. It's just a simplified depiction of an actual hard disk. Remember that a single hard drive is actually made up of a stack of flat disks with the read/write heads in between the disks. A simpler depiction would be just a cylinder without the horizontal bands.
Answer: The American National Standards Institute (ANSI) set the standards for flowchart symbols in the 1960s - pre-dating hard disk drives. The standard memory in use at that time was drum memory - a precursor to disk drives - they were large metal cylinders coated in ferromagnetic recording material.
Comment: what makes you think that iconography follows ANSI standards? Most designers in Internet era didn't (don't) even know drum memory. I started in 1997 and never saw a drum memory!!
Answer: It's a stack of platters that would be loaded into the drive mechanism. (Drums were represented by a horizontal cylinder.) The symbol dates from a 'new' 1969 ISO standard for flow chart symbols.IBM flowchart template 1969 In those days, through probably the new millennium, coding, business and system analysis were actually formal regimes when teams of people worked in parallel on projects and had to optimize limited resources.
This changed in the 'internet' era with developers writing minimally viable and buggy code that will get tested by end users and (hopefully) fixed in the next sprint.


can i replace single 20 amp breaker with double 20 amp

Question: I had a single 20amp outside breaker with one red and one black wire connected to it. it kept flipping. i had unused double 20amp breaker. i put red wire in one spot and black wire in other of double 20amp breaker. is that safe or not
Comment: Why does it keep flipping?  When the breaker trips, what loads lose power?   Are you talking about a [tandem](https://diy.stackexchange.com/questions/110151/what-is-a-tandem-breaker-aka-duplex-cheater-twin-double-stuff-etc) breaker (because no, that is not safe at all).
Comment: A picture of the panel and a list of what loads are currently powered by the circuit would help.
Comment: Do the red and black wires lead into the same cable or different cables?  What are you trying to run on the circuits in question?  What do you mean by a "double 20A breaker"?
Answer: Man oh Man>>>>>>  no way.  I don't do be mean, but you obviously have no idea where these cables lead or how they are connected , could be a MWBC  could be an repurposed cable....you just can't know until you test and test some more until you know where this stuff goes.  you'll need a multi-meter and test that circuit thoroughly . Regularly tripping a breaker is a major issue and and dangerous .     You may need to call a pro.
Comment: Well regularly tripping a breaker may be as simple as the user intentionally overloading it because they want more stuff to work than the circuit can safely power.
Comment: And it may be that the red/black used to be two separate breakers and now doubled up under one breaker and separating is a *good* thing. Or it could be something else and separating could end up with causing all kinds of problems. *Too many unknowns*.


If you know 2 of 8 questions but the test has only 4 questions. What is the probability you will know at least one of the questions on the test?

Question: Background:
This is a hypothetical question that and my friend and I have been arguing over all day. We're both upper-year mathematics students and should reasonably be able to come up with the solution, however, we've been arguing about it non stop.
Situation:
There's a test bank with $8$ questions in it. The test will randomly give you $4$ of these questions. If you happen to know $2$ of the $8$ questions ahead of time,
A) What is the probability your test would have at least one of the questions you know?
B) What is the probability your test would have both of the questions you know?
So far we've come up with the solutions for part A) of:

simply $25\%$ because you know $25$ percent of the questions
$39 \%$ because you have a $\frac{2}{8}$ chance of knowing the first question and a $\frac{1}{7}$ of the second and $\frac{2}{8}+ \frac{1}{7} \approx 0.39$
$\frac{1}{16}$ because the test has $\frac{1}{2}$ of the total questions and you have a $\frac{1}{8}$ chance of getting your question
$\frac{1}{8}$ similarly, because you know two of the questions so $2 \times \frac{1}{16}= \frac{1}{8}$

For part B), we think it could be

$\frac{2}{8} \times \frac{1}{7} \approx 3\% $
$\frac{1}{16}$?

We're really lost and at this point, I think we need a third party to arbitrate our discussion haha.
Comment: For part B), the probability should be $$\frac{\text{ways to choose 4 questions from 8 but 2 of them are fixed}}{\text{ways to choose 4 questions from 8}} = \frac{6\choose2}{8\choose4}$$. Similarly for part A).
Comment: Thanks for your Solution on part B. That makes perfect sense now! I'm still confused about how it relates to part A. In my mind (could be wrong) it seems that since you need only one of two questions to meet the criteria, you would need some form of addition in the probability. Still thinking on this one, but thanks for the solution on the first part!
Comment: For Part A, you are right that it requires some addition of probability. Knowing at least one question implies that either both of them are known, or only one of them are known. And we have already found the probability of the former case. How about the latter case? It should be $$\frac{2 \cdot {6\choose3}}{8\choose4}$$. The sum of two probability will be the answer
Answer: I'd like to offer an alternative approach. I will instead find the probability that neither of the two questions you know is selected, then subtract that from 1. There are $6\choose 4$ ways to pick a set of 4 questions from the 6 questions you don't know, and there are $8\choose 4$ ways to pick a set of 4 questions without restrictions. So, the probability that you know none of the 4 questions is
$$\frac{6\choose 4}{8\choose 4}=\frac{3}{14}\approx 21.43\%$$
Subtracting this from 1 gives a probability of $\frac{11}{14}$ of knowing at least 1 question on the test, or about a $78.57\%$ chance.
I checked this with python, and it numerically lines up.
Comment: It should be 78.57, I think.
Comment: Dang, this will absolutely end the rivalry, thank you very much. That makes a lot of sense.
Comment: No problem @EthanPullan, glad to help! Also thanks for catching that richrow, I'll fix it right away.


How can I fix drooping vinyl siding?

Question: I have vinyl siding on my new home. Starting about a week ago, one segment of siding detached on one end and is drooping. The other side is attached just fine.
I tried snapping it back into place, as it looks like each is just supposed to stay in place by snapping into each other. That lasts for about a few hours, and it starts to sag in the middle and eventually the same end detaches and droops again.
My father in law suggested using a galvanized nail and hammer in the siding, but seems like a brute force bandaid. Is he right? What should I do to fix this?
Answer: Even though the panels snap to each other they are nailed to the wall at the top edge of the panel. So it's probably a good idea to nail it back. Just make sure it's a little loose because the panels expand and shrink a lot depending on outside temperature.
Comment: I checked: The panel itself was never nailed near the top as you described. Is it possible they just missed that nail? It was fine for 5 months. I guess the heat warped it?
Comment: I went ahead and just hammered this in. Thanks for the advice.

How can I fix drooping vinyl siding?


converting a calendar object into a string in java with format "yyyy-mm-dd hh:mm:ss"

Question: I'm converting a date stored in a calendar object in a string for a query in MySQL. I need the string in format "yyyy-MM-dd HH:mm:ss", i.e.: "2010-01-01 15:30:00".
I'm using a code like:
    Calendar TimeStop = Calendar.getInstance();
    TimeStop.set(2010, 01, 01, 15, 30, 0);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String TimeStop_Str = sdf.format(TimeStop.getTime());

now, the string, instead of being "2010-01-01 15:30:00" like I would expect is "2010-02-01 15:30:00".
I have already checked on http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html for possible errors in the parser formula (for example the capital MM for month or capital HH for hours) but it didn't worked.
I guess that there is some other field that I should set, or maybe there is another method... any idea?
Comment: The Java coding convention is to use lowercase first letter for variable names, e.g. `timeStop`.
Answer: Calendar.JANUARY is actually 0, not 1.
When you provide 01 for the month field in set, you're actually setting the month to February, which is why you get 02 when SimpleDateFormat renders it as MM.
When you use any of the Calendar.get/set methods, you must take extra precautions to make sure that you are aware of this discrepancy between the "natural" 1-based indexing, and the more "awkward" Calendar's 0-based indexing. Any time you're getting/setting the month of a Calendar, there's always this potential to cause a serious bug.
This is just one of those really awkward design in Calendar that leaves a lot to be desired. One of the better, more pleasant date/time API library available out there is Joda Time, so if at all possible, you may consider a switch to that library instead.
API links

Calendar.MONTH - "Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year [...] is JANUARY which is 0".
Calendar.set(…, int month, …) - "month - the value used to set the MONTH calendar field. Month value is 0-based. e.g., 0 for January."

On octal literals
Also, note that 01 is actually an octal literal (i.e. base 8). You shouldn't make a habit of prepending 0 to integer literals (§3.10.1), because they can cause subtle bugs/errors unless you're very careful.
For example, int i = 09; is an illegal Java code.
    System.out.println(010); // prints 8, not 10

See also

Can I customize syntax highlighting in Eclipse to show octal literals differently?
 Octal number literals: when? why? ever?
Comment: Danke!
this means that the Calendar starts from "0", but the parser start from "1"... ok
Thank you also for the other comment
Comment: @andystrath: For month fields of `java.util.Calendar`, yes, it starts from `0`. That's why when you `set` the month to `1`, it's actually `February`, which is `02` in `MM` format.
Answer: It's just that months start from 0 (not 1)
That said, you should not convert to string in order to insert a date in the DB. You can either use the timestamp, or java.sql.Date together with PreparedStatement
Comment: (regarding the DB stuff) +1 from me; I don't know the exact details, but this does sound like the more sensible thing to do.


Can I use any C# library in Xamarin

Question: From what I understand Xamarin provides most (if not all) features of C# for mobile app development. Does that mean I can use any C# library (say, nAudio or something else), provided it is compatible with a target platform? And how to see if a library compatible with a mobile platform?
Comment: The best way would be to try it, have you tried it? See the limitations: https://developer.xamarin.com/guides/ios/advanced_topics/limitations/
Comment: @JeremyThompson I can't really _try_ it since I'm just looking into different ways of making a C# desktop app available for mobile devices
Answer: To understand it you should learn how .net is Fragmented.

nAudio uses most of the .net framework APIs and Windows Native APIs, so simply u can't use this with Xamarin.
Even if you think Xamarin can targets Windows, you have no corresponding API in the version of .Net subsystem.
Only possible solutions will be moving the code to server, and let it server all the clients.
or
Rewriting the nAudio for Xamarin
Comment: So, basically, when using Xamarin I am limited to libraries that provide easier ways of doing something (like more math calculations, etc) and anything hardware/driver-related is unavailable? That stings.
Comment: @BarsiktheCat, not at all but yes. otherwise you / the library developer must have developed the library by having API switching depending on the platform.

Can I use any C# library in Xamarin