Ubuntu server as an internet server

Question: How can I configure an Ubuntu server installation to provide internet access to private network, such that machines on the private network can access the internet through the Ubuntu server? The machine has two NICs of course.
Comment: The best way to add additional information to your question is by editing it, with the *edit* button. It is better visible that way, and comments are mainly for secondary, temporary purposes. Comments are removed under a variety of circumstances. Anything important to your question should be in the question itself.
Comment: what do you mean "internet access"
Comment: :P Well, I mean internet access! There are many computers in a LAN network connected to server. The server itself is connected to internet.
Comment: So, you want to turn the server into a router, then.
Answer:
You need to use Ubuntu as a firewall/gateway router. Please check this Scenario

Or you need Internet Connection Sharing (ICS) provides the ability for one computer to share its Internet connection with another computer. please check the wiki Internet/ConnectionSharing
Answer: Unless you are prepared to deal with a lot of automated attacks on your server, I would highly discourage this.  Your router will provide a level of protection between you and the internet.
What exactly are you trying to accomplish?  There might be a better way to do what you want.  I have my ubuntu box acting as a DHCP server with dockerized Pi-Hole installed.  It blocks a good majority of ads and allows me to fine-tune DHCP settings that the router won't let me.
If you really, really need to have the server facing externally, I would recommend that you harden the server significantly by denying all access to the internal LAN unless the request originated from within the LAN.

Ubuntu server as an internet server


How to remove photos without masters from library in OS X Photos app?

Question: I was cleaning my drive and removed many file duplicates. I removed many photo masters (originals) from OS X Photos app library, but when I open Photos app I saw that all photos are still in my library. Is there any way to delete photos without masters from my library?
Answer: Photos should detect when changes have been made to the library and prepare it for you. See Photos has attempted to repair the library.
You can force Photos to repair the library if it doesn't do it automatically:

You can force Photos to try to repair the library by holding option and command (⌥⌘) whilst launching Photos. Photos.app will try to repair the library and it may ask you for administrator privileges.
Comment: Unfortunately it didn't help.


SPI communication with multiple slaves

Question: I am working on a project that is using an ATtiny861A and this only has one SPI. If I want to hook up a radio and an external memory to the same SPI, will there be an issue sending data from the external memory to the radio? I know I can hook up the external memory and the radio to the same SPI but I am not sure if the radio will be able to send the data saved on the external memory.
Comment: Any particular radio?
Comment: It will be a CC2520 from Texas Instruments
Comment: I'm fairly sure you could run that as a master, making a multi-master system.
Answer: Your micro is the master and as such you can't get this type of bus to interact slave-to-slave. It's a case of reading the memory into the micro and then forwarding this to the radio i.e. the micro must buffer the data when sending it between slaves.
Comment: @Therusscher SPI being Master-Slave protocol, Everything must go through Master
Comment: So they can communicate but the Micro-controller needs to hold the data before it is sent? Would this all be done in the coding?
Comment: Yes, it is done in the micro's coding

SPI communication with multiple slaves


What is the Minimum GPA for admission in a graduate school in a respectable science university in the US?

Question: I am thinking about applying to graduate studies in physics related Phd or master degree in the US, but my GPA is very low, 2.4/4.0 to be specific.
I wonder if there are respectable universities in the US that can accept such low average?
Notes:
-I have some experience in research from my undergrad.
-I had my Undergraduate degree in physics from a respectable Canadian university.
Thanks in advance!
Comment: Have you taken the GRE? Your GPA is not competitive, but might be offset by a strong GRE and excellent letters of reference / work experience.
Comment: Reading in-depth some potential departments criteria listed on their website can be very informative. In many grad programs they come right out and say whether or not there is a minimum GPA they accept. In the US many programs use 3.0 as the minimum, and it would take something quite unusual (or a specific professor really going to bat for you) to get in. Other programs say they have no minimum, so it's going to be down to the rest of your application to make up for a lack-luster GPA.
Answer: (In the US) in Physics, some programs will weight things like the physics subject GRE and research experience, especially publications, ahead of the GPA. However, some schools do have a GPA cut-off around 3.0, so it's possible some schools wouldn't get far enough into your application to read it.
If you want to apply to prestigious or highly-selective programs right now, I think you would need:

To have scored very well on the general and physics-subject GREs.
Very good letters of recommendation that speak directly to your ability to succeed in a graduate program.
An "explanation" for your GPA in your application. Was it because you worked a lot? Was it because you spent a lot of time doing research? Do your last couple semesters show a better GPA than your overall GPA? If so, you could make an argument that you addressed the issues that led to your lower GPA during the course of your undergraduate career, and these issues will not continue to impact your graduate performance.

If you don't fee you have documented supplementary support like that, you still have options:
Take a year off and gain experience
You can also take a year or two off and work a research/physics-related job or internship, and/or take a couple extra classes. Taking one class at a time while working a job or internship can push up your overall GPA that they will consider (and can go a long way to making your graduate career easier), and if you spend a year or so doing something else, there will be more focus on what else you were doing. If you can get a publication during that time, that's an excellent way to display that you do have the skills to succeed in a graduate program.
Apply to "Bridge" programs
Several universities have Bridge programs, meant to help students build a competitive background for graduate study. Often, these Bridge programs also grant your access to that institution's graduate program, if you finish 1-2 years of the bridge program in good standing. One example is The University of Chicago's Physics Bridge program. This is not a masters.
Apply to Masters programs
Many universities have Masters programs, which may include the opportunity of transferring into the university's graduate program, or to another university's graduate program.
Answer: Of course there is luck involved, but there are always professors that ignore GPA provided you have other experience that makes you stand out as a candidate. It is generally less about the school and more about connecting with a particular group. Reach out to different groups and see who bites - if a group offers you funding acceptance to the school will follow.


Download unmanaged-package to local pc

