Cannot reboot to Ubuntu from Microsoft

Question: Been using for years.  New Dell laptop and I left the MS OS on the computer and loaded Ubuntu 16.04.2.  I then switched at boot to Microsoft, and now the computer will not reboot back to Ubuntu.  How do I get back to my Ubuntu OS!?!?
Comment: You have to give us more information. Do you see the GRUB menu? Are you able to see Windows and Ubuntu in that menu? If you select Ubuntu, exactly what happens next, and what do you see? Are there any error messages?
Comment: By "Microsoft", you mean Windows, right?
Answer: windows likes to put itself at the top of the boot order. a work arond is this:
boot from a live CD. install efibootmgr.
find the file /efi/ubuntu/grubx64.efi. copy it to /efi/boot/bootx64.efi. if the file is there already overwrite it. this makes grub the default loader.
next use efibootmgr to delete all entries in the boot list. restart you computer, be sure ubuntu is the fiirst OS you boot into so it is placed in the first slot.
Comment: Before starting to copy files, and overwriting existing files, and installing additional software, why don't you find out more information from the user about exactly how/where their boot is failing. At least make backups of files before overwriting. Maybe recommending boot-repair might be more user friendly and safer?
Comment: I tried booting from a live CD, but it still would not boot
Comment: secure boot has to be off, and cd has to have priority boot.
Comment: How do I make the CD the priority boot, I did it once before, but forgot how...
Comment: in the system setting to make it permanent. or holding a function key at boot to get a boot menu. the right key varies from computer to computer. t F2, F10, F12  are most common
Answer: Windows likes to take over the booting whenever possible, and doesn't recognize Linux partitions.
You'll need to boot from a live CD or live USB and reinstall GRUB.  This will make GRUB the default boot loader again, and should recognize both Ubuntu and MS Partitions.
Comment: How do you know that GRUB is the problem? You haven't asked the user any questions yet. Why not recommend boot-repair?
Comment: @andy -- when he boots into windows he will have the same problem unless he does my fix

Cannot reboot to Ubuntu from Microsoft


Mapping sequences of different lengths to fixed vector - Python

Question: I am trying to make a chatbot using a deep neural network in python using keras. The problem I am having is that for the deep neural network to work, the input dimension has to be fixed. So my question is, how can I map a sequence of words (sentence of different lengths) to a fixed vector so I am able to feed this through a deep neural network?
Comment: Look up "sentence embedding", word2vec, and paragraph2vec.
Answer: A recurrent neural network (RNN) is probably what you want to look into. It has exactly that capability of dealing with variable length input sequence. In fact, currently some of the most successful applications of RNN are in the NLP area, where the inputs are sentences of varying size. Just google recurrent neural network LSTM and you will find lots of tutorials.
Answer: There is a lot of research going on in this field of generating fixed length sentence vectors. Here are some of the ways.

Train/Download vectors.
Add the word_vectors in the sentence to get the fixed length sentence vector. Surprisingly it gives decent results.
If you have a huge corpus. One popular algorithm and used for various baselines is "Quoc Le & Tomáš Mikolov: "Distributed Representations of Sentences and Documents". The gensim implementation can be found here.
You may also download pretrained sentence vectors. Here are some of the sources.


Where did the phrase "sidewalk prophets" come from?

Question: Where did the phrase "sidewalk prophets" come from?
Is this a phrase coined in a song or literature?
I know it is a Christian band, but it seems too familiar for just that.
Comment: What research have you already done yourself? Please see the [List of General References](http://meta.english.stackexchange.com/a/2574/43980)
Comment: What makes you think it is anything more than a band's name?
Answer: In an interview posted on blogspot.com

Where did the name of the band come from?
Dave came up with the "Sidewalk" which stems from a lyric in the Jars of Clay song "Art In Me".  The line reads something like this "Images on the sidewalk speak of dreams descent".  Essentially, the way we understand this line of poetry is that God can be speaking through anything whether it's writing on the street or starts in the sky.
"Prophet" came from Ben's word of the day dictionary.  The definition of a prophet according to the dictionary is someone who speaks the truth about life.
When we combined the two our name means - we're people who search for God in everything and seek to tell the truth about life from our perspective which is as followers of Christ.

So it is just a made up band name.
Comment: Seems pretty definitive to me. However, it should be noted that in the USA it is actually not all that uncommon to come across random guys standing on sidewalks shouting prophecy at any passerby in earshot. The stereotype is wearing a sign reading: "[Repent: The End is near!](http://currenteditorials.files.wordpress.com/2013/01/the-end-is-near.jpg)"
Comment: Speaker's corner comes to mind
Comment: I spend a lot of time in Europe - happens there too.
Answer: The term "sidewalk prophet[s]" appears in Google Books and Elephind newspaper database search results from as early as 1890. The expression does not appear to be especially common, however, even today. Here are the eleven pre-1980 matches for the term that I've been able to find.
From "Political Circles Quiet," in the Pittsburgh [Pennsylvania] Dispatch (February 3, 1890):

With a Sabbath calm which oozed through the keyhole of the closed doors at Republican headquarters, and the fact that a Unitarian congregation held the fort at the County Democracy rooms, and the Randall Club members were attending their Sunday devotions, the pursuit of political news yesterday was over a straight and narrow path. An investigation from sidewalk prophets of both parties showed, however, several points which rather change the unanimous characteristic of the indorsement said to have been given to Judge Bailey on Saturday night.

From "Where Are Our Golf Links to Be Located?" in the Santa Cruz [California] Sentinel (August 20, 1911):

SIDEWALK PROPHETS POINT THEIR FINGER WITH EMPHASIS TO MOORE RANCH UP THE COAST.
...
The mystery as to whether the site chosen is the Moore place or some other will soon be made public, but until such time the guessers, and there are many, can carry on their investigations and make their prophecies.

From Frank Grimes, "Debates and Decisions," in the Abilene [Texas] Daily Reporter (April 11, 1916):

Rain plays a bigger part in the universal scheme of things than any other element. Without rain there would be nothing to eat, wear, smoke, drink or sing about. Without rain the politician would call in vain for attention, the merchant would wait a century for business and the sidewalk prophet would lose his job.

From From Jane Just, "Down the Western Appleway," in The American Scene (1936) [combined snippets]:

DOWN THE WESTERN APPLEWAY Jane Just And it came to pass, just as Sam, the sidewalk prophet, had predicted, that a great wave of feminine indispositions swept the unusually healthy community of Apple Center. The new doctor was thirty-and-two, handsome and unmarried. And what with millions of honey bees buzzing and droning in the blooming orchards, Sam had dozed a little in his tilted chair when the tap-tap of Gran'maw's cane recalled him.

From Cedric O'Leary, A Shamrock Up a Bamboo Tree: The Story of Eight Years Behind the 8-ball in Shanghai, 1941-49 (1956) [combined snippets]:

At 11:30 a.m. we marched out of the compound, flanked by police and gendarmes. The streets were crowded with thousands of people, now suddenly noisier than before. "Chins up, fellows!" somebody shouted. "Don't worry, it won't be long!" a sidewalk prophet yelled. "Home for Christmas!" some optimist called out.

From Samuel Taylor, I Have Six Wives: A True Story of Present-day Plural Marriage (1956) [combined snippets]:

It was not the face of a ladykiller; in fact the first impression was of an ordinary guy, like you and me, neither blessed nor cursed with any unusual characteristics. He didn't have the beady eye and loud voice of the sidewalk prophets. His personality was pleasant and somewhat reserved; the distinctive physical trait was his slow, calm smile, which he used for emphasis in conversation—and which, I learned, cost him an ulcer to maintain.

From Robert Fontaine, "The Good World", in The Third Book of Words to Live By: Selected and Interpreted by Seventy-eight Eminent Men and Women (1962) [combined snippets]:

Once, as a small boy, I was convinced by a sidewalk prophet with a magnificent but dirty beard that the world was to end in 48 hours.
Knowledge of the world's end rather pleased me. I soon would stand with the angels on clouds of pink joy and do nothing but sing all day. I would say goodbye to homework to dentists, and to beating rugs in the back yard after school. When, 48 hours later, the time had come and the world was still shining there, I was disappointed—at first.

From Carlene Polite, The Flagellants (1967) [combined snippets]:

"I have been off, Ideal, blinking at stationary stars, sieving through the dust, paddling against a maelstrom, drowning with alcoholics, rabble-rousing with students, dissenting with idealists, ... sprinkling holy water in a deserted cathedral, watching a priest lock up a silver chalice, holding down ladders for unheeded sidewalk prophets, stepping aside for stampeding crowds, watching a movie produced for the sightless, bidding for literature about to be burned, ...

From Henry Dumas, "Harlem," in Rope of Wind and Other Stories (by 1968/1979) [combined snippets]:

Elder Dawud was preparing to deliver his evening message to the people. He walked behind a man carrying the [American] flag. Another man was setting up a ladder for the Elder, and every once in a while somebody shouted a greeting at Elder Dawud. The people knew him. He was one of the many sidewalk prophets who—more than once—had indirectly caused the people to react in concert over some issue of concern to Harlemites. He was a short, dark man, about forty years old, but his thinness gave the appearance of youth.

From Charles Wilson, The Commoner William Jennings Bryan (1970) [combined snippets]:

Readily, volubly, Bryan answered, and with considerable skill at improvisation he kept on with his fusillade against the tariff and its economy-ruining, people-degrading partisanship. The clustering standees began to sway a little with the compelling rhythms of his words. Once more, William Jennings Bryan was the sidewalk prophet, the bard of the courthouse steps, of the open wagon beds of Springdale, Springfield, Spring Valley, and Spring Hill, of Bald Knob, Nellie's Apron, Prairie Grove ...

From J.U. Peters, "The Los Angeles Anti-Myth," in Itinerary: Criticism: Essays on California Writers (1978):

Th religious cultism of Los Angeles is treated in tones ranging from the comic to the grotesque. Some authors, such as Waugh and Loos, choose to be deliberately ribald in their treatments of Southern California's commercial cemeteries or sidewalk prophets. They often portray naive believers, such as the witness in [Anita Loos's] No Mother to Guide Her who recounts in court his drug store revelation: "And then I got another shock! For sitting there at the soda fountain, plain as any picture I ever seen of her, and all covered with jewels, was the Magdalen, having a chocolate malted. And while I'm standing there gasping, the Twelve Apostles all trooped in and joined her for a Coke" (NMGH, p. 99).

