furnace high limit switch turning off burners

Question: I have a goodman furnace  model gcs90904cxa. All filters are brand new blower replaced last year new limit switch vents open in house exhaust and incoming air vents clean inducer motor free turning. Replaced flame sensor and thermostat everything starts up normal as it should no problems starting runs for about minutes then burners shut off and 4 beeps for high limit switch fan runs for about 3 minutes and it starts the cycle all over again every 5 minutes after that. Cannot find any air restriction. Also removed blower and cleaned top of secondary heat exchanger Was alot of dust build up. Am at a loss trying to figure out what is causing the high temps could the main heat exchanger be causing it or maybe an inducer motor is slowing down as it heats up had to replace that about 5 years ago?
Comment: It sounds like the blower is not moving enough air. Has it worked properly since it was changed? You can temporarily remove the filter and see if that helps.
Comment: make sure all your kids didn't close the vents in their rooms
Comment: the furnace worked perfectly all last season  i turned it off in the spring and just start it back up a week ago and all this started. I did a walkthrough of my house and opened every vent and made sure none where covered by furniture or anything.
Answer:
You should not have a big buildup of dust if all filters are in place. Is a filter missing? Your furnace manual says that some internal filters are not included. In any case, dust may be restricting airflow.

Why was the high limit replaced? The replacement may not be proper spec or it could be defective or could have failed early in its life. Suggest you measure the air temperature in the main duct to see if the high limit is tripping too soon. If you don't have a thermocouple probe, you can drill a small hole in the main duct and insert a meat thermometer. Repair hole with aluminum tape or caulking.

When the blower was replaced, did the tech set the correct blower speed to achieve the desired temperature rise? Perhaps not. If the blower is running too slowly to remove heat from the heat exchanger -- perhaps due to dust buildup -- you will exceed high limit.

This is the procedure in your manual:
Comment: ty will take a look in the next few days.


Sequential circuit modelling using structural verilog description

Question: I'm working on implementing cordic algorithm using structural verilog description and running it on FPGAs. I want to know a way to implement D-flipflops using structural descripton. Is there a pre-defined name that would implement a DFF just like and,or,nand gates?
Answer: Flip-flops and latches are usually implied in HDL synthesis from a behavioural description where a value needs to be stored either between clock edges (flip-flop) or dependant on some other value (latches). It is not really necessary to make them explicit.
If you are using modules to describe basic gates for a structural description these will be vendor specific and you will need to look at the documentation from you vendor to determine the correct names. There are many types of D-type flip-flops all of which might have a different name.
If it was me I wouldn't try and implement something like the CORDIC algorithm directly with a gate level structural description. I use a behavioural description appropriate for the synthesis tools to do most of the gate level work (such as implying registers) for you.


Package animate with android

Question: Could you please suggest to me a way to visualize on Android systems a PDF which contains animations realized with the animate package? I already tried with the Adobe Reader for Android, but it didn't work.
Thank you in advance!
Maurizio
Comment: Did you use the fullscreen/presentation mode?
Answer: animate-made animations rely on JavaScript. None of the known PDF readers on mobile platforms include a JavaScript engine. Therefore it is currently impossible to play this kind of animations on mobile devices.
Though I doubt it will help a lot, you could vote for a adding JavaScript on the Feature Request page of Acrobat Reader for Android:
https://acrobat.uservoice.com/forums/595576-acrobat-reader-for-android?query=javascript

Package animate with android


Water stream impact force

Question: Since I'm not a physics or math expert, I wanna ask how to calculate the actual force of water launched from a water cannon, and then for example compare it to the forces from a firehose. I know that I did not give any specific data but I assume that I need velocity of water, diameter of hose/nozzle, flow rate and probably something else.
Answer: There is kind of standard trick to solve this problem.
When you apply some force $F$ to a body for a period of time $t$ the momentum of this body will change by $Ft$.
Let's say we have a fire horse which produces a water stream. 1500 liters per minute, speed is $20 \text{m/s}$. (I am not sure these are specifications of some real fire fighting truck).
So, each second 1500 / 60 = 25 liters of water hit the target and stop. Mass of this water is $25 \;\text{kg}$. Speed: $20 \;\text{m/s}$. Change of momentum: $ \text{mass}\times\text{speed} = 500 \;\text{kg}\,\text{m}\,\text{s}^{-1}$ (this is the momentum of moving water, after water hits target is stops and it's momentum becomes 0). The force acting from the target on water (and from water on the target) is:
$$F \times 1 \;\text{s} = 500 \;\text{kg}\,\text{m}\,\text{s}^{-1} \\ F = 500 \;\text{kg}\,\text{m}\,\text{s}^{-2} = 500 \;\text{N}$$
This is about a weight of $50 \;\text{kg}$ object.

Water stream impact force


ROC and false positive rate with over sampling

Question: I'm modelling a rare event (say 1 in 10000) and I'm using an over sampled train set to cross validate and train my model. I'm using ROC as a global performance metric but there are business reasons for which I want to be able to communicate the false positive at a certain cutoff specified by our business folks (say 0.95).
Based on my over sampled train set my model produces an ROC of 0.97 (5 folds cross validation). If I look at the curve I can determine that the False Positive rate at cutoff 0.95 is 0.0003.
Give that, when I score a test set and take all observations with a probability of 0.95 or greater, can I state that on average 0.0003 of those will be false positives?
Or do I need to adjust 0.0003 to account for the true class distribution of my rare event?
Comment: You want to communicate the false positive rate, or the positive/negative predictive values? With rare events these will differ wildly.
Comment: I want to be able to communicate what the expected false positive rate is at a given cutoff (say, 0.95).
Answer: Given the strongly imbalanced dataset, avoid oversampling your dataset and focus on predicting correct probabilities.
In more detail: As with any classification task, we have to consider our utility function in terms of correct outcomes and choose the action that optimises the expected utility. More specifically, because we are dealing with a imbalanced dataset, using the AUC-ROC only is probably a bit short-sighted. Using AUC-RP and/or calibration curves to showcase the performance of the classifier is more relevant. A best case scenario would be using a proper scoring rule like the logarithmic scoring rule or Brier score so we convey a coherent idea of the classifier's performance. In that respect because you work with "business folks" try reporting to the MAE of the probability predictions. MAE is an improper scoring rule for probabilistic outcomes but pretty much everyone can relate to an "expected absolute error" irrespective of the Maths background (the "squared error" is  hard to explain to people who do not know the difference between variance and standard deviation already).
I would also recommend caution when it comes to oversampling the available data. This again can be relevant in some cases but realistically it changes the underlying distribution of our data. Given our model is well-calibrated (check the respective calibration curve), our classifier has no problem being relevant to another (unseen) sample of interest. In contrast the insights from a classifier trained on an over-/under-sampled training sample do not transfer to the general population and we have little control as to why the classifier might not generalise correctly as the new unseen sample of interest will have by definition a very different distribution for features to our (over-sampled) training set.


Leads not 'meeting goal' when converted

Question: I have a Journey that sends new Salesforce Leads emails in a sequence every two days, with the 'goal' being that the Leads will convert to Opportunities. I have about 110 Leads that have entered the Journey and I've seen at least three that noticed in Salesforce are converted, but are not showing up as counted toward the Journey goal, despite hitting a Wait or Decision Split activity after converting. I checked the setting of the goal and it is pulling the isConverted field from the Contact -> Salesforce Lead and the criteria is to 'equals TRUE'. Are there some other basic settings that I'm missing that I should check?
Answer: The challenge is that you are dealing with a "complex" scenario. What happens technically, upon conversion is that:

The lead is soft deleted in marketing cloud by the connector
A new contact is created in the marketing cloud
The original lead ID is added as an alternate key in alternate key store

This all assumes you are using SF Record ID's a subscriber keys throughout the system.
The issue, thus, is that the ID of the record that was introduced in the journey, might no longer be available in the contact grid, so we aren't pulling over the updates.
I would engage SF Support to ask how to properly track if a lead was converted in a journey, when Marketing Cloud is not the one who is converting.
Comment: Thanks Kenneth, that makes a lot of sense and I figured something like that was happening, and yes I'm using the 18 character Lead/Contact ID as the subscriber key in MC. I'll open a ticket with support.
Comment: Thanks ZackB - did the support solve this for you? :) If you found my answer solved it, please mark it as answered for the question to the benefit of others :) (and help mark the issue as resolved here) :)
Comment: Support said they are working on a feature to fix this, which will be pushed at some date in the future. Marking this solved.

Leads not 'meeting goal' when converted


How to Calculate weekly Turnover

Question: I am trying to calculate the weekly turnover of a portfolio consisting of 5 assets .The portfolio rebalances every week an I have calculated the weights and portfolio returns for each week. Is there a formula I can use in excel to calculate the weekly turnover? Or an easy way to calculate in  another program?
Comment: I aslo have negative weights in my portfolio which has to be taken into account
Answer: Min (purchases or sales) / portfolio market value
You would typically need quantity of shares held for each position so that you would be able to calculate the market value of purchases and sales.
Weights or market values would not work because they tend to be impacted by the performance of your holdings.
Quantity of shares are used because you will be able to compare current number of shares of asset A vs a week ago.
Comment: Thank you for your answer but how can I quantify my assets? One of my assets is an index and the other 2 are commodities. Should i start by investing a hypothetical amount in the portfolio lets say 1000?
Comment: Yes, that is a good way. Assume you start with initial equity 1000 USD (or other convenient amount). And do all calculations (dollar amounts, shares) to a high degree of precision.
Comment: Thank you very much
Comment: Index turnover is usually 0 except at times of rebalancing. So depending on what week your trying to measure index turnover, it may be 0%. As with the commodities, I am wondering how are you gaining exposure? Is it also via ETFs?

How to Calculate weekly Turnover


What can I do with Villagers?

Question: So there's these villagers (called TESTIFICATE?!) inhabiting my villages. Can I interact with them? What happens if I kill them?
Comment: What does "Post is related to a rapidly changing event" mean?
Comment: @fireDude67 I would assume it's because the version of Minecraft that the OP is talking about is 1.9 PreRelease. It's basically a beta of a beta, if that makes sense. Even though the villagers don't have a purpose yet, they most likely will in the near future.
Comment: Where is the Murder tag when you need it?
Answer: Villagers were introduced in the beta 1.9 pre-release, and, for the most part, act like passive mobs: they'll get up in your grill and walk around without a care in the world.  When you kill them, they don't drop anything.
In addition, 1.2 brought a number of changes to mob AI such as villagers:

entering houses at night and leave them in the morning
breeding to populate all the houses in a village
enabling the automatic creation of iron golems that protect them

The first new behavior—entering houses at night and leaving them in the morning—allows you to use villagers as a poor man's daylight detector.
Finally, as of snapshot 12w21a, villagers power Minecraft's economy by trading items with players.
Comment: The villagers themselves don't really do anything to defend themselves, do they?  The iron golems do the work.
Comment: @JohntheGreen You are correct: villagers don't defend themselves. Updated answer based on what was finally released (realized my previous comment was a bit unclear as to what I was denying).
Answer: They also pick up food, but different ones like or dislike different kinds of food.
Comment: Can you elaborate on this?
Answer: I have Played Minecraft for a few now, but ever since i started, i spawned a Villager Egg. To me it seems they:
At night, they go in any possible Home Nearby,
They are capable of climbing ladders, and walking up stairs
They run away from zombies,enderman, and spiders
Soon, when a new version comes out, they will be able to breed and have kids, that YOU can name.
They mainly eat Cake,but some are different.
Comment: They run away from only zombies, and do not eat cake. Get your facts right.

What can I do with Villagers?


What am I messing up

Question: <code>package Testsel3;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Classel3 {

public static void main(String[] args) {
    System.setProperty("webdriver.chrome.driver", "C:\\Users\\xyz's
Laptop\\Chromerdriver\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();

    driver.get("https://www.gmail.com");
    driver.manage().window().maximize();
    driver.findElement(By.id("identifierId")).sendKeys("firstname.lastname@example.com");

}

}
</code>
When I try to run the above script I get an error saying: Multiple markers at this line
- The method sendKeys(CharSequence...) from the type WebElement refers to the missing type CharSequence

The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
Answer: If you get the above error message in Eclipse IDE then you must be using Java version 8 java JDK 8. In JDK 8 the CharSequence Class have new default methods as compared to previous JDKs causing this issue.
Quick Fix Try this:

driver1.findElement(By.id("aa")).sendKeys(new String[] {"xx"});

so it does not use CharSequence, seems like you are using a newer JDK version than what Selenium that was compiled against. You could also try the following.

Right click on project go to java compiler settings and lower compliance level to 1.5
Download newer version of selenium jars.

What am I messing up


Mediation analysis doubt on standards proposed by preacher and hayes

Question: i have done mediation analysis according to the standards of preacher and hayes. My c' happens to be less than c with bootstrap at -.063 and no 0 in between the confidence intervals, but in the path c', the p value did not become non-significant. According to B&K this can be assumed as partial mediation, but what does preacher and hayes have to say for this? Does preacher and hayes support partial mediation? And citation will be much appreciated. Thank you.
Answer: Jokingly saying, you should ask Preacher and Hayes what they have to say :-) but afaik their steps are just a little bit better than Baron and Kenny, which happened to be heavily criticized and has been deemed outdated by many (eg. Is Baron and Kenny method for mediation now outdated? )
Preacher actually did a paper about partial mediation (but not only). Here is some interesting excerpts:

Importantly, we also extend past work on this topic by questioning the
  emphasis on the significance of c' after including the proposed
  mediator, as well as the use of terms such as 'full' versus 'partial'
  mediation.

Or this:

Abandon the emphasis on the significance of c and c'

Or this one:

These findings underscore the importance of avoiding the terms 'full'
  or 'partial' when describing mediation.

Rucker, D.D., Preacher, K.J., Tormala, Z.L., Petty, R.E., (2011)., Mediation Analysis in Social Psychology: Current
Practices and New Recommendations, Social and Personality Psychology Compass 5/6, 359–371, DOI: 10.1111/j.1751-9004.2011.00355.x
However, I'd like to draw your attention to another paper about whole this mediation story. It's titled 'Mediation myth' and it covers almost all aspects of today's mediation analysis. Nicely written, but with quite nasty (for us) conclusions:

The observation that ab is significant would be taken by many
  researchers as evidence for mediation.  But whether results of
  significance testing in mediation analysis generally have any
  meaningful interpretation is a critical question, one that is rarely
  considered in most mediation studies.

Rex B. Kline (2015). The Mediation Myth, Basic and Applied Social
Psychology, 37:4, 202-213, DOI: 10.1080/01973533.2015.1049349


Why capacitor value should be greater than gate capacitance of gate of NMOS in Bootstrap topology?

Question: In case of buck converter when NMOS is used as high side driver then bootstrap circuit is used to keep gate voltages higher. While designing that bootstrap circuit, the value of capacitor is recommended to be 10 time greater than capacitance of gate of transistor. What's the reason behind this?
Answer:
While designing that bootstrap circuit, the value of capacitor is recommended to be 10 time greater than capacitance of gate of transistor.

I didn't know if there's a rule of thumb like this, but the importance comes from the Q (charge), actually.
Here are some technical details:
The total charge held by the bootstrap capacitor is \$Q_B = C_B \cdot V_C\$. When the hi-side MOSFET turns on the total consumed charge is \$Q_T=Q_G + I_G \cdot D\cdot T_{SW}\$; where,

\$Q_G\$ is the gate charge
\$I_G\$ is the gate current (or total current drawn from the capacitor, a few nano-Amps)
\$D\$ is the duty cycle and \$T_{SW}\$ is the switching period (i.e. 1/fSW)

The charge \$Q_T\$ will be provided by \$C_B\$ itself, thus \$Q_B\$ should be sufficiently large. When the charge is consumed, the capacitor voltage should not drop significantly, or else the MOSFET can turn off due to insufficient \$V_{GS}\$. So, \$Q_T\leq C_B\cdot \Delta V_B\$ where \$\Delta V_B\$ is the voltage drop across the bootstrap capacitor.
A practical example:
Using this MOSFET (\$\mathrm{Q_G=18nC}\$) at \$\mathrm{f_{SW}=100kHz}\$ with a duty-cycle of 0.5. Let's assume that the maximum allowed voltage drop is \$\mathrm{\Delta V_B = 100mVDC}\$ and \$\mathrm{I_G=100nA}\$. So, \$\mathrm{C_B\geq (18nC+0.1\mu A \cdot 10\mu s\cdot0.5) \ /\ 0.1V\approx 18nC \ / \ 0.1V = 180nF}\$ which is 50+ times the gate capacitance. If more voltage drop is allowed then the required bootstrap capacitor can be lower. For example, for \$\mathrm{\Delta V_B = 500mVDC}\$ the bootstrap capacitor should be at least 36nF which is 10 times the input capacitance.