Question: I got an unmanaged-package installed in my org, I wish to export the package to my other org, how can I download the package or export it to other org?
Answer: the solution I propose uses the Salesforce CLI (find it here: https://developer.salesforce.com/tools/sfdxcli). The reason for this is, that the cli enables you to interact with the org from your local pc. Which includes the most important points here, meaning the retrieval and deployment of your desired metadata.
There are five basic steps that you have to complete in order to transfer the unmanaged package.
1 - Get a package.xml file which lists all of the components related to your desired package. Here's a tool which can generate a complete package.xml of all components in your org: https://packagebuilder.herokuapp.com/
2 - Open a command line in the same folder where your pacakge.xml lies and authentificate with to your org, where you want to export the package:
sfdx force:auth:web:login

In case this is a sandbox use:
sfdx force:auth:web:login -r https://test.salesforce.com

3 - Retrieve the metadata by following command:
sfdx force:mdapi:retrieve -u <UsernameSource> -r retrievepath/ -k ./package.xml -w  30

4 - You now should find a zipfile: retrievepath/unpackaged.zip. Unzip it and authentificate to the org you want to deploy to.
5 - Deploy the target org with the retrieved metadata:
sfdx force:mdapi:deploy -u <UsernameTarget> -d retrievepath/unpackaged/ -w  30

I don't know any "easier" way to this, but in the past this worked pretty fine for me.
Comment: Hi,thanks for the reply, I am stuck at the first step, when I use the tool to get all the components of my org, it show me "500 - Website Error" and "There appears to have been an error. The administrator has been notified.", do you know how to solve this error?
Comment: If I had to guess, I'd say it's some kind of permisison issue, that your user is not able to do that. Or you selected the wrong type - production/sandbox

Download unmanaged-package to local pc


Question on capacitive circuit in practice

Question: If we were to build a circuit, let's say with a power source of 120V AC going into a transformer which steps that up to 10kV @ 30mA, the output of which would be connected to a capacitor with a capacitance of about 3060pF, what would be happening in that circuit, especially on the right side, where the capacitor is, if 60 Hz were pumped in there through the AC source, taking into account where the circuit is grounded?

Now, theoretically from what I understand, due to the fact that the right side would act as a purely capacitive circuit, there would be "no power" because the current and voltage are 90 degrees out of phase. However, if I were to build this, would something blow or burn up or quit working, like the transformer or the capacitor or the wire? Would AC flowing through a capacitor count as a no-load situation and mess up the transformer? Also, would it be necessary to ground it twice? I'm just wondering how this would function were I to build this circuit, and what I technically should/could design better.
Answer: The capacitive reactance of 3060pF at 60Hz will lead to a current somewhat in excess of the rated 30mA to flow, so the transformer will get quite warm over time.
The grounding is not relevant to the current flow.


How fast should I set the metronome for agitato?

Question: What would the numeric tempo range be for a march marked "agitato"?
Comment: Sorry I mixed up the manuscripts the title of this is  "battle music" sorry again. Does this change something?
Comment: That will vary on the piece so much that I am voting to close.  With a more specific question, I would vote to re-open.
Comment: An "agitato" tempo is fast, at least allegro.  The third movement of Beethoven's Moonlight Sonata is marked "Presto agitato" for example.  If your piece is marked "tempo agitato" it will mean a fast tempo, but you don't have more than that to go on beyond Mark Lutton's explanation.
Comment: Lol Bob I thought of exactly that piece when I wrote my answer.
Comment: That is in middle of a piece, here on the beginning  it says only agitato. I know that this is a march  from the title.
Answer: Agitato is an indication of character not speed. As Mark points out it means agitated or aggressive but that does not mean that it is inherently fast.
You have the third movement from the Moonlight Sonata that is Presto Agitato

This song from the soundtrack of Interview with the Vampire shows a piece that is Allegro Agitato just to illustrate that the mere fact that there is an indcation of Agitato does not necessarily mean fast.
Answer: "Agitato" is not exactly a speed.  It means "agitated" and generally means that the speed will be faster than normal -- it's more a relative speed than an absolute speed.  But really it's more of a mood or feeling than a speed.
A typical tempo for a standard parade march is 112. I can picture a band marching to that tempo in a Fourth of July parade, but I'm having trouble picturing a band marching "agitatedly".  Maybe the enemy is advancing directly behind them?
If that were the case I guess they would be doing a Quick March.  Try 140 bpm which is typical Quick March tempo and see how that works.
Comment: I tried 140 it's to fast, even 130 is not ideal. I put it to 124.
Comment: Whatever speed works best.


Putting rear hand brakes onto a 16" Diamondback Jr Viper

Question: I'm trying to add rear hand brakes onto a 16" bike for my son.  I've seen other online versions of the same bike model (Diamonback Jr Viper) with hand brakes; which makes me think I should be able to get it done.  Would anyone be willing to give me some advice for a good, easily activated hand break for a child (average sized 5yo, but on the weaker side of the spectrum). Of course, I know that I've only been talking about the handle; but, I would ask for your recommendations for the whole break system.  Planned use is very average; 1st bike, riding around the neighborhood...
Answer: It looks like to 20" version of the bike comes with a rear linear pull brake, but the 16" has a coaster brake. This is common practice with kids bikes as children young enough to be on a 16" bike don't have enough hand strength to operate a brake lever effectively.
I looked into doing the same thing when my daughter had a 16" bike, but found that it is not workable. In general there is no place to mount a brake caliper on a 16" bike. There is often a seat stay bridge with a hole in it but it is intended to mount a fender. The hole is too far away from the rim to mount a caliper.
My advice would be to save your money for the next bike you get your son when he grows out of the 16".
Comment: Concur - he'll grow out of it before his hands are strong enough to use the hand brakes effectively.
Answer: I liked @argenti-apparatus answer, but I just wanted to add that many children's bikes don't come with child size brake levers.
You may need to use the brake lever adjsutment screw to move the lever as close to the handle bar as possible as otherwise the child will not be able to physically use the brake.


Kernel of linear transformation composition

Question: I have matrices A and B of linear transformation. Both have dimension 8x8. I know that dim(Ker(A)) = 2 and dim(Ker(B)) = 1. What are the possible dim(Ker(AB))?
Comment: The range of $B$ is 7-dimensional. Its intersection with the kernel of $A$ could be 2-dimensional, or 1-dimensional. Verify these statements, and then consider the implications for your question.
Answer: A vector $v \in \mathbb{F}^n$ (here, $n = 8$) is in $\ker(AB)$ if and only if $(AB)v = A(Bv) = 0$. That is, $v \in \ker(AB)$ if and only if $Bv \in \ker(A)$. We have three options:

$\mathrm{im}(B) \cap \ker(A) = \{ 0 \}$. This is not possible as $\dim \mathrm{im}(B) = 7$ while $\dim \ker(A) = 2$.
$\mathrm{im}(B) \cap \ker(A)$ is one dimensional. That is, $\mathrm{im}(B) \cap \ker(A) = \mathrm{span}(w_0)$ for $w_0 \neq 0$. Choose some $v_0 \in V$ so that $Bv_0 = w_0 \in \ker(A)$. Then, the collection of all solutions to the equation $Bv = w_0$ is given by the affine line $v_0 + \ker(B)$. The space of all solutions to the equation $Bv = \lambda w_0$ for some $\lambda \in \mathbb{F}$ is given by the affine line $\lambda v_0 + \ker(B)$. Thus, $\ker(AB) = \mathrm{span}(v_0) + \ker(B)$. This space is two dimensional as $\ker(B) \cap \mathrm{span}(v_0) = \{ 0 \}$ ($Bv_0 = w_0 \neq 0$) so $\dim( \ker(AB)) = 2$.
$\mathrm{im}(B) \cap \ker(A)$ is two dimensional. That is, $\mathrm{im}(B) \cap \ker(A) = \mathrm{span}(w_0, w_1)$ for $w_0, w_1 \in V$ linearly independent. Then, similarly to the situation before, if we choose some $v_i \in V$ such that $Bv_i = w_i$ then $\ker(AB) = \mathrm{span}(v_0, v_1) + \ker(B)$ which is three dimensional (as $w_0, w_1$ are linearly independent).

Note that this analysis reminds one of the proofs for the rank-nullity theorem. In the end, $2 \leq \dim \ker(AB) \leq 3$.
This analysis is useful if you want to explicitly construct examples in which $\dim \ker(AB) = 2,3$. Alternatively, you can use inequalities about the rank of the product of matrices. Using $\mathrm{rank}(AB) \leq \min(\mathrm{rank}A, \mathrm{rank}B)$ you see that $\mathrm{rank}(AB) \leq \min(6, 7) = 6$ and so $\dim \ker(AB) \geq 2$. On the other hand, using $\mathrm{rank}(A) + \mathrm{rank}(B) - n \leq \mathrm{rank}(AB)$ you see that $5 \leq \mathrm{rank}(AB)$ and then $\dim \ker(AB) \leq 3$. Then you can construct examples that show that both cases are possible.
Answer: You have the situation where $U \stackrel{A}{\rightarrow}V\stackrel{B}{\rightarrow}W$
and $U=V=W=\mathbb{R}^8$ if you consider matrices to work on columns. The kernel of AB  is the reverse image by $AB$ of $0 \in W$  into the space $U$. This equals the reverse image of ker$(B)\subseteq V$ into $U$ by the map $A$. Now the reverse image of a subspace $X$ of $V$ of dimension $m$ is the dimension of the intersection $Y$ of $X$ with im(A) augmented with the dimension of kef($A$). In our case $m$ = 1 and dim(im($A$))$=8-2=6$ so dim($Y$) = 0 or 1, whether ker($B$) lies in im($A$) or not, so the answer to your question is $0+2$ or $1+2$;


Rendered object Blender 2.74 can't be moved

Question: I have rendered an object, but cannot move it around, rotate it to see all sides of the object. Is it possible to move it?
Comment: to get started with blender (and 3D in general) use resources on this page http://blender.stackexchange.com/questions/15355/resources-for-blender. A good place to familiarize with the terminology and workflow is this: https://www.blender.org/support/tutorials/
Comment: I don't see why this is unclear or should be closed.  It's an honest beginner's question.
Comment: http://www.blender.org/manual/getting_started/basics/quick_render.html#what-is-rendering
Comment: Thanks for putting me in the right direction. And yes, I'm a complete beginner and Blender is overwhelming at the start....
Answer: Rendering (in Cycles) is the process of taking the 3-dimentional scene and calculating the light paths (called rays) bouncing through the scene to the camera.  The end result is a 2-dimentional picture of your scene, so you can't really rotate it and look around.  Just like you can't rotate and look around a photograph you took in real life.
See my answer here for more on how Cycles works.
In order to be able to move and look around your model in perfect real time Cycles would have to perform a separate render from every possible position and angle of the camera, which is impossible.  Here a few ways to view your rendered object from multiple angles.
1. Viewport rendering
As gladys pointed out you can enable viewport rendering.  This basically re-renders the entire viewport every time you move the view.  Viewport rendering is mainly just for viewing material tweaks and the like in real time.
You can change the amount of samples used for viewport rendering in the properties panel under the render tab > sampling rollout > samples > preview.

2. Animating the object/camera
For a final output to showcase your object you may want to create an animation of either the camera moving around the object or the object itself moving.
Animation is done by setting keyframes.  A keyframe tells Blender the state you want an object to be in at a particular frame, Blender will then interpolate the object smoothly between keyframes.  To set a keyframe go to the frame you want to keyframe and hit I and choose the property you want to animate (i.e. location, rotation, scale, etc.).
Try checking out this tutorial.
3. Baking
Baking is a way of saving what the surface of a rendered object looks like to an image texture which you can then apply to the object as a shadeless shader to make the object look like it is rendered.
Unfortunately I don't have the space here to even dip into the world of texture baking but you can check out this tutorial for starters.
One thing to consider about baking is that things like gloss and transparency/refraction do not bake well as they are dependent on the viewing angle.
Comment: @Kat  Glad I could help!  If this answered your question in a satisfactory manner you can mark it as accepted by clicking the little green check mark next to the answer.
Comment: Thx for your help...this is great. Kat
Answer: If you rendered it you can't move it around because it is a 2D picture. But before you render it you can look at it in the 3D viewport, by enabling the rendered display then you can rotate move etc. Make sure you use the Cycles Render engine.

Or, you can press SHIFT+Z, to switch between solid shading and rendered shading. (in the 3d viewport)
Comment: Ok, tried this but then the object (sculptured 'frog'), turns out completely black.I'm new to Blender...so, why does it change to 2D after rendering? This defeats the purpose of creating in 3D? or do you have to animate for it to be in 3D?
Comment: do you have a light in your scene?
Comment: if you render something the output is a 2D picture or movie...but you can still work in 3D....??
Comment: Thx Gladys this has helped and am working on the lighting atm
Answer: When a scene is rendered, the viewport shifts from the 3D view (where you can rotate) to the UV/Image editor (where you can't rotate). Simply press ESC to go back to the 3D view.
Or select the desired view in the bottom left menu:

Shifting to the 3D view will again view your 3D object editable, but not very pretty. So arrange the camera and lights to your liking and do another render.
Comment: Thx this helps :)


Magento 2 Custom Theme development

Question: Is there a repo out there with a solid custom theme for Magento 2? I'm looking for educational purposes. I learn better by looking at the code vs reading a mile long blog.
Answer: the blank and luma themes are just made for this ;)
the blank theme to show how you can create some sort of a base theme and the luma theme for how to extend the base theme
I think you will get pretty good results by copying the luma theme and starting your own with this as a base.
https://github.com/magento/magento2/tree/develop/app/design/frontend/Magento
Comment: What about header/ footer phtml? Magento_Theme/templates/html folder?
Comment: Hi David, page not found while click on the above link

Magento 2 Custom Theme development


How do you use the /testfor command in 1.5.2?

Question: I play in 1.5.2, and right now I'm working on using commands. I see that there's a /testfor command when I write /help, but what does this even mean? What is it and how do I use it?
Edit: This question is not a copy: 1.5.2 commands could very possibly be different than the latest version.
Comment: It could very well be, but is it? If you want to differentiate between the two questions, please do so with solid argumentation.
Answer: /testfor, in a command block paired with a comparator, counts how many entities match specified conditions. For instance, testfor Unionhawk will emit a signal if I am online. testfor @a[x=0,y=64,z=0,r=3,m=0] counts the number of players within 3 blocks of 0,64,0.
In general, /testfor is not particularly useful. Most of the time you will want to use scoreboard commands to work with entities matching desired criteria, since you can use scores in other commands.


Why doesn't the Source engine clear the back buffer?