Assessment
During the period 1890–1980, the term "sidewalk prophet[s]" seems to have been confined to the United States. The earliest matches for the term use it in a figurative sense to refer to people who claimed insight into matters of contemporaneous conjecture or speculation but who might be nothing more than rumor mongers or uninformed guessers themselves. The first five excerpts, ranging in publication date from 1890 to 1956,  presented above adhere to this pattern; but the last six excerpts, ranging from 1956 to 1979, present a very different sense of the term—that of inspired (or demented) religious (or quasi-religious) proselytizers preaching to passers-by.
I can't tell whether "sidewalk prophet[s]" was ever an established slang term for "purveyor[s] of word on the street," but it doesn't seem to carry that meaning today. Instead, the expression seems to be synonymous with "street prophet[s]" or "street preacher[s]"—the last term being far more common than the other two, as this Ngram chart for the period 1800–2019 indicates:


Replication jobs are not getting created after failover

Question: I added distribution database to the alwaysOn group of dist1 and dist2 server. I setup replication for the database which are part of AAG and act as a publisher( node 1 and node2) and subscriber resides on node2. replication works fine when pub db gets failover from node 1 to node 2 or vice versa.
However, If i failover distribution database from DIST1 to DIS2 then changes are not getting replicated. There's a SQL agent job(monitor and sync replication jobs) that crates all replication related SQL agent jobs on new primary post-failover but it's not creating any of the replication jobs. I tried to run steps manually but it throws following error.
Error 22022: SQL agent job 'XXXXXXXXXXX' does not exist in cache.
I tried to recreate replication jobs manually on on new primary but it didn't help. What could be reason for jobs couldn't find in cache.
Answer: Issue is resolved. I restarted sql agent service and it fixed the issue


Magnetic flux and flow of electrons

Question: What does change in magnetic flux mean? How can you change magnetic flux? How does a change in magnetic flux influence a current of electrons (electricity)?
Answer: It means the magnetic lines of force are moving, or expanding and contracting,. Like when a transformer is changing its magnetic flux as the current with in it switches poles from negative to positive and back aka alternating current AC current, as in not DC current. When a conductor cuts a line of magnetic force it induces a voltage, whether by the moving of the conductor or moving of the flux, either or.
Answer: Magnetic flux is basically the surface integral of the normal component of the magnetic field passing through that particular surface. Or to explain more simply, taking the concept of magnetic field lines into consideration, it is the number of magnetic field lines passing through a given area of the surface, where magnetic field lines is a pseudo concept just taken into consideration for simplicity.

More the crowded the magnetic field lines more is the magnetic intensity in that particular area you consider.

A change in magnetic flux implies a change in the number of magnetic field lines passing through a given area.Saying more profoundly,a change in the result of the surface integral.
So,from the equation of magnetic flux(given in the above image) a change in magnetic flux can be gained either be changing the magnetic field through the given area or by changing the area of the given body or by changing the angle between the magnetic field and the area vector.

The change in magnetic flux through a coil inducing an emf across it can be explained as follows:
Comment: Questions.  So there is an induced EMF across points a and b.  Where a is positive and b is negative.  1.  Which direction is the actual current flowing through the wire, b to a or a to b?  2.  What is the direction of the actual current flow.  3.  Is this electron current flow or positive current flow?  4.  Does the induced EMF produce an induced (secondary?) current that opposes the actual current?  5.  If so, what is the direction of the induced current.  6.  Is this electron current flow or positive current flow?
Answer: All magnetic flux stems from movement of electric charge, so it makes sense that it can stimulate movement of electric charge. A permanent magnet has a certain magnetic field around it that is the result of an alignment of magnetic domains, which in turn arise from the spin alignment of a bunch of electrons. The term flux is defined as the amount of something going through an area. If you imagine a box near a magnet and imagine the field lines, see that some of them are going through your box (no matter how you oriented things that should be so because the field extends out infinitely). Now if you moved the box or the magnet in anyway and the amount of field density intersected by the area of the box changes, then you've "changed the flux" of the box, so if the box is actually a copper loop, then current should flow according to the laws deduced by Maxwell, Faraday, and others.

Magnetic flux and flow of electrons


Do cryptocurrency webminers in a blog violate adsense policies?

Question: JavaScript based webminers are used to mine cryoto currencies by using visitors computing power on several sites. Is that illegal? Do they violate adsense policies ? As of now according to adsense Terms and conditions I couldn't find anything specially pointing out cryoto mining. Anyone got further info?
Comment: As in: "Can you use both AdSense and a crypto currency miner script on the same site?"     I'm not sure about AdSense, but users don't appreciate sites that spike their CPU usage.
Answer: Google's Adsense policy does not touch upon Crypto Currency Browser miners directly but it is clear that either malware or anything else that interferes with site navigation is considered a breach of their terms of use, therefore webminer scripts are likely to breach their terms of use policy.

Site behaviour
Sites showing Google ads should be easy for users to navigate. Sites
  may not change user preferences, redirect users to unwanted websites,
  initiate downloads, include malware or contain pop-ups or pop-unders
  that interfere with site navigation.

Crypto Currency Browser miners are not Malware nor do they interfere with navigation...
At this point I would expect you to immediately stand up straight in your chair and want to throw out justifications that its neither malware nor will it interfere with site navigation but hear me out first!

Site Navigation

While its true that you could set the CPU time of the web miner to low so that users won't even notice a performance drop it should be dearly noted that a slow computer or one that becomes stressed becomes even more stressed and therefore site navigation could be affected due to the performance of the computer. Google could use this as a justification to terminate or suspend your account.

Malware

AVAST! has already classified Coin Hive webminer as Malware and as a result they have blocked the script running, a discussion about this can be found on Reddit. More will likely follow suit.
Malwarebytes has been blocking the original Coinhive API and related proxies an average of 8 million times per day, which added up to approximately 248 million blocks in a single month.
Google Chrome, the team at Google Chrome are already thinking of adding a block feature into their browser, you can find out more about this on bleepingcomputer.

Not Eco-friendly
While hardware manufacturers are constantly looking at ways of reducing energy consumption, web miners unnecessary directly increase the TDP of the CPU which in turn has a direct impact of power used and increases one's power unity bill, however this will likely run into a few pence depending on the settings of the web miner.
Stigma...
The problem that you face is the stigma of web miners, since they can set to aggressive they are unlikely never going to be accepted. The other issue is Google and Bing may see Web miners as direct competition vs their ad networks, because if websites can make money from Crypto, sites won't need ads.
Google and Bing alone can punish websites from using their adnetworks or worse, they can purposely apply a SEO penalty of those sites running them, ultimately the future of browser web mining is in the hands of Google, Bing and Anti Virus Software Applications.
My Opinion?
Not that it counts... any site that I visit that runs a crypto miner on my machine will join my ban list, hundreds of thousands of people and IT minded people are developing hardware and software solutions to block these scripts.
Most browser families already have dozens of add-ons that block them, sorry but there's a BIG difference than clicking an optional ad then a non-optional crypto miner.
I would however change my stance on this idea if webmasters had a 'opt in' option.
Comment: Ohkay. Thank you @simon , so basically its a bad idea to integrate a mining script to a website. I was just wondering if i could use a small percentage of clients cpu to get some hashes done.


tomcat8: 'free(): corrupted unsorted chunks'

Question: We upgraded from Ubuntu 16LTS to Ubuntu 18LTS a couple of days ago and since then have had Apache Tomcat crash completely twice (once per day, about 25 hrs apart). The java process stops running.
One line is added to the log file at this point:
free(): corrupted unsorted chunks

(that's it - no timestamp)
It doesn't seem to correlate to any particular action happening on the server at those times, at least it's hard to tell with only two instances, but my suspicion is it may have something to do with garbage collection.
That's because the server monitoring shows memory usage for the java process drop from 7.90GB to 0.93GB within a minute at that point (in actual fact the java process quits so it's possible that smaller amount is after I manually restarted tomcat). The server's max memory setting -Xmmx is set to 8GB and gradually before the crash it creeped up to just below that through the course of the day.
Furthermore, the very first lines of the tomcat log are
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

In /etc/default/tomcat8 I have the line
JAVA_OPTS="-Djava.awt.headless=true -Xmx8g -XX:+UseConcMarkSweepGC"

That UseConcMarkSweepGC option was added back on Ubuntu 16 where tomcat7 was used and I seem to remember it was recommended. In fact the config. file still says
'Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved response time)

Anyway I've now removed it in the hope that that was the issue. We will see if there's a crash tomorrow but in the meantime does that seem reasonable? Can anyone suggest any steps to validate this hypothesis or debug further, or any other ideas for what might be happening?
Comment: +UseConcMarkSweepGC wasn't the issue, it's still crashing (slightly less often), so I'm still looking for a solution!
Answer: In case anyone else has this issue, thanks to the helpful java-core-libs mailing list, I found the cause was the use of the APR/native libraries in Tomcat. Uninstalling these (apt-get remove libapr1) and removing configuration references from server.xml resolved the issue


moving row within a table on draw.io