SUMMARY
I'm not sure if this can lead to a simplification like "CBOOT should be at least 10 times Ciss of the MOSFET". But sure it depends on the gate charge, actually. If you use buck converter ICs (i.e. the ICs having the MOSFET inside) you should always consider what the datasheet recommends.
Answer: To charge a MOSFET's gate capacitance up to a sufficient voltage to produce decent drain-source conduction (i.e. operate the MOSFET as a switch) requires the injection of current (as with any other capacitor): -
$$I = C\dfrac{dv}{dt}$$
The more current injected, the quicker will be the rise in gate-source voltage. Given that you want the gate-source voltage to rise pretty quickly when using the MOSFET as a switch in e.g. a buck converter, you are obliged to inject a decent amount of current.
But ultimately, you are stealing that current from the buck-converter output (that's what a bootstrap circuit does) AND you are stealing that current through the bootstrap capacitor AND, you don't want the voltage across the bootstrap capacitor to be much affected by the current hence, you design your bootstrap capacitor to be much bigger than the gate-source capacitance.
If the voltage across the bootstrap capacitor rose pretty quickly with the current you are stealing, then it leaves less headroom to produce a decent gate-source drive voltage to apply to the gate and the MOSFET would not adequately turn-on and you would lose power efficiency and the MOSFET would get hotter.
So, choosing a bootstrap capacitance of 10x the MOSFET gate-source capacitance is a rule of thumb - you can go more if you want and sometimes you can go a bit less.
Answer: Because the voltage in the bootstrap cap (any cap, actually) drops when you drain it, but you still need the voltage in the gate source cap to end up high enough to turn on the MOSFET. It drops less if it is bigger for the same charge taken from it.
If they were equal, for example you would need the bootstrap cap to start at double your required gate source voltage since it would be half the voltage by the time it charged the gate source cap (which would also probably be higher than what the gate oxide can withstand).


hip flexor stretch and popping sound

Question: I used to practice Taekwondo before, my hips would pop when I externally rotate my  hips after sitting for long and I assumed it was normal. No pain or snapping, just a pop like you might hear when you stretch yourself out after being a position for long. Now, I have starting working on my flexibility again. I have found the same popping has resumed after I started stretching hip flexors. Is this normal?
Comment: What I'm gradually getting to know from online resources is that if we find popping associated with increase in flexibility, it is a sign that flexibility and strength of muscles around the joint aren't in balance. Will see a PT soon...
Answer: Do not take medical advice from strangers on the Internet.
Please see a medical doctor or/and a physiotherapist.  If you have access to a physiotherapist that specialises in sport injuries, that would be good choice.
Answer: Go see a physiotherapist. Right away.
My wife, a dance teacher, showed the same symptoms and it turned out to be torn tendons. It needed to be corrected with minor surgery. Hopefully this is not your problem, but definitely get it looked at before it turns into something serious. If you're lucky, you just need a cortisone injection.

hip flexor stretch and popping sound


How to prevent duplicate records in salesforce using validation Rule?

Question: I want to prevent duplicate records of an object in Salesforce. I know how to do it by writing a trigger,but some one told me it can be possible by validation rule also.
Can anyone help me how to avoid duplicate records using validation rule ?
Comment: there is an idea exchange post for same https://success.salesforce.com/ideaView?id=08730000000BpwkAAC .  Can't you just use unique checkbox on field?
Answer: Salesforce implemented new functionality to spot the duplicate, using Matching rules and Duplicate rules.
You don't have to replicate the functionality with custom workflow rules, unique fields, triggers etc. Plus it has the ability to do fuzzy matching as well as exact matching.
Answer: You can also do it with a unique field and workflow rule ( field update ).


how to safely open files downloaded with tor?

Question: If I download a file (PDF,doc,image,video etc) with a tails/tor setup, how can I ensure the file doesn't "call home" or isnt imbedded with malware (other than looking at the hash)? Will a simple malware scan work? And if I use tails to open the files and disconnect from the network I'm using can I still have my anonymity compromised?
Comment: well theres a lot of tools to analyze these files..... too many to list. But you can put an application in a sandbox with `firejail`. You could open your pdf reader like `firejail xreader malware.pdf` and it would restrict the application with Linux namespaces
Comment: As said in one answer - it does not matter where you got this file from. Does this answer your question? [How to safely view a malicious PDF?](https://security.stackexchange.com/questions/18878/how-to-safely-view-a-malicious-pdf)
Answer: The fact that a file was downloaded with TOR doesn't really have much relevance to whether or not it's technically safe to open, except maybe that it might be "more likely" to be malware. If you're asking if opening the file will compromise your anonymity, then that depends on the filetype and your setup. Generally you can assume that unless you're using tails or a VM/Router that is proxying all traffic, anything that executes code as your local user is going to be able to "curl http://attacker-ip/3948291" and give you up that way. I wouldn't even be comfortable opening up a regular PDF/DOCX file because it'd be hard to be sure there wasn't some documented feature I'm unaware of where those file formats autoload external content, nevermind a zeroday.
More generally, don't trust antivirus scans to be anything except a second line of defense. Consumer AV software (and honestly most enterprise IDS software) is generally only able to catch simple variations of already logged malware, or very obviously (to a computer) malicious combinations of sys or library calls. You also shouldn't expect to be safe unplugging the computer while you open it unless you're sure that whatever code you executed won't start up again later.
Comment: Those are really great points, thank you! Can a file instigate a malware attack just by downloading or does it need to be opened first?  If so would downloading a file then rebooting a new instance of tails with no network connection be enough to assure there's isn't an attack? ( assuming the computer never contained a harddive and only tails usb), otherwise the malware must be stored on your ram right?? Is that even possible?
Comment: TAILS is designed to be amnesic; you're given a clean slate when you reboot tails, so unless it persisted on some external storage that you then reintroduced, you should be OK.

The problem with downloaded files isn't necessarily just code execution; if I can embed an image that is retrieved via hyperlink in that DOCX file, then I can just look on my server and see what IP connected to me, and now (if you didn't have TAILS or one of the other solutions I mentioned), I have your IP address.
Comment: Ok that makes sense, thank you for clarifying! What about if the file is downloaded to a usb drive then reopened on that drive when the network is offline (on a reboot of tails)? Additionally, waterhole attacks use similar malware correct? I read that the malware can be installed at a firmware level, is that true? If i fell victim to both a waterhole attack and an embedded malware attack by the same person is tails still going to keep my anonymity safe?
Comment: You would do better to learn more about where the security boundaries exist in these systems and their guarantees than to try to rote memorize the status of each scenario you can think of. Historically that tactic doesn't work very well.


How do I properly Shrinkwrap in a crease?

Question: I´m rather new to Blender and tried using the shrinkwrap modifier more, I can get it to work just fine on simple forms, but when there is a crease it always just makes a bridge as the closes vertices are not the ones in the crease.
Is it even possible to shrinkwrap in a way so that a crease is not bridged over? If so, what would the setup of the Shrinkwrap be?
Comment: try adding more geometry to the wrapper by using subdivison surface modifier.
also a screenshot of issue is more appreciated!
Answer: As Nand 27 says above, make sure you have at least enough geometry to work with on the source object.  I have a plane that I subdivided so that it's about a 24x24 grid.  Then, did you try different modes?  For example, this is using the "Nearest Surface" mode:

But this is using "Project" mode, which projects onto the surface:

As you can see, in this case, the "Project" nicely follows the shape of the indentation, whereas "Nearest Surface" had trouble finding the corner.


Why some TV shows like morning shows have no ending credits?

Question: I've been watching some morning shows like Good Morning America, Today and This Morning (USA) and noticed that none of them have crew ending credits, just opening credits with the anchors and daily guests. Is there a reason for that? Is it because they are considered a newscast and thereby they do not follow guilds' guidelines such as WGA and DGA?
Comment: Downvoters care to comment?  This seems like a reasonable, TV-oriented question to me.  I certainly don't know the answer and might be interested to learn it.
Comment: Sometimes the US network news programs run credits once a week, or extended versions of the credits once a month or once a year.   I believe the CBS evening news used to run longer credits on Friday night.  I recall one of the network news programs signing off at the end of the year with the anchor saying "... now let's show you a list of all the people who worked on this program in the last year," or something like that…
Comment: Whether they are "news" in the journalistic sense, they are definitely not scripted fiction. While I don't watch morning talk shows, I have seen a few in the past, and I wonder if there might be some credits hidden in there somewhere, at least for some of them.
Comment: The same is sometimes true of sports coverage.  I have no way to document or "back this up" - but I've personally noticed that news and sports will occasionally show ending credits.  I believe some news organizations may do this on certain holidays - though they may air in a different day segment than the morning show (air for news division as a whole).  An example in sports would be when the recent NFL season ended (or at least NBC's coverage ended); NBC ran lengthy credits identifying nearly everyone at NBC Sports.
Answer: Probably time-constraints
An article on NewscastStudio.com, Networks celebrate the holidays by paying tribute to their teams, gives a brief explanation about end-credits:

Some newscasts, stations and networks opt to run full credits New Year's Eve or New Year's Day.
Other newscasts will run full credits throughout the year either as time allows or on a predetermined frequency, such as once a week, though these are obviously without the holiday theme.


How to improve mathematics for Programming Contests?