Question: In the Source engine, when the map does not have a sky box, I see that typical artifact from the back buffer not being cleared. Why does the Source engine do that? Is it a performance reason, or something like that?
Comment: Extra steps are extra steps. If you can make assumptions to reduce those extra steps, then you will see improvements in performance. In this situation, it sounds like adjustments were made under the assumption that all outdoor environments would always have a skybox, and not need a screen clear. Indoor environments are simply. . . in doors :)
Answer: The source engine doesn't clear the back buffer simply due to the way levels are setup (i.e. it's not needed).
Source engine levels are built from brushes (i.e. volumes are either added as solid/liquid or subtracted from other brushes) and the player (or more specific, the camera) is always in an enclosed space, even if the level is supposed to be outdoors. Areas where you see the skybox are actually the surfaces of brushes marked as "sky". I've had a random look at YouTube and the first hit I've found explains level building pretty well. Watch it from about 1:45 to 2:15 to see the "sky" being set, then at the end of the video you'll see it in action.
So why not clear the back buffer? Performance. Clearing the backbuffer would solve glitches you can see when the camera gets "outside" due to a bug, but in standard gameplay you wouldn't notice this anyway. So if it doesn't make any difference, you can just skip it alltogether. Clearing the back buffer has a complexity of O(n) depending on the number of pixels on screen, doing nothing at all would simply be O(0) (well, that isn't defined, but I think it pretty much shows the idea).
Comment: Good answer. And as an add-on to this; while the base engine seems to have this issue in-game, I'm pretty sure they change this when you're working in Hammer Editor, or Source Filmmaker; as you're expected to do a lot of noclip-flying-about in those.


Learn How To Develop GUI Applications

Question: I'm learning Objective-C and already know many other languages, but every time that i try to develop GUI applications i stuck, because i didn't understand and mental visualize the application running and those coordinates of the buttons and the other objects always let me confused, but where i can learn how to do good GUI applications using only my codes(without any type of IDE)? Thanks.
Comment: In my opinion, good GUI applications do not position elements using coordinates.
Comment: I didn't know if i choose the right words to describe my question, but every question about it please comment. Thanks
Comment: Are you familiar with the event (message) driven architecture? See for example http://msdn.microsoft.com/en-us/library/ms644927%28VS.85%29.aspx
Answer: I suggest you start "thinking" about the application before actually developing it. How to navigate and access its functionalites from the end user's perspective, by doing wireframes / mockups. Use tools such as balsamiq mockup for that (here are many other similar tools).
In the end, what you really want to do is look at the usability, and develop an approach to development that puts the end-user in the center of the creative process. There are some excellent free resources out there. My favourites are: http://www.uxmatters.com/ and this book and blog Designing Web Interfaces
Comment: Hi! the second link is obsolete! :)
Answer: I suggest starting small and working your way up. Start off writing a simple Unit converter application with a GUI. Then maybe try something bigger like a minimal text editor (Open, edit the text, and save back out), and go from there.
Also, if you have a certain kind of application you really like, use it as an example and try to think how its developer made it. The great thing about Cocoa apps on the Mac is you can usually open up the actual interface files the application uses (right-click the Application bundle and select "Show Contents", navigate in there until you find .xib or .nib files, which usually can be opened by Interface Builder). Poke around in those to get an idea of how the apps work.
Finally, when you start building your applications (big or small) I highly suggest doing paper mockups. While using a tool on a computer is great, a blank sheet of paper has much less to get in your way. It's essentially your imagination and the paper. Start with a big rectangle (your Window) and draw in the interface. You'll get a feel of how things relate spatially. Don't focus too much on making the mockups pretty or detailed, but do focus on flow of the application and how you'd want it to be used.

Learn How To Develop GUI Applications


Hardware for testing Mapper 30 NES homebrews

Question: For someone wanting to get into NES/Famicom game development, and test on hardware (original and/or clones) to make sure the controls feel right, and to make sure the game is compatible for hardware play, what is a sure method for doing this?
Two SD/MicroSD hardware solutions I am aware of are EverDrive N8 and KrzysioCart.
Below are the Famicom versions of these cartridges respectively:

The end goal would be to flash the game to Muramasa hardware, so the game should play the same on the testing hardware as it does on the final hardware. What I know about these boards, I learned from this video. When it comes to distinctions between the various types of boards, I still have lots of questions, but that's another post for another day.
If the best solution is to strictly test through the Muramasa hardware (skipping SD/MicroSD cart solutions) by flashing to it each time (since that would be the final destination), then that's fine. I don't really know what workflow will be quickest when going back and forth between coding and testing. While not all testing will be through hardware (probably most will be via ROM), periodic hardware testing seems like a good idea, and so a quick workflow for that is desirable.
When it comes to flashing cartridges, the INLretro is the only hardware I am currently aware of for that, and I'm not sure how quick it would be workflow wise to flash with this over and over, or whether that's even a good idea. Workflow speed and ease of use are the main factors that have led me to look at SD cartridge solutions for testing.
Hardware testing workflow criteria:

Must support Mapper 30, which NESmaker uses.
Must work the same on the SD cart as on the final Muramasa hardware (if SD is used).
Must work with Famicom (my console is Japanese).

I've come across various forum threads discussing Mapper 30 compatibility with the SD cartridge solutions mentioned above, but couldn't pin down a definitive answer.
I realize this is a somewhat niche topic, but hopefully someone here has some experience with it and can offer some guidance. Thanks.
Answer: I have KrzysioCart with mapper 30 support and it plays fine. I have an old version with that special feature (not every KC version has it)... however, there is a new release of KrzysioCart with default support for mapper 30, battery saving and some GUI improvements. You can find it here.
I'm not sure if Kris sends item worldwide, you should ask.
Comment: Thank you! Before your answer I got the Everdrive N8 (Famicom version) and its recent OS releases also support Mapper 30. I still don't know anything about flashing games onto blank carts for distribution. Haven't made it that far yet. I've been able to load Mapper 30 games such as Troll Burner onto the Everdrive, and load test programs compiled with [8bitworkshop](https://8bitworkshop.com/) onto it as well.


Proof of $\sqrt{\pi/2}$ in birthday paradox?

Question: I had found in the past a publication in a crypto conference (in 80s if i am not mistaken) which I believe was the first proof why for example a random function $f:X\rightarrow X$ with $\#X=2^n,$ is expected to have collision in $\sqrt{\frac{\pi}{2}\times 2^n}$ iterations. I can't find it, anyone has the reference?
Comment: https://hal.archives-ouvertes.fr/inria-00075445/document
Comment: boss, thanks. Is it that trivial? why the downvote
Comment: @AntonisParagas don't take the down-votes personally. Many people are too lazy to answer / comment to correct you. For me - what do you mean "expected to have collision"? Though - nice reading from SEJPM
Comment: Dropped an upvote... for whatever that's worth.
Comment: haha cheers, i was just wondering if it was out of line or something
Answer: The paper you are looking for is:
"Random Mapping Statistics" by Flajolet and Odlyzko, first published in  Advances in Cryptology — EUROCRYPT '89. EUROCRYPT 1989. Lecture Notes in Computer Science, vol 434.
It is freely available via SpringerLink and via Archives-Ouvertes (PDF).
The relevant statistic you are looking for is probably the rho-length, which specifies the specifies the average length of a cycle to be $\sqrt{\pi n/2}$ where $n=2^k$ in your case.
The abstract reads as:

Random mappings from a finite set into itself are either a heuristic
  or an exact model for a variety of applications in random number
  generation, computational number theory, cryptography, and the
  analysis of algorithms at large. This paper introduces a general
  framework in which the analysis of about twenty characteristic
  parameters of random mappings is carried out: These parameters are
  studied systematically through the use of generating functions and
  singularity analysis. In particular, an open problem of Knuth is
  solved, namely that of finding the expected diameter of a random
  mapping. The same approach is applicable to a larger class of discrete
  combinatorial models and possibilities of automated analysis using
  symbolic manipulation systems ("computer algebra") are also briefly
  discussed.


How to check Log4j in Magento installation?

Question: I don't know if my Magento server is infected by Log4j, how could I check it?
Answer: If you have ElasticSearch installed, the chances are that you have a vulnerability in your server. You need to update your ElasticSearch to the version launched Dec 13, 2021.
Running this command below you can check the Log4j version installed, the versions 2.0 to 2.14.1 are affected.
dpkg -l|grep log4j;

You can find more details here.
Answer: As i read on Elastic (elastic.co) older Log4J versions could be also vulnerable too. This might be relevant for older Magento 2 installations with an older ElasticSearch setup or even for Magento 1 Shops that get patches from MageOne using ElasticSearch. If updating ElasticSearch is not an possible, setting the Dlog4j2 formatMsgNoLookups option to true should stop the lookup function and fix the gap.

In versions 1.17.0-1.28.0, the issue can be mitigated manually by setting system property -Dlog4j2.formatMsgNoLookups=true.

On my setup I found the options file at /etc/elasticsearch/jvm.options, added the option and restarted ElasticSearch afterwards.
To get fully sure that log4j on other setups with Magento is not installed i also checked for relevant .jar files.
find / -name '*.jar'

Sometimes the log4j jar can be packed into another jar as mentioned in that post. So this simple find statement wouldn't find it. For that you can search for the class "JndiLookup" in packed jar files with
sudo find / -name *.jar -exec sh -c "if zipinfo {} | grep JndiLookup; then echo -e '{}\n'; fi" ;

See video on u-labs.de


When you smooth-en a surface at microscopic level, friction increases. Why?

Question: When I was learning a chapter related to Static electricity, my teacher had mentioned that when you rub your comb with DRY hair specifically, static electricity is generated due to friction. Further more she had mentioned a case in which a glass rod is rubbed with silk cloth and still static electricity is generated. However it is important to note that glass rod and silk cloth are very smooth, thereby this reduces friction considerably,then how come static electricity was produced?
Comment: Note that your title and body don't seem to match.
Answer: When considering whether two surfaces will have a high friction or a low friction when rubbed together, more important than whether they are individually smooth or rough is what the barrier to their passing actually is. Consider first two perfectly flat plates. Even if the two plates are made out of wood, which is rough, they slide relatively easily past each other. However, two ridged plates will not easily slide (perpendicular to the ridges) even if the material is quite smooth. The ridges must push the plates apart to pass each other, i.e. they must overcome an energy barrier of sorts.
When you get down to the atomic level and examine friction, you see that it is actually due to weak chemical bonding between the two surfaces. Each chemical bond takes a certain amount of energy to break, so it takes energy to slide two surfaces against each other. If you assume that the binding energy of each point of contact is roughly equal, then the frictional force becomes proportional to the number of contact points between the surfaces. At the atomic level, two very smooth surfaces fit very close together - there are a lot of points of contact - so the frictional force is high. Ironically, at that scale a certain amount of roughness can actually reduce the friction by reducing the number of points at which the two surfaces make significant contact.
So while it may seem to you that the glass rod and silk cloth are too smooth to create static electricity, it's only because you can't see small enough. At the size of the atom, where electrons are jumping from one molecule to another, the surfaces are still relatively very "rough," in that there's a lot of sticking together going on.
Answer: The correlation between smoothness or roughness and static friction is not trivial. If the surfaces are perfectly flat and clean, then they could theoretically weld together. This is generally not the case as surfaces are terminated by oxygen and water generally which significantly affects molecular scale surface interactions. The chemical composition of a material and its surface termination (adsorbates) govern the molecular scale interactions.
Overall the relationship between surface structure and friction depends on a combination of surface structure and atomic friction (interactions at the molecular scale). It is found that the fractality of surfaces is a key consideration in predicting their frictional behaviour.