Question: On draw.io, I am trying to move a row in a table, I grab the right hand equals sign on
the row to move, but when I move it to a new position the row snaps back
to its original position. I am using the online version on Windows 10
Answer: When a row is dropped to early, it could snap to original position. Check the following article: https://drawio-app.com/tables-in-drawio-got-a-makeover/ In order to move row 4 to another place, it was drag&dropped slightly over the first row and it became the 2nd row.
Hopefully the article will help.
Answer:
The equal like symbols, you hold them, and then you can reorder the rows in the tables.
For reordering columns, I checked and it's not yet a feature in draw.io, hopefully it will be a feature.
Comment: Your answer is already part of [the question](https://webapps.stackexchange.com/q/153522/).
Comment: @Blindspots As someone who just wanted to know "how to move a row from table in draw.io" (which is the title of the post), this helped me.
Answer: It's not really designed to work in this way. Just add a row, copy and paste the values, then delete the old row. 5 second job.
Draw.io works in objects. The object is a table in this scenario. It's not designed to move sub-objects (rows) from one object (table) to another object (table).
Draw.io is an awesome tool I used on a daily basis, but don't expect unicorns.

moving row within a table on draw.io


Issue with Gizmo Alignment on Bone Tail Selection in Blender Armature

Question:
Hello everyone,
I've encountered an issue in Blender while working with Armature, specifically when selecting Bone Tails. Despite setting the Gizmo's pivot point to 'Active Element', the Gizmos continue to align with the Bone Head instead of the selected Tail. I've made sure to select only the Tail part in Edit Mode, expecting the Gizmos to appear at the Tail's location for manipulation, but this hasn't been the case.
Here are the steps I've followed:
Switched to Edit Mode and selected the Bone Tail precisely.
Changed the Gizmo's pivot point setting to 'Active Element', hoping it would align the Gizmo with the selected Bone Tail.
Unfortunately, the Gizmo still aligns with the Bone Head, which is not what I'm aiming for. I want to be able to manipulate the bone from the Tail's position using the Gizmos centered on the Tail.
I'm using Blender version 4.0.2
Has anyone experienced this issue or can provide insight into what might be causing this? Any suggestions or workarounds would be greatly appreciated.
Thank you in advance for your help!
Answer: I've discovered that changing the pivot point from 'Active Element' to 'Median Point' unexpectedly resolved the issue.


What happens to non-cooperative shareholders when a company goes private?

Question: I own a few shares in some large publicly-traded US company. This company gets acquired and "goes private". Am I required to give up my shares in the acquisition? What if, for whatever reason, I don't want to cooperate? Are my shares still worth anything? Do I still get dividends? What is the law on this?
Comment: I doubt you're 'required' to do anything but any financial adviser worth much salt should be able to tell you whether to but, hold or sell.
Answer: You get to vote as a shareholder. If by bylaws a vote passes to go private, your shares will be included no matter how you personally voted. You'll get bought out. This is usually done automatically by the brokerage.
Comment: Yeah, in the US each state manages "lost property" accounts for its residents, so the money will probably be delivered to the state based on the last known residence address. Companies also have successors who can handle investor relations questions of this kind. May be a bit harder to track if there were a lot of mergers and acquisitions along the way.
Comment: For paper certificates you'd get instructions where to send them and would get a payment in return. I've done it once (had some paper shares in a startup that got acquired).
Comment: @littleadv: Is there any "permanent" clearinghouse for outstanding shares in the event that e.g. paper shares are held in a safe which, of course, has no means of responding to any such notices, and are found to be part of someone's estate decades later?
Comment: For curiosity, if you know, how was (still is?) that handled with shares on paper ?
Answer: I have some shares in this process at the moment, in the UK.  "Required" is the word the registrar used, as in I'll be required to sell assuming the vote goes the way it's expected to.  In practice that means I'll receive a cheque at some point, and won't have to do anything except pay it in.
My shares are held electronically, and they have all my details up to date so it's easy, and there are no certificates that I could refuse to send.
It's also handy for me, as I wanted to get rid of them anyway (but it wasn't worth the hassle of doing it since my online broker ceased to exist, and they're not worth much).
Answer: While the other answers are correct, they perhaps don't address the mechanism - i.e. answer the question "I owned 0.01% of this company - how can I suddenly own 0%?".
In most takeovers the target's shares are (at the end of the process) either 100% owned by the acquirer (an "acquisition") or are merged with those of the acquirer so they no longer exist (a true "merger").
Mergers are easier to understand: in general the corporate law of the jurisdiction provides that on a vote of the target's shareholders (normally by supermajority) the owners of the target's shares receive in substitution for those shares whatever is offered in the relevant offering document (normally cash or shares in the acquirer, but occasionally deferred consideration, loan notes or similar). In jurisdictions (eg England and Wales) which do not support "native" mergers, a similar effect can be achieved through a court sanctioned process (here a "scheme of arrangement") where a court will, after a vote and having determined the arrangement is fair, change the legal interest of the target's shareholders into something else (eg cash).
In an acquisition, things are more complicated. Often a "tender offer" is made first, whereby the acquirer makes an open offer for shares in the acquirer. At some point by corporate law or by the rules of the market on which the shares are listed, they are forced to make an offer for all the shares, in order to protect the rights of minority shareholders (in a private company environment this is called a "tag along" provision). Equally once they have achieved a greater percentage of ownership, they can compulsorily purchase the remainder (in a private company environment called a "drag along" provision), i.e. treat a small minority as having accepted the offer. The mechanism to enforce this can vary between jurisdictions - for instance it can be a provision in the relevant statute law, or the listing rules of the market may require such provisions be incorporate into the company's articles of association or equivalent (i.e. the legal rules specific to that company on how it operates).
The net result is that ownership of shares in a company (especially one traded on a public market) does not give you unfettered ownership in that company - that ownership is subject to a set of rules "for the greater good" which are designed both to protect minority shareholders, but also stop them from being obstructive (eg holding a tiny minority of shares to prevent a full acquisition), with those rights being mediated by shareholder votes (often requiring supermajorities).
Comment: +1 this is a great explanation, thank you!
Answer: tl;dr -- In the U.S., each share becomes equivalent to a large final dividend amount (for valuation purposes, but not for tax purposes).
In the United States, here is a common scenario for how a company that goes private treats non-cooperative shareholders:

The deal is approved by the board.
The deal is approved by shareholder vote.
If needed, any government approvals are obtained.
The deal closes.  Often this involves all of the company's assets being given to the now private company, in exchange for cash equivalents, bonds, and/or stock.
Cooperating shareholders receive their promised payment (in cash equivalents, bonds, and/or stock) in exchange for their shares.  In some cases, the promised payment is broken out into a final dividend and a residual purchase amount.
Non-cooperating shareholders may keep their shares but not get paid yet.
Ordinary dividends cease.  (Especially if the formerly public company no longer owns an ongoing business to fund them.)
The newly private company's finance and accounting departments take over the jobs that were formerly handled by the formerly public company's finance and accounting departments.
The non-cooperating shareholders may sell, bequeathe, or assign their unredeemed shares in the formerly public company (subject to any applicable restrictions), but the shares are likely to stop being traded on exchanges after a very short time period.
Owners of such unredeemed shares may redeem their shares to the successor company (acting on behalf or in lieu of the former company).  Typically, the successor company will pay the deal's cash amount per share.  But other provisions might be made (as part of the deal) for what would have been bond or stock amounts per share.
Comment: @Jasper Thank you! I would have liked to do that too. It seems like a good career.
Comment: This seems to contradict @littleadv's answer
Comment: This is wrong. Shares do not become "final dividend amount". Dividends are very specific types of payment with specific treatment for both the payer and the receiver, and buyout is not that. It is also not true that the owners of the shares may freely trade them - that depends on the company charter and bylaws, and the conditions of the sale.
Comment: Jasper could we have a source for your answer please?
Comment: @EllieKesselman -- I worked in the accounting and financial reporting departments of a Fortune 500 company that went private.  I have also worked for another Fortune 500 company that was parted out in several complicated transactions.


Installing guide of nginx 1.2 and php 5.4 on Centos?

Question: I have been searching this for a while, but fail to find an up-to-date guide of installing the newest version of nginx and php on a centos system. Any help is appreciated. Thanks!
Answer: It's pretty straight forward.
Add the repo for nginx, yum install nginx
Then install php, php-cli, spawn-fcgi or php-fpm (there might be one or two other you need to do, but google will have them).
Then just configure nginx to use fcgi for the php and you are good to go.
I did this just last week and it was pretty painless.  I dont have the links handy though, but I just googled and had luck.
Answer: Install php, php-cli, nginx and spawn-fcgi from your repository.  I did this a little while ago on a Debian based server.  I used these instructions that are specific to Ubuntu, but gave me enough information to get up and running.
After some quick searching I found instructions specific to CentOS as well.


Changing Summation to Integral

Question: This is the text from Reif Statistical mechanics. In the screenshot he changes the summation to integral(Eq. 1.5.17) by saying that they are approximately continuous values. However, I don't see how. Can anyone justify this change?
Comment: What is the context? What does $W$, $n_1$ means and why do we sum? I guess that in general, if you approximate a summation variable as being quasicontinuous, you can always approximate by an integral.
Comment: Here W(n) refers to probability of given problem(The random walk by drunken man). My question is how can you approximate the quasicontinuous variables which is W above by integrals? Can you justify it?
Comment: Well usually one does this by saying that the $n_1$ are "really close to each other" such that changing the summation by an integral introduces a negligible error. It's an approximation, thus it's justified depending on how large would you allow the error to be.
Comment: I will apply mean value theorem. If we apply this I get $W_{n}\delta{n}$. Now,how do I tell that this and above sum yield approximately same result?
Answer: I think Reif was being sloppy there. I don't have the book handy but that seems to be the case. A passage from discrete to continuous would go something like this:
Say we're talking about the normalization of a probability mass function:
$$ 1= \sum_{n=0}^N W(n) \,. $$
You first note that $n$ is a counting number, so its increments are by 1. Namely, ${\rm d}n = 1$. So you can just insert one:
$$ 1 = \sum_{n=0}^N {\rm d}n W(n) \,.$$
Then for some reason, you might be interested in the variable $r=n/N$. The ratio of rightward steps or something. You rewrite:
$$ 1 = \sum_{n=0}^N \frac{{\rm d}n} {N} N W(n) \,.$$
Now you realize that as $N\to\infty$, the quantity ${\rm d}n/N$ approaches an  infinitesimal ${\rm d}r$ . Now, thanks to the infinitesimal element, the summation looks like a Riemann sum, allowing the passage to an integral
$$ 1= \sum_{n=0}^N \frac{{\rm d}n} {N} N W(n) \to \int_0^\infty {\rm d} r \, N W(Nr) =1 \,.$$
Then, one proclaims that a new function, say, $P(r)$ has to be the probability density for the continuous variable $r=n/N$ such that $$P(r) = N W(N r) \,.$$
From what I can see, Reif's treatment is not emphasising that the new variable is proportional to $1/N$, and also failing to identify that the probability density of the new variable is not the same $(W)$ as that of the old variable, even though they are very closely connected (equation above).
Comment: You're welcome @Abhi7731756. If the answer was not only helpful but it actually did the trick for you, please don't neglect _accepting_ the answer :-) If not, don't do it of course.

Changing Summation to Integral


Raspberry pi 3 A+

Question: The Raspberry Pi 3 A+ ,I think is memory-constrained,in that Chromium does not work well. I wanted to code Scratch 3 on it as Scratch 2 is only available offline. Using the web seems off limits and so does Sonic Pi even offline. Thonny for Python is usable offline . Is there any way around this issue?. Would using some type of adaptor work e.g. Pimorono. Also, I presume it is more suited to hardware projects similar to Pi zero projects,am I right? I downloaded Raspbian via Noobs onto 16 Gb micro-sd card initially.
Comment: Why don't you buy a Pi4 4GB?
Comment: Because I just got this one and I presume it will work for some purpose
Comment: It will work fine for anything that does not require lots of memory. Looks like you've had loads of suggestions on the Pi forum https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=254791
Comment: Ahh! I know but it all sounds gobbledygook. I am amazed someone can track that!
Answer: If you read the Foundation documentation you will see that Scratch 3 ONLY works on a Pi4 (or earlier model with 1GB RAM, but operation is marginal).
The Pi3A+ has the same memory 500MB as the earlier single CPU Pi models with a 4 core processor. It is an extremely capable machine - the only limitation is the number of simultaneous tasks.
You can certainly install Scratch 2 (which should be included in the full download).
DO NOT use NOOBS, install Raspbian.