Question: You might close this question or downvote it, but I can't stop myself from asking the experts of mathematics who solve thousands of math problems. I'm a C++/C programmer who wants to improve his coding skills. I learnt many algorithms and several concepts but I believe this is not sufficient. Moreover, in the last few months, I've competed in various coding competitions where I observed a strong relationship between programming and mathematics. People who are good in mathematics are able to solve problems more easily compared to others. I know that it is the mental capability of an individual which allows him to do things in a better way, but, in my opinion, hard work can fill that gap to some extent. I'm ready to do a lot of hard work to become a good programmer but I lack proper guidance. So I'm posting this question expecting someone to come and help me, by giving some advice and suggestions on how to improve my mathematics for coding competitions. What is the best way to do it and are there any good books that can help me?
Comment: I don't think that ability of doing math implies good programming skills. Both are implied by analytical thinking and that can definitely be improved by doing math. Most probably what you are observing is that people who are good at math, can also find the shortcuts quicker since they are relatively more exposed to the methods which allow to see analogies among conceptual structures.
Comment: @percusse : Then what should I do now ?
Comment: My personal opinion is that you first decide what is feeling right for you and what is not. Some visualize some write it down and plan. But as far as I know nobody became an expert without hard work and head scratching just because they know math or something else. Don't get me wrong, I think what you are trying to do is remarkable and tough but it takes a little bit of vision rather than building up the arsenal of knowledge. If you accept my humble advice, start reading [this](http://en.wikipedia.org/wiki/Literate_programming) and try to picture their point of view.
Comment: I don't know too much about it and I am an average programmer. But as you can see, things evolve and change as it has been with Java or any other new idea. Even Knuth himself tries to change the things once in a while . So why shouldn't not you? :)
Comment: @code_hacker:I can understand your problem and possibly relate myself to it,I also faced the same situation few months before, algorithmic programming is a different thing than pure mathematics,it is more in the applied sense.If your mathematics basics is okay, all you need to do practice hard in Topcoder arena and then reading the editorials! (contd)
Comment: For learning a new  topic,TC tutorials is a good choice but
if you find some tutorials a bit abstract,then you may like reading book [The Algorithm Design Manual](http://www.algorist.com/),However,most people like the traditional CLRS which is indeed a great book and doing the exercises will give you a lot.Good luck!
Comment: @percusse : I totally agree with you but right now what I'm struggling through is lack of that thinking ability,take for example,recently I posted some questions from some contests to discuss their approach.Can you suggest some good basic mathematics books which can help me to strengthen my basic theorems of mathematics(and more related to the application in computer science)?And Thanks for the advice,it was really great. :)
Comment: @FoolForMath : yeah TC tutorials are great,I always refer to them whenever I'm in trouble but I feel that questions asked in contests are more tough compared to those tutorial knowledge.I think good coders refer to other materials as well.What's your opinion?
Comment: @code_hacker:What is your definition of good?Anyways,TC contains such a large volume of problems so if you are comfortable with DIV 1 problems of most SRM's,I think you have a good chance in any contest.
Comment: @code_hacker : I already dared to say things outside my research scope. So all can give you is this [wonderful comparison applet](http://cg.scs.carleton.ca/~morin/misc/sortalg/). I strongly recommend you to understand what makes a sorting algorithm better. Make your own guess and see if it fits your intuition. That would kick you in the teeth immediately the more you read about the complexity ;)
Comment: @all : Thanks for your valuable advices. :)
Answer: I would divide the skills required for programming competitions as follows:

The ability to think abstractly.
The ability to employ well-known algorithms and algorithmic techniques.
Knowledge of previous competitions tasks.
Flexibility of point of view which allows to find easy implementations.
General problem solving techniques.

Skill (5) consists of ideas such as "backward reasoning" and "reversing a task" (these are not even specific to exact sciences).
Skill (4) is an art which is gained mostly by experience and also by looking at work done by other contestants.
Skill (3) is obviously a matter of experience.
Skill (2) is attained by thorough preparation including both solving problems and reading algorithms books.
Skill (1) is again an art, but this time it is an art which has much in common with other branches of mathematics.
Let me give you some examples from the latest International Olympiad in Informatics (IOI2011, http://www.ioi2011.or.th/tasks):
Task RICEHUB (relatively easy) requires an insight similar to task POST from IOI2000, which is an example of skill (3).
Task RACE (relatively hard) is mostly a matter of applying a known technique. The easiest way to solve this one is to try known techniques one after the other until you realize which one gives an efficient algorithm. I think it's very hard to solve this if you approach it any other way (I'm not giving details of the solution to avoid ruining it for you. There's a solution on the website). So this is an example of skill (2).
Task PARROT (relatively easy, but conceptually new in IOI) can be used as an example of skill (4). The "mathematical" solution is not too hard, but there are implementation issues. Again, in order not to spoil the question, I would just suggest considering task MAGIC SQUARES from IOI1996 and task TWOFIVE from IOI2001 which involve implementation details similar to the ones in PARROT (MAGIC SQUARES is easier than PARROT and TWOFIVE is harder in respect to those implementation issues).
As for skill (1), task CROCODILE from IOI2011 can serve as an example, but I'd rather give you a cleaner one which also serves as an example for skill (5):
Consider the well known egg-droping problem (see http://www.ocf.berkeley.edu/~wwu/riddles/hard.shtml).
To solve this problem one should first reverse it and ask "what's the highest building I can solve with up to $t$ throws?". To solve the reversed problem, one should employ backward reasoning (reversing and backward reasoning are examples of skill (5) ) and say: Let's try to sketch a solution strategy: The first throw would be from... well.. I don't know where from. So let's denote the floor of the first throw by "t_1" and continue from there. I will not continue describing the solution, but note that "let's denote the floor by a variable and continue" is an example of abstraction. Instead of a number of a formula, we just accept the fact that we don't know what this floor is yet, make up a variable to denote it, and continue.
(you may find tasks from IOI up to IOI2008 in http://ioinformatics.org/history.shtml).
From my experience with students participating in IOI, I would say that the ones who also participate in IMO (or otherwise very oriented toward mathematics and not just computer science) are:

Always on top in regard to skill (1)
Tend to be better than others at skill (5)
Have a potential to become exceptionally good at skill (4) after some hard training

EDIT:
As a final advice: Try solving many tasks. Code any task you solve to make sure you understand all the details. After solving (or trying long enough), always read an official solution or discuss the solution with someone else. In a more advanced stage of your training, read tutorials you can find on the web especially about data structures. You can find some of these on TopCoder's website.
As topics which are traditionally considered as mathematics and not computer science:

Mathematical games can be relevant to programming competitions.
In many computational geometry tasks it may be worthwhile to feel comfortable with convex sets as mathematicians think of them (maybe this is a bit advanced).
General mathematical experience and rigor can help you avoid wrong solutions which intuitively seem correct.

Overall, I'd say that the best way to become better in programming competitions is to train specifically for them while getting general mathematical education.
There are not many "traditional math" topics which can help you directly with those competitions.
(probably the best and most relevant way to get general basic math education is to take "Linear Algebra" in university or to learn the same material elsewhere. Again, this is not directly relevant, but eventually your problem solving skills would benefit from the rigor you will learn at such a course).
Comment: @code_hacker: Looking at your questions history, I think you could benefit from a book on Enumerative Combinatorics (the one by Charalambides for example). You may also benefit from studying IMO problems in number theory or combinatorics. There are books about IMO problems, but I don't know them well enough to give a recommendation. I would also recommend you to take a look at other kind of programming contest problems which are more about algorithms and less about numbers (this is my favorite genre of tasks. It characterizes IOI, but also appears in TopCoder and others). Good luck!
Comment: This is really a good answer.Can you suggest me some books which I can refer to strengthen my basics of mathematics?
Comment: My first book suggestion would be "Introduction to Algorithms, a Create Approach" by Udi Manber. As for more traditional mathematics, I don't know the basic books in English, but I think any first year book about Linear Algebra, Calculus or Discrete Mathematics should be good, as long as they are intended for *mathematics* students. Discrete Mathematics and Combinatorics are more relevant to computer science, while Calculus will give you the best treatment of mathematical rigor. Linear algebra is somewhere midway in those respects. As for mathematics directly relevant to competitions(contd)
Comment: I would divide it to "mathematics for analysis of algorithms" and "mathematics involved in the contest problems". The former is not very hard and is covered, for example, in CLRS. The relevance of the latter vary between different programming competitions. In IOI, for example, there is only very basic traditional mathematics involved in the tasks (except, maybe, for the computational geometry tasks which are slightly more complex mathematically). What competitions will you attend? What tasks make you think you need to learn more mathematics?
Comment: Usually I give coding competitions on topcoder,codechef,codeforces,etc. Tasks which require some application of mathematics theorem to reduce the problem to smaller problem which can then be solved by simple programming,I think demand mathematics,for example you can take a view at my history of questions which I have asked.It'll give you some idea about the mathematics which a programmer need.
Comment: @user3533 : Thank you so much.
Answer: As a slight counterpoint, I'll make the claim that if your goal is to become a better programmer, then the math skills you're looking for for contest problems probably aren't what you really want.
Don't get me wrong - I'm a huge fan of 'programmer math' (discrete mathematics, combinatorics, algorithmic analysis, etc) and believe that it's an immensely useful tool to have in your repertoire; and I absolutely adore 'recreational' mathematics and some of the branches of number theory that often wind up a part of programming contests.  But those skills have virtually never been a part of my day-to-day work as a programmer (and I'm in one of the fields where they're most likely to come up), and in my opinion my knowledge of them is almost orthogonal to my programmer skills.
There's still ample use, certainly, for some of the basics - being able to simplify a problem first, being able to analyze the algorithms you use, all are handy skills; but the core tenets of programming (organization of code, abstraction, etc.) will IMHO carry you much farther.  Programming contests are a lot of fun, and they're certainly encouraged, but they're not really a reflection of 'real-world' programming, in my experience, and I'd be a little leery of putting too much effort into skills that apply primarily to contest problems.
Comment: I'll keep that in mind.
Answer: In order to improve mathematics in Programming Competition you can solve problems in Project Eular ( Click Here) . You can visit Topcoder , There are some very good tutorials on Math , Number Theory , Combinations , probability .


How to calculate decision boundary from nonlinear svm in R?

Question: As a follow up to this question - How to obtain decision boundaries from linear SVM in R?
Is it possible to do the same with non linear SVM? (Radial for example). What do the weights represent?
Comment: see http://stats.stackexchange.com/questions/164935/how-to-calculate-decision-boundary-from-support-vectors/167245#167245
Answer: That depends. In the radial-basis function (RBF) case, it's generally impossible to obtain the weights.
The kernel trick is applied as I outlined in this answer.
Basically, we define new weights $\mathbb{w} = \phi(x)\cdot\mathbb{u}$ so that $\mathbb{w}^T\phi(x)=\mathbb{u}^T\phi(x)^T\phi(x)=\mathbb{u}^TK$ and $\mathbb{w}^T\mathbb{w}=\mathbb{u}^TK\mathbb{u}$.
We minimize with regards to $\mathbb{u}$, so to recover the weights in kernel space we simply do the back transformation $\mathbb{w}_{p_K\times1} = \phi(x)_{p_K\times N}\cdot\mathbb{u}_{N\times1}$.
Some kernel spaces are infinite though, like the RBF kernel, and so the resulting weights vector is infinite as well (i.e. you can't really represent it, nor the $\phi(x)$ kernel space representation as $p_k\rightarrow+ \infty$). Other finite space cases admit the solution though.


Oxidation states of Thiosulphate

Question:
I was given this question and don't understand why the two sulphur atoms have different oxidation states - and how to actually figure it out. Could someone please explain it to me? I've attached the reasoning that was provided but it isn't very clear to me. I understand that oxygen is usually -2 (with exceptions) and that the molecule itself should have a net charge of -2 but I thought that then meant that each sulphur atom would have an oxidation state of +2.  Any help would be greatly appreciated!!
Comment: If you count oxidation state formally, than it is done by moving all electrons of a shared electron pair to the more negative atom or dividing it between atoms if they have the same oxidation state. This, however, gives rise to question for which resonance structure one calculates oxidation state, which might give different values for thiosulfate. On another hand, thiosulfate is isoelectronic to sulfate, so it is natural to use same oxidation numbers for same positions as in sulfate. This approach is often used for organization of compounds into groups.
Answer: If the last paragraph in your quotation is meant to be the book's answer, I would stain that text with my intensely colored, anthocyanin-rich cranberry jam*. I would find either $-1$ and $+5$ or $0$ and $+4$ more defensible.
-1 and +5
In this model we use the raw electronegativities of the atoms to render the sulfur-sulfur bond nonpolar, so the outer sulfur atom would have the same $-1$ oxidation state as it would in the disulfide ion $\ce{S2^{2-}}$. The central sulfur atom, losing two electrons to each oxygen atom to satisfy $-2$ for the latter, ends up at $-1+6=+5$.
0 and +4
Here we take a slightly more advanced approach, arguing that the sulfur-sulfur bond is inductively polarized by the oxygen atoms withdrawing electronic charge from the central sulfur. In response the sulfur-sulfur bond has its electrons polarized towards the central atom as if that atom were more electronegative. Thereby the outer sulfur is rendered with an oxidation state of $0$ and the inner one with $-2+6=+4$. This assignment has the advantage of dovetailing with a well-known chemical property of thiosulfate: a generally redox-inert acid such as hydrochloric acid causes it decompose to elemental sulfur (oxidation state $0$) and sulfur dioxide (sulfur oxidation state $+4$).

*Cranberries are actually white on the inside when fresh. The bulk color turns red only when the anthocyanin dye, which is not colored in its reduced form, is exposed to air as the cranberries are crushed or popped.
Comment: Lol yes I would love to stain the textbook too. Thank you for the response, that makes a lot more sense to me!!
Comment: @KokoFaen If the answer helped, please accept it by clicking on the checkmark.
Comment: There's one in every crowd. Would be good to know why the downvote, even if that is as much of a luxury as a free lamborghini.
Comment: @OscarLanzi maybe they don't like cranberry jam ;)
Comment: @NilayGhosh that 's because they're thinking of the canned stuff. Make your own and then you'll like it.
Comment: I'm getting rwo downvotes,so must be missing something. Do tell.

Oxidation states of Thiosulphate


Android: SQLite transactions when using ContentResolver

Question: The goal: refresh database from XML data
The process:

Start transaction
Delete all existing rows from the tables
Per each main element of parsed XML insert row into main table and get PK
Per each child of the main element insert record into 2nd table providing FK from the previous step
Commit transaction

Pretty standard stuff as far as db operations. The problem is that CRUD operations are not done within ContentProvider but rather using ContentResolver so the insert for example looks like resolver.insert(CONTENT_URI, contentValues). The ContentResolver API doesn't seem to have anything pertained to transaction and I cannot use bulkInsert since I'm inserting in 2 tables intermittently (plus I want to have delete inside the transaction as well).
I was thinking of registering my customized ContentProvider as listener by using registerContentObserver but since ContentResolver#acquireProvider methods are hidden how do I obtain the right reference?
Am I out of luck?
Comment: see this: http://stackoverflow.com/questions/4655291/semantics-of-withvaluebackreference
Comment: Did you ever find a solution to this? I can not find a solution that works
Answer: I've seen that in the source code of Google I/O application, they override ContentProvider's applyBatch() method and use transactions inside of it. So, you create a batch of ContentProviderOperation s and then call getContentResolver().applyBatch(uri_authority, batch).
I'm planning to use this approach to see how it works. I'm curious if anyone else has tried it.
Comment: I've tried this approach and it works well. However each ContentProviderOperation in the batch are atomic operations. What I mean by this is that there is no way to correctly handle dependent operations for master-detail relationships where the identity key created by the first operation is needed as input for subsequent operations. I've asked this before, but got zero responses (http://stackoverflow.com/questions/3224857/master-detail-using-contentresolver-applybatch).
Comment: I tried it too and I noticed a performance gain of over 1000 Percent. Just by copying the code from the IOShed Project to my Provider.
Comment: This answer is not correct. The default impl of `applyBatch()` only iterates over the operations and applies them in isolation. This only provides a means to implement a transaction, by overriding `applyBatch()` in your `ContentProvider`. It does not provide transactional behavior on it's own. If you don't control the `ContentProvider` implementation, you are out of luck.
Answer: It is possible to do transaction based multi table inserts rather cleanly since Android 2.1 by using ContentProviderOperation, as mentioned by kaciula.
When you build the ContentProviderOperation object, you can call .withValueBackReference(fieldName, refNr). When the operation is applied using applyBatch, the result is that the ContentValues object that is supplied with the insert() call will have an integer injected. The integer will be keyed with the fieldName String, and its value is retrieved from the ContentProviderResult of a previously applied ContentProviderOperation, indexed by refNr.
Please refer to the code sample below. In the sample, a row is inserted in table1, and the resulting ID (in this case "1") is then used as a value when inserting the row in table 2. For brevity, the ContentProvider is not connected to a database. In the ContentProvider, there are printouts where it would be suitable to add the transaction handling.
public class BatchTestActivity extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ArrayList<ContentProviderOperation> list = new
            ArrayList<ContentProviderOperation>();

        list.add(ContentProviderOperation.
            newInsert(BatchContentProvider.FIRST_URI).build());
        ContentValues cv = new ContentValues();
        cv.put("name", "second_name");
        cv.put("refId", 23);

        // In this example, "refId" in the contentValues will be overwritten by
        // the result from the first insert operation, indexed by 0
        list.add(ContentProviderOperation.
            newInsert(BatchContentProvider.SECOND_URI).
            withValues(cv).withValueBackReference("refId", 0).build());

        try {
            getContentResolver().applyBatch(
                BatchContentProvider.AUTHORITY, list);
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (OperationApplicationException e) {
            e.printStackTrace();
        }
    }
}

public class BatchContentProvider extends ContentProvider {

    private static final String SCHEME = "content://";
    public static final String AUTHORITY = "com.test.batch";

    public static final Uri FIRST_URI =
        Uri.parse(SCHEME + AUTHORITY + "/" + "table1");
    public static final Uri SECOND_URI =
        Uri.parse(SCHEME + AUTHORITY + "/" + "table2");

    public ContentProviderResult[] applyBatch(
        ArrayList<ContentProviderOperation> operations)
            throws OperationApplicationException {
        System.out.println("starting transaction");
        ContentProviderResult[] result;
        try {
            result = super.applyBatch(operations);
        } catch (OperationApplicationException e) {
            System.out.println("aborting transaction");
            throw e;
        }
        System.out.println("ending transaction");
        return result;
    }

    public Uri insert(Uri uri, ContentValues values) {
        // this printout will have a proper value when
        // the second operation is applied
        System.out.println("" + values);

        return ContentUris.withAppendedId(uri, 1);
    }

    // other overrides omitted for brevity
}

Answer: All right - so this does not dingle aimlessly: the only way I can think of is to code startTransaction and endTransaction as URL-based query requests. Something like ContentResolver.query(START_TRANSACTION, null, null, null, null). Then in ContentProvider#query based on the registered URL call start or end transaction
Answer: You can get the implementation of the content provider object itself (if in the same process, hint: you can control the provider's process with multiprocess="true" or process="" http://developer.android.com/guide/topics/manifest/provider-element.html) using ContentProviderClient.getLocalContentProvider () which can be casted to your provider implementation which can provide extra functionality like a reset() that closes and deletes the database and you can also return a custom Transaction class instance with save() and close() methods.
public class Transaction {
    protected Transaction (SQLiteDatabase database) {
        this.database = database;
        database.beginTransaction ();
    }

    public void save () {
        this.database.setTransactionSuccessful ();
    }

    public void close () {
        this.database.endTransaction ();
    }

    private SQLiteDatabase database;
}

public Transaction createTransaction () {
    return new Transaction (this.dbHelper.getWritableDatabase ());
}

Then:
ContentProviderClient client = getContentResolver ().acquireContentProviderClient (Contract.authorityLocal);
Transaction tx = ((LocalContentProvider) client.getLocalContentProvider ()).createTransaction ();


How to move cross sell products to main (left) column of cart on Magento 1.9

Question: I want to move the cross sell products in 'view cart' (Magento 188.8.131.52) from the bottom of the right column to the bottom (below the cart contents) of the left column. How can I do this?
Answer: This can be done in 2 steps:

Move the call to get the crosssell html to the proper place
Update the CSS

Step 1:
Look at line 176 in the following file:
app\design\frontend\rwd\default\template\checkout\cart.phtml

You will notice the call to get the crosssell html:
<?php echo $this->getChildHtml('crosssell') ?>

Just cut that code and paste it around line 153 like so:

</form>

<?php echo $this->getChildHtml('crosssell') ?>

<?php echo $this->getChildHtml('shopping.cart.table.after'); ?>

Obviously do this in your own copy of the file in your custom theme (if you care about updates braking the design in the future)
Step 2: Update the css (either override the current rules or change the current rules and then recompile the scss).
currently the css looks like this:
.cart-forms, .cart-totals-wrapper, .crosssell {
  float: right;
  clear: right;
  width: 40%;
  padding-left: 20px;
}

Remove .crosssell from the rule.
Add a new rule for .crosssell as follows:
.crosssell {
float: left;
width: 60%;
}

Answer: My solution, for Magento 1.9:
Just modify the styles.css file (located at /skin/frontend/{your theme}/default/css) removing the .crosssell class from here
 .cart-forms, .cart-totals-wrapper, .crosssell {
  float: right;
  clear: right;
  width: 40%;
  padding-left: 20px;
}

and moving it here
.crosssell {
clear:right;
width:60% !important;
}

Of course, you can modify the .crosssell class according to your needs.
Hope it helps!


How to connect two LDOs in parallel?

Question: I have two LDOs that convert different input voltages into the same voltage. I'm not sure how to safely connect the outputs together so they become the same signal and can be both be used to power the board, is it as simple as just connecting the outputs together since the voltage is the same? Thanks
Comment: You probably should not connect the outputs, directly. What are the two input voltages, which you say are different?
Answer: It is not at all recommended to parallel the output of the two LDOs together. The one with the higher voltage output will try to supply the load - that is if you can keep them stable and not get oscillation happening.
A better method will be to use one LDO and diode OR the input sources into the LDO. Then the higher voltage supply will contribute.
Comment: Thanks! Reading up on it sounds like exactly what I needed.
Comment: @Johnny - Yeah. Should work out OK. Use Shottky type diodes if you want to limit the voltage drop across the diodes. Nice thing however is that putting the diodes in front of the LDO means that you can get a nice regulated voltage out at your load. That is compared to if you tried to diode-OR a two LDO solution together where the diode drops would mess with your regulated voltage levels.

How to connect two LDOs in parallel?


Lock formula but allow colouring of the cell?

Question: Can anyone tell me how to lock a formula in a cell but allow the users to format the colour of the cell?
Answer: Yes, you must protect the sheet, but allow formatting.
Go to the review tab, changes group and select protect sheet.
The third box down in the new window is format cells, so place a check mark in this box to allow users to format the cells.
Answer: This simple VBA code will help you to Lock Sheet with Password but allow to apply all type of formatting to Rows & Columns.
<code>Sub ProtectButAllowFormatting()
Sheets("Sheet1").Protect Password:="AA", DrawingObjects:=False, AllowFormattingCells:=True
End Sub
</code>
How it works:

Copy & Paste this code as Standard Module.
Run Macro to Protect Sheet.
Apply Format to Rows/Columns.
If need Unprotect Sheet using Password.
Alter Sheet Name & Password, if & when you
need.


How to implement real-time replication of MongoDB (or CouchDB) to many remote clients

Question: I'm considering how to design a mechanism for replicating a (potentially large) MongoDB or other NoSQL (CouchDB, etc) database to dozens of clients at once. The clients would function like a replica set, but the replication would be one-way and the remote clients would belong to other parties. Specifically, I am looking for the following features:

real-time: changes to the master database should be pushed out to the clients as quickly as possible
replication to new clients: a new client must be able to connect, automatically sync the majority of existing data, then receive real-time updates.
efficient: both the initial synchronization/transfer of data and tracking of real-time updates ("diffs", if you will) are computationally efficient, with multiple clients connected.
secure: the master database presents an interface to which remote clients (who do not belong to the same owner or system) can connect: i.e., we cannot just add all the clients to the master's replica set.
robust: a temporarily connection failure between a client and the master database should be easily and efficiently recoverable.

In some sense, the server is publishing a collection of data and the clients are subscribing to it. I realize that this is a hard software engineering problem, and to my knowledge no piece of software has implemented this exactly yet. However, some approaches have come to mind as close, which I'll list below.

Meteor's DDP protocol: It's designed to do this with Mongo-like collections and exactly implements the model of publishing and subscribing to a set of data (rather than a stream of messages). It manages the initial sync and sends along live changes. However, it's still in development, and far from being an industrial-strength solutions - current drawbacks are that the server keeps a copy of every client's state in a possibly inefficient way and is only tested on collections that can fit in the memory of a web app. Also, it appears that DDP cannot efficiently sync an out-of-date database without fetching everything from scratch. If anyone can point to some examples of how large of a collection can be synced over DDP, that would be great. (See also: https://stackoverflow.com/q/10128430/586086)
Broadcasting the Mongo oplog: Using a high-throughput message bus like Apache Kafka, one may be able to efficiently send the oplog to many clients at once. This tackles some of the system implementation challenges. However, this requires that the clients start with an initial sync that gets them close enough to the current master state somehow and then start replaying the oplog from the appropriate point.
Continuous replication a la CouchDB: I'm not sure how this is implemented and how robust it is, given the sparsity of the documentation. However, it does seem to work over remote database connections. How efficient is this, though, when multiple clients are trying to replicate at the same time? (A similar hack to this would be to make the clients MongoDB Priority 0 replica set members; however, that seems to be far from its intended use. See also: http://guide.couchdb.org/draft/replication.html)

Please give pointers to software or pieces of software that already implement parts of this, or suggestions on the algorithms/data structures needed to do this efficiently.
Comment: I am trying to find a good architecture for a similar scenario, albeit with N hosts all having data very peculiar to themselves, and they have to sync that data out to all the other servers, scattered around the globe.  I'd love to know how you got on.  Getting the large scale architecture right will save a thousand headaches later on.  Sorry @WiredPrarie but I have to disagree!
Answer: If you are looking specifically for real-time replication, I'd recommend you look into SaaS offerings specifically for this purpose, such as https://www.firebase.com/


Should you tell everything in a poster session if you have not published it yet in a journal?

Question: I have a poster session tomorrow about an idea I didn't publish yet but planning very soon. If people stop by and asked me in detail about my idea, should I openly discuss or not?
Answer: I certainly would. It is often very beneficial to discuss your work with somebody who can understand it. You may get some interesting remarks, suggestions that you didn't think of, or just some information that you are not aware of. Besides, the openly exhibited attitude of "I'm not telling you anything of value because I suspect you are a petty thief trying to steal my intellectual property" leaves a very unpleasant impression and the evasive moves of the sort "This would take too long time to explain" may just make people suspect that you don't know what you are talking about yourself. So if you do not want to share your ideas at the moment for whatever reason, I would just not go public with anything at all.
With that said, the chance that somebody will stop by and engage in a long meaningful discussion with you during a poster session is not too high (unless you present something really outstanding), and you certainly do not need and aren't expected to tell everything you can in the case of the usual "small talk".
Just my two cents.
Comment: I would add that you should be able to keep the head on that.


ipython shell syntax error with "?" in string in `python-shell-send-string`

Question: When in the IPython shell, ?open returns help on the "open" function. But when I send it with python-shell-send-string it throws a syntax error saying "?" is not recognised. I can see the output in the IPython shell. I am using Doom Emacs. The default Python shell is set to "python3". I've tried changing it to "ipython3", didn't help.
Answer: I think the problem is with the python evaluation set-up code. It throws the syntax error as it needs a valid python syntax and "?" is IPython command line specific. I found a couple of functions that would send a string directly to the interpreter:
comint-redirect-send-command and comint-redirect-send-command-to-process.
These do the job pretty well.
Edit:
I've just come across the following. One can run IPython specific commands from script (or as a send string) using the following command.
get_ipython().run_line_magic('pinfo2', 'object')

This is equivalent to running object?? in the IPython console. pinfo is equivalent to object?.


How to reduce Docky pop-up sensitivity?

Question: I'm using Docky version: 18.104.22.168 Release on Ubuntu 16.04
The dock is having very high sensitivity. Whenever I bring my cursor to
the bottom of the screen, say, to open up the log cat in Android Studio,
it pop's up and covers a significant amount of my screen space
preventing me from using anything it overlaps with. I have to take the
cursor very slowly to the bottom of the screen every time I want to
access something at the bottom. Has anyone else faced this issue? Can
someone suggest an easy way to fix this, as I'm new to Ubuntu? Also, I
don't want to use other docks like Cairo because they are resource heavy
and my laptop isn't very powerful, especially when using Android Studio.
Answer: Step 1: Install gconf-editor from the Terminal
sudo apt install gconf-editor

Step 2: Open gconf-editor using the command
gconf-editor

Step 3:
Navigate to the following folder:
/apps/docky-2/Docky/Interface/AutohideManager
Step 4:
Set the UnhideDelay value to 500 (note this is in ms)
Step 5:
Restart your computer
OR
Go to System Monitor, select the Processes tab, right click on docky and click on kill. Then restart docky like you would launch an application

How to reduce Docky pop-up sensitivity?


Teflon tubing in nozzle throat coming out?

Question: I have a HE3D prusa XI3 printer with an MK8 extruder. While printing or testing, the extruder makes a clicking noise as if the filament isnt getting hot enough to extrude. I began my investigation and read about many reasons why this could be happening. Eliminating most of them, I finally took off the fan on the extruder and looked at it while it was trying to extrude. I noticed the teflon tubing and tried to push it back into the throat. Then the extruder worked fine. I put everything back together and began testing again. The clicking came back,  - I then took the fan and heatsink back off and there it was again. Pushing back down and this time extruding some material and noticing the tubing slowly coming up. Is there anyway to fix this without upgrading to a better hot end?
Answer: It looks like you got too tight nozzle, too cold hotend or extruding speed is too high (all could be in the same time of course).
As filament goes into the teflon tube (coldend) and then into hotend it doesn't have enough time to go out throught the nozzle. So it causes that melted filament accumulates in hotend and pushes out teflon tube.
Check application and arduino settings for

nozzle diameter (increase it), check if it's not plugged with something inside
hotend temperature (increase it), check for your filament settings
extrude ratio (decrease it), check also gearing on extruder motor
Comment: I know its not plugged by using guitar wire to clean it out. Also the temp is fine at 190c for PLA I also raised it to 200c to check this Ill look at settings here to see if thats the issue.
Comment: Maybe your thermistor doesn't respond properly. I mean maybe you set 200C but you get 160C or so ;) Definitely clicking sound tells that extruder cannot push filament and skips knurls
Comment: Yup so i took the extruder apart to clean it all out. I found that the filament was heating/melting and pushing the teflon up.
Comment: then it looks like my diagnosis was correct :)
Comment: Sorry just got off work im going to plug it in tonight to see if the problem is fixed. I also turned the max flowrate down from 2 to 1. To see if thats the problem. Then tomorrow i found someone who has a infrared temp gun to see if temperature needs calibrated
Comment: Thank you so much for your help! Finally my first print came out!
Comment: good to hear! I'm happy with you :)
Comment: I have also dealt with this issue. The teflon can be pushed up if your extrusion is too much as well. It builds up molten filament after a couple layers and you can hear the clicking because the teflon is getting ground up on a MK8 extruder due to it pushing up into the hobbed bolt especially during a retraction. Cleaning the teflon out with a guitar string is a bit dicey as any scratching inside there can make the problem worse later. Best solution is to completely replace the tubing to be sure.


Why buckling is described by the maths of the harmonic oscillator?

Question: Is this a coincidence or there is a more deep connection between the notion of the harmonic oscillator and the notion of buckling?
Comment: [Smoked fish](https://en.wikipedia.org/wiki/Buckling_(fish)) are harmonic oscillators? Please consider giving more context here.
Comment: The question is about "the notion of buckling" which is more general than "bucking of axially loaded columns" (though that may be the only special case that is discussed in some engineering and physics courses!)
Comment: @ACuriousMind The wiki page you referenced is incomplete. The panel at the bottom mentions Freshwater herrings, Longfin herrings, Round herrings and Thread herrings, but it ignores Red herrings.
Answer: It's because the harmonic oscillator is a very general tool. If you have a displacement-dependent force which you don't know, the first approximation is to approximate it linearly as $$f=-k\delta$$ where $\delta$ is the displacement. Now, materials are often non-linear ($f$ has dependencies to $\delta^n$) but the linear (elastic) theory gives a pretty good description already!
You can model this way (as a restoring force depending on $\delta$) any phenomenon which has an equilibrium state from which it gets displaced "a little bit".
Now, when you described buckling (assume 1D) you start with a straight rod, which you assume is at equilibrium (energy $E=0$) then you deform it of an amount $\delta$ and assume the energy is increased by an amount $1/2k\delta^2$ as if it was a "spring" (remember: if $f=-k\delta$ then $E=1/2k\delta^2$). You pay an energy cost scaling with $\delta^2$ for the deformation, the same you pay to compress a spring.
The reason the linear theory is so nice is that Newton's equation for such a force reads
$$m{d^2\delta \over dt^2}=-k\delta$$
which has the very simple solution for the displacement $$\delta(t)=Acos(\Omega t+\phi)$$ where $A$ and $\phi$ depend on your problem and $\Omega$ depends on the material properties (the spring constant and the mass). Because the force is linear, if you have multiple forces acting on your rod as in buckling, where the stress distributes along the rod, you can just sum them and you get a sum of cosines which are very easy to treat with Fourier series' analysis.
Let's call $\delta(x)$ the displacement at a point $x$ along the rod. If the rod is straight at $x$ then $\delta(x)=0$, otherwise $\delta(x)$ it's the distance with respect to the equilibrium position.
The form of the force we choose for buckling has as a consequence that the main way a rod can buckle is following a cosine $\delta(x)\approx cos(\pi x/L)$  (where $L$ is the length of your rod) profile (fixed at the estremities and buckled at the center), followed by $\delta(x)\approx cos(2\pi x/L)$ with 2  "buckled" points, then three. The general solution to your buckling problem, is a sum of all these configurations.
It is a direct consequence of choosing something like $f=-k\delta$ to model your problem.
Answer: For small-amplitude vibrations of a structure with internal stresses, the equation of motion can be written as $$M\ddot x + \omega^2(K_e + K_\sigma)x = 0$$ where $K_e$ is the elastic stiffness of the material, and $K_\sigma$ is the additional stiffness terms caused by the internal stress. ($K_\sigma$ can be interpreted as the work done by an infinitesimal rigid body rotation of the stressed structure.)
Euler's theory of buckling is equivalent to saying that the structure buckles when the lowest frequency $\omega$ reduces to $0$.
The connection with a harmonic oscillator is rather tenuous, because this criteria doesn't really have anything to do with the mass of the structure. The real criterion is just that the internal stress distribution when $K_e + K_\sigma$ becomes singular. Since $M$ is non-singular for any real structure, $K_e + K_\sigma$ is singular if and only if $M^{-1}(K_e + K_\sigma)$ is singular, so bringing $M$ into the math doesn't change anything.
Answer: The only obvious connection would be as follows.
For small deflections of a slender column in compression, the resulting column curvature resembles a sine wave with zero-deflection constraints on its ends. That sine wave could in principle be associated with the natural frequency of vibration of that column, at least in the sense that if the column were loaded near its stability limit and it were then excited at that frequency, it would immediately "pop out" into its deflected shape in response to that perturbation.


What is the exact difference between Docker EE (Enterprise Edition), Docker CE (Community Edition) and Docker (Custom Support)

Question: Docker installation guides does contain three different ways of installing Docker. I want to know the exact difference between the three components.
Answer: Docker CE (Community Edition) is the simple classical OSS (Open Source Software) Docker Engine.
Docker EE (Enterprise Edition) is Docker CE with certification on some systems and support by Docker Inc.
Docker CS (Commercially Supported) is kind of the old bundle version of Docker EE for versions <= 1.13.
Take a look at this blog post and this other one about Docker CE & Docker EE.
Answer: "What is Docker Enterprise Edition?
Docker Enterprise Edition comes in three versions: basic, standard and advanced. The Basic edition comes with the Docker platform, support and certification, while the Standard and Advanced version add additional features such as container management (Docker Datacenter) and Docker Security Scanning.
Docker EE is supported by Alibaba, Canonical, HPE, IBM, Microsoft and by a network of regional partners. Those who want to test Docker EE can download a trial version for free from the official site.
Docker is also offering a certification program to help third-party vendors in ensuring their products work with Docker EE.
What is Docker Community Edition?
Docker Engine has been renamed to Docker Community Edition, and, as the name suggests, it's a do-it-yourself, community supported version of Docker that's available for free of cost.
The community edition will be available in two versions: Edge and Stable. Edge will be released each month with the latest features. Stable will be released on a quarterly basis. While Edge will receive security updates and bug fixes for the current release, the stable version will get similar updates for four months after the initial release. This update cycle will give users a big enough window to plan upgrades from older versions.
While the two versions are targeted at different audiences, there isn't much, or any, difference at source code level. "Both Docker EE and CE are based on the open source Docker project, which is developed in the open with Docker's community of partners and contributors, and this forms the open, modular core of all Docker CE and EE editions," said Messina."

From CIO.com

Also, take a look at the resources here and the official Docker documentation.
Comment: Thanks for the clear answer! Specially that renaming part. Went on with bit of confusion on whether there are three separate versions of Docker.
Comment: Are there any licensing concerns with attempting to manually install Docker CE on RHEL? I can't seem to find any reference to this aside from a stack overflow answer that achieves this (https://stackoverflow.com/questions/42981114/install-docker-ce-17-03-on-rhel7).
Answer: TL;TR;
We are currently dealing with two editions of Docker: Docker Community Edition (CE) and Docker Enterprise Edition (EE).
Docker EE comes with additional features that can help enterprises launch, manage, and secure their containers more efficiently, but what is worth emphasizing is that the two editions offer the same core features.
The main differences are that Docker CE is a free to use for everybady and open source and, on the other hand, Docker EE in the basic plan costs $1,500 per node, per year...
Another important difference is the operating systems on which we can run them. Docker CE can run on Windows 10 and Mac, on Azure and AWS, as well as CentOS, Debian, Fedora, and Ubuntu and Docker EE can run on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), Oracle Linux, Ubuntu, Windows Server 2016, as well as Azure and AWS.
Thus, in most private and commercial cases of Docker use, Docker CE should be sufficient.
For an in-depth look at all the differences, I encourage you to visit:Docker Community Edition or Docker Enterprise Edition - Everything You Need to Know
Answer:
Docker CE vs EE: An Overview

Docker CE is a free and open source containerization platform. It is a rebranded version of the Docker open source solution that has been freely available since the launch of Docker in 2013.
CE can run on Windows 10 and Mac, on Azure and AWS, as well as CentOS, Debian, Fedora, and Ubuntu. CE can be downloaded directly from the Docker Store.
Docker EE, on the other hand, is a premium version of CE. Docker EE is an integrated, fully supported, and certified container platform that runs on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), Oracle Linux, Ubuntu, Windows Server 2016, as well as Azure and AWS.
Docker CE vs EE: How They're the Same
First things first, it's important to note that Docker CE is not a 'watered down' version of Docker EE. Both CE and EE have the same core features and functions:
Both editions are updated quarterly (although Docker CE users can expect "Edge" updates, discussed further herein), and both are available on a wide range of popular operating systems and cloud infrastructures, giving enterprises the freedom to run containerized applications on their favorite infrastructure—without lock-in.

Docker CE vs EE: How They're Different

While both editions offer the same core features, Docker EE comes with additional features that can help enterprises launch, manage, and secure their containers more efficiently.
Here's a summary of what companies can do when using Docker Enterprise Edition:
Gain access to certified Docker images and plugins
View your container clusters in a single pane view
Access controls for cluster and image management
Receive official same-day support from Docker
Run vulnerability scans on your Docker images
Run Docker EE engine with FIPS 140-2 certification
Advanced image and container management, LDAP/AD user integration, and role-based access control (formerly available only through Docker Datacenter, which is now part of the Docker EE plan)
Continuous vulnerability monitoring and Docker Security Scanning (formerly available only through Docker Datacenter, which is now part of the Docker EE plan)
Understanding Docker's Versioning Format
As you research Docker CE and Docker EE, you may wonder about the platform's versioning format. On the release of both CE and EE, Docker decided to change the way they versioned their product. Before March 2017, the latest version of Docker that was available at the time was v1.13. After the rollout of CE and EE, the new version was referred to as 17.03.
From the outside, it seemed as if Docker had skipped past 16 versions, but in actuality, Docker had changed their versioning scheme to YY.MM (year and month), similar to the scheme used by Canonical for Ubuntu..

How Often Are Docker CE and Docker EE Updated?

Docker CE comes with two release channels: "edge" and "stable".
The edge channel releases a new version every month, and you gain the advantage of getting new features with each release. As for the stable channel, a new release becomes available every quarter.
If you decide to go for the stable option, you will have to wait longer to get the new features; however, on the plus side, the stable channel is much easier to maintain since you only need to install an update every quarter, as previously mentioned. The edge channel is suitable for those who want access to the latest features quicker.
In terms of support for both channels, the edge channel only releases bug fixes and security patches during the version's current month. The stable channel releases patches for security issues and bug fixes for 4 months after the initial release, giving users a one-month window to upgrade to the latest release while still receiving fixes.
With Docker EE, a new version is released every quarter, and each release is supported for a full calendar year. Both bug fixes and security patches are backported to all supported versions.
Source: Docker
Docker CE vs EE: Pricing
Docker CE is free to use and download. The overall experience of CE can be enhanced through a range of free and paid add-ons from Docker Cloud at your own discretion.
Docker EE is a premium version that is available through three pricing tiers:
Basic: With Basic Docker EE, you get the Docker platform for certified infrastructure, along with support from Docker Inc. You also gain access to certified Docker Containers and Docker Plugins from Docker Store.
Standard: Comes with the same features as the Basic tier but with added advanced image and container management (single pane view), LDAP/AD user integration, and role-based access control (Docker Datacenter).
Advanced: Comes with added Docker Security Scanning and continuous vulnerability monitoring.
The general pricing for each tier is usually based on cost per node per year:
Basic: $1,500 per node, per year with Business Critical support
Standard: $3,000 per node, per year for Business Critical support
Advanced: $3,500 per node, per year for Business Critical support
Docker EE is also available as a one-month free trial. To activate your Docker EE free trial subscription, log into The Docker Store and navigate to the Docker EE page.


How to show both currencies at once in the node page for price field

Question: I am using Drupal commerce kickstart, Here I have two types of currencies like $ and INR. In the node page I am showing INR currency by default. Using Curreny Selector Module I am showing Dropdown to select the currency. If currency selected by user then calculated $ currency is showing fine. But here I need to show both prices at once. For example, "Rs.1205 & $20" at once without selecting the currency from dropdown. I am loading this node page programmatically. So I want to load the currency programmatically which is converting through European Bank. Any Suggestions please.
Answer: Commerce Multicurrency does exactly that.

This module enhances some of the multi-currency capabilities of Drupal
  Commerce.
Current features:

UI for fine granular definition of exchange rates.
  (Every currency combination can be defined separately if needed)
  Synchronization of currency exchange rates directly from the European Central Bank (ECB).
UI to specify which rates shall be synchronized and which are handled manually.
Generation of currency specific price fields inclusive generation of rule-set to handle them.
hooks for easy integration of custom currency exchange rate sources.


Custom web part which downloads a file from SharePoint document library

Question: I need to make a custom web part which can download a file from a SharePoint document library. I created a web part which contains a download button. The button should download the file. Currently I am using an html anchor link tag using the download attribute. It uses the path to a file in a SharePoint document library. The anchor link tag can be structured like this:
<a href="<path to doc in SharePoint>" download> Download
This works fine on the hosted workbench, but when my app is deployed to a site on SPO, it does not work fine. The first time it is clicked, it works (the url in the url box briefly changes to the file path of the doc to be downloaded, the file is downloaded and then the url changes back to the site page url). But the second time it is clicked, the url changes to the file path of the doc to be downloaded, and does not change back. Each time I click a link on the page after that, the url changes to the link, and does not execute the action. An error is shown in the console at this time: This is a problem because there will be many of these web parts on a page, and clicking each button twice to make it download is bad. Additionally, in order to refresh the page, the back button must be clicked as many times as the download buttons were clicked to have the url go back to the page url. Otherwise if the url file path still points to the doc to be downloaded and refresh button is clicked, the file is simply downloaded again, the page does not refresh (obviously).
Can some one help me come up with a solution which allows files to be downloaded from SharePoint correctly? This should not be hard to do, I just want to be able to reliably download a file with a custom web part from a SharePoint document library.
Answer: I found the answer here: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/hyperlinking
I needed to add the data-interception attribute with a value of 'off'
Thx for the help everyone lol...
Comment: But we cannot add this to SharePoint OOTB navigation links.


Can we restrict Maximum Job history rows for particular job/jobs in SQL Server 2012?

Question: I am aware that there are 2 universal settings for Job history retention rows in SQL Agent. First one is default 1000 rows and per job max history row count is 100.  Second one is deleting history older than given weeks.
Apart from these 2 options, do we have any possibility left to set up our desired max row count for a single job/few jobs? Like individual max row count for each job/specific jobs.
For example, I have a job which runs for every hour whose run time changes according to other concurrent jobs resource blocking.I want to see at which hour schedule, the Job took long time. As I have multiple jobs running on server, only 10 job history entries are available for this job. Also, I don't require more history entries for few other jobs. So, Could anybody please let me know if there is any way to setup individual max history row count for specific jobs?
Comment: If you have two jobs where you want to keep only the last 10 rows, and one job has 2 steps and the other has 5 steps,  are you keeping 10 rows each (so 5 executions of the first job, and 2 executions of the second), or 10 total executions each (so 20 rows for the first job, and 50 rows for the second)? Well, disregarding step 0 for simplicity.
Answer: Not through the UI, but since the sysjobhistory table is not a system table, you could manage this manually with a simple scheduled job that cleans up. Assuming you always want to keep fewer rows for the exceptions than the rest.
First, let's assume you have some query against sysjobs that will return the jobs you want to be more restrictive:
SELECT job_id FROM dbo.sysjobs WHERE <...>;

Next, for simplicity, let's say that for all the jobs in that list, you only want to keep the 10 most recent rows.
DECLARE @rows_to_keep int = 10;

;WITH history AS
(
  SELECT rn = ROW_NUMBER() OVER
    (
      PARTITION BY job_id
      ORDER BY run_date DESC, run_time DESC
    ),
    job_id, run_date, run_time
    FROM msdb.dbo.sysjobhistory
    WHERE job_id IN
    (
      -- query from above
      SELECT job_id FROM dbo.sysjobs WHERE <...>
    )
)
DELETE history
WHERE rn > @rows_to_keep;

It gets a little more complex depending on the answers to these comments:

If you have two jobs where you want to keep only the last 10 rows, and one job has 2 steps and the other has 5 steps,  are you keeping 10 rows each (so 5 executions of the first job, and 2 executions of the second), or 10 total executions each (so 20 rows for the first job, and 50 rows for the second)? Well, disregarding step 0 for simplicity.

Also if you want different rules for different jobs, you can just create your own table:
CREATE TABLE dbo.CustomJobRetentions
(
  job_id uniqueidentifier,
  rows_to_keep int
);

Then you can incorporate that into your query:
;WITH history AS
(
  SELECT rn = ROW_NUMBER() OVER
    (
      PARTITION BY h.job_id
      ORDER BY h.run_date DESC, h.run_time DESC
    ),
    h.job_id, h.run_date, run_time, c.rows_to_keep
    FROM msdb.dbo.sysjobhistory AS h
    INNER JOIN msdb.dbo.CustomJobRetentions AS c
    ON c.job_id = h.job_id
)
DELETE history
WHERE rn > rows_to_keep;

Please try this out on a test system first.
Comment: Thanks @AaronBertrand for a solution. I will give it a try and see.


Is it possible to Uninstall and Install applications at the same deployment in SCCM?

Question: We installed an application to some client machines and we want to deploy the new version by
1) Uninstalling the prior version if there is, then

2) Installing the new version at the same step (because the msi of the application cannot uninstall the prior version and we have to perform uninstallation and installation of the application at the same step. Is it possible? If so how can we manage this on SCCM or msi side by using a script, etc? Any help would be appreciated.
Comment: It seems to me like this question got clipped when it was posted and that there's something missing...
Comment: Sorry, but I have no enough knowledge SCCM and I would be happy if you inform me about what is missing?
Comment: I mean to say that your question doesn't seem to be complete. Re-read the last few sentences and clarify if needed.
Comment: Ok, I update the question. I hope now it is clear :)
Comment: @GregL Any help pls?
Answer: My deployment of SCCM uninstalls one version and installs the subsequent version in a single step regularly.  Here is how to achieve that.
Package both versions as applications whose full lifecycle is tested and working.
For this to work you need both the original and the new version to be packaged as an SCCM Application that SCCM can successfully put through the full lifecycle (start out uninstalled and undetected, install, detect, uninstall, undetected).  Test the full lifecycle of each application separately before moving on to the next step.
Deploy version n
With a well-formed application, you can deploy the application to computers without regard for whether the application is already installed.  If the application is already installed, CcmExec will detect it and do nothing. If the application is not detected, it will invoke the installer.
Supersede version n with version n+1
Supersedence is the key to achieving uninstallation and installation in a "single step".  CcmExec actually processes uninstallation followed by installation, but I've always seen that happen back-to-back so you don't risk the user going without that application for an extended period of time.
Here is the supersedence screen you are working toward:
Comment: +1 - Using the supersedence section within SCCM is probably the best and tidiest way.
Answer: Create a New Pacakge
Source Folder: \\server\here\there
Standard Program
Command Line: installThis.bat
Etc...
Source Folder should also contain "installThis.bat"
Minimum contents of InstallThis.bat
REM *** Get the "UninstallString" of the old version from this registry locaton
REM *** HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
REM *** Replace the first MSIEXEC here with that UninstallString
MsiExec.exe /X{071c9b48-7c32-4621-a0ac-3f809523288f}
MsiExec.exe newVersion.msi /this /that /other

Comment: Many thanks for your help. With this scripts, do you mean to create a script that uninstall and then reinstall the application using the msi file of the latest version? Could you please explain a little bit more and update your answer to explain step by step?
Comment: Any help please?
Comment: I realize it's a minimal answer, but packages in SCCM are less complex than applications. Which part are you not following? The basics of creating a package, or the script?


Intuitive explanation for the formula of bound surface charge in a dielectric

Question: The bound surface charge in a dielectric is given as $\sigma_{b}=\vec{P} \cdot \hat{n}$. Where $\vec{P}$ is the polarisation and $\hat{n}$ is the surface normal.
Could anyone please give me a intuitive explanation for this?.
Answer: The following analogy may help intuition, although that's very subjective.

Remember that a discontinuity in the electric field at a surface is a sign of the presence of a surface charge density, which is given by
$$\sigma=\varepsilon_0[{\bf E}_{\rm above}-{\bf E}_{\rm below}]\cdot\hat{\bf n},$$
where $\hat{\bf n}$ is the normal vector to the surface (pointing from below to above). This was a consequence of the electric field having divergence $\nabla\cdot\bf E=\rho/\varepsilon_0$.

In an analogous way, the polarization vector $\bf P$ has divergence $\nabla\cdot{\bf P}=-\rho_b$, or written in a more suggestive way, $\nabla\cdot{\bf P}=\rho_b/(-1)$; therefore a discontinuity in the polarization vector at a surface causes a bound surface charge given by
$$\sigma_b=-[{\bf P}_{\rm above}-{\bf P}_{\rm below}]\cdot\hat{\bf n}.$$
If we take the surface to be the outer surface of a dielectric and the normal $\hat{\bf n}$ pointing from the inside of the dielectric to the outside, then ${\bf P}_{\rm above}=0$ (because outside we don't have dielectric) and ${\bf P}_{\rm below}$ is the $\bf P$ of the dielectric, hence
$$\sigma_b=-[-{\bf P}_{\rm below}]\cdot\hat{\bf n}={\bf P}\cdot\hat{\bf n}.$$


Example of differential map on manifolds but not not on euclidean space

Question: can anyone give me an example of diffential map of a map $f : M \Rightarrow N $ where $M$,$N$ are manifolds different from Euclidean space?I read somewhere that Hopf map is  differential map from $S^3$ to $S^2$ but i don't know about it, Can someone explain it with how it is a differential map?
Comment: THe identity map from a manifold to itself would do.
Answer: Take a circle and rotate every point by a fixed amount. This is a differentiable map between the manifolds $M=N=S^1$. You can use charts to show the map is differentiable, and you can calculate its Jacobian. Or take any n-sphere $S^n$ and send a point to its antipode, i.e., send $(x_1,x_2,...,x_n) \rightarrow (-x_1,-x_2,...,-x_n)$


How to achieve the super high contrast look of Thierry Le Gouès' Soul Album?

Question: I'm curious to know how to achieve the high contrast look of Thierry Le Gouès' Soul album (please note: images are NSFW). I know this is probably done in post but I would like to know if there is a particular technique or maybe even an online tutorial to achieve this look.
Comment: For those not familiar with Thierry Le Goues, I do **not** recommend a Google image search at work.
Answer: I do not know the details, but do not underestimate the power of makeup.
Normally this kind of photos have a lot of pre-production work.
Just a tip, "back in the days" of film photography there was a film called "lith" for example Kodak's Kodalith, that produced a totally contrasted image, with almost no middle tones. This is not the case because you can see clearly gray tones. What you have is a super glossy oily makeup with some good softboxes reflection.
Comment: You mean [this film](https://filmphotographystore.com/products/35mm-bw-film-kodak-kodalith-vintage-stock-1-roll)? The samples aren't as contrasty as you say though, I wonder why. Never tried it myself.


Why can't the schema owner create a new table?

Question: I have a DB user called STANMAN which owns the STANMAN schema.  When I try to create a table as STANMAN, it says STANMAN has insufficient privileges.  How could a schema-owner not already have sufficient privileges?  Naturally, when I try to GRANT ALTER or GRANT CREATE, I get "Cannot grant, deny, or revoke permissions to sa, dbo, entity owner, information_schema, sys, or yourself."  What am I doing wrong?
Comment: Sorry, but what Database Engine are you using?
Answer: If you are using SQL Server 2005 or later then to create an table in a schema you need both CREATE TABLE at the database level and ALTER at the schema level. Ownership of a schema covers the ALTER permission requirement but not the CREATE TABLE one.
CREATE TABLE is also granted by membership in the db_ddladmin fixed database role. This role is for backwards compatibility - do not use it for new security implementations.
Comment: Thanks! I still don't know why I got that error message, but since it's working now, I will live to troubleshoot that another day!