Why is a company's size often represented by its market capitalization?

Question: The calculation of market capitalization of a company only includes publicly listed stocks. A larger market capitalization company might have issued 30% of its shares while a company having slightly lesser market capitalization (say 5% lesser) may have issued only 10% of its shares. Is market capitalization the right attribute to represent the size of companies?
Comment: Does this answer your question? [How can I find out what percentage the publicly traded shares (float) are of the total company?](https://money.stackexchange.com/questions/13699/how-can-i-find-out-what-percentage-the-publicly-traded-shares-float-are-of-the)
Comment: "issued 30% of its shares" doesn't really mean anything. It's the shares that have been issued that matter. The rest don't actually exist. They're just a legalism that allows the company to, at some point in the future, issue more shares with less hassle. But issuing new shares, whether previously authorized or newly authorized, still requires that the company receive value for those shares that's comparable to the value of the outstanding shares.
Answer: It is a simple measure. The number of shares is easily available and the price as well. Calculating market capitalization is a simple multiplication and you get what the market thinks the company is worth. It is a number that is easily comparable against other companies. To my knowledge, such comparisons are typically based on the total market capitalization, not just the free float. The free float on the other hand is often used for index weighting as it is a better representation of the tradeable volume of shares.
There are some drawback to using market capitalization:

different sectors are valued differently. A price/earnings multiple of 40 is not uncommon for tech stocks but would be extremely high for utilities or REITs
many companies are not listed at all and will not show up in these rankings. The severity of this problem is strongly depending on the region. For example Germany has plenty of family owned businesses (e.g. Aldi, Würth, Bosch) estimated around a value of 5 billion that would be placed in the Top 50-100 in a market cap ranking.


Invariance in Euclidean and Minkowski spaces

Question: Consider Wick's rotation from Minkowski to Euclidean space in QFT. What is the connection between $O(4)$-invariance in Euclidean space and Lorentz invariance in Minkowski space? If we define a quantity which is $O(4)$-invariant in Euclidean space, is it guaranteed, that it will become Lorentz invariant after analytical continuation back to Minkowski space?
Comment: Related: http://physics.stackexchange.com/q/110360/2451 , http://physics.stackexchange.com/q/21261/2451 and links therein.
Answer: Yes, you are right. In Minkowski space $(t,x,y,z)$, the space-time interval:
$$ds^2=dt^2-dx^2-dy^2-dz^2$$
If we define $t=-i\tau$, then we will have
$$ds^2=-d{\tau}^2-dx^2-dy^2-dz^2=-(d{\tau}^2+dx^2+dy^2+dz^2)=-ds_E^2$$
where $ds_E^2$ denotes the Euclidean interval in $4D$ Euclidean space $(x,y,z,\tau)$.
As you can see, once the transformation between $t$ and $\tau$ is fixed, we can go back and forth between the two representations which are invariant under Lorentz and Euclidean rotations respectively.
Comment: Thank you for your reply. Does the same refer to all physical quantities, for instance built up in an invariant way from fields like $F^{\mu\nu}$ in QED? Does not the compactness of O(4) and noncompactness of Lorentz group influence the conclusion?
Comment: you don't have to worry too much about the other quantities. Once you have done the transformation for the time, then naturally quantities with certain $t$-dependence will probably have a different $\tau$-dependence. The purpose of Wick rotation is to make the integrations converge and after that we will have to rotate back to the normal $t$, i.e. replacing the $\tau$-dependence by the corresponding $t$-dependence. There are indeed cases where this method fails. I don't think the compactness matters because the rotation is just a technique for doing functional integrations
Comment: I am interested not only in performing cetrain integrals, but in the formulation of the euclidean field theory as a whole. In such theories there are certain quantities which are O(4) invariant. They are for instance connected with topological properties of fields and with their behaviour at euclidean infinity. However the topology of euclidean space and Minkowski space is entirely different. Can one be sure that these O(4)-invariants will become Lorentz-invariants after back Wick's rotation? Im am not sure, if for instance a winding number continues to have sense in Minkowski space.
Comment: http://www.math.columbia.edu/~woit/wordpress/?p=160&cpage=1 and http://motls.blogspot.sg/2005/02/wick-rotation.html, I just found this page, the author, who used to be a SE user, had a nice discussion regarding Wick rotation in his blog. Unfortunately, some of the content is beyond my reach so far. hope this can give you some clue
Answer: Three of the angles from the $4$-dimensional rotations, $\mathrm{SO}(4)$, become imaginary, leading to the group called the Lorentz group. The imaginary angles correspond to a transformation called a boost, and the angles are called rapidities. The Lorentz group, at least the proper orthochronous part of it, has the property of being broken into three regions that are mutually isolated and correspond in Minkowski space to the surfaces at $\tau = \sqrt{(ct)^2 - r^2} = 1$ with $t > 0$, $\tau = 1$ with $t < 0$, and $\tau = \sqrt{-1}$. That is, those three hyper-surfaces cannot be reached by a continuous path defined by changing $3$-d rotation angles and boosts.
Comment: Wait. Is the isolation of those regions a property of the group, or a property of Minkowski space-time? I think I may be wrong and that is a property of the space on which the group acts, not the group itself.


My woodland explorer map doesn't have an icon on it

Question:
As you can see from the above picture, my map doesn't have a house icon, to show where the woodland mansion is. What does this mean? I haven't been able to find anything online about it. Any help would be greatly appreciated.
Comment: Sounds like a bug. If you re-create the world (in Creative) and go to the same villager, does it give you the same buggy map?
Comment: Are you using a texture/resource pack?
Answer: Found a fix. This happened to me as well. All you need to do is place your map in a crafting table and surround all other 8 slots with regular paper. This increases the size of your map by increasing the scale (i.e: "1:2" now becomes "1:4", then "1:8", and so forth). Keep doing so until you see a house icon.
Answer: Thats becuase the mansion was located along the edge of the map, so as the other answer mentioned, you can usually see it by expanding the map, but just to clarify, this is not really a bug.
Comment: What is the point of adding an answer here that basically repeats the other answer?
Comment: Because unlike the other answer I actually explain why it happened. This is not a bug as one would expect.


We are given a class consisting of 4 boys and 4 girls.

Question: We are given a class consisting of 4 boys and 4 girls. a committee that consists of a President, a Vice-President and a secretary is to be chosen among the 8 students of the class. Let a denote the number of ways of choosing the committee in such a way that the committee has at least one boy and atleast one one girl. Let b denote the number of ways of choosing the committee in such a way that the number of girls is greater than or equal to that of boys. Then what are the values of a and b?
Answer: As Simon said in his answer above, $a$ can have two cases:
$a.1:$ 2 boys 1 girl, which yields $\binom{4}{2}\binom{4}{1}$ choices for people and $3!$ arrangements for their positions which yields $6\cdot4\cdot6=144$ possibilities.
$a.2:$ 1 boy 2 girls, which is the same as above and yields  $144$.
Thus $a=288$.
$b$ also has two cases:
$b.1:$ 1 boy 2 girls, which as above, yields $144$.
$b.2:$ 3 girls, which yields $\binom{4}{3}$ to choose the three girls and $3!$ arrangements which gives $4\cdot6$ possibilities $24$.
Thus $b=168$.
Answer: Case a is either 2 boys 1 girl or 1 boy 2 girls, case b is either 1 boy 2 girls or 3 girls. The numbers are small enough to enumerate the possibilities.
Comment: A mathematical answer would help, regardless. If OP encounters a larger data set, it might not be 'small enough' and the equations would make more sense.
Comment: You're right, but since there's only 8 possibilities in this case I wouldn't take the trouble.
Answer: I agree with the answer by Linus S and the comments by Simon and Joe Taxpayer.  This is an alternate approach using a generating function that will give the solutions handily  even if the numbers are not "small enough".
We are counting the number of injective functions from the set {President, Vice President, Secretary} into the set {boy1, boy2, boy3, boy4, girl1, girl2, girl3, girl4}. The bivariate exponential generating function:
(1 + x)^4 * (1 + y*x)^4 will count the number of girls that are selected for an arbitrary number of positions.  In this case (since there are 3 positions) we seek   the coefficient of x^3/3! which is:  24 + 144 y + 144 y^2 + 24 y^3.  This tells us that of all 336 possible selections there are 24 with no girls, 144 with exactly one girl, 144 with exactly 2 girls, and 24 with exactly 3 girls.


FIDO2 (YubiKey) to unlock LUKS from command line

Question: Following the example of how to add a FIDO2 key from a YubiKey, but I can't figure out how to use the YubiKey to unlock it form the command line.  The instructions talk about unlocking at boot--but that's not what I want.
Setup
Make a 128 MiB file, make it a block device on loop0 and setup LUKS.
$ dd if=/dev/urandom of=disk.bin bs=1M count=128
128+0 records in
128+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 0.534038 s, 251 MB/s
$ losetup /dev/loop0 disk.bin
$ cryptsetup luksFormat -y /dev/loop0

WARNING!
========
This will overwrite data on /dev/loop0 irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for temp.bin:
Verify passphrase:

Add the Yubikey.
$ systemd-cryptenroll /dev/loop0 --fido2-device=auto  --fido2-with-client-pin=yes
 Please enter current passphrase for disk /dev/loop0: ****
Requested to lock with PIN, but FIDO2 device /dev/hidraw9 does not support it, disabling.
Initializing FIDO2 credential on security token.
 (Hint: This might require confirmation of user presence on security token.)
Generating secret key on FIDO2 security token.
 In order to allow secret key generation, please confirm presence on security token.
New FIDO2 token enrolled as key slot 1.

Remove the the non-FIDO2 key.
$ cryptsetup -q -v luksKillSlot /dev/loop0 0
Keyslot 0 is selected for deletion.
Key slot 0 removed.
Command successful.

Problem
Now what?  This doesn't work:
$ cryptsetup open /dev/loop0 loop0_encrypted
Enter passphrase for disk.bin:

I now have a LUKS disk but I don't know how to unlock it.  All tutorials I found say to make modifications to /etc/crypttab and give instructions for mounts at boot.  I want to mount without rebooting and (preferably) without modifying /etc/crypttab.  What am I missing?
Answer: When configuring the FIDO2 security token to require a PIN it conflicts with regular LUKS passphrase entry, since both are entered on the host via keyboard. The option --token-only is used to indicate that a PIN will be entered, instead of a passphrase, and passed to the (here presumed single) security token.
sudo cryptsetup open --token-only /dev/loop0 loop0_encrypted

Using --token-only is simple enough for manual FIDO2+PIN usage, such as when connecting external disks/USB sticks, etcetera. Having cryptsetup automatically switch to PIN entry when there are no passphrase slots does sound like a reasonable usability improvement though. (TODO: update answer if default behavior changes.)

Tested using cryptsetup v2.6.1 (tagged 2023-02-09); available in Debian 12 (Bookworm), Ubuntu 23.04 (Lunar Lobster), Fedora F38, etcetera.
From the upstream cryptsetup open docs. (Emphasis mine.)

If there is valid LUKS2 token but it requires PIN to unlock assigned keyslot, it is not used unless one of following options is added: --token-only,
--token-type where type matches desired PIN protected token or --token-id with id matching PIN protected token.

Debian 12 man page. (Emphasis mine.)

--token-only
Do not proceed further with action if token based keyslot unlock failed. Without the option, action asks for passphrase to proceed further.
It allows LUKS2 tokens protected by PIN to take precedence over interactive keyslot passphrase prompt.
Answer: Using systemd-cryptenroll to set up the encryption suggests that you need a similar tool of the systemd family to unlock it.
Turns out it is essentially Example 3 in the systemd-specific version  of the crypttab(5) man page.
sudo /usr/lib/systemd/systemd-cryptsetup attach loop0_encrypted /dev/loop0 - fido2-device=auto

The equivalent /etc/crypttab entry would be:
loop0_encrypted /dev/loop0 - fido2-device=auto

Note that for example, on Debian 12, the crypttab(5) man page says:

ON DIFFERENT CRYPTTAB FORMATS
Please note that there are several independent cryptsetup wrappers with their own crypttab format. This manpage covers Debian's implementation for initramfs scripts and SysVinit init scripts. systemd brings its own crypttab implementation. We try to cover the differences between the systemd and our implementation in this manpage, but if in doubt, better check the systemd crypttab(5) manpage, e.g. online at https://www.freedesktop.org/software/systemd/man/crypttab.html.


Ansible Inventory scripts

Question: I am using the digital_ocean inventory script that is shipped with ansible which is working fine.  However, I am trying to access the host information from that script inside a playbook.  Do these values get saved as variables that can be accessed from inside the playbook?  If so, does anyone know what the name of the variables are?
I am not sure if this data is stored in the global variables namespace (or whatever it is called) for use in playbooks later.  Do I need to make a separate call to the inventory script  later?  I would like to not have to do this since each call to the script takes a while.
Thanks in advance.
Answer: The variable are available directly in the global scope.
Check the intro inventory documentation.

Ansible Inventory scripts


Is it a good investment strategy to go long on "boring" companies (AT&T for example) and keep them around just because of their dividends?

Question: Is it a good investment strategy to go long on "boring" companies (AT&T for example) and keep them around just because of their dividends or would it be better to trade more frequently companies that don't necessarily offer dividends? Maybe a mix of the two?
Comment: For what it's worth, if you decide to invest in high dividend stocks, there are a few indexes (and associated index tracking funds) that can help. VIG and VYM (ETFs managed by Vanguard) come to mind as good examples, as well as the indexes that they are based upon.
Answer: Like almost all investing question: it depends!
Boring companies generally appreciate slowly and as you note, pay dividends.
More speculative investing can get you some capital gains, but also are more likely to tank and have you lose your original investment.
The longer your time horizon, and the more risk you are willing to take, then it is reasonable to tilt towards, but not exclusively invest in, more speculative stocks.
A shorter horizon, or if you have trouble sleeping at night if you lose money, or are looking for an income stream, would then tend towards the boring side.
Good Luck
Comment: @sdg - thank you for your answer, it makes sense. What I have a hard time figuring out is when to sell a certain stock, even more so a dividend paying one.
Answer: You might want to look up Dividend Yield Trap. Many stocks with high dividend yields got that way not because they decided to increase their dividend, but because their prices have dropped. Usually the company is not in good shape and will reduce their dividend, and you're stuck with a low-yield stock which has also decreased in price.
Answer: Future tax increases on dividends are likely. The Wall Street Journal says. "The millions of Americans who receive dividend income ... need to begin adjusting their investment strategy accordingly." (ref)

"Last week the Senate Budget Committee
  passed a fiscal 2011 budget resolution
  that includes an increase in the top
  tax rate on dividends to 39.6% from
  the current 15%—a 164% increase." ...
  "You can expect fewer businesses
  either to offer or increase dividend
  payouts."
Answer: I had read a book about finance, and it had mentioned that you can gain big profits from investing in the best companies in the most boring markets, like the funeral business for example. These markets are slow growing, but the companies pay a good dividend. Many books recommend investing in dividends because of the compound growth and stable income. Remember that at the end of the day, you should put the same amount of research into buying a stock as you would buying the entire company. With that being said, you may find a great company that may or may not offer dividends, but it should not be of great significance since you feel you are buying into a great company at a fair price. Though dividend growth is a great tool to use to see if a company is doing well.


What does S mean in a bond name?

Question: Recently i read many bonds names such as  Elevated Railroad First 5s, United Drug Company 7s, etc. What does 5s or 7s mean?
Comment: Which market are these bonds traded ? Cannot seem to find any ? I didn't find any currently traded bonds either with that suffix either.
Comment: @DumbCoder I've checked my commercial market data provider through my work connection using `*Elevated* Railroad*` and `*United*Drug*Company*` and found nothing either so the s could stand for suspicious...
Comment: **update** : I think I've found them referring to 1930s bonds here: https://www.passeidireto.com/arquivo/21318832/security-analysis--benjamin-graham/31 this suggests that this is mainly of historical usage and interest.
Answer: It's just shorthand for the interest rate that the bonds pay. "5s" is short for "fives", which is short for "bonds paying a five percent coupon rate"; "7s" is short for "sevens", which is short for "bonds paying a seven percent coupon rate".
This terminology is still in use; when a company has more than one series of bonds outstanding, one way of distinguishing them is to refer to them as "5s" for the five percenters and "7s" for the seven percenters.
Comment: Can you post some examples of Bonds using the terminology, I was unable to find any.
Comment: It's more of a conversational thing these days, so there may well be no examples on line.
Answer: In some cases it is used for 'years' as in the paragraph below:

What immediately stands out on the chart above for me is that no matter what the Fed did, and by extension how the short and intermediate parts of the yield curve traded in relation to that, the long bond (for most of the time the 10s were it; the 30s disappeared in 2002 to come back later in 2006) by and large remained steady the whole time. There were, of course, variations, but for the most part the 10s ended up where they started.

Source: seekingalpha.com(emphasis mine)
Comment: Certainly it can be, as in the example you found. It all depends on context. I've edited to turn your question into an answer.

What does S mean in a bond name?


How can I derive the preferred oxidation states of a transition metal from its electronic configuration?

Question: For example $\ce{Fe}\ (Z=26)$ Short formula: $\mathrm{1s^2\ 2s^2p^6\ 3s^2p^6d^6\ 4s^2}$. If we make the electronic formula we get 4 single electrons ($s=1/2$), which means that the valence in normal state is 4, but in the periodic table it is $2/3/6$. How can I find its valence?
Answer: Firstly you need to appreciate that the 4s orbital is at higher energy than the 3d orbitals (despite the filling order suggesting the oposite). This means that the two 4s electrons are lost first giving a valency of two (which is common to all the first row transition elements). The next point is that one of the 3d orbitals is fully ocupied so one of these two electrons will be preferentialy released due to the repulsion of its pair. This results in a valency of three. These are by far the most common valencies of iron. In fact compounds of 4, 5, and 6 oxidation states (valencies) are known but are very unstable, so of little importance.
Comment: Can you explain me what " two 4s electrons are lost first giving a valency of two" means? How can they be lost? Does that mean they go direclty to 3d?
Answer: The simple valence bond model works well for nonmetals and the molecules they form. It fails completely and badly when trying to extend it to transition metal compounds. There is no easy way to explain why iron, which has four unpaired electrons in the ground state ($S = 2$) is typically found in the oxidation states $\mathrm{+II}$ and $\mathrm{+III}$ in compounds in aquaeous solution.
This behaviour can only be explained by complex molecular orbital theory. It involves a lot of delicate balances that typically cannot be explained a priori without extensive stability calculations. However, the general gist is that the orbitals are split into different energy levels depending on the compound's symmetry and the orbitals' irreducible representation. At first approximation, we can assume a stable configuration if there are no degenerate orbitals that are unevenly populated, but single or multiple unpaired electrons are not a problem. Indeed, iron(III) compounds, that are often very stable, even have a spin of $5/2$ in high-spin state. The secret thereto is even orbital population.
I am afraid that I can give you no real guidance for transition metals except learning, rote memorisation of typical cases and developing an intuition for the more complex ones.
Answer: The electron configuration of iron is 1s^2 2s^2 2p^6 3s^2 3p^6 3d^6 4s^2. Here, the 4s shell is the outermost shell. So, iron has 2 valence electrons. While reacting, these 2 electrons can go to any other electronegative element who requires these electrons to complete its outermost shell. So, this gives iron a valency of 2. Now, the one out of 2 orbitals is completely filled. So, due to repulsion this electron can also be given out. This gives iron a valency of either 2 or 3. However, iron is mostly found in valency 3 as it is mostly stable.


Optimizing random function

Question: If I wanted to determine the parameters of a deterministic algorithm that optimise some performance measure, there are any number of well-known techniques I could try. My problem concerns an algorithm whose behaviour is stochastic. Mathematically, the aim is to maximise $\mathbb{E}f(\mathbf{x})$, where for any $\mathbf{x}$ a random value of $f(\mathbf{x})$ is calculable but $\mathbb{E}f(\mathbf{x})$ is not (except by averaging empirical values of $f(\mathbf{x})$). My efforts with gradient descent and an EA have failed, and I think it's because $f$ is too noisy. (Sampling $f$ many times at the same $\mathbf{x}$ would give a less noisy average, but is too computationally expensive.) Are there any algorithms designed for this situation?
Comment: somewhat related: https://datascience.stackexchange.com/q/74710/55122
Answer: Bayesian Optimization can be useful to find the optimal value for black-box functions without assuming a functional form.

Optimizing random function


Number in the upper lefthand corner of Praat soundwave

Question: What does the number in the purple box (0.4649) indicate? I always thought it was a measurement of amplitude, but when I get the RMS amplitude of the highlighted selection, Praat returns a value of 0.2208 Pascal. Thank you!
Answer: You was thinking correctly, it is just that this value is the highest amplitude of your visible signal on the window. Whereas RMS (Root Mean Square), like its name indicates it, takes into consideration the average of the amplitudes of your signal. So the RMS value will be always between the highest and the lowest amplitude found in a given interval.
The exact formula of RMS is: √ { 1/(t2-t1) ∫t1t2 x2(t) dt }.
Answer: It appears that this is the maximum and minimum air pressure level within the window (where the link says "There are two numbers shown on the left side"). The corresponding Praat manual on sound pressure calibration explains how the integer values are normalized, and how you might calibrate recordings to get true sound pressure level.


Is it permissible to factor out a dot product?

Question: I am an independent student trying to work out a proof. I have followed steps to get to a case where I have $c \vec v \cdot \vec y > d\vec v \cdot \vec x$ -- where c and d are scalars, and v,y and x are vectors. In simple algebra I would factor out the v's -- but I am still learning linear algebra. Is there an analogous operation? It seems like vectors cannot be divided like scalars.
Comment: Just to be clear; $c$ and $d$ are scalars, $\bf v$, $\bf x$ and $\bf y$ are vectors and $>$ is an inequality sign? It's not true that you can "cancel out" the $v$'s, but what you *can* do is say $c {\bf v} \cdot {\bf y} > d {\bf v} \cdot {\bf x} \iff {\bf v} \cdot (c{\bf y} - d{\bf x}) > 0$. Try to work with the bilinearity of the dot product.
Comment: What ultimately would you want to prove if you could make some statement about $y$ relative to $x$?
Answer: You can't in general factor out a vector. Remember that scalar multiplication and the dot product are completely different operations and you you can't treat them as if they are the same.
But in the above you can use that
$$
c(\vec{v}\cdot\vec{y}) = (c\vec{v})\cdot \vec{y} = \vec{v}\cdot(c\vec{y}).
$$
That is, you can move the scalar around.
There are other rules, as
$$
\vec{v}\cdot \vec{y} + \vec{v}\cdot\vec{z} = \vec{v}\cdot (\vec{y} + \vec{z}).
$$
Here you are factoring out the vector $\vec{v}$.
Comment: @bernie2436: Yes, if $V$, $X$ and $Z$ are vectors and $d$ is a scalar, you can do this.
Comment: thanks for your help. I am learning this stuff on my own so feedback like this is really really useful
Comment: Thanks. What about if dV * (X - Z) -- can I distribute the dot product to get dV * X - dV * Z ?


Do you any have access to Computer Science Review Elsevier Journal MS word Template?

Question: I'm in the process of submitting a paper to the Computer Science Review Elsevier Journal. I've gone through their "Guide for Authors," but I'm finding it a bit challenging to discern the specific font, size, and other formatting details. Would anyone happen to have experience with this journal and perhaps possess a Microsoft Word template tailored for their submissions? Any assistance would be greatly appreciated. Thank you!
Comment: For papers in computer science, I would really recommend you use LaTeX. [Here is information on LaTeX for Elsevier journals.](https://beta.elsevier.com/researcher/author/policies-and-guidelines/latex-instructions?trial=true)
Answer: First of all, I suggest to follow @Stephan Kolassa advice and use Latex.
You can find the Latex instruction linked in comment here.
According to their FAQ as of the 16th of November linked here:

Most journals accept a PDF of your manuscript at initial submission and require you to submit your manuscript with source files at a later stage. However, some journals require a manuscript to be submitted in a specific template file. In these cases, the template is probably in LaTeX and in exceptional cases in CRC.

Additionally, the FAQ also gives the following information:

If a journal requires you to use a certain template for submission, you can find this in the journal's Guide for Authors. Consult your Guide for Authors from the journal homepage. To go to your journal's homepage, search for the journal using the search box under 'Find by journal title' in the journal author's page.

Going to the Guide for Authors for Computer Science Review Elsevier Journal which you can find ehre, I can find the following information (emphasis mine):

Our online submission system guides you stepwise through the process of entering your article details and uploading your files. The system converts your article files to a single PDF file used in the peer-review process. Editable files (e.g., Word, LaTeX) are required to typeset your article for final publication. All correspondence, including notification of the Editor's decision and requests for revision, is sent by e-mail.

I also find the following quote a bit below in the "Use of word processing software" paragraph:

Keep the layout of the text as simple as possible. Most formatting codes will be removed and replaced on processing the article. In particular, do not use the word processor's options to justify text or to hyphenate words. However, do use bold face, italics, subscripts, superscripts etc.

From those quotes, it appears the manuscript is gonna go through typesetting, and thus those formatting details you are wondering about are not important, and are only relevant to your first submission, if you submit only a PDF. In later stages, you will be asked to submit source files and format won't matter anymore.
The guide for authors also suggest using Latex:

You are recommended to use the Elsevier article class elsarticle.cls to prepare your manuscript and BibTeX to generate your bibliography.
Our LaTeX site has detailed submission instructions, templates and other information.


How can we allow an NFT to only be be traded on OpenSea and make direct transfer not possible?

Question: How to Stop Direct Transfer of  NFT only Trade of NFT on opensea should be available ?
Answer: You can use OpenSea's OperatorFilterRegistry to block transfers to trading platforms without trading fees.
Here is an example for an ERC-721 token.
Note that this is not a foolproof mechanism and NFT owners can always trade peer-to-peer or use unlisted exchanges.
You should also trust OpenSea not to ban competing trading platforms or even users. Using the OperatorFilterRegistry will make your NFTs vulnerable to censorship and will reduce the initial sale value of your NFTs.


Change status bar back to default after changing it to `Light`, per view Controller scenario

Question: I want to be able to change the status bar color on a per view controller basis. My ViewController flow is A->B->C. The launch status bar color is black (in A), and I change it to white in view Controller B. I use the following in Bs viewDidLoad:
 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
 [self setNeedsStatusBarAppearanceUpdate];

Which works perfectly. However when I go back to ViewController A, it is white also. I tried using the following code to change it back but it doesnt work:
 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
 [self setNeedsStatusBarAppearanceUpdate];

I also tried:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;

But its deprecated and doesnt work.
I have seen the other questions on SO about this, but they tell you how to change it but not change back to default.
Thanks in advance
Answer: Setting the navigation bar back to default in viewWillAppear did the trick.


Should 8x10" prints be actually 8x10?

Question: I ordered a bunch of prints from a shop i've been using for a number of years. This time however I ordered a bunch of regular 8x10" prints. When they arrived I put them all in a cello bag and on top of rigid 8x10" backing board and noticed that all the prints are a little smaller. When I measured them all the prints are 1/16 to almost 1/8 of an inch smaller in each dimension.  Is this normal or should the prints be exactly 8x10"?  I am worried that when people purchase 8x10" frames (which is why I decided to crop and print at this size) the prints will not fit.
Answer: Within production of paper based products such as photo prints, there are inaccuracies that are hard to avoid. If the prints are exposed on photo paper usually paper rolls are used which may already show these inaccuracies. Here you can find tolerances that are acceptable within an usual international paper size standard. I would guess, if your deviations are in the same range (about 1/10 in for comparable sizes) you have little arguments for a claim, but I would guess at least with local printers you could at least define some lower tolerances in advance.
There is even a bigger problem if the sizes are derived from a different unit system. In Germany we have a usual size of 10 cm x 15 cm, which may or may not be 4 in by 6 in, dependent on the manufacturer of the paper. In the latter case, it is a deviation of more than 2 mm on the longer side.
Usually the picture frames should be constructed with a bit smaller exposed area such that the border of the print is entirely hidden, but from my experience you can never be sure and have to measure in every single case. Disappointing.
Comment: my 8x10" prints are almost exactly 2mm smaller on both the short and the long side which is the maximum tolerance based on the link you provided. However I did some reading and it seems that most 8x10" frames and mats have an overlap from 1/4 - 1/2 inch so I should be good.
Comment: The link is only for the ISO paper standard and not for photographic print sizes, so it is just something similar you can take as a rough reference. The German version of the Wikipedia entry about photographic print sizes (en: https://en.wikipedia.org/wiki/Photo_print_sizes) mentions a cutting inaccuracy of 1 mm of usual photo production, so what you get is much more inaccurate. Maybe the company tells you the reason if you ask them.
Comment: Europe commonly calls 8x10 inch photo paper to be 20x25 cm.  But if actually cut 20x25cm, it will be 3 and 4 mm shorter than 8x10 inches.  That is near 1/8 inch.
Comment: 20x25cm would be around 7 7/8 inches by 9 13/16 inches.  But I believe even in Europe the actual standard is supposed to be 8x10 inches, and 20x25cm is just their approximation in a more familiar unit.  In other words, it should be 20.32 by 25.4 cm.
Comment: This may be true for printing companies. I do a lot of inkjet printing myself and buy paper from 4 different companies. From them I get 5 different 10 cm × 15 cm variants (differences in the range of 4 mm). Another aspect is that the printing companies may cut the paper rolls to suit your image aspect ratio. That may introduce another source for differences, especially since they usually use an around 2% larger exposure area to do borderless printing which may distort the aspect ratio and introduces further tolerances.

Should 8x10" prints be actually 8x10?


echo or print /dev/stdin /dev/stdout /dev/stderr

Question: I want to print the value of /dev/stdin, /dev/stdout and /dev/stderr.
Here is my simple script :
#!/bin/bash
echo your stdin is : $(</dev/stdin)
echo your stdout is : $(</dev/stdout)
echo your stderr is : $(</dev/stderr)

i use the following pipes :
[root@localhost home]# ls | ./myscript.sh
[root@localhost home]# testerr | ./myscript.sh

only $(</dev/stdin)seems to work , I've also found on some others questions people using :"${1-/dev/stdin}" tried it without success.
Answer: stdin, stdout, and stderr are streams attached to file descriptors 0, 1, and 2 respectively of a process.
At the prompt of an interactive shell in a terminal or terminal emulator, all those 3 file descriptors would refer to the same open file description which would have been obtained by opening a terminal or pseudo-terminal device file (something like /dev/pts/0) in read+write mode.
If from that interactive shell, you start your script without using any redirection, your script will inherit those file descriptors.
On Linux, /dev/stdin, /dev/stdout, /dev/stderr are symbolic links to /proc/self/fd/0, /proc/self/fd/1, /proc/self/fd/2 respectively, themselves special symlinks to the actual file that is open on those file descriptors.
They are not stdin, stdout, stderr, they are special files that identify what files stdin, stdout, stderr go to (note that it's different in other systems than Linux that have those special files).
reading something from stdin means reading from file descriptor 0 (which will point somewhere within the file referenced by /dev/stdin).
But in $(</dev/stdin), the shell is not reading from stdin, it opens a new file descriptor for reading on the same file as the one open on stdin (so reading from the start of the file, not where stdin currently points to).
Except in the special case of terminal devices open in read+write mode, stdout and stderr are usually not open for reading. They are meant to be streams that you write to. So reading from the file descriptor 1 will generally not work. On Linux, opening /dev/stdout or /dev/stderr for reading (as in $(</dev/stdout)) would work and would let you read from the file  where stdout goes to (and if stdout was a pipe, that would read from the other end of the pipe, and if it was a socket, it would fail as you can't open a socket).
In our case of the script run without redirection at the prompt of an interactive shell in a terminal, all of /dev/stdin, /dev/stdout  and /dev/stderr will be that /dev/pts/x terminal device file.
Reading from those special files returns what is sent by the terminal (what you type on the keyboard). Writing to them will send the text to the terminal (for display).
echo $(</dev/stdin)
echo $(</dev/stderr)

will be the same. To expand $(</dev/stdin), the shell will open that /dev/pts/0 and read what you type until you press ^D on an empty line. They will then pass the expansion (what you typed stripped of the trailing newlines and subject to split+glob) to echo which will then output it on stdout (for display).
However in:
echo $(</dev/stdout)

in bash (and bash only), it's important to realise that inside $(...), stdout has been redirected. It is now a pipe. In the case of bash, a child shell process is reading the content of the file (here /dev/stdout) and writing it to the pipe, while the parent reads from the other end to make up the expansion.
In this case when that child bash process opens /dev/stdout, it is actually opening the reading end of the pipe. Nothing will ever come from that, it's a deadlock situation.
If you wanted to read from the file pointed-to by the scripts stdout, you'd work around it with:
 { echo content of file on stdout: "$(</dev/fd/3)"; } 3<&1

That would duplicate the fd 1 onto the fd 3, so /dev/fd/3 would point to the same file as /dev/stdout.
With a script like:
#! /bin/bash -
printf 'content of file on stdin: %s\n' "$(</dev/stdin)"
{ printf 'content of file on stdout: %s\n' "$(</dev/fd/3)"; } 3<&1
printf 'content of file on stderr: %s\n' "$(</dev/stderr)"

When run as:
echo bar > err
echo foo | myscript > out 2>> err

You'd see in out afterwards:
content of file on stdin: foo
content of file on stdout: content of file on stdin: foo
content of file on stderr: bar

If as opposed to reading from /dev/stdin, /dev/stdout, /dev/stderr, you wanted to read from stdin, stdout and stderr (which would make even less sense), you'd do:
#! /bin/sh -
printf 'what I read from stdin: %s\n' "$(cat)"
{ printf 'what I read from stdout: %s\n' "$(cat <&3)"; } 3<&1
printf 'what I read from stderr: %s\n' "$(cat <&2)"

If you started that second script again as:
echo bar > err
echo foo | myscript > out 2>> err

You'd see in out:
what I read from stdin: foo
what I read from stdout:
what I read from stderr:

and in err:
bar
cat: -: Bad file descriptor
cat: -: Bad file descriptor

For stdout and stderr, cat fails because the file descriptors were open for writing only, not reading, the the expansion of $(cat <&3) and $(cat <&2) is empty.
If you called it as:
echo out > out
echo err > err
echo foo | myscript 1<> out 2<> err

(where <> opens in read+write mode without truncation), you'd see in out:
what I read from stdin: foo
what I read from stdout:
what I read from stderr: err

and in err:
err

You'll notice that nothing was read from stdout, because the previous printf had overwritten the content of out with what I read from stdin: foo\n and left the stdout position within that file just after. If you had primed out with some larger text, like:
echo 'This is longer than "what I read from stdin": foo' > out

Then you'd get in out:
what I read from stdin: foo
read from stdin": foo
what I read from stdout: read from stdin": foo
what I read from stderr: err

See how the $(cat <&3) has read what was left after the first printf and doing so also moved the stdout position past it so that the next printf outputs what was read after.
Answer: stdout and stderr are outputs, you do not read from them you can only write to them. For example:
echo "this is stdout" >/dev/stdout
echo "this is stderr" >/dev/stderr

programs write to stdout by default so the first one is equivalent to
echo "this is stdout"

and you can redirect stderr in other ways such as
echo "this is stderr" 1>&2

Comment: On Linux, `echo x` is not the same as `echo x > /dev/stdout` if stdout does not go to a pipe or some character devices like a tty device. For instance, if stdout goes to a regular file `echo x > /dev/stdout` would truncate the  file and replace its content with `x\n` instead of writing `x\n` at the current stdout position.
Comment: @Michael-Daffin > Thank you , so if i want to read stdout and stderr i can only use cat ? (since they're files) , for example i want to show the user the last error that occurred `echo this is your error $(cat /dev/stderr)` ?
Comment: @OmarBISTAMI You can't read from `stdout` and `stderr`, they are outputs.
Comment: this is interesting, so effectively under these contexts `>` and `>>` are equivalent to each other, you can only write with append behavior.
Answer: myscript.sh:
#!/bin/bash
filan -s

Then run:
$ ./myscript.sh
    0 tty /dev/pts/1
    1 tty /dev/pts/1
    2 tty /dev/pts/1

$ ls | ./myscript.sh
    0 pipe
    1 tty /dev/pts/1
    2 tty /dev/pts/1

$ ls | ./myscript.sh > out.txt
$ cat out.txt
    0 pipe
    1 file /tmp/out.txt
    2 tty /dev/pts/1

You will probably need to install filan with sudo apt install socat first.


How do I limit the size of the %TEMP% folder in windows 7?

Question: Is there a way to limit the size of a user's %TEMP% folder under Windows 7? Our corporate systems have intentionally small hard drives, and some users have temp directories getting up to 1.5GB. It'd be helpful if we could limit that to, say half a GB. Any insight would be appreciated.
Answer: use quotas? It will limit obviously everything in their homedirs but it works. You can also use a login script to empty the %temp% folders every time they log in.


Why interfaces and buses gets faster with every version if they are physically the same?

Question: An interface or computer expansion bus gets faster with every version eg. PCI express 1.0 is 4GB/sm, PCI express 2.0 is 8GB/s, PCI express 3.0 is 16GB/s. I understand that things like microprocessors get faster because newer ones are manufactured in better way, but these buses are all physically the same (at least they look like and are compatible). So how come that every version is 2x times faster if it is physically the same as the old one? Why couldn't it be 16GB/s in the first place?
Comment: Because signaling.
Comment: a)  Because they are not the same, and are only reverse-compatible.  3.0 is reverse-compatible with 1.0, but 1.0 is not forward-compatible with 3.0.  b)  Because we didn't know how to back then.  We learn and grow and improve with each generation.
Answer: They are multiples ways to improve the bandwidth of an interface or bus:

Overhead encoding : most of old buses use 8B/10B encoding while newer interfaces or bus versions will use 64B/66B and PCIe 3.0 even use 128B/130B encoding.
With 8B/10B you send 20% more data than the useful ones. With 64/66B the overhead ratio is only 3.125%.
What does that mean ? In general we talk about useful bandwidth about buses. So for a 1 Gbps bus, if you use 8B/10B, the real bandwidth needed is 1.25 Gbps.
But the overhead encoding is dependant of the following evolution.
Moore's Law factor: as time flies, you'll have more computing power in a chip and you'll be able to use more powerful algorithms but which need more computing power.
You also will be able to make your chip consume less power or having more powerful transceivers.
You will also be able to increase the frequency of your bus.
Transceivers: Even if we talk about digital bus, the signal transmitted still need an analog part. This is done by transceivers. They are very power consuming parts of an IC and with the Moore's law and shrinking, you'll be able to have more powerful transceivers than few years behind.
You will also have more evolved equalization and pre-emphasis algorithms that will provide the signal to be sent on a longer distance or the same distance but with a higher frequency)
Modulation: Ethernet standards use different Pulse-amplitude modulation (PAM-5, PAM-16) to be able to send more data on the same 4 four pairs cable.
DDR: Use both clock edges to sample data.

This is just some facts that come to my mind.
Why can't we have a very high bandwidth at the beginning ? Try the Moore's law.
I think you may be able to have the best of the best in equalization, encoding, modulation, but you'll need a chip that will be very expensive and very power consuming.
Also, for instance PCI Express 1.0 started in 2003 with a bandwidth of 2 Gbit/s per lane. Ten years later, with PCI Express 4.0 we have almost 16Gbit/s per lane. But did we need 16 Gbit/s bus in 2003 ?
Consumer electronics need affordable solutions for their needs. If you try to sell them a 10 Gbps bus for $15 when they need only 5 Gbps for $10, they won't buy it.
But bus maker know that there is a higher bandwidth need as time passes and they prepare the evolution to be cost-effective.
Answer: Simply because the bus itself is only half the equation.
As you said, processors improve due to smaller scale processing and higher integration. It is exactly these processors that drive the signals on those buses. If they can handle higher throughput speeds and get better noise immunity, the bus gets faster.
Comment: The co-processor, south-bridge and north-bridge are processors too.
Comment: @nhgtygbg The interconnecting wires may be same, perhaps with tighter tolerances, but what makes the difference are the bus drivers which take a lot of time and effort to design and optimize.
Comment: As well as the technical imperatives others have pointed out, there are commercial imperatives.  Companies can't spend 20 years perfecting a technology with no financial return and with no guarantee that the technology will be taken up when they do release it.  They release in stages to mitigate both risks.
Comment: But bus is integrated with motherboard not the processor. You can have the same processor in motherboard with PCI 2 or in motherboard with PCI 3. So how can it be?
Comment: Because the CPU itself doesn't handle the PCI bus.
Comment: @Ignacio Vazquez-Abrams So what was the barrier to create bus as fast as 16GB/s in the first place
Answer: Most of this is a matter of balancing needs against expense.
For example, the original IBM PC had an 8-bit bus running at 4.77 MHz. Why didn't it have a wider, faster bus? Because it had a CPU with an 8-bit bus running at 4.77 MHz. A bus that was wider and/or faster could have been built, but there was nearly no point in doing so, because the CPU couldn't use any more than that anyway. To keep costs reasonable, it didn't have a lot of highly intelligent peripherals either, so even though  they knew how to build faster buses, using one would have resulted in substantially higher costs but little or no matching improvement in speed--the system spent little enough time waiting for the bus, that even a bus of infinite bandwidth and zero latency wouldn't have made the entire system a whole lot faster.
The PC/AT followed pretty much the same pattern--the width and clock rate of the expansion bus precisely matched the external bus of the processor (16 bits wide, initially 6 MHz, later increased to 8 MHz).
The PCI bus was initially designed about the same way. At the time, Intel was (mostly) building 486 CPUs, with an external bus that was 32 bits wide, running at 33 MHz. The PCI bus did the same.
Then things sort of languished for a while--although PCI designs (under the PCI-X moniker) were widened to 64 bits, and clock speeds increased to 66, 133, 266 and 533 MHz, these (especially the 266 and 533 MHz varieties) never became very popular. Some of the variants were used in some servers, but even there they never became particularly common.
Some of that was driven by politics, but a lot of it was a simple matter of cost and lack of need--most people just didn't have much need (or even use) for a bus a lot faster than basic 32-bit, 33 MHz PCI at the time. Essentially the only place they really gained much from greater bandwidth was for video cards, for which AGP provided a significant improvement in bandwidth at much lower cost.
PCI Express is really much the same way. Bandwidth has generally been quite a bit greater than anybody had any real use for at the time (even in high-end video cards), so building a more expensive bus to get greater bandwidth didn't make much sense. If anything, it would probably make more sense to ask why they bothered building that much bandwidth to start with and/or why they've expanded bandwidth so aggressively, even though almost nobody really needs or uses the bandwidth that's available.
About the only answers I have for that probably sound at least a little cynical. The first is simple competition: even if it provides little real benefit to the average consumer, Intel probably sees at least some competitive advantage to being able to advertise much larger bandwidth numbers than their AMD--and in pushing AMD to spend money on R&D to at least come close to keeping up.
The second comes down to fab utilization. I don't know for sure, but I'd guess that Intel basically builds CPUs in their newest fabs. When a fab becomes obsolete for that purpose, they (most likely) use it to build less critical parts--especially north and south bridges. Since they have fabs that were cutting edge only a few years ago to use, their transistor budget for bridge parts is pretty large, and they'd probably like to use that budget to produce the best part they can, and justify the highest price they can (which kind of leads us back to the first point).
The other side of the coin is that although this may not provide a massive benefit to the consumer, the actual cost to the consumer is also quite low. You can buy a complete motherboard now for less than (for one example) I once paid for a 10 megabit/second Ethernet card--and the motherboard includes at least one (and often two) Gigabit Ethernet connections, six or eight SATA connections, a dozen or so USB connections, etc. In short, even if they built an otherwise-current motherboard with "only" PCI-E 2.0, it probably wouldn't lead to a significant cost reduction.
Of course, a more capable motherboard also makes a (marginally) better long term investment--even if you don't use it immediately, it's possible that (for example) you might continue using that motherboard a while, and eventually upgrade the graphics card to something enough faster that even if it doesn't use the full available bandwidth, it might still use a little more bandwidth than the previous standard supported.
Looking at it from the other direction for a moment: how does having a larger transistor budget and more capable fab lead to a faster bus? At least two points are immediately obvious. One is pretty simple: when you shrink transistors, the input capacitance of a transistor shrinks too. Although you need (and use) I/O buffers, the reduced capacitance leads more or less directly to being able to use faster signaling (i.e., rise time and fall time are reduced). Second, when you can use more logic, it becomes practical to use more sophisticated signaling schemes. For example, an older scheme might have transmitted 10 bits across the wire for every 8 bits of data you wanted transmitted. A newer one (that requires more sophisticated logic) might instead encode 65 bits of data you want sent as 66 bits going across the wire. The first results in 25% overhead, but the second in only ~3% overhead. Of course, you pay for that increased transmission speed in the form of needing more transistors on each end to do the encoding/decoding.
To summarize: the bus bandwidth in typical consumer devices is driven heavily by cost. The technology to build faster certainly exists, but for most computers, there's just not much point.


Fermi level in metals and semicoductors

Question: As we read about Fermi energy, it is the energy of the highest occupied electrons. But if we look at the energy level diagram of semiconductor the Fermi level is situated somewhere between the valence band and the conduction band. The probability of the occupancy of the Fermi energy level is zero. If there enter some electrons in the conduction band due to thermal excitation conduction happens. My question is that how does the energy of the electrons whose energy is above the Fermi level, against the definition of the Fermi energy, are not called to be present at the Fermi energy level?
Comment: I don't get what "are not called to be present at the Fermi energy level" means. Fermi energy is the highest occupied energy at absolute zero temperature. Above that there is always a finite probability that energy is above Fermi energy. Check the  Fermi Dirac distribution has a tail above 0K.
Answer: To quote from a note in Ashcroft and Mermin's Solid State Physics book (p. 573 in the 1976 version):

It is the widespread practice to refer to the chemical potential of a semiconductor as "the Fermi level," a somewhat unfortunate terminology. Since the chemical potential almost always lies in the energy gap, there is no one-electron level whose energy is actually at "the Fermi level" (in contrast to the case of a metal). Thus the usual definition of the Fermi level (that energy below which the one-electron levels are occupies and above which they are unoccupied in the ground state of a metal) does not specify a unique energy in the case of a semiconductor: Any energy in the gap separates occupied from unoccupied levels at $T=0$. The term "Fermi level" should be regarded as nothing more than a synonym for "chemical potential" in the context of semiconductors.

Now, you might also want to look deeper into The chemical potential of an ideal intrinsic semiconductor (Mark R. A. Shegelski, American Journal of Physics 72, 676 (2004)) for a deeper look at the behavior of the chemical potential as a function of energy. In that paper it is shown that as $T \rightarrow 0$ the chemical potential goes to the bottom of the conduction band.
Answer: Fermi energy is only defined at $T=0$. For a finite temperature we refer instead to the chemical potential. Thus, thermally excited electrons are technically "above" the Fermi level and not "on" the Fermi level. In other words, thermally excited electrons don't define what the Fermi level is, only the highest occupied states at $T=0$.
Comment: I'm not sure, but I think the OP wants to know how a Fermi level can be defined in an energy gap when there are no electrons there.
Comment: Well technically it is not defined in a gap but rather at the band edge for an insulator. Placing a Fermi level in a band gap is just a matter of convention and won't change the physics anyway (since the density of states is 0).
Answer: Don't forget that to calculate the number of electrons (or electron density) in any energy range you need to multiply the density of states by the occupancy number (F-D function). In the band gap there are no energy levels (as the name shows) so the density of states is zero. So what the F-D distribution tells you is that if you had a level right in the middle of the gap (for intrinsic semiconductor), the occupancy number would have been 1/2.  But then it won't be a gap, would it? In the conduction band you have non-zero density of states so you can have electrons. Not so many as in a metal, as the values of F-D function are quite small in that region.

Fermi level in metals and semicoductors


$F: M_n \to M_n$, $F(m) := m^3$, what is the derivative?

Question: We recall that $F: U \to Y$, with $U \subset X$ open and $(X, \|\cdot \|_X)$ and $(Y, \|\cdot|_Y)$ normed vector spaces, is differentiable at $x \in U$, if there is a continuous linear map $S_x: X \to Y$, which is the derivative of $F$ at $x$, such that$$\lim_{\|h\|_X \to 0} {{\|F(x + h) - F(x) - S_x(h)\|_Y}\over{\|h\|_X}} = 0.$$Let $M_n$ be the space of $n \times n$ real-valued matrices and define $F: M_n \to M_n$ by $F(m) := m^3$. How do I see that $F$ is differentiable at every $m \in M_n$? What is its derivative?
Comment: Please add your thoughts/partial work when you ask a question, in order for us to help you more specifically.
Answer: Hint :-
$||(M+h)^3-M^3||\ =\ ||(M^2+Mh+hM+h^2)(M+h)-M^3||\ =\               \\             ||M^2h+MhM+Mh^2+hM^2+hMh+h^2M+h^3||$.
Since the derivative is a Linear Map so find the terms which are "Linear" in $h$ and bound the rest of the terms using the condition that $||h||\rightarrow 0$.


Is it okay to keep open the MySQL database connection open through out the Application or open and close connection query-wise?

Question: I'm developing a REST API using Nodejs along with MySQL as the database.Is it okay to keep open the MySQL database connection open through out the Application or open and close connection query-wise ? Is there a best practice or a standard methodology for handling situations like this.
Comment: Some of the down-voters care to elaborate what is wrong with this question exactly so the author can improve?
Comment: Why it's been down voted?
Answer: For fast response time and high throughput, it's actually best to keep database connections open and reuse them for subsequent requests. Most database frameworks offer some kind of connection pool mechanism where a request handler can get a database connection for its work and return it to the pool afterwards.
Note that the answer referenced by @RomanBoegli mentions connection pooling, too, so we're not in contradiction here. You should just mentally replace opening and closing of the database connection with getting one and returning it to the pool, and should keep it for as short as possible.
Answer: Consider the database as your data treasury. Hence, it is in your interest to keep traffic through the open door to a minimum. Therefore I suggest you to open the DB connection as late as possible, ideally just right before the query execution, and closing it right after it again. See this answer for concrete implementation.


MCX redirection on OSX network users

Question: Hi I have an open directory network
users login with network based user home folder
I am trying to redirect the ~/Library/Caches folder to a /tmp/User/Library/Caches folder using MCX redirection using workgroup manager on the group
I have setup the redirect as per below

I can see that it works as on login the /tmp/User/Library/Caches folder is created, however no applications are using it, they continue to create items in the ~/Library/Caches folder
Can anyone assist in telling me what I am missing to get the new cache folder to be used? I have other managed preferences setup e.g. hide wifi icon and they work perfectly. So I know they are being used.
Thanks
Answer: Answering my own question
The user did not have permission to delete original ~/Library/Caches folder therefore the MCX failed
Manually deleting the ~/Library/Caches folder on the server allowed MCX to generate the new symlink

MCX redirection on OSX network users


How can I hide exposed filter control if the filter is not applicable to existing views results?

Question: I have created a view with three exposed filters. Now I have to hide these Fields dynamically - if field is not present in any of the content types of the nodes in current result, filter based on this field should not be visible. I am using Drupal 7.
Answer: You have to create a small module or add a function into template.php where you use a one of the hook alter functions. You test your view results for a given set, and if you at that result don't need the filter you unset it. Probably the best hook is: hook_views_pre_render.
"https://api.drupal.org/api/views/views.api.php/group/views_hooks/7"
Check out the comments on the hook_views_pre_render function to get an idea of how to use it. Hope this gets you on your feet.