Raspberry pi 3 A+


Template for product-category page

Question: Where can I find the template that is used for the product-category page?
The general template is "page-full.php".
But where is the template for the single-product page (single.php?) and the product-category page? I'd like to edit them to show elements that are not visible on other pages and vice versa.
Much appreciated.
Comment: Take a look at the WooCommerce documentation about their template structure.
Answer: Your theme doesn't necessarily include all these template files.
It might just use index.php to serve the single page template as well as listings (category, date, author, tag, etc).
The articles Theme Development and Template Hierarchy from the codex should get you on the right road with theme development.
If you add a single.php file, WP will use that instead of index.php for example.
'product-category.php' (as @ialocin rightly says) is almost certainly a WooCommerce template file and the way you override that is different. They have good docs: http://docs.woothemes.com/document/template-structure/
The general principle is the same - you override the default template (index.php) with successively more-specific templates.
Comment: Thank you for the quick response. So I essentially have to copy the existing page template and edit it. So I have to rename it "product-category.php"?
Or rather. Where do I add the link for the additional template file?
Comment: Like I said in my comment under your question, take a look at the WC documentation about their template structure and how to override templates. Because it differs a bit from the WP standard. @theHubi
Comment: I've skimmed through the text and get the basic concept. There's always a main file and a "substitute" file, if the first one does not exist. So essentially adding a "product-category.php" adds it automatically to that system?
Comment: OP - answer edited above, @ialocin totally right of course.

Template for product-category page


How should I cite the ministry in my own country in APA?

Question: In my research paper, I have cite from a curriculum published by the Ministry of Education in my country. Should I cite the name of the ministry in my own language (i.e. Milli Eğitim Bakanlığı; MEB as abbreviated in subsequent citations) in Turkish or in English translation (as Ministry of National Education; like MoNE, 2020)? And how should I reference it at the end in the sources section?
Comment: Everyone please note that the APA has a *very* strict style that goes to ludicrous lengths in specifying every dot and tittle. (I am unaware of other organizations' styles that have [their own website](https://apastyle.apa.org/) and [a *style* blog](https://apastyle.apa.org/blog). The APA Publication Manual, 7th ed., has 428 pages.) Since the OP asks specifically about APA style, answers based on common sense without reference to the APA's style guidelines will probably be misleading.
Answer: The standard in APA when citing something titled in a language other than the one you are writing is to use the original title (transliterated to the Latin alphabet if necessary) but to also include a translation enclosed with [ ]s.
For an example from the link below:
https://blog.apastyle.org/apastyle/2018/09/how-to-quote-a-foreign-language-source-and-its-translation.html

Bussières, E.-L., St-Germain, A., Dubé, M., & Richard, M.-C. (2017). Efficacité et efficience des programmes de transition à la vie adulte: Une revue systématique [Effectiveness and efficiency of adult transition programs: A systematic review]. Canadian Psychology/Psychologie canadienne, 58, 354–365. https://doi.org/10.1037/cap0000104

See also https://guides.library.uq.edu.au/referencing/apa6/works-in-non-English-languages and https://guides.library.uq.edu.au/referencing/apa6/works-in-non-English-scripts
Comment: @nick012000 In APA I think in-text citations are always author/date format, right? Is there an exception where the title of a reference would matter? I can't think of any citation style that uses the title in-text, but I may be missing something outside my area.
Comment: @nick012000 Ah sorry, now I follow you. I can't find specific APA guidance on that circumstance with an institutional author but in examples from less authoritative APA reference guides it seems the institutional author is used as-is (transliterated but not translated).
Comment: What about in-text citations?
Comment: Yes, author/date, but what about when the author is an organization whose name isn't in English? For instance, when you do an in-text citation for something written by Google in 2019, you'd cite it in-text as "(Google, 2019)".
Answer: If the rest of your paper is in English and aimed at an international audience, it's more helpful to cite it in English translation. You might even want to write "Turkish Ministry of National Education", to make it clear which country's ministry you're referring to.
Comment: [Sorry to ask, but is your answer based on common sense or on the APA style?](https://academia.stackexchange.com/questions/161785/how-should-i-cite-the-ministry-in-my-own-country-in-apa#comment434822_161785) If the latter, can you cite the specific section in the APA publication manual you are referring to?
Comment: In principle I do agree with you. But APA style thinks differently. There is pretty much zero allowance to "look beyond strict adherence to rules to *why* you're citing things" in the APA Publication Manual. I'm not saying this is the way things should be, but in a question that explicitly asks about APA style, it would be good to clearly indicate which part of an answer is based on common sense, and which part is grounded in the APA Publication Manual.
Comment: I was just going off common sense. If you want to reach an international audience, you need the translation (possibly in addition to the original Turkish). That's regardless of which specific citation style you're using. You need to look beyond strict adherence to rules to *why* you're citing things - so that people can understand what your sources are.
Answer: Both. If the legal/official name is X, then you certainly want X appearing, for example as a searchable item, whether or not it's in English or whatever. At the same time, yes, you probably want to give an explanatory translation (e.g., into English), for what the official title/name/label means.
Comment: [Sorry to ask, but is your answer based on common sense or on the APA style?](https://academia.stackexchange.com/questions/161785/how-should-i-cite-the-ministry-in-my-own-country-in-apa#comment434822_161785) If the latter, can you cite the specific section in the APA publication manual you are referring to?
Comment: @StephanKolassa, based on common sense, yes, or utilitarian criteria. Not on any official "style rules".
Comment: Thank you! [Here is my answer to ObscureOwl, which would also apply here.](https://academia.stackexchange.com/questions/161785/how-should-i-cite-the-ministry-in-my-own-country-in-apa/161806?noredirect=1#comment434836_161792) Unfortunately, common sense/utilitarian criteria have a small intersection with the APA style.


Why do we use rt.jar in a java project?

Question: What is the necessity of rt.jar ??
Answer: It contains all the classes provided in the Java Runtime Environment.
If you don't have it on your classpath you will not have access to any of those classes you need to use like java.lang.String or java.io.File.
Answer: rt = Run Time
It contains all the java runtime libraries. (Essential)
Answer: Cross compilation is one case where you have to explicitly use it.
E.g., if you are on Java 8, and want to compile Java 7 while rejecting Java 8 extensions. So you could try:
javac -source 1.7 Main.java

But then javac will say: warning: [options] bootstrap class path not set in conjunction with -source 1.7, because it might generate error co compile against a different version of the JCL.
So you would need to set rt.jar with:
javac -source 1.7 -bootclasspath /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar Main.java

This was asked at: warning: [options] bootstrap class path not set in conjunction with -source 1.5
Answer: rt.jar stands for runtime JAR and contains the bootstrap classes, I mean all the classes from Core Java API. I have found that many Java programmer doesn't know what is rt.jar? and often confused with the role of rt.jar file or  why we use of rt.jar file in Java? No surprise, the name is little bit cryptic.
This file always reside inside lib directory of JRE, at least in Windows and Linux. In MacOSX it reside at different location and also has different name i.e. classes.jar, but that is only prior to JDK 1.7. From Java 7 release Apple has stopped distributing Java and if you separately install, it will have same name as rt.jar.
Many developer thinks to include their classes inside rt.jar to solve classpath related problems, but that is a bad idea. You should never be messing with rt.jar, it contains class files which is trusted by JVM and loaded without stringent security check it does for other class files.
Answer: It contains the Java built-in classes. rt maybe stands for Runtime. Without it you couldn't run Java programs:)
Answer: The rt.jar is where all the java packages reside.  For example, if a class file calls for the java.util package, then the JVM can look for it inside the rt.jar, thus enabling it to run correctly.
On a side note: Don't mess around with it.
Answer: It contains all the standard JDK classes. During the  process of class loading in JVM, this is the first one to  get loaded and is done by the bootstrap class loader, parent of all class loaders.
You  can check it yourself by compiling a java program with this option:
javac -verbose program.java

in  order to  see the sequence of the class loaded.
Sample:
[Loaded sun.security.timestamp.TimestampToken from /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar]
[Loaded sun.security.util.CertConstraintParameters from /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar]
[Loaded sun.security.util.ECKeySizeParameterSpec from /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar]
[Loaded sun.security.util.ECUtil from /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar]
[Loaded sun.security.util.Pem from /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar]

Comment: @brntsllvn I have edited the answer. It should just be java -verbose (https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html)
Comment: When I run `javac -verbose:class program.java`, I get `javac: invalid flag: -verbose:class`...should it be `javac -verbose program.java` or am I missing something? Thx.
Answer: The runtime (rt.jar) holds all the (most of the..) java classes that form the Java SE. It is added to the classpath automatically.

Why do we use rt.jar in a java project?


Did Catholic Church alter the Nicene creed?

Question: When was the Filioque clause added to the creed and what is the reason for that? Did the eastern fathers believe in the filioque?
Comment: Related: https://christianity.stackexchange.com/questions/92000/why-according-to-the-catholic-church-does-the-filioque-not-violate-the-council
Answer: First, to clarify: The Filioque refers to the Latin phrase "and the son," to describe the internal "economy" of the Trinity. It describes the Holy Spirit as proceeding from the Father and the Son, as opposed to from the Father only. The Council of Nicaea [325] required only that a believer stipulate "I believe in the Holy Spirit." The Council of Constantinople [381] described the Holy Spirit as "proceeding from the Father."
The answer to the question "When was the Filioque clause added to the creed?" depends on whether one is speaking of individual church fathers, local churches, papal usage, Catholic liturgy, or ecumenical councils. Several Western Fathers used the clause prior to 381. The Council of Seleucia-Ctesiphon in Persia [c. 410] reportedly used it as well. However, most Eastern churches and teachers abided by the ruling of 381, insisting that only another ecumenical council could change it.
In the 9th century, Pope Leo III used the Filioque, stating that "the Holy Spirit is Complete God begotten of the Father and the Son." It was also endorsed by the Council of Aachen in 809 convened by Charlemagne and governing the practice of the churches under his sovereignty. However, this usage offended Eastern churchmen, who considered the Filioque to violate the teaching of the ecumenical council of 381. The issue became a major international controversy when Patriarch Photius of Constantinopol accused the western church of heresy for using it and attempted to effectively ban its use. In 867 one of several councils held under Photius' leadership excommunicated Pope Nicholas I for using the Filoque and declared the teaching anathema.
The Filioque became a formal part of the Latin rite in Rome in 1014 under Pope Benedict VIII. The issue became the crucial theological question of the East-West Schism
The Filioque clause was generally rejected by the Eastern fathers, especially after 381. The year 1014 is a good a date as any to understand when it became part of Catholic tradition, although Leo III's endorsement in the early 9th century is also a candidate.
Comment: So is your answer "yes, the Catholic Church changed the Nicene Creed"?
Comment: The question was "When was the Filioque clause added to the creed?" But I certainly think that the RCC added it, since it's not in the original. This is technically not quite the same as changing it. The Nicene Creed is still the creed of 325. What the RCC recites is usually called the Apostles Creed. Let me say that in recent years there have has been progress between Catholic and Orthodox leaders about this, in the sense that they no longer condemn each other on account of it.
Comment: This is a very studious answer, +1
Comment: @SupportiveDante sorry for the delay in responding. The Nicene Creed is still the Nicene Creed. But yes the RCC added the filioque. Previously, in 381 Council of Constantinople added something when it described the HS as "proceeding from the Father." The Nicene Creed doesn't speak of the HS as "proceeding"... only that "I believe in the Holy Spirit."
Answer: Going to add onto @Dan Fefferman's comment from November 22, 2022 at 21:33.
Yes the East added to the creed in 381, there was no rule against councils doing this, and this first council of constantinople became the second ecumenical council, everyone accepted the change. Then, the third ecumenical council, the council of ephesus in 431 stated that nobody can alter the creed. Everyone agreed to this third ecumenical council.
So in short, the East got upset because everyone agreed via the third ecumenical council not to alter the creed. The only thing that could allow for a change in the creed would be another ecumenical council, which never came because for a council to be ecumenical it has to be universally accepted and the East rejected the western alterations to the creed.
Comment: Welcome to Christianity.SE! and thank you for your contribution. When you get a chance, please take the [tour] to understand how the site works and [how it is different than others](https://christianity.meta.stackexchange.com/a/1809/50259). I would also recommend reading the [Help Center's](https://christianity.stackexchange.com/help) sections on asking and answering questions.


Custom Authentication, Authorization, and Roles implementation

Question: I've got an MVC site, using FormsAuthentication and custom service classes for Authentication, Authorization, Roles/Membership, etc.
Authentication
There are three ways to sign-on:

Email + Alias
OpenID
Username + Password

All three get the user an auth cookie and start a session. The first two are used by visitors (session only) and the third for authors/admin with DB accounts.
public class BaseFormsAuthenticationService : IAuthenticationService
{
    // Disperse auth cookie and store user session info.
    public virtual void SignIn(UserBase user, bool persistentCookie)
    {
        var vmUser = new UserSessionInfoViewModel { Email = user.Email, Name = user.Name, Url = user.Url, Gravatar = user.Gravatar };

        if(user.GetType() == typeof(User)) {
            // roles go into view model as string not enum, see Roles enum below.
            var rolesInt = ((User)user).Roles;
            var rolesEnum = (Roles)rolesInt;
            var rolesString = rolesEnum.ToString();
            var rolesStringList = rolesString.Split(',').Select(role => role.Trim()).ToList();
            vmUser.Roles = rolesStringList;
        }

        // i was serializing the user data and stuffing it in the auth cookie
        // but I'm simply going to use the Session[] items collection now, so
        // just ignore this variable and its inclusion in the cookie below.
        var userData = "";

        var ticket = new FormsAuthenticationTicket(1, user.Email, DateTime.UtcNow, DateTime.UtcNow.AddMinutes(30), false, userData, FormsAuthentication.FormsCookiePath);
        var encryptedTicket = FormsAuthentication.Encrypt(ticket);
        var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) { HttpOnly = true };
        HttpContext.Current.Response.Cookies.Add(authCookie);
        HttpContext.Current.Session["user"] = vmUser;
    }
}

Roles
A simple flags enum for permissions:
[Flags]
public enum Roles
{
    Guest = 0,
    Editor = 1,
    Author = 2,
    Administrator = 4
}

Enum extension to help enumerate flag enums:
public static class EnumExtensions
{
    private static void IsEnumWithFlags<T>()
    {
        if (!typeof(T).IsEnum)
            throw new ArgumentException(string.Format("Type '{0}' is not an enum", typeof (T).FullName));
        if (!Attribute.IsDefined(typeof(T), typeof(FlagsAttribute)))
            throw new ArgumentException(string.Format("Type '{0}' doesn't have the 'Flags' attribute", typeof(T).FullName));
    }

    public static IEnumerable<T> GetFlags<T>(this T value) where T : struct
    {
        IsEnumWithFlags<T>();
        return from flag in Enum.GetValues(typeof(T)).Cast<T>() let lValue = Convert.ToInt64(value) let lFlag = Convert.ToInt64(flag) where (lValue & lFlag) != 0 select flag;
    }
}

Authorization
Service offers methods for checking an authenticated user's roles.
public class AuthorizationService : IAuthorizationService
{
    // Convert role strings into a Roles enum flags using the additive "|" (OR) operand.
    public Roles AggregateRoles(IEnumerable<string> roles)
    {
        return roles.Aggregate(Roles.Guest, (current, role) => current | (Roles)Enum.Parse(typeof(Roles), role));
    }

    // Checks if a user's roles contains Administrator role.
    public bool IsAdministrator(Roles userRoles)
    {
        return userRoles.HasFlag(Roles.Administrator);
    }

    // Checks if user has ANY of the allowed role flags.
    public bool IsUserInAnyRoles(Roles userRoles, Roles allowedRoles)
    {
        var flags = allowedRoles.GetFlags();
        return flags.Any(flag => userRoles.HasFlag(flag));
    }

    // Checks if user has ALL required role flags.
    public bool IsUserInAllRoles(Roles userRoles, Roles requiredRoles)
    {
        return ((userRoles & requiredRoles) == requiredRoles);
    }

    // Validate authorization
    public bool IsAuthorized(UserSessionInfoViewModel user, Roles roles)
    {
        // convert comma delimited roles to enum flags, and check privileges.
        var userRoles = AggregateRoles(user.Roles);
        return IsAdministrator(userRoles) || IsUserInAnyRoles(userRoles, roles);
    }
}

I chose to use this in my controllers via an attribute:
public class AuthorizationFilter : IAuthorizationFilter
{
    private readonly IAuthorizationService _authorizationService;
    private readonly Roles _authorizedRoles;

    ///
    /// Constructor
    ///
    /// <remarks>The AuthorizedRolesAttribute is used on actions and designates the
    /// required roles. Using dependency injection we inject the service, as well
    /// as the attribute's constructor argument (Roles).</remarks>
    public AuthorizationFilter(IAuthorizationService authorizationService, Roles authorizedRoles)
    {
        _authorizationService = authorizationService;
        _authorizedRoles = authorizedRoles;
    }

    ///
    /// Uses injected authorization service to determine if the session user
    /// has necessary role privileges.
    ///
    /// <remarks>As authorization code runs at the action level, after the
    /// caching module, our authorization code is hooked into the caching
    /// mechanics, to ensure unauthorized users are not served up a
    /// prior-authorized page.
    /// Note: Special thanks to TheCloudlessSky on StackOverflow.
    /// </remarks>
    public void OnAuthorization(AuthorizationContext filterContext)
    {
        // User must be authenticated and Session not be null
        if (!filterContext.HttpContext.User.Identity.IsAuthenticated || filterContext.HttpContext.Session == null)
            HandleUnauthorizedRequest(filterContext);
        else {
            // if authorized, handle cache validation
            if (_authorizationService.IsAuthorized((UserSessionInfoViewModel)filterContext.HttpContext.Session["user"], _authorizedRoles)) {
                var cache = filterContext.HttpContext.Response.Cache;
                cache.SetProxyMaxAge(new TimeSpan(0));
                cache.AddValidationCallback((HttpContext context, object o, ref HttpValidationStatus status) => AuthorizeCache(context), null);
            }
            else
                HandleUnauthorizedRequest(filterContext);
        }
    }

I decorate Actions in my Controllers with this attribute, and like Microsoft's [Authorize] no params means let in anyone authenticated (for me it is Enum = 0, no required roles).
I am curious about the appropriateness of my setup:

Do I need to manually snag the auth cookie and populate the FormsIdentity principal for the HttpContext or should that be automatic?
Are there any issues with checking authentication within the attribute/filter OnAuthorization()?
What are tradeoffs in using Session[] to store my view model vs. serializing it within the auth cookie?
Does this solution seem to follow the 'separation of concerns' ideals well enough?
Answer: I'll take a stab at answering your questions and provide some suggestions:

If you have FormsAuthentication configured in web.config, it will automatically pull the cookie for you, so you shouldn't have to do any manual population of the FormsIdentity. This is pretty easy to test in any case.
You probably want to override both AuthorizeCore and OnAuthorization for an effective authorization attribute. The AuthorizeCore method returns a boolean and is used to determine whether the user has access to a given resource. The OnAuthorization doesn't return and is generally used to trigger other things based on the authentication status.
I think the session-vs-cookie question is largely preference, but I'd recommend going with the session for a few reasons. The biggest reason is that the cookie is transmitted with every request, and while right now you may only have a little bit of data in it, as time progresses who knows what you'll stuff in there. Add encryption overhead and it could get large enough to slow down requests. Storing it in the session also puts ownership of the data in your hands (versus putting it in the client's hands and relying on you to decrypt and use it). One suggestion I would make is wrapping that session access up in a static UserContext class, similar to HttpContext, so you could just make a call like UserContext.Current.UserData. I can provide some code for this if you need some suggestions. This approach will let you hide the implementation so you can change from session to cookie and back without affecting other code that uses it.
I can't really speak to whether it is a good separation of concerns, but it looks like a good solution to me. It's not unlike other MVC authentication approaches I've seen. I'm using something very similar in my apps in fact.

One last question -- why did you build and set the FormsAuthentication cookie manually instead of using FormsAuthentication.SetAuthCookie? Just curious.
Josh
Comment: Thanks for the review/answer. It's very helpful. This is a question I have going on StackOverflow (http://stackoverflow.com/questions/8567358/mvc-custom-authentication-authorization-and-roles-implementation) and been unhappy with the response. If you would, post your answer there and I'll give it to you. Also, if you would like to share your `UserContext` example for question #3 there too, that would be even more awesome. As for the cookie, it came before I used `Session[]` and I was setting it manually with a serialized encrypted ticket...'just leftover code.
Comment: I cross-posted this and added the `UserContext` code. Hope it helps.


How to create low-overhead file system

Question: I have usb keychain with size of 7.5GB and I need to copy file on it with size 7.4GB. But I can't because superblocks consume 0.5GB of space.
Comment: Do you need a file system? What about putting all the files in a tar archive and write that archive directly on the block device?
Comment: Does it *have* to be ext4 specifically? I'd probably try ext2: something like `mke2fs -t ext2 -N 64 -O sparse_super`. That said, I'm not sure you can get the filesystem overhead down quite as far as you'd need (to less than 1.3% of the device capacity).
Comment: I don't care about filesystem if it's able to handle files with size bigger that 4GB.
Comment: @Marco That's an interesting approach that is crazy enough that it just might work. You might want to make an answer out of that one, since it clearly addresses the OP's problem statement even though not the literal question.
Comment: @MichaelKjörling *"That's an interesting approach that is crazy enough that it just might work."* Nothing crazy about it. It used to be very common when saving stuff to tape.
Comment: @dmckee That was meant tongue-in-cheek.
Answer: You don't need a file system to write data to a device. You can simply use tar to create an archive that stores your directory structure and all meta data and write that to the device.
Writing data
Here sdb is an example of the USB drive on my system, adjust according to your setup.
tar cf /dev/sdb <some_directory>

Reading data
You can directly use tar to read the data from the device:
tar xf /dev/sdb

In my experiments this always reads the entire block device, not just the data in the tar archive. If you know that your device has 8 GiB but you only saved, say 3 GiB, you can use dd to avoid reading the entire device:
dd if=/dev/sdb bs=1M count=3072 | tar xf -

Side notes
Try to compress the data as much as possible. This might take a long time, but maybe everything fits on a drive with an ordinary filesystem. I would advice to use 7-Zip, it's slow but it has a high compression ratio. Here is an example:
7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z <some_directory>

Comment: It's compressed HD video, so another compression would be only waste of time. How can I write it without compression?
Comment: Just use `tar` like described in "Writing data" and "Reading data" and skip what I've written in "Side notes". Tar does not compress by default.
Comment: I'm gonna try it today. If it works i'll accept your question :)
Answer: Since you don't really need an ext4 file system but are really asking about a file system that will bring the overhead down below about 1.3% of the device capacity (100 MB out of 7.5 GB), I'd look at various low-overhead options. The two most obvious that meet your criteria of being able to handle a single 7.4 GB file is either ext2 with a low inode count and sparse superblocks, or a low-overhead FAT32 file system.
EDIT: It looks like I was wrong about FAT32's maximum file size, but I'm leaving it here in case someone comes across this and can live with the limitation that a single file cannot be larger than 2^32 - 1 (4 GiB - 1) bytes.
For a low-overhead ext2 file system, try something along the lines of mke2fs -t ext2 -N 8 -O sparse_super. The -N 8 specifies the number of inodes on the file system. I don't know how low this will go, so this knob may require a bit of twiddling.
For a low-overhead FAT32 file system, try something like mkdosfs -F 32 -f 1 -r 8 -S 32768 -s 128 -a. This will create a -F 32 FAT32 (which allows the file size you need), with -f 1 a single FAT, -r 8 8 root directory entries, -S 32768 a logical sector size of 32 KiB, -s 128 128 sectors per cluster (you might be able to increase this even further) and -a disable data structure alignment.
Comment: FAT32 won't work (he needs to copy files > 4 GB).
Comment: @Renan Good catch. I thought that increasing the logical sector size would get around that limitation, but it looks like it doesn't because of the 32-bit file byte size field.

How to create low-overhead file system


Positive definiteness of sample covariance matrix when $ N < p $

Question: Say I have a sample where $ N < p $, where $ N $ denotes the number of observations and $ p $ the number of variables. I know that the rank of the covariance matrix is then at most $ N $. I know that it is not positive definite since it is not invertible. However, I read from Wikipedia that a covariance matrix has to be at least positive semidefinite. Can I deduce positive semidefiniteness from here?
Answer: Yes, the sample covariance matrix will still be positive semi-definite.
To see this, note that if $X\in \mathbb{R}^{N\times p}$ is the data matrix (with observations in the rows and variables in the columns), then the sample covariance matrix is $C := \frac{1}{N-1}Y^TY\in \mathbb{R}^{p\times p}$, where $Y\in \mathbb{R}^{N\times p}$ is the matrix $X$ with each column's mean subtracted from that column's entries.
Note that $C$ is symmetric as $C^T = \left( \frac{1}{N-1}Y^TY\right)^T = \frac{1}{N-1}Y^TY=C$.
Also, for any $\mathbf{v}\in\mathbb{R}^{p}$, we have
$$\begin{align*}
\mathbf{v}^T C \mathbf{v}&= \frac{1}{N-1}\mathbf{v}^TY^TY\mathbf{v}\\
&=  \frac{1}{N-1} \left( Y\mathbf{v}\right)^T Y\mathbf{v}\\
&= \frac{1}{N-1}\left\| Y\mathbf{v}\right\|^{2}\\
&\ge 0.
\end{align*}
$$
Thus the sample covariance matrix $C$ is positive semi-definite.
Comment: So my question stems from an observation I had while working with a dataset. It considered the portfolio problem. I had some allocation for which the variance of the portfolio were negative. Indicating that the sample covariance matrix is rather indefinite.
Comment: That should not be possible in theory. I would try to double check the covariance matrix and check if it is positive semi-definite (which you could do by verifying that it is symmetric and its eigenvalues are all non-negative). Otherwise perhaps numerical or rounding errors are causing this.
Comment: You were right. The covariance matrix had some NAs due to non-overlapping values. These values were imputed. I assume that this is the reason for the negative eigenvalues.


Forex instead of futures as a hedge

Question: Why don't companies use forex trading as a hedge for their foreign exchange risk instead of futures ? Forex is much more liquid than futures,  easier to have access to all your positions anytime, customizable trades ?
Comment: Who says 'they' don't?
Comment: @Grade'Eh'Bacon I do; they actually use swaps but I wasn't going to mention them
Answer: The simple reason is that they don't need and can't use liquidity; they know when they expect their foreign currency denominated cashflows will fall (within a reasonable range of dates) so they buy futures with the intention of taking delivery at maturity. OK that's not entirely true because the futures normally deliver financially rather than as an FX trade but the maths shows that the outcome is equivalent.
One other key thing to consider is that the company wants to lock in the exchange rate in the future, at the time when the cashflow occurs, rather than the current exchange rate. It doesn't matter (much) whether that rate is better or worse than spot, it is the rate they need to make their exchange at.
So, what the companies are doing is hedging the exchange rate that their future cashflows will be exchanged at rather than hedging the exchange rate at the current time but there is another, linked, reason why they don't make the exchange at spot in the current period; they don't actually have the cash to do so right now. These future cashflows have not been realised yet so they literally don't have the cash to spare now to convert to or from a different currency to complete the trade that you are suggesting. They will only have the cash available at the date when the exchange needs to be done so how can they use that cash in the current period?
Comment: @user71822 my point is that hedging is supposed to reduce risk where as trading with leverage *increases* risk.
Comment: But they don't need to use that full cash in the current period when trading forex. I mean if I buy $125,000 worth of currency with a 1:35 leverage, I have to deposit about $3550 to control a $125,000 position which is similar to futures where an initial margin maintenance $3550 will be required to be deposited in a margin account before opening a 125,000 Euro futures contract.
Comment: So what is the risk profile of that position and how can a company which is not an expert FX trading house mitigate that risk?

Forex instead of futures as a hedge


Meaning of "ride one's hobby"?

Question: I looked it up and think it's something to do with "hobbyhorse", and that it seems quite a popular expression in the early 19th Century,but English as my second language I have doubt with my own conclusion/findings.
Comment: Originally a *hobby* was a small-to-middling size horse, later extended to a wicker figure thereof (in morris dancing and such), and eventually the children's stick-toy. From which derives the most common sense today: *favourite occupation or topic, pursued merely for the amusement or interest that it affords, and which is compared to the riding of a toy horse* (OED).
Answer: The meaning of the phrase

ride one's hobby

depends on the context. The phrasing is archaic, rather than modern. Modern phrasing would be more likely to be something along the lines of

indulge, pursue, or occupy oneself with, a hobby.

So I will assume the meaning of the phrase you're asking about is one or more of the meanings that phrase might have had in the early 19th century.
Originally, and through the 19th century, 'ride a hobby' sometimes referred to riding one of a breed of small, agile, fast horses. These were the Irish Hobby horse. The breed is now extinct. Its closest living relatives are the contemporary Irish Connemara pony and the Irish Draught. Recent research (Maternal Heritage of the Thoroughbred, E. Hill, M. Bower 2010) has shown that the hobby horse contributed 61% of the modern thoroughbred's maternal genes; Arab and Oriental (non-Arab) mares contributed only 8% and 31% respectively.

(Public domain illustration depicting the Irish Hobby [charging down the hill at right]. Art Mór Mac Murchadha Caomhánach riding to meet the earl of Gloucester, as depicted in an illustration to Jean Creton's Histoire du roy d'Angleterre Richard II.)

(A Connemara Pony, descendent of the Irish Hobby. By Satu Pitkänen, GFDL, via Wikimedia Commons.)
The first, earliest meaning of 'hobby' that might fit with

ride one's hobby

is this, as reflected in the first (earliest) definition of 'hobby' in the OED, which supports the definition with quotes using the meaning through 1861:

A small or middle-sized horse; an ambling or pacing horse; a pony. Now Hist., arch., or dial.

Some sources give this sense of 'hobby' as the direct origin of the contemporary sense of 'hobby', via its reference to a pastime of Henry VIII:

Henry VIII greatly admired the "Irish Hobby" for its natural, ambling gait and comfortable ride. He began racing his own specially bred Hobbys against horses owned by others of the English nobility. By 1816, Henry's pastime would lead to the word "hobby" being entered in the dictionary with a new meaning: "a costly pastime indulged in by the idle rich."

(From "The Irish Hobby Horse", October 21, 2015, at a blog titled dermotmccabe. Emphasis mine.)
The OED Online definition of the modern sense of 'hobby' does not agree with that story of the entrance of 'hobby' into English:

A favourite occupation or topic, pursued merely for the amusement or interest that it affords, and which is compared to the riding of a toy horse (sense 3); an individual pursuit to which a person is devoted (in the speaker's opinion) out of proportion to its real importance. Formerly hobby-horse n. (sense Compounds 1).
1816   Scott Antiquary I. xi. 248,   I quarrel with no man's hobby.

In this sense, and in the quote given from 1816 supporting it, the modern meaning of hobby derives from the riding of toy hobby horses, rather than Henry VIII's indulgence.
Another possible sense of

ride one's hobby

derives from yet a third sense of 'hobby'. In addition to the contemporary sense of 'hobby', which was common in the early 19th Century, and the real horse called the 'hobby', also common, one could ride a velocipede called a 'hobby':

(Hobby Horse, about 1818. Smithsonian Institution, Negative #: 61-347.)
The image shows one found in the United States, believed to be of French origin, but the inventor of the velocipede was German. A British cartwright produced an improved version which became a short-lived fad in London, 1819:

(A lithograph depicting the son of the British cartwright who popularized the velocipede in 1819 riding one. From a public domain photo.)
This, then, is the third meaning that

ride one's hobby

might have had in the early 19th Century; that is, it could refer to an English dandy riding a velocipede, a 'hobby' as defined in the OED Online:

†4. A kind of velocipede, introduced in 1818, on which the rider propelled himself by pushing the ground with the point of each foot alternately ....

["hobby, n.1". OED Online. September 2015. Oxford University Press. http://www.oed.com/view/Entry/87460?rskey=cdtZ8E&result=1&isAdvanced=false (accessed December 03, 2015).]
Summary
The three possible meanings of "ride one's hobby" in the early 19th century were these:

ride a real horse called a hobby;
ride a toy horse or, figuratively, pursue an occupation or topic merely for amusement;
ride a velocipede.
Comment: Thanks! It's #2 – in a figurative sense. I'm rather curious why an expression like this just faded away later. If you do a search on Google Books, you can find a number of books published in the early 19 Century used this expression.
Comment: @Janef, you're welcome. Although the phrasing is archaic, it's still used now, and will be readily understood (in the figurative sense). I prefer "riding" to "working on", "indulging", etc. also, and don't hesitate to use "riding"--but then, I don't hesitate to appear the geek, either.

Meaning of "ride one's hobby"?


How many 6-digit numbers are there whose digits alternate between even and odd numbers?

Question: Just hoping to solve this question that asks how many 6-digit numbers there are, where each digit alternates between even and odd numbers? I know that you simply need to find the number of options each digit can hold but was unsure if I am supposed to add them up or multiply - given this is a mutually exclusive question. Thank you in advance!
Comment: Well, why not try it for $2$ digit numbers?  Those can easily be counted by hand and that should make it easy to check your methodology.  Note:  don't forget that $0$ is excluded as a first digit.
Comment: When counting, if your choice is dependent on the previous choice, you multiply. This is the rule of product. You have 5 even digit choices and 5 odd digit choices. Start by counting how many numbers are there starting with an even digit, then multiply the count by 2 to account for the analogous case of numbers starting with odd digit.
Comment: Make three-digit numbers with odds and also three-digit numbers with evens, choose from the two sets and interleave in two different ways.
Answer: There are nine choices for the first digit, and five choices for each of the other five digits. The answer is therefore $9 \cdot 5^5=28125$.
Answer: There are $3$ even digits and $5$ choices they each can be.  There are $3$ odd digits and $5$ choices they each can be.
You can start with either an even digit or an odd digit.
If you start with an odd digit it can not be $0$ so there are $4$ choices.
That's enough.
Do not read the next paragraph:

  I told you not to read this!  Don't read the next one either.

 $5^3\cdot 5^3 + 4\cdot 5^2\cdot 5^3$
Answer: Imagine that you picked an even number for your first digit. In order to pick from even, you had 4 choices available (2, 4, 6, 8), since 0 is not a valid way to start a number. So the amount of 6 digit numbers whos digits alternate between even and odd and who begin with an even number are:
$4\cdot$ (the rest of the of the choices)
Why do we multiply here? Because for any 5 digit combination xxxxx that you pick, you get 4 more possibilities: 2xxxxx, 4xxxxx, 6xxxxx and 8xxxxx. This is why we multiply when there is an "interdependency" or the order matters.
Anyways, since your first digit was even, the next digit must be odd. In that case you have only 5 choices (1, 3, 5, 7, or 9).
So, so far you have:
$4\cdot5\cdot$(the rest of the choices)
Why do we multiply by 5 here? Again, given any 4 digit choice xxxx, you have 5 new possibilities by letting the previous digit vary (1xxxx, 3xxxx, 5xxxx, 7xxxx, 9xxxx), and for each of those possibilities you have another 4 possibilities by letting the first digit vary (21xxxx, 41xxxx, 61xxxx, 81xxxx, etc.). I hope this helps make clear that we will be multiplying these all together.
Now, since you picked an odd number for your first digit, you must pick an even number for the second one. This gives you another 5 choices. Likewise, your next number must be odd again - another five choices. We continue in this manner until we end up with:
$4\cdot5\cdot5\cdot5\cdot5\cdot5$
But remember! This is just one possible case. You assumed you started with an even digit, which is how you started off with 4. But you could also have started with an odd digit. In that case you would have 5, not 4 choices, since all 5 odd digits are acceptable beginnings to a number.
By the same reasoning as before, you have 5 choices for the next even number, 5 choices for the next odd number, etc. So in the case where you start with an odd number, there are:
$5\cdot5\cdot5\cdot5\cdot5\cdot5$
possibilities.
So now we have the number of possibilities for these two cases. Here's the crux: Do we add them or multiply them together to get the final answer?
Earlier, we multiplied numbers together, because for each choice, we were able to generate more possibilities. But in this case, the two paths are independent of each other. I had to choose at the start to do one or the other - I don't get to somehow go down both paths. So, since these two values are not dependent on each other, we add them together.
$4\cdot5\cdot5\cdot5\cdot5\cdot5 + 5\cdot5\cdot5\cdot5\cdot5\cdot5$
$ = (4 + 5)\cdot(5\cdot5\cdot5\cdot5\cdot5)$
$ = 9\cdot5^5 = 28125$


Private files and Nginx configuration

Question: How to configure Drupal 7 to have private files folder. And also this configuration is secure within Nginx config.
Answer: To set up a private files folder, navigate to: Administration » Configuration » Media » File system.  Create a path from the Unix root for the "Private file system path" (e.g. <code>/var/files</code>) outside of the Drupal root.
Make sure that this folder is readable and writable by the web server user.
By having this folder outside of the Drupal root, it is secure.  It cannot be compromised through the web server.
Comment: Thanks for the answer. So can I use "/var/files" for the creation in Private file system path or there's a certain or exact config? Thanks again!
Comment: Yes, the gist of the answer is that you can use `/var/files` (or any *other* path that is outside of the Drupal root) as the private file system path.  There is no exact config , the path `/var/files` is just the one I happen to use myself.

Private files and Nginx configuration


how to deal with yokohama 215 45 r18 tier side wall damage

Question: I think the damage is this part, should i replace it?
Answer: If its a deep gash (looks like it is), just replace it.
Risking driving on a tire with a weak sidewall could cause a blow out when cornering, which is incredibly dangerous.
Comment: Agree here - there may be de-laminatibg occurring inside as well, so for your safety and others replace it. Sad about the cost....
Answer: As long as the metal wireframe under the rubber is not exposed I don't see a reason to replace the tire.
You will want to monitor tire pressure over the coming days and weeks though.


What are some characteristics of top quality research work in math?

Question: What are some characteristics of top quality research work in math? What do papers in top notch math journals have in common?
Comment: Good luck getting mathematicians to agree on what the top quality research work is.
Comment: As I write this there are two answers. One (mine) is more about how you _create_ great math. The other is how you might _recognize_ that an existing paper might be great math. Answers to quite different questions, actually.
Comment: Yes that's true. Well, publishing in Annals,JAMS and other top journals of that caliber certainly helps with social status in math. But not all the great good quality papers are published in those journals . Also not all papers in top journals that don't deal with open questions nor open a new theory. For instance, they give simple proofs for an already  known results. And typically those papers dont get cited as one expects
Answer: Since you ask about top quality research, I'll say some things about the extremes. Perhaps you can extrapolate a bit from the extremes to come to an understanding.
The first kind of superlative mathematical work is one that settles an old problem that many have worked on unsuccessfully in the past.
The second sort, though it may take a while to recognize it as such, is a paper that opens an entirely new field of mathematics. Sometimes the originator may not even recognize his/her work as a fundamental advance.
So, really good math papers are those that, perhaps, approach one of these extremes in some way. An old, settled, result proved with a new technique might be interesting if the new way of proving something lets others think in a new way about other problems.
Non mathematicians often think of mathematics as a bunch of facts. Early learners in mathematics think of it as proving theorems. But before you can have a statement of a theorem you need the insight to see what might be true and provable from what is already accepted. Some of those insights turn out to be valid, others not. But it isn't about the facts, nor about the proofs of the facts, but an exploration of what might also be true and provable. If you can do that, you are doing real mathematics.
Answer: In my opinion the main factor of a good  research paper is the high number of citations. It shows that the paper has been read and further developed by other mathematicians.
This is my true story. When I was near the end of my undergraduate and looking for a supervisor for my Phd study. At that time there was a guy, who advertised himself and by many other people, having high-profile publications. He had papers in Inventiones of Maths, Advances of Maths, Pacific Journal of Maths,... These are considered as high-quality journals for many mathematicians. However, there was one thing that bothered me at that time, no one cited his papers, except for himself.
I took me two years to figure out that all of his papers are false. Believe me or not. He worked on an area that was old and not many people are working on this. More importantly, his papers all contained mistakes, and be incurable. This is a good lesson for me. The first time I met him, I asked him some basic questions about distribution theory. It was easy for me  to reliaze that he is not sure about even some basic maths, which is standard for any analytics.
During my Phd, I had a good time to spend time reading other people's work. And I come to realize that so-called high-ranked journals might not be parallel with the quality of their papers.
Comment: It appears that perhaps you inadvertently left off the end of the story?


Weak convergence in a Hilbert Space

Question: What does it mean for a sequence $\{f_n\}_{n=1}^\infty\subseteq H$ to converge weakly? I know it means that it converges in the weak topology and I've read a few definitions of weak topology which all seemed quite confusing and it seems like I'm missing something important here.
Comment: Why don't you state what you know about weak convergence first?
Comment: Normally it means that you've given up on vector convergence. :)
Answer: In Banach space $X$ a sequence $\{f_n\}$ converges weakly to $f$ if
$$
\varphi(f_n)\to\varphi(f),
$$
for all $\varphi\in X^*$, where $X^*$ is the dual of $X$.
In the case of Hilbert space $H$, every element of the dual space is realized by an element
of $H$ (Riesz Representation Theorem). Thus $f_n\to f$ weakly if and only if
$$
\langle f_n,\varphi\rangle\to\langle f,\varphi\rangle,
$$
for all $\varphi\in H$.
Answer: Let $\{f_n\}_{n=1}^\infty$ be a sequence in $H$, and let $f\in H$. Then:

$f_n\to f$ in the weak topology if and  only if for all $\phi\in H^*$ one has the convergence $\phi(f_n)\to \phi(f)$ as $n\to \infty$.

Why is this? Let's first look at the direction ($\Rightarrow$). So we assume $f_n\to f$ in the weak topology, and want to prove $\phi(f_n)\to \phi(f)$.  To this end, let $U\subseteq \mathbb{R}$ (or $\mathbb{C}$, if you are working over the complex numbers) be a neighborhood of $\phi(f)$. By the definition of the weak topology, the linear map $\phi\colon H\to \mathbb{R}$ when $H$ is equipped with the weak topology; thus, in particular, $\phi^{-1}(U)$ is a weak open neighborhood of $f$ in $H$. Since $f_n\to f$ in the weak topology, it follows that $f_n\in \phi^{-1}(U)$ for all large enough $n$. Therefore $\phi(f_n)\in U$ for all large enough $n$. This proves that $\phi(f_n)\to \phi(f)$.
Now let's look at the direction ($\Leftarrow$). So we assume that $\phi(f_n)\to \phi(f)$ for all $\phi\in H^*$, and want to prove that $f_n\to f$ in the weak topology. To this end, let $V$ be a weak open neighborhood of $f$. Since the weak topology on $H$ has for a subbasis all sets of the form $\phi^{-1}(U)$ where $U\subseteq \mathbb{R}$ is open and $\phi\in H^*$, it follows that we can find a weak neighborhood $V'\subseteq V$ of $f$ of the form $$V' = \phi_1^{-1}(U_1)\cap \cdots\cap \phi_m^{-1}(U_m)$$ where $U_i\subseteq \mathbb{R}$ are open and $\phi_i\in H^*$. By our assumption, we know that $\phi_i(f_n)\to \phi_i(f)\in U_i$ for each $i$, and therefore $\phi_i(f_n)\in U_i$ for large enough $n$ for each $i = 1,\ldots, m$. That is to say, for large $n$, we have $f_n\in V'$. This proves that $f_n\to f$ in the weak topology.
I hope this answer was helpful, but since you haven't said what you know or exactly where you're confused, it might just be completely useless. In any case, if you have specific questions about any of the details here, please feel free to ask.

Edit: Just an extra remark. If $f_n\to f$ in the strong topology, then certainly $\phi(f_n)\to \phi(f)$ for every $\phi\in H^*$, since such $\phi$ are continuous, and thus $f_n\to f$ in the weak topology as well. The converse does not hold. For instance, if $\{e_n\}_{n=1}^\infty$ is any orthonormal basis in $H$, then the sequence $e_n$ converges weakly to $0$ (why?), but does not converge to $0$.

Weak convergence in a Hilbert Space


How to calculate the probability distribution function (PDF)?

Question: Sorry for the dumb question, I've been struggling with understanding the probability distribution function formula, what does "x" and "d" stand for in the formula
, and how to use the formula? I've searched for many sample problems and answers but just couldn't get how did they reach the results, as none gives any step-by-step solutions and instead gives the straight results. Could you show me a detailed process to solve a sample question to help me understand how to use this formula?
Thank you so much!!!
Answer: Glad to help you get out of notation heck.
First, you may be puzzled about what $f_X(x)$ means.  It is just the writer's way of saying "the probability distribution function for the random variable $X$, evaluated when $X$ is $x$.  Let's give an easy example:
Say that $X$ has a range of $0$ to $1$ and on that range, the pdf is $2x$.  That is, it is very unlikely that $x$ will be near to zero, where the pdf is very small, and the most likely values will be near to $1$.  In that case, we would say that $$f_x(x) = 2x$$
Now for the "d" in the formula -- actually, that is part of a math notation $dx$  which stands for a very tiny change in $x$.  If you have had some calculus experience, you will be familiar with notations like
$$
\int_a^b x^2 \, dx = \frac13 (b^3 - a^3)$$
If you have not had any differential calculus experience, you won't understand the notations used when talking about pdf's or cumulative distribution functions.
Finally, let's try to understand the whole equation.  It says that the probability that the variate $X$ is between $b$ and $a$ is given (in our example) by
$$ \int_a^b 2x \, dx $$
where that $2x$ is the pdf or $X$ at the point $x$.
This integral turns out to have value
$$\int_a^b 2x \, dx = (b^2-a^2)$$
And you can see that the probability that $0 \leq X \leq 1$ is $1^2 - 0^2 = 1$ which is comforting -- we knew $X$ had to be in that range.  What we can learn from this is that not every possible function is usable as a pdf; if we had chosen $f_X(x) = 3x$ instead, the "normalization" would be wrong, and that comforting property would not hold true.
As a meatier exercise, what would the probability that $X \leq \frac12$ be?
Well, $$\left( \frac12 \right)^2 - 0^2 = \frac{1}{4}$$
Comment: Thank you so much Mark for your patient explanation! I got the x and d now. :-) I do not, unfortunately, have any experience with calculus and that's the reason why I did not understand how to use the formula. I've gone through some video tutorials of calculus but unfortunately it's too broad and quite tough to catch. Could you kindly explain me why ∫ba 2xdx=(a2−b2)?
Answer: I want to add on to what Mark Fischler wrote, and it'll probably be too long for a comment, so it'll go in an answer.
It may interest you to know that another name for PDF is probability density function, and this alludes to a possibly useful way to think of the PDF.  One of the confounding aspects of continuous random variables (such as the amount of rainfall in a given year) as opposed to discrete random variables (such as the number of children in a family) is that the probability of them holding any precise value is, in the ideal case, zero.
For instance, what is the probability of the rainfall in Los Angeles in a given year being precisely $14$ inches?  And I mean, really, really precisely, as in $14.000000\ldots$ inches?  I think that if you insist on infinite precision, you will agree that the probability must be zero (or, at least, smaller than any positive value that you can name, which is effectively zero).
So what we do, instead, is give the density of the probability.  If we say that the probability density at $14$ inches of rain equals $0.1$ per inch, so to speak, then what we mean is that the probability that the rainfall lies within (let's say) a $2$-inch range centered on $14$ inches (i.e., $13$ to $15$ inches) is approximately $2$ inches, times $0.1$ per inch, or a probability of $0.2$.
It won't be exactly $0.2$, because the probability density is not a fixed value, but rather a function of the amount of rainfall, which is why it's called a PDF in the first place.  The density might be different when you're talking about a rainfall of $5$ inches, or of $50$ inches, and this variation is represented by making the density a function of a number of inches.  Suppose you were to call this function $f(x)$, and you plotted this function on a graph, with inches of rainfall along the $x$-axis, and probability density along the $y$-axis.  Then you drew vertical lines at $13$ and $15$ inches.  Those lines, and the function $f(x)$, and lastly the $x$-axis combine to "box in" an area.  That area represents the probability that the rainfall is somewhere between $13$ and $15$ inches!
Furthermore, if you were to measure the area between the PDF and the $x$-axis (what we often call the "area under the curve"), that area would add up to $1$, which is nothing more than the observation that the total rainfall must equal some value (between $0$ inches and infinite rainfall) with probability $1$—i.e., with complete certainty.
There is an operation in calculus that determines the area under the curve between two vertical lines, called integration.  We say that the integral of $f(x)$, from $x = 13$ to $15$ (inches), equals the probability that the rainfall is between $13$ and $15$ inches.  This is what that looks like, symbolically (using $X$ to denote rainfall):
$$
P(13 \leq X \leq 15) = \int_{x=13}^{15} f(x) \, dx
$$
That's all that says.  Sometimes, people will write $f_X(x)$, in place of $f(x)$, to emphasize that the function $f(x)$ is a PDF for the random variable $X$.  But either way, it is just a function that tells you how densely the probability of rainfall (or whatever you're talking about) is "packed" in the neighborhood of a given value.
Hope that helps.
Comment: Also, it sounds as though you haven't much (if any) experience with integration, if you're not familiar with the $dx$ notation.  I'm afraid that goes beyond the scope of this answer.  You'll have to find other resources to explain that.  But hopefully, this will tell you what the integral represents in this case, at the least.
Comment: Hi Brian, thank you so much for such detailed and patient explanation for a dumb like me! Feel crying when reading it! and thanks a lot for helping me out many times. Indeed I've no experience with calculus, integration or differentiation, I've watched some video tutorials about calculus and PDF and got an idea of the PDF now. Yet still no idea of the dx notation or how to compute. What I'm studying is not calculus and thus would go a bit too far to learn the whole thing, would you recommend any online resource that I can get a quick idea of the dx notation and the computation of the function?
Comment: This seemed like a relatively painless introduction: https://www.mathsisfun.com/calculus/introduction.html
Comment: At the bottom of the first page are links to differentiation and integration, which are the two fundamental and complementary operations of calculus.


struct ip_mreq disappears when compiling with -std=c99

Question: On some of our linux boxes compiling with gcc -std=c99 makes struct ip_mreq disappear (included from netinet/in.h)
Is there some other interface we are supposed to use ?
Comment: what do you mean with "dissappear"? Can you provide an actual compiler/linker error message?
Comment: using cpp i can see the struct is defined or not depending on the presence of -std=c99
Answer: Try --std=gnu99.
The default for GCC is '--std=gnu89' which means C89 with GNU extensions. By selecting '--std=c99' you are enabling C99, but disabling the GNU extensions. '--std=gnu99' will select both C99 and GNU extensions support, giving you the best of both worlds.
Comment: Or use `-std=c99 -D_GNU_SOURCE`
Answer: I am having the same problem. Everything compiles fine using gcc when I do not provide "-std=c99", but when the flag is included, the compiler fails saying that the field with type 'struct ip_mreq' "has incomplete type."
This is a problem since I am dependent on some C99 features.
Answer: I don't think there's another interface pre-c99. You may be able to use this with <code>-std=c99</code> if you add the following at the top of your source(s):
<code>#define __EXTENSIONS__
</code>
but a better way is probably
<code>#define _XOPEN_SOURCE
</code>
Please note that I haven't confirmed.