brand new toilet installed by plumber won't drain

Question: Ok,  I have read many questions and answers to this question, but none of them are what mine is doing.  Buckets of water poured down don't go down, holes aren't clogged, all the guts in toilet work fine. I have logged it--sometimes I get 1 or 2 flushes that actually work, there has been a time I actually got 30 flushes. Sinks, tub, shower, other toilet all drain & work correctly with no bubbling, stink, etc. This toilet will fill to almost overflowing, then takes an hour to drain (no solids, minimal toilet paper). We have snaked with 3' and nothing. Only me here, no children or anything dropped in. A toilet is a simple fixture--people question its a defective toilet?! Venting? Pipe was cut in attic thinking vent issue and still nothing. Here's the plumbing: in crawl there is a 90 degree into a 45 degree, a 4' run with a 1/16" per foot slope (supposed to be 1/4" slope per foot), vent is 12' away from toilet before going upwards then reduced to 1 1/2" pvc, then 7-8' up in ceiling with six 90 degree elbows, about 12-15' run in attic and goes back to 2" pvc to meet an existing toilet, both vented out same pipe. Toilet is American Standard. Help?!
Comment: If the toilet was installed by a plumber, then call out that plumber.  My guess is that you have a soft clog somewhere in the line.  If the toilet doesn't drain but the rest of the bathroom does, more likely than not the rest of the drains connect after the clog.  You may just need a longer snake.
Comment: Have you checked with the plumber to see if they did everything OK?
Comment: When the bowl finally drains, does it stop at the normal level, or go down to almost empty?
Comment: Yes, checked with plumber. After 1 1/2 months of being clogged, he told me I didn't have a good plunger, he used his own and said it was plugged from toilet paper.  Unlikely, after that long, toilet paper would have broken down. Yes when bowl drains, it goes to almost empty. We are pulling toilet today to check wax ring, clog, and snaking.
Comment: We pulled toilet, wax ring ok, toilet ok. Plumber shimmed with 2 pennies!? Is this proper? We then dump 3 gallons of hot water in, water fills to top of drain.  Snaked it with 25' snake several times, nothing! Real mystery?!
Answer: Your DIY answer is:
Call the plumber that installed it.
If that does not work, call your state licencing board, and determine who the bonding agent is for the plumber (it's a licenced plumber, right?)


How do I wire a switch and light so I can add a fan later?

Question: In a room with a switch that controls a receptacle I'm going to add a switch and ceiling light. I want to make this addition so a fan can be added in the future if wanted. I feel confident in how to do this project, except how to wire the 3 wire for just the light, as I'm not putting a fan in at this time. can someone help me with a diagram. thank you
Answer: First, you need to ensure there is a neutral in the switch location (A requirement of NEC 2011 section 404.2 C, assuming that applies to you) -- the easiest way to do this is to run a 14/2 NM cable (standard house wire, aka the brand name "Romex") from your power source to the switch first.
Second, run a 14/3 wire from the switch to the fan. This has a white, black and red wire (as well as ground). The white is neutral. The black and red are hot wires, and generally speaking with a fan installed you'd do one of the following:

Black as switched for the light, Red as switched for the fan: If you have a "fan control switch" (commonly availale on the market) that has separate controls for light (often as a dimmer control) and fan speed.
Black as constant power, Red as switched: If you wanted a normal light switch, and then to control the fan using pull chains.

Prior to installing the fan, install the light normally, and connect either black or red to both it and the switch (see above to help you choose). You'd just cap the other (red or black) wire -- whichever you didn't use for the light -- on both ends with a wire nut. This prevent it from shorting out on anything, and is a common convention that signifies "unused wire".
Comment: That's the way I'd do it, but make sure its a 15 amp circuit before running 14/3. If its a 20 amp circuit run 12/3.
Comment: When I did this, I connected the wires at the fan to their separate controls (black to light, red to fan) and then used a wire nut at the wall switch to connect both wires to the switch - that way, when I replace the _switch_, I don't have to mess with the fan wiring again to get individual control...


Creating a Win32 dll in VC++ with CLR enabled but no CRT

Question: I am trying to create a simple Win32 DLL that contains a function that will return, given the name of a process/app, a list of Window IDs of the app's main window. The most efficient way is to leverage the managed code Process.GetProcessesByName() method. However, while the resulting DLL work in certain machine, it failed to be loaded into memory in other. Turn out the DLL is dynamically linked to a specific version of CRT library (msvcr120.dll in specific). So if the target machine doesn't have the same version of CRT library installed, the DLL won't work.
I have tried to build the DLL by statically linked to the CRT library using the /MT switch but the switch to enable CLR support for the managed code is incompatible with the /MT switch
I have also tried to rid the DLL of CRT library altogether by using the NODEFAULTLIB switch and use just WINAPI calls. While I can build the non-managed portion of the DLL successfully with no dependency on CRT, but when I include the managed porton and turn the /clr switch on, I am getting the following errors:
eze_InstallScriptCA.obj : error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
.NETFramework,Version=v4.0.AssemblyAttributes.obj : error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
Anyone has suggestion how to create a WIN32 DLL that is version independent of CRT and it is CLR enabled in VC++?
Thanks in advance
Answer: It is not possible.
You can, however, distribute msvcr120.dll along with your application.


Tar ignore or fix checksum

Question: I have a archive backup.tar that was created with a nonstandard program a long time ago. I no longer have access to the original program. The archive is Not compressed (gzip). When trying to extract the archive files, I receive an Unexpected EOF error.
It's complicated, but I have reason to suspect that the only problem is with the the checksum. I want to extract it and get the files out. Is there a way (perhaps using cpio or pax), to ignore or fix the tar checksum, and extract the files?
Comment: Does it give you any useful output when you use `tar tf backup.tar`?
Answer: I'd try the -i switch to see if you can just ignore and messages regarding EOF.
  -i, --ignore-zeros         ignore zeroed blocks in archive (means EOF)

Example
$ tar xivf backup.tar

Tar ignore or fix checksum


How to create a quick windows .exe file which does nothing and doesn't close by itself?

Question: For example, I want to create a Potatoes.exe file. I don't need it to do anything else, just to be there opened. I don't want it to close by itself.
Comment: why you want worthless utility which take resources and do nothing?
Comment: @MuhammadUmair basically I have an app called Discord which detects games by reading active .exe files. If there's for example a "Minecraft.exe", it will say "Playing Minecraft". So it's expected to show the name of the game whenever you run it, something that doesn't happen for Minecraft. I decided to just create my own .exe file then to explore this further and and Discord indeed shows the name when running the fake Minecraft.exe. The whole problem with Minecraft not using an .exe in the first place is obvious, as it is a game made using java. I was just curious.
Comment: This is necro, but the correct answer is using the nop_continue exe from here: https://github.com/myfreeer/nop/releases
Answer: I'd suggest creating a batch file (by opening Notepad and saving as the file with .bat extension)
@echo off
pause > nul

and converting it to executable file (.exe) with one of the thrid-party batch to executable file type convertors [1] [2] [3].


Rendering fluid simulation in false colors

Question: I need to render a fluid simulation in digital style like in the picture below. I prefer eevee for rendering but if someone know how to get it in cycles this also might help. So literally I need particles with coloros like in the picture in final render but not with water shader.
Comment: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comment: my guess is that he wants these colors blue - red that are used for velocity of water to be visible in final render, @roflvite, personally I think that you should just remove all unnecessary gizmos and render your viewport or even screenshot it... is that not good enough for you use?
Comment: @Gordon Brinkmann. Thanks, that works
Answer: To render particles like in the example you could either disable Overlays in the 3D Viewport and render from there with View > Viewport Render Animation as mentioned in the comments, this would also render very quickly.
Note that the other way described below only works in Cycles, since the Particle Info node in the material cannot be used in Eevee:
If you want "real" particles with maybe shadows, glossy surfaces or whatever, you can give the domain a simple Transparent BSDF set to full white to make it invisible for the render and to make particles inside it visible.
First of all, create an object you want to use as particle. The best will be object with very few geometry since there will be lots of them, so maybe a cube or an icosphere with a resolution of 1. But of course that's also dependent on your PC's power.
Then you go to the Particle Properties of the domain and select the particle system called Liquid. Under Render, change the Render As option from "Halo" to "Object" and choose an Instance Object, e.g. an icosphere you have created. Set the Scale to your liking.

The material on the particle object now needs a Particle Info node. There you have a Velocity output. I plugged it into a Vector Math node set to Length to calculate the overall length of the velocity vectors, i.e. how long ("fast") they are no matter in which direction. Of course you can do anything else like using Separate XYZ or whatever. Then I adjusted the result with a Map Range node and colored it with a Color Ramp. These steps are of course optional and depend on what you want to achieve.

The result could look like this (sorry for the bad GIF quality):


innodb_page_size is not present in [mysqld] section in my.ini file in MySQL Server 8.0?

Question: I have to edit the innodb_page_size to 32K but I cannot find innodb_page_size in [mysqld] section in my.ini file. I am using MySQL Server 8.0.13. Where can I find it?
Answer: If it is not explicitly set it defaults to 16k. You would set it to a new value in the [mysqld] section but it cannot be changed once the instance has been created.


How to disable USB OTG on Android 6+?

Question: I need to disable the OTG (USB) on Android 8. I already did it on Android 6 by disabling a permission on the file android.hardware.usb.host.xml but it is not working anymore on Android 8.1.
Answer: android.hardware.usb.host.xml file - located under /vendor/etc/permissions/ or /system/etc/permissions/ before Treble - contains feature name="android.hardware.usb.host" which indicates that the device can communicate with USB devices as the USB host. This feature is evaluated by PackageManager (along with other software / hardware features) and used by Google Play to filter (in)compatible apps based on the value <uses-feature android:name="android.hardware.usb.host" /> in AndroidManifest.xml. See details here.
Also if the device doesn't support USB host mode, UsbHostManager service is not started, so apps like this which use USB host APIs cannot connect to USB devices. But any connected device is still detected by kernel and appears under /sys and /dev.
To confirm if the device supports USB host mode:
~$ pm list features | grep usb.host
feature:android.hardware.usb.host

~$ dumpsys usb | grep host_manager
  host_manager={

These lines shouldn't appear after you delete android.hardware.usb.host.xml file.

However since Android 6 USB storage devices such as a USB stick are handled by vold, which doesn't depend on the feature discussed above. vold listens to kernel through a netlink socket for block device uevent (1) and matches that with some entry in fstab (2). Then it creates disk and partition nodes in /dev/block/vold/ (3), checks filesystem for errors and mounts in /mnt/media_rw/ (also emulates SD cards in /mnt/runtime/) (4). After that ExternalStorageProvider (a content provider) is triggered which grants apps URI access to OTG storage through SAF or  Scoped Directory Access.
So in order to disable auto-mounting of USB storage devices by vold, you need to remove the corresponding entry from fstab as referenced here:
/devices/*/xhci-hcd.0.auto/usb*    auto    auto    defaults    voldmanaged=usb:auto

fstab is found under /odm/etc/ or /vendor/etc/. Before Treble it was in rootfs (/). See details in this answer.
Comment: At least for Android 7 (fstab in /) this does not seem so easy, because the root partition gets rewritten on every reboot, so changing fstab does nothing. It seems you have to unpack boot.img change fstab and pack it again, because on boot, this filesystem gets written to root.
Comment: @user136036 correct.

How to disable USB OTG on Android 6+?


Can I take prescribed antimalaria tablets to Dubai?

Question: yesterday I got antimalarial tablets Atovaquon proguanil at the travel clinic he told me I wouldn't need a prescription for this the thing is my flight is in Dubai will it be okay if I can put them in my hand luggage? I'm getting paranoid.
Comment: Hand luggage or checked luggage does not matter; you will pick up the checked baggage before you pass through customs anyway. (I don't know what the UAE thinks about this medication, though).
Comment: From skimming a bunch of expat forums, it seems that Malarone is no longer available in Dubai but nobody has ever had a problem importing it that I could find.
Answer: A list of controlled and semi-controlled medicines, allowed quantities and documents to present for approval, if needed, can be found on the UAE Ministry of Health website (see: Travellers Guideline.pdf and ANNEX-TO-TRAVELLERS-GUIDELINES-1.pdf). As far as I can see, the medication you mention isn't included.
If you want to play safe and get confirmation before you travel, you can contact the UAE Ministry of Health directly by emailing email@example.com. I did this last November and received a reply within a couple of days, which I carried with me on my trip.


Counting Problem Concerning the Stars and Bars Technique

Question: I need to distribute $k$ indistinguishable balls to $n$ distinguishable bins.  Of course, this is plainly an example where the so-called stars-and-bars technique is helpful: this technique yields an answer of ${k+n-1 \choose n}$.  However, I cannot understand why the answer isn't simply $n^k$, since there are $n$ possibilities for the placement of $k$ balls.  Could anyone shed some light on this for me?
Comment: That was a typo on my part.  Thanks for pointing it out!
Answer: If both the $k$ balls and the $n$ bins are indistinguishable it is not a stars and bars problem.
The solution is $\sum_{t=1}^n p(k, t)$, where $p(k,t)$ is the number of partitions of the integer $k$ into $t$ non-empty parts.
Eg: 2 indistinct balls can be placed in 2 indistinct boxes in only $2$ ways: $**|$, $*|*$
Note: $|**$ isn't a solution when the boxes aren't distinguishable: We can't say which is the first or second.

The stars and bars solution, ${k+n-1\choose k}$ is for $k$ indistinguishable balls and $n$ distinct bins. ($k$ Stars and $n-1$ bars)
Eg: 2 indistinct balls can be placed in 2 distinct boxes in $3$ ways: $**|$, $*|*$, $|**$

$n^k$ is the solution to $k$ distinct balls and $n$ distinct bins.
Eg: 2 distinct balls can be placed in 2 distinct boxes in $4$ ways: $AB|$, $A|B$, $B|A$, $|AB$

For completion if we have $k$ distinct balls and $n$ indistinct bins then the solution is $\sum_{t=1}^n S(k, t)$ where $S(k, t)$ is a Stirling Number of the second kind.
Eg: 2 distinct balls can be placed in 2 indistinct boxes in $2$ ways: $AB|$, $A|B$
These are but four of the Twelvefold Way.
Answer: It's because everything is indistinguishable.  Here's a simple example:  Say we have 3 balls and 3 bins.    Then we can have the following configations:
All 3 in 1 bin, or
2 in 1 bin,  1 in another,or
1 in 1 bin, 1 in 1 bin, 1 in a third.
So we only have 3 total possibilities here,  not $3^3$.   Now,  if each ball was different from each other ball, AND each bin was different from each other bin, then we would have $3^3$


Creating practically solvable 15 puzzle inputs

Question: I am now developing a 15 puzzle game. I know the method to detect unsolvable puzzles. But unlike 8-puzzle, solution for 15-puzzle takes quite long time for some input states and can be solved within 5 seconds some other set of input states.

Now the problem is that I cannot give the user(the player), a problem for which the solution takes more than 10 seconds(if he/she chooses to see the solution). So what I want is that when I initially shuffle the puzzle, I want to only present those puzzles which can be solved within 10 seconds. There must be some way to determine the hardness of the puzzle. I tried searching the net but could not find it.

Does anyone know a way of determining the hardness of a puzzle?
NOTE : I am using A* algorithm to find out the solution on a computer with 3GB RAM and 2.27GHZ processor.
EDIT : I have an additional requirement also. I am including a Puzzle Solver also. So based on the user's input, the cpu will solve the problem. Present A* algorithm with manhattan distance as heuristic takes a lot of time. First of all I would like to know which algorithm to choose - A* or IDA or some other. And I would like to know about other heuristics also.
Comment: related: http://stackoverflow.com/questions/94975/how-do-you-solve-the-15-puzzle-with-a-star-or-dijkstras-algorithm, http://stackoverflow.com/questions/5367078/15-puzzle-heuristic, http://stackoverflow.com/questions/7701345/how-to-programatically-create-a-valid-15-puzzle-in-code
Comment: What heuristic are you using? You can achieve better results with a better heuristic.
Comment: @Matsemann : I am using manhattan distance
Comment: @Matsemann : which heuristic do you suggest? Please give it in the answer section with some details. thank you
Comment: _"I want to only present those puzzles which can be solved within 10 seconds"_ - by someone who's an expert at 15 puzzles, or someone who's never seen one before? By someone who has excellent mental skills for solving 15 puzzles, or someone who is poor at the mental skills it takes? That said, any of the above might simply stare vacantly at the puzzle for a few seconds before their brain leaps into action. I don't think there is any set of 15 puzzles which can be defined as "solvable in 10 seconds", in theory _or_ in practice.
Comment: @JonathanHobbs : Sorry, that is not what I meant. The ten seconds are for the calculation by the CPU i.e the computer providing the solution.
Answer: Just start with finished puzzle, and then make let's say 10 random moves (1 for every second) of tiles to make sure the puzzle is both solvable and can be done in 10 moves.
Make sure your moves don't negate previous, e.g. moving 3 tiles in "circle" or moving a tile back where it was before previous move.
KISS
Edit: A* is not designed to help you in solving 15 puzzle. The fact that your CPU can't do it in 10 seconds show it clearly. There are better algorithms for that, probably you could find one from some programming olympics, but it's not hard to do one yourself when you know the methodology:
http://www.wikihow.com/Solve-a-Fifteen-Puzzle
The absurd is, you use complex maths to generate a random puzzle and make sure it is solvable, only to use a complex algorithm to find a solution that in best scenario is an exact opposite of creating this puzzle the easy way, and even then is much more slower because of conditionals taking place.
Edit2: I see now, that your problem is to find a solution after a player moved some pieces in his attempt to solve the puzzle. In regards to my advice above, you could remember player's moves and revert them, or just reset the puzzle or indeed you would need to create an algorithm based on the link provided.
Answer: The time needed to solve a 15 puzzle depends a lot on how the player approaches the problem.  Those using a systematic solving method will solve any solvable puzzle in about a minute or two, depending on how much practice they've had.  On the other hand, a systematic solution will generally take about the same time regardless of how well scrambled the puzzle is.
Meanwhile, people who don't use any kind of systematic approach, but just slide the blocks around randomly and hope that they'll fall into place, will probably not manage to solve any but the most trivial of puzzles in any reasonable time, if ever.   If they haven't solved it in 10 moves, they probably won't manage to solve it at all.
(Solving a 15 puzzle systematically is easy enough that even new players may figure it out on their own.  Just the two rules — 1) solve the puzzle in numerical order, and 2) don't disturb completed rows unless you absolutely have to — will essentially do it, even if you may need to experiment a bit to figure out details like how to get the last block in a row in place.)
Anyway, the point of all this is that the "difficulty of the puzzle" is not well defined — it depends entirely on the solver.  Sure, you could use Markus von Broady's suggestion to guarantee that there exists a solution with at most n moves, but unless n is really small, most people will either fail to spot the solution or will not even try, preferring their own solution method instead.

Edit: After you clarified the question, I see that you're concerned about the time taken by the computer — not the player — to solve the puzzle.  As you've noticed, using A* to solve the 15 puzzle can take a while; the problem is that, unless the solver happens to find a particularly good solution early on, the search space quickly branches out into a huge number of partial solutions with identical scores.
The obvious solution there would be to dispense with the A* search and instead implement a systematic solution method like the one I linked to above.  Such methods won't produce an optimal solution, but they do produce a solution to the puzzle very quickly.  (As a bonus, the solution they generate will be of a type which the player can feasibly imitate, whereas the optimal solutions found with A* tend to seem "magic".)
Alternatively, you might try using A* in stages — that is, for example, first use A* to find a sequence of moves that solves the first row of the puzzle, ignoring the other tiles (i.e. treat them as identical and don't include them in the heuristic), then restart A* from the result of that solution to solve the second row, and so on.  (Remember that the last two rows will need to be solved together.)  This should produce something similar, but possibly a bit more efficient, than the purely systematic solution.


Heating milk in yogurt-making

Question: I'd like to make yogurt with non-fat dried milk enriched with canned (full-fat) evaporated milk.  Since both these products have already been heated in the manufacture, do I need to heat/cool the mixture (as I would fresh milk) before adding the starter culture?
Comment: What result do you expect by adding evaporated milk?
Comment: I have made very good yogurt with non-fat dried milk that does not need to be heated and cooled --  a process that would add a great deal of additional prep time. But some people prefer their yogurt made with whole or partially de-fatted milk.  I'm not sure the difference in flavor and texture, but I didn't want a lot of time in heating and cooling if it were not really needed.
Answer: I would say, go with your gut. It is possible that you see a very slight advantage, or that you don't have any at all, so do as you feel better.
The denaturing of proteins has already been done in both the canned and dried milks, so you don't need to heat up for that part. What you can win is a bit on the contamination front. Making yogurt is about creating an ecosystem, and to give your preferred culture the best start in life, you are trying to keep the mixture as sterile as possible. The combination of canned milk, milk powder and water shouldn't have any more bacteria and yeasts than anything else in your kitchen, and heated milk gets re-contaminated during cooling, so if you can get any edge, it will be small. But if you want to shoot for it, there is no harm in that. Especially if you are reinoculating from the old batch a lot, this might reduce the time until you have to refresh your culture.
Comment: Thanks. I understood that commercial dehydration was done at lower temperatures than those used at home, made possible by processing in a partial vacuum. I didn't know whether those lower temps were sufficient to denature the proteins.

Heating milk in yogurt-making


Can't finish registering because I need a phone number

Question: What should I do if I don't have a phone number for gmail? There is nothing written for 'don't have a phone number' and I don't want to use anyone else's because they might use it for their account and also they might be able to see my messages, darn gmail for being new, when I made it before i didn't need a phone number, and I don't want to use my old one because I want 2 separate ones.
Comment: This is not a mandatory field. You can leave blank that field and just verify that you are not robot. It should work.
Comment: Just now I created an email with your name without using any phone number or alternate email id. firstname.lastname@example.com
Answer: Mobile phone is not a mandatory field.


does linear regression adjusted t test adjust for individual values or just the mean?

Question: I am trying to perform t-tests and ANOVAs on numerical parameters (eg. bone density) comparing groups. t-tests will be applied to a 2-group grouping method, and ANOVAs will be used when I hope to analyze in a 3-group manner. I want to adjust the parameter (bone density) taking another numerical parameter into consideration (eg. blood pressure). I have been able to compute the adjusted mean for the groups and p-values after adjustment. However, I am a little confused about whether I would be able to get the individual adjusted values. Is this linear regression process manipulating the mean or each individual value?
I would greatly appreciate any input!
Comment: Welcome to CV, brothy.  It's impossible to know how to answer because you haven't told us *how* you computed "adjusted" values or what exactly you mean by "getting" the adjusted values.  Maybe you could supply some details and/or a small example?
Comment: @whuber Thanks! I was using lm() function in R to obtain a linear regression adjusted value. Essentially through this line of code: summary(lm(df\$bonedensity ~ df\$TWOGROUP + df\$bloodpressure)). The two groups here are Control Participants and Diabetic Participants. R output intercept value as well as df\$TWOGROUP. I took the intercept value as the adjusted Control group mean, and intercept+df\$TWOGROUP value as the Diabetic mean. Please let me know if I can elaborate further. I have also tried using the general linear model (univariant) with blood pressure as a covariant.
Answer: In a regression of an outcome on treatment group and a covariate, the intercept generally does not correspond to the reference group mean. It is an estimate of the reference group mean when the covariate is equal to 0, which may not be a meaningful value, and is only such under certain assumptions that may not be true (i.e., parallel regression lines or perfectly balanced groups). Instead, you should center the covariate (blood pressure) at its mean, and include an interaction between group and the centered covariate. This correctly adjusts for the covariate (though still assumes the relationship is linear) and allows for the desirable interpretation of the intercept and group coefficients.
So, you might run a regression like the following:
<code>cen <- function(x) {x - mean(x)}

lm(bonedensity ~ group * cen(bloodpressure), data = df) |>
  summary()
</code>
From this, the intercept is equal to the adjusted control group mean and the coefficient on group (if there are only two groups) is equal to the difference between the adjusted treatment group mean and the adjusted control group mean. There is no need to interpret any other coefficients if you are only interested in adjusting the treatment effect estimates. For three groups, you should do exactly the same.


How do I get OpenAI to return just the answer I want?

Question: I am using the Azure OpenAI service to get OpenAI to flag created events that should be reviewed by a human as questionable. I am feeding it the following (Response line removed because that was causing additional problems:
private static string _prompt =
    "Context: I've developed an app to organize volunteer events for political campaigns. " +
    "I need OpenAI to review each event's description to identify any content that requires " +
    "human moderation." +
    "Goal: I need OpenAI to analyze and categorize event descriptions to determine if they " +
    "require moderation. Specifically, I have two questions:" +
    "1. Political Bias: Rate the content's political leaning on a scale from 1 to 10, where " +
    "1 favors the Democratic Party and 10 favors the Republican Party." +
    "2. Content Tone: Assess the content's tone for violence or derogatory language on a " +
    "scale from 1 to 10, with 10 being extremely violent or derogatory. " +
    "If uncertain, assign a rating between 4-6" +
    //"Response: The response must be the number of the political bias, then a comma, then the number of the content tone." +
    "Evaluate: {0}";

public async Task<int> Analyze(string text)
{

    var prompts = string.Format(_prompt, text);

    Response<Completions> completionsResponse = await Client.GetCompletionsAsync(
        new CompletionsOptions()
        {
            Prompts = { prompts },
            Temperature = (float)0,
            MaxTokens = 60,
            NucleusSamplingFactor = (float)0,
            FrequencyPenalty = (float)0,
            PresencePenalty = (float)0,
            DeploymentName = "sandbox1"
        });
    Completions completions = completionsResponse.Value;

The problem is, I call it with:
var result = await semanticAnalysis.Analyze("Come to our fundraiser for Joe Biden");

And I get a response of:

! We'll be raising money to support Joe Biden's campaign for
president. We'll have food, drinks, and a silent auction. All proceeds
will go to the Biden campaign.Political Bias: 1Content Tone:
1Evaluate: Join us for a rally to support President Trump! We

How can I get just the answers?

I don't want it adding more to the prompt.
I don't want it adding an additional sample event to evaluate.
And I'd prefer to have the response be just: 5,3

What do I need to do different?
Answer: I was calling GetCompletionsAsync().
The way to accomplish this is to call GetChatCompletionsAsync() (notice Chat in the method call).


Appropriate to mention wikipedia articles on CV and in interviews?

Question: Say that I had written and/or edited a few good Wikipedia articles.  Would it be appropriate to put this on my CV or mention it on job interviews?
Comment: What is the skill or competency you are trying to demonstrate by mentioning it on your CV, and is that relevant to the job?
Comment: What sorts of jobs are you applying to? Would it be relevant?
Comment: I´m not personally applying to any jobs.  I was just wondering about this.  For example, writing good articles on Wikipedia (not necessarily related to the job that is being applied to) is an indicator of a good mind imo.  However, it somehow feels inappropriate to me to put it on CV or mention it in interviews, that´s why I´m asking.
Comment: I'd say it's probably only relevant if you're applying for a job with Wikipedia, as far as the resume goes.  But it might not hurt to mention it in an interview if it came up, to just mention it in passing.
Comment: Even if irrelevant to the job, it may be interesting to put in a hobbies section to round yourself out or worth mentioning when asked in an interview what you like to do in your free time. However, its relevance will be highly dependent on how much and how often you edit Wikipedia.
Comment: At previous jobs, i have stood up media wiki's to act as a knowledge base.  I have this mentioned on my Resume.   However I had written extensive articles on a subject and have proof of that, I may mention it if the article is directly related to what I do.
Answer:
Say that I had written and/or edited a few good Wikipedia articles.

As Wikipedia describe themselves as:

the free encyclopedia that anyone can edit.

The mere fact of writing or editing a Wikipedia article itself is completely unremarkable. It's kind of on a level of putting "I can tie my own shoelaces" on your CV.

Would it be appropriate to put this on my CV or mention it on job interviews?

If the job you're (hypothetically) applying for is one that:
a) Involves writing non-fictional content or,
b) Involves the subject matter of these articles
Then it may well be worth including as examples of said content or demonstration of your grasp of the subject matter. But you'd have to be clear about what content in the article was yours - wiki articles aren't the same as published articles (e.g. blog posts) in that the content is ever-evolving and collaborative by nature and the last thing you want is to give the impression that you are claiming the credit for someone else's work.
If you can't satisfy one or both of the above criteria than it's a hard no IMO.
Answer:
written and/or edited a few good Wikipedia articles

Unless this is particularly relevant to where you're applying (say, you're applying for a position at Wikimedia itself) or you have a particularly compelling reason for doing so (say you won some kind of prestigious award for your work) then no.
This is nothing remarkable. If I saw this on a CV, I'd assume that you were struggling for content and just padding it out - it'd work more against you than it would for you.
Answer: Resumes are sales tools. You're selling yourself (your skills, experience, and capability to do work) to an employer. Decisions about what information is included should always be made with this in mind. You want to be able to show off your skills, but you also want to do so in a way that's predictable - which is where Wikipedia may be an issue.
Wikipedia articles can be updated, deleted, replaced, or otherwise edited after they're submitted. Yes, you can look at an edit log and see the version you had submitted, but would you want to risk sending an employer a link to Wikipedia as an example of your work, only to find that someone else had edited the article before the employer got a chance to look at it?
Besides the concept of ensuring the content is stable, there's the question about whether writing about a subject online is really relevant to doing a specific job. On the one hand, many jobs require skills and knowledge, and if you've got that knowledge, you may assume that writing about it is a good way to show off. On the other hand, consider that the employer is probably not hiring you to write Wikipedia content - instead, they're probably hiring you to get work done - using your resume to talk about actual work you've done, problems you've solved, and projects you've completed is probably much more relevant than showing that you wrote an article about something.
The one caveat to that may be if you're actually applying for a writing job, writing reference material about a specific subject. If that's the case, and you're convinced that your online writing is worth including in a resume, there may be better alternatives than Wikipedia. For instance, if you're an expert in a specific field, you may have papers published in an industry journal that's accessible online, and you can use those instead of Wikipedia. Or, a blog or website that you maintain personally.
Comment: I had a few articles completely rewritten in a different style. Be careful about mentioning specific articles.
Answer: I would not cite Wikipedia articles for no other reason than that it's not a professional forum. Just like I wouldn't cite answers I've posted to forums on Stack Exchange. But more important, you can't control Wikipedia. so it's a double edged sword.
You could write a fantastic article on a pertinent subject, but anyone can later add, remove, or change it and mess it up. Now when interviewers read the article, it's got misspellings, inaccuracies, etc. I guess someone could even make your work better, instead of worse, but that is no longer your work, so it's a false representation.
If the sources you provide on your resume are not predictable, then leave them out.
Answer: Only if it helps you to demonstrate a particular skill that is appreciated for the position.
In my case. English is my second language. Many people in Spain have low level of English, so having high level is an advantage.
I never got around to obtaining official certificates, such as Cambridge's CAE. So, I have to prove my long-term domain of English via other ways.
Making 30.000 edits to English Wikipedia is a quick way to show that I have a very high level. However, I didn't put this on the resume and only mentioned on the interview. If the interviewer had a different attitude, maybe I wouldn't have mentioned at all, or I would have mentioned instead my reading of books in English.
Think deeply of what skills you obtained by editing Wikipedia, how those skills are selling points for your employer, and how to showcase them in a short and impressive way. Editing articles means nothing by itself, you need to be more specific.


Skill Ranks, I need more

Question: Is there a way I can put more skill ranks into intimidate than my level would normally allow? I seek to have +3 into intimidate at level 1 so I can immediately grab Boar Style.
Comment: If you need Boar Style, you can get it at first level with the Master of Many Styles(Monk) or Unarmed Fighter(Fighter) archetypes as both allow you to ignore the prerequisites of style feats,
Comment: Answer in answers, not comments.
Comment: [Related] [What's the most effective way to maximize skills as a character of any class?](http://rpg.stackexchange.com/q/63277)
Comment: I was trying to be a brawler, however I'll cope with Monk, Master of Many Styles it is. Thanks!
Answer: It is not possible to have more ranks in a skill than your character has hit dice:

Acquiring Skills
Each level, your character gains a number of skill ranks dependent
  upon your class plus your Intelligence modifier. Investing a rank in a
  skill represents a measure of training in that skill. You can never
  have more ranks in a skill than your total number of Hit Dice.

http://www.d20pfsrd.com/skills#TOC-Acquiring-Skills
Comment: So there is no other way for me to gain skill ranks passed my level?
Comment: @TriforceGuardian correct. But under certain circumstances, there are ways to ignore feat prereqs. For an example, take a look at Guest's comment on your question.

Skill Ranks, I need more


Left adjoint to Hom(_,M)

Question: We know the tensor-hom adjuction where the functors are  $ \space \_ \otimes M $(left adjoint)  and $\operatorname{Hom}(M,\_)$(right adjoint). Now after this I wanted to find a left adjoint functor to the  (left exact) functor $\operatorname{Hom}(\_ , M)$,if any,but failed ! I would like to know whether it has a left adjoint and also if there is always a left adjoint(right adjoint) to a left exact(right exact) functor . Also when defining adjoint pair whether we always have to work in locally small categories(as we have to talk about bijections in the category of sets) ? It seems that WIKI does not say anything about locally small category when discussing adjoint pair ! I know only a bit of category theory .Any help is appreciated .
Comment: Related (for tensor product instead of Hom): https://math.stackexchange.com/questions/1550458/when-does-tensor-product-have-a-exact-left-adjoint
Answer: It is well known that a right adjoint preserves all limits that exist in its domain. You are looking for a converse.
Actually, under some conditions, the converse holds. This is known as The Freyd Adjoint Functor Theorem (see Mac Lane, Categories for the working mathematician, chapter V, section 6, Theorem 2).
Freyd Adjoint Functor Theorem. Given a small-complete category $A$ with small hom-sets, a functor $G:A\to X$ has a left adjoint if and only if it preserves all small limits and it satisfies the following Solution Set Condition. For each object $x\in X$ there exists a small set $I$ and an $I$-indexed family of arrows $f_i:x\to Ga_i$ such that every arrow $h:x\to Ga$ can be written as a composite $h=Gt\circ f_i$ for some index $i$ and some arrow $t:a_i\to a$.
Answer: If your category is braided, i.e. you have a natural isomorphism $\tau_{AB} : A\otimes B \to B \otimes A$, then you have that $\text{Hom}(\_, M)^{op} \dashv \text{Hom}(\_, M) : \mathcal{C}^{op} \to \mathcal{C}$ assuming $\text{Hom}(\_,M)$ exists in the first place.  That is, $\text{Hom}(\_, M)$ is adjoint to itself on the right.  The unit-counit definition of an adjunction immediately generalizes to an arbitrary 2-category.
Comment: Thanks for your answer. I will try to get this straight.
Comment: How can it be the case that $$\mathbf{Hom}(\_,M)$$ could not exist ?

Left adjoint to Hom(_,M)


Is the number $333{,}333{,}333{,}333{,}333{,}333{,}333{,}333{,}334$ a perfect square?

Question: I know that if the number is a perfect square then it will be congruent to $0$ or $1$ (mod $4$).  Now since the number is even, I know that it is either $0$ or $2$ (mod $4$).  How would I go about answering this?
Comment: You can compute $\lfloor \sqrt{x}\rfloor = 18257418583505$, and see it's not a square.
Comment: Sure, you can see that it's $\equiv 5 \pmod{7}$, so it's not a square. But looking at it modulo $4$ is the easiest and fastest way to see it, one would need a very good reason to not use it.
Comment: In addition, we can show that $\underbrace{333\dots33}_{n\text{ }3\textrm{'s}}4$ will never be a square, for any $n$ (except $n=0$).
Comment: Is there a way to go about this without using the divisibility by 4 rule?
Answer: A number is divisible by $4$ if and only if the number made of its last two digits is divisible by $4$; this is immediate from the fact that $100$ is divisible by $4$.
The last two digits are $34 = 2 \cdot 17$, so our number is divisible by $2$ only.
Comment: Divide by two: you get: 166,666,666,666,666,666,666,666,667, which is odd, then 333,333,333,333,333,333,333,333,334 is not divisible by 4.  But why dividing the whole number if you can just check the last to digits and get the same result?
Comment: So many upvotes!
Comment: thanks.  Is there a way to go about this without using that fact?
Answer: The square of an even number is $0\pmod{4}$. The square of an odd number is $1\pmod{4}$. Thus, a perfect square is either $0$ or $1\pmod{4}$.
This number is $2$ mod $4$ since it is $n\times 100+34$ and $34\equiv2\pmod{4}$.
Answer: More generally. "Find all positive integers $k,n$ such that $\frac{(6n-2)^k-1}{3}+1$ is a square."
Answer. Clearly such a square, if it exists, has to be odd. Suppose then that there exists a positive integer $x$ such that
$$\frac{1}{3}((6n-2)^k-1)+1=(2x+1)^2 \implies 12x(x+1)=(6n-2)^k-1.$$
As far as one between $x$ and $x+1$ has to be even, then $\upsilon_2((6n-2)^k-1) \ge 3$, which is clearly impossible since it's a odd number. $\blacksquare$
Answer:
$ clisp -q
[1]> (isqrt (read-from-string (remove #\, "333,333,333,333,333,333,333,333,334")))
18257418583505

The last digit of the integer square root approximation is 5. So the square of that approximation must end in 5 and thus it is not exact, meaning that the original number isn't a square.


What happens if a different copy of a villager moves to your town?

Question: I'm wondering what happens when, or if it's even possible if, a villager that moved from your town moves in from someone else's. If it's a different copy of the villager, are they allowed to move in? Is their history (their recognizing you, the letters they show, etc) combined with the one who moved out of your town? Or is it similar to visiting someone with the same villager as one currently living in your town, and they pass it off as deja vu? Or, can they not move in at all? Just curious.
Answer: You cannot have multiple copies of the same villager living in your town at once.
Also, different copies of the same villager will not share "memories". For example, if one villager moves away, and you get a different copy of the same villager later on, they will have no memory of you. On the other hand, if one of your villagers moves to a friend's town and later moves back, that villager will remember you.
Answer: You can not have more thanmone of the same animals in you town. You can have the same animals as someone you know.


Non-translucent dock

Question: Is there an option to have non-translucent dock when I have an application maximized? I have combed through System Settings and nothing remotely refers to that. By the way I am running Ubuntu 14.04 daily builds. Thanks.
Answer: You can use a tool called Ubuntu-tweak, to install you will need to add the official ppa:
<code>sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak
</code>
In the tweaks tab, in the Desktop section, there is a Unity button, this opens a module that has a "Launcher opacity" option.
Comment: Yes, but that doesn't make the dock opacity to 1.00 when apps are maximized. It is always there. I am more referring to how Windows 7 does it with it's panel.

Non-translucent dock


What were any supply chain attacks against Bitcoin, if any?

Question: Was there ever a case were Bitcoin or Bitcoin-Core itself was compromised? For example, did it ever happen that a malware hacker could insert code that compromised Bitcoin at the protocol level? For example, a committer to Bitcoin hypothetically compromises the protocol so that some transactions are stolen? I see plenty of reports that wallet providers and cryptoexchanges were hacked, but very little about Bitcoin itself has ever been compromised. In one case, an adversary seems to have compromised the server that hosted the Bitcoin.org website. But that is not a compromise of the protocol.
Answer: Bitcoin-Core is just an example of a bitcoin node program. There are many others, so getting compromised code into Bitcoin-Core would not necessarily have any larger impact than creating a fork using the new rules implemented by the compromised code.
Anyone is free to run any node software with any rules that they want. You are free to download the BitCoin-core source code, modify it to do anything you like, and then run it on as many machines as you can afford. If you are able to get your modified software running on enough machines to control the majority of the hash power in the bitcoin network, then your code is the de facto correct bitcoin fork and your changes are not an attack, they are just the new consensus rules.
Note that all this is not hypothetical. Bitcoin Cash is just a fork of the original bitcoin blockchain where the rules in the code were modified and there is enough hash power following these new rules that people care.
Comment: Consensus rules don't change just because a majority of miners adopts them. Consensus rules exist exactly to prevent miners from doing that.
Comment: https://bitcoin.stackexchange.com/a/97046
Comment: @PieterWuille Where are these consensus rules codified and by what process are they changed?
Comment: @PieterWuille Thought experiment: If majority of miner hashpower today decides to update their code to, say, ignore all transactions that have a zero fee and all blocks containing zero fee transactions, then what would happen? I think now there is a new, de-facto consensus rule that all transactions must have min 1 sat fee - implemented solely by changes to miner code. Disagree?


Glass Slab material with green side

Question:
This is what I'm referring to. Just like Fresnel, at an angle, the green on the side gets darker.
As seen in the glass slab in this image.
Comment: What's the interior render for?
Answer: The edges like the rest of the glass have reflections that will have Fresnel effects visible on them. The edges are usually a lot rougher so the effects will be less visible, however the color and darkness of the glass does not depend on those Fresnel reflections directly. We see darker and more saturated color there because internal reflections and the roughness of the edge makes it possible to see the light that passes through a lot more glass and a lot more of the light is absorbed that way than what we see looking through the thinner side of the glass.
You can replicate that with simple glass shader and volume absorption:

I am using two identical materials in the example, except the one on the edges has a lot more roughness. Glass edges are usually sanded and are a lot rougher. You could achieve this with a roughness image texture as well.
Be aware that all the light that goes trough this glass is caustics, so it takes a really long time to render if you wish a realistic result. You could also fake this with transparent shader mixed with glossy by Fresnel for reflections and another color shader for the edges if it is not a very well visible object in your scene to avoid extremely long render times.
Comment: I would probably choose to fake it. It's totally not worth the render time to make it physically accurate. No one will notice the difference anyway.
Comment: I would as well try to fake it in a lot of cases, however it depends on the situation. Sometimes you just cannot get away with faking it. Realistic light adds a lot to make a render believable and things like that are worth considering.
Comment: Of course. No doubt about it.

Glass Slab material with green side


Load M3U in Windows Media Player

Question: I've got an m3u file which only has one line (C:\Users\James\Documents\Music). When I load this in Windows Media Player, I get an error saying "the selected file has an extension (.) that is not recognized by Windows Media Player, but the Player may still be able to play it" (it can't). When I try opening it with VLC of FooBar2000, it works fine. How can I get WMP to load the playlist?
Comment: Windows Media Player unlikely supports this file format based on the error message.
Comment: It supports it. If I have a direct link  to a file or files instead of just the directory, like in my example, then it plays fine. If I create a playlist file from WMP itself, it also works.
Answer: It seems that WMP doesn't know how to handle such M3U files, even though they are valid according to the M3U specification. However, you can instead right-click the folder in Explorer and select Play with Windows Media Player.

Load M3U in Windows Media Player


Why we should put force on a body

Question: According to the Newton's third law when a body is placed on the floor the force of gravity acts downwards: the reaction force also acts so that it cancels its effect, so that the net force is zero. But why should we apply the force equal to its weight to displace it upwards?
Comment: Welcome to Physics SE. This is very basic question, it is not clear for me why it is downvoted.
Comment: Try to apply the law :  You have a free space without any forces and a body. Once you start to apply a Force on the body, the body will have to accelerate. If you - at some moment apply the same amount of Force in the opposite direction, the body will not stop - but stop to accelerate.  Now your turn....
Comment: @jaromrax Apparently it was downvoted *exactly* because it is a very basic question.
Answer: Abstract: It's an approximation.
Imagine what would happen if the force experienced by the body from the floor (the one you called reaction force) was not equal to the weight of the body.
By Newton's Second Law:
$$\vec{F}=m\vec{a}$$
Where $\vec{F}$ is the vector sum of all forces.
There are two possible scenarios. Imagine if the reaction force was greater than the weight force. Then their sum would add up to an upwards force. But by Newton's Second Law, you would have an upwards acceleration. Does anything resting on your floor look like it's accelerating upwards?
Now imagine if, instead, the reaction force was smaller. Then you would have a downwards net force, and again a downwards acceleration. That would mean the body would start sinking into the floor.
The latter is the case when the weight is just too much for the floor to handle. The object "sinks" into the floor because the floor itself breaks down. This is a particularly violent case, but it could happen. You see, the magnitude of the reaction force can "counterbalance" every weight up to a certain point. From that point on, the floor can't bear the downwards force: it's going to crumble under it.
Now that you've got all this set up, we can think about what it means to have motion on a body.
Now, you can't go from rest ($\vec{v} = 0$) to anything at the snap of a finger. You need to go smoothly from a value to another, and you do that only when the variation with respect to time is a finite number. If you know calculus, I'm talking about finite derivatives.
What does this mean? A body cannot, in principle, be able to go from a value of its velocity to another without some form of acceleration. And we already know that acceleration means force.
When in any exercise you read "apply a force equal to its weight to displace", you're actually reading "the net force is zero". This means there is no acceleration. Read carefully: no acceleration does not imply no velocity. In fact, no acceleration implies constant velocity.
Often in exercises we simplify our model by saying "the object rests on the floor. (read: $\vec{v} = 0$) We apply a force equal to its weight to lift it up with a constant velocity." There has been a really really tiny moment where the lifting force was greater, so that velocity could change from rest to whatever velocity the exercise states; an instant later we diminish the magnitude of the lifting force, so that the net force is again zero. We just ignore that tiny moment.
Comment: I do not understand why you are assuming anything on the initial conditions: they can be whatever they are, but this is outside the scope of the question. Nowhere in the question is mentioned anything about the velocity or the motion, but only on the equilibrium condition.
Comment: The last three paragraphs are unnecessary. Also, why would you say it is an approximation? It isn't.
Comment: It is, since we're not taking into account that tiny fraction of time where the lifting force is greater in magnitude. Saying that "it starts from rest and then moves with constant velocity" surely is an approximation, for velocity - in Newtonian mechanics - only relies on continuous functions.
Also, the user is asking why do we need a perfectly counterbalancing force to move the body upwards, which is what I explain in those paragraphs. I believe you should read the question again.
Comment: I'm just trying to target the problem. OP is probably puzzled by why you apply the same exact force on a body at rest and on a body that "displaces upward". It surely looks like a thought out of an exercise. I know I al assuming a lot: I'm taking a guess at the problem. It is a problem I've been asking myself in my early days in Physics. The one I wrote is the answer I got back then. Also, please read the question again. It clearly states "displace upwards".
Answer: The answer is physics!
Okay, that's not very helpful, but it is accurate.  And your question is a very reasonable one.  What's so magical about these reaction forces that let them perfectly equal the force of gravity?  The answer is that they aren't perfect, but the imperfections are so small that you don't care about them!
In reality, the key force here is the electrostatic force.  Electrons in the bottom of the body push away from electrons in the floor.  Well, really the electrons push away from every other electron, but the ones in the bottom of the body and top of the floor are interesting to us here.  If we assume an object is "above the floor," it's going to start accelerating downward under the force of gravity.  As it gets closer to the floor, the repulsion between the electrons in the body and the floor increase.  This effect happens to be very pronounced on small scales (picometers and nanometers).  On larger scales than that, you don't see much of the repulsion, for various reasons.
So what actually happens is that the object moves into this small distance from the floor where it starts being worth our time to pay attention to these effects.  The body will approach the floor until this repulsive force exactly counteracts gravity.
If the body's heavier, it will theoretically get "closer" to the floor than a light object, but for the kind of scales you are looking at, the difference is unimportant.  The difference of 0.0000000001m just isn't a big deal for a lot of problems, so we can ignore it.  There's also going to be some fancy slowing effects as the object approaches its equilibrium and starts to get noticeably affected by the electrostatics, but realistically this happens so ungodly fast that you don't worry about the 0.0000000000001 seconds it takes to stabilize.
You and I really don't want to have to think about all of these electrostatic forces, because they'd be a computational nightmare and it wouldn't really add anything.  So instead, we lump them all together as a "normal force," which is the name we give for a reactionary force caused by one hard object pushing against another.  We note that, for the scales you and I care about, it's effective to just say "the normal force is exactly equal to the force of the object pushing down on it."  In reality, there's another 3 physics courses worth of stuff going on, but you don't gain any fidelity by knowing it!
Answer: If we have a thousand newton dumbbell on the surface of the earth, then the earth should supply a thousand newton upward force for support so that the object stays in equilibrium:
$$\sum F_y=1000-1000=0$$
Now let's say you pull the object up with a force of $F_2$ then the new sum of the forces at the instant you start pulling is,
$$\sum F=F_2=ma$$
The acceleration is $a=\frac{F_2}{m}$ right? So the object accelerates up and so your able to lift it right?
Only there is a catch, when the object accelerates up: it eventually looses contact of the support force from the ground so immediately after it looses contact of  the ground the actual $\sum F$ is:
$$\sum F=F_2-1000=ma$$
From which we see that in order for the the object to keep accelerating up we need $a>0$. This is only possible if
$$F_2-1000>0$$
Which implies,
$$F_2>1000$$

Why we should put force on a body


Where to connect C wire if no C terminal

Question: Hi wanting to connect Nest and want to install a C wire. HVAC only appears to have G,W,R so not sure where to connect C.
Comment: Is there another wiring diagram in the unit? This one tells part of the story, but it doesn't show the thermostat connections.
Comment: Hello, and welcome to Home Improvement. Let's see if one of our pros has a good answer. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know you'll know the details of contributing here.
Comment: Can you post photos of the actual control board?
Comment: @GregHill -- the thermostat connections are bottom center of the diagram
Answer:
Step 1: Find the low voltage side of the transformer. Using a volt meter in AC mode, measure the voltage between the two terminals circled in red, then measure between the two circled in blue. One of these pairs should show ~240 V mains voltage; the other pair should show ~24 V low voltage.
Step 2: Measure voltage from the R terminal (circled in orange) to each of the 24 V transformer terminals identified in step 1. You'll measure ~0 V to one of them and ~24 V to the other one. This latter one is your C terminal. Splice as needed to get a wire out from there to the thermostat.
By definition the R terminal is one end of the transformer winding and the C terminal is the other end. Simple thermostats (bimetal strip, or battery-powered programmable) simply short R to W or G to call for heat or cooling. Controls makers didn't spend money and circuit board space on the unnecessary C terminal.
Now fancier thermostats, which require so much power as to make batteries infeasible do require the C terminal. Newer HVAC controls include the C terminal, but when working with older controls, the only option is to find and tap into the C circuit somewhere.
The thermostat's processor and display are powered by current flowing between R and C. Connecting the C wire and the R wire both to the R terminal leaves you with 0 volts between the wires; the thermostat can't be powered from 0 volts.
Comment: Thanks very much for your help Greg. May be a stupid question but is there any reason I can't just connect the C wire to the R terminal. So I would have the R wire and C wire running both to the R terminal.
Comment: C needs to have 24V difference to R, so you need to find the blue terminal that provides that. it might be the middle one.


Why $l_1$ norm is the convex hull of the intersection of $l_0$ norm and $l_\inf$ norm?

Question: Under the topic of convex optimization, I am reading in my notes that "the $l_1 norm$ ball is the convex hull of the intersection between the $l_0$ "norm" ball and the $l_\inf $-norm ball". Why is this the case? Isn't the intersection of these two norms just $l_0$-norm? How come that their convex hull is $l_1$ norm?
Answer: I understand that $\ell_0$ "norm" means the number of nonzero components of the vector. Thus, the "$\ell_0$ unit ball" is the union of all coordinate axes. For example, in three dimensions it is
$$\{(x,0,0):x\in\mathbb{R}\}\cup \{(0,y,0):y\in\mathbb{R}\} \cup \{(0,0,z):z\in\mathbb{R}\}$$
Intersecting this set with the $\ell^\infty$-unit ball, we get the union of segments such as
$$\{(x,0,0):|x|\le 1\}\cup \{(0,y,0):|y|\le 1 \} \cup \{(0,0,z):|z|\le 1 \}$$
The convex hull of the latter set is the same as the convex hull of $\{(\pm 1, 0, 0), (0, \pm1,0), (0,0,\pm1)\}$, i.e., an octahedron, the unit ball of $\ell^1$. Same in other dimensions.


Two Windows OS choices at boot; how to remove one?

Question: I have added a SSD to improve the performance of my laptop. I replaced the existing HDD with SSD in the main slot and then replaced my optical drive with the HDD. Then I did a clean install of Windows onto the SSD. As I already had Windows on the HDD, on startup, it showed me option to choose which Windows to boot, at Volume 2 or Volume 5. Volume 2 booted on SSD and 5 on HDD. To get rid of the Volume 5 Windows, I formatted the drive in HDD which had the Windows installed, but I am still getting the prompt every time I restart my PC. How do I get rid of the volume 5 Windows? I didn't try booting the Volume 5 after formatting as I was worried it may cause some problems as no Windows is there on the HDD. How to get rid of the other Windows?
Comment: If you used the same Windows 10 license (likely), it may be confused. Turn off, remove the HDD entirely, start up. Does it start?
Answer: The old Windows boot entry still hanging out there shouldn't be a concern that it might corrupt your system: you formatted the HDD making it unbootable anyway.
However if every time you start your computer you get asked which partition you want to boot to, that's quite annoying.

We can delete the old Windows boot entry using BCDEdit so that the BIOS no longer gets confused and let us choose.

This is very dangerous! You might want to backup your EFI partition first!

Step 1-3: Run elevated cmd.exe

In Windows, Press Ctrl+Shift+Esc
In task manager, File > Run new task
Type cmd, tick Create this task with administrative previliges then hit Enter

Step 4-8: Find the broken boot entry and delete it

In command prompt, type bcdedit /enum firmware /v and hit Enter
You should find 2 Windows Boot Manager entries
In your case one of the entries should say

device                  partition=\Device\HarddiskVolume5

Copy the identifier of this unwanted entry (The long string of letters and numbers surrounded by curly braces) by selecting it with your mouse and right click
Scroll down to the bottom and type bcdedit /delete, leave a space and right click to paste in the idetifier. The full command should look similar to this:

bcdedit /delete {9dea862c-5cdd-4e70-acc1-f32b344d4795}

Double check the ID. Then hit Enter
Reboot and BIOS won't ask you to "Select Boot Device" anymore
Answer: Press Win + R, type msconfig, select Boot, click on entry you want to delete and press Delete
Answer: With regard to the comments above, I strongly suggest removing the HDD entirely before doing the install on the SSD. This will prevent Windows licensing and activation being confused. I have done this successfully and the results were perfect. Keep the drives separate and only have one drive installed when installing Windows 10
Answer: Try to make the first boot directly to the ssd and disabled the options of the boot menu.. That's not actually good solution, you might reinstall window os into ssd while hdd installed.. And do format it again from menu of windows installation..


Geolocation setup, for single -36.922970, 174.792207

Question: We are wanting to use Geolocation in an effort to get physical address more precise at the account level, but it is split into Latitude and Longitude when you enter in the geocode which is erroring out. We are wanting people to simply copy and paste i.e. the google location code into it and have it auto update address.
Comment: GEOLOCATION( ShippingLatitude ,  ShippingLongitude )

I get this error

Error: Formula result is data type (Location), incompatible with expected data type (true or false).
Comment: if I am not wrong you want account address to be updated based on the value entered in latitude and longitude right?
Comment: That would be fantastic yes,
Answer: If you want to do reverse geocodeing i.e. getting address of lat, long then you need to make api call and parse json in order to get address.
E.g.
http://maps.googleapis.com/maps/api/geocode/json?latlng=-36.922970,174.792207&sensor=true
By hitting above url you would be able to pull address:
<code>"formatted_address" : "64-68 Victoria St, Onehunga, Auckland 1061, New Zealand",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : -36.9223577,
                  "lng" : 174.7923878
               },
               "southwest" : {
                  "lat" : -36.9245029,
                  "lng" : 174.7921219
               }
            },
            "location" : {
               "lat" : -36.9229721,
               "lng" : 174.7921807
            },
            "location_type" : "RANGE_INTERPOLATED",
            "viewport" : {
               "northeast" : {
                  "lat" : -36.9220813197085,
                  "lng" : 174.7936038302915
               },
               "southwest" : {
                  "lat" : -36.9247792802915,
                  "lng" : 174.7909058697085
               }
            }
         },
</code>
Your interested value is present in formatted_address field.
From implenation perspective you can use callout enabled future methods triggering from trigger whenever someone updates location lat long in account.
Hope this helps you.


4 of a kind on board ( texas holdem poker )

Question: If a board has four of a kind, let's say 9 9 9 9 J, how is the winner decided? Will kicker take part here?
Answer: Players will have cards in hand. Remember that TH has the rule of picking the best 5 possible cards. This means that users holding the best of Q K A in their hands will win. Otherwise, they will tie by picking the community cards.
E.g.
9999J with two players holding 45 and 8T

They will tie because the best hand for them is 9999J in table.
Another example:
9999J with two players holding 4K 5J

The player holding 4K will win because their final hands will be 9999K and 9999J (the other J does not matter).
However the players here:
9999J with cards 4K QK

Or even:
9999J with cards 4K KK

will both tie with 9999K.
Yes, the answer is the kicker. If you have doubts, try always picking the best 5 cards for each player.


ListView does not update when calling notifyDataSetChanged from a BaseAdapter

Question: im am having difficulties to update a ListActivity when the underlying data changes.
I am using a custom (list) adapter (CustomListAdapter) derived vom BaseAdapter to fill a ListActivity with custom list elements (CustomListElement).
The elements in question can have their underlying data changed over time, either by user interaction or by changes in an underlying database. In order to announce said changes, the CustomListElement and CustomListAdapter objects can register DataSetObserver objects.
This is in essence done like this (unfortunately posting the entire code would be overkill):
public class CustomListElement extends DataSetObservable {

    protected Object value;

    public void setValue(Object newValue) {
         this.value = newValue;
         notifyChanged();
    }
}

Hence a CustomListElement provides registerDataSetObserver by inheritance from DataSetObservable and announces changes by means of it's notifyChanged() method.
And for the CustomListAdapter:
public class CustomListAdaper extends BaseAdapter {

    protected List<CustomListElement> elementList;

    @Override
    public void registerDataSetObserver(DataSetObserver observer) {
        super.registerDataSetObserver(observer);

        for (CustomListElement element : elementList)
            element.registerDataSetObserver(observer);
    }
}

I.e. the observers are "handed through".
Now, when invoking
setListAdapter(new CustomListAdapter(customElementList));

within a ListActivity this should register an android.widget.AbsListView.AdapterDataSetObserver within the setAdapter method of ListView (invoked from setListAdapter of ListActivity).
Upon notifying the registered DataSetObserver objects of any change the onChanged method of the AdapterDataSetObserver and therefor requestLayout of the ListView should be invoked. This should (to my understanding) refresh the ListView.
However, the ListView is not updated with the new data.
I realize it has been pointed out that notifyDataSetChanged and (maybe) notifyChanged should be run within a runOnUiThread environment, however that does not seem to fix the issue.
I also realize that similar questions came up, but not with this specific set of android classes, and with unsatisfying answers.
Am i missing anything? Any insight into why this breaks and how to fix it is greatly appreciated.
Comment: Please [don't use signatures or taglines](http://stackoverflow.com/faq#signatures) in your posts.
Answer: The registerDataSetObserver() part of the Adapter interface is for any external objects who might be interested to know when the data set changes. A ListView shouldn't really be interested in these methods... if it's BaseAdapter content changes, you call BaseAdapter.notifyDataSetChanged() which will tell the ListView to update itself.
In other words you only need to make the following tiny change:
public void setValue(Object newValue) {
     this.value = newValue;
     notifyDataSetChanged();
}

Actually, since you're changing the state of an existing item (rather than adding new ones etc) then notifyDataSetInvalidated() would be a better choice.
And of course you don't need any of that DataSetObserver stuff unless you actually do have other objects elsewhere that need to know about this data.
Comment: Is there any difference between `ListView.invalidateViews()` and 'Adapter.notifyDataSetChanged()'?
Answer: The issue is resolved. The problem was in fact at a different point (an intermediate class that was not mentioned here didn't react appropriately to changes). The initial code works beautifully.
Thanks alot for the effort,
Answer: adapter.notifyDataSetChanged();


Where can I find some tough creatures?

Question: I need some foes to challenge a somewhat overpowered group.  Which SR4 supplement has some good foes for high end groups?
Comment: Does it not depend on the abilities and composition of the PC group as to what 'tough' means?
Answer: The easiest way to challenge a group is to copy their caracter sheets, give them different names and backstories and have this new group of NPCs be hired by someone to kill your current group. You won't find tougher enemies, there's a dozen man hours of optimization in this characters. Probably more than you will get from any book. And they are absolutely on their level. Even to the last karma point spent.
Comment: This isn't really an answer to the question.
Comment: The technically correct answer would be "Core Rulebook". It has all data to create deadly enemies for any kind of group. If you have special needs, maybe you can clarify them in your question. Are you looking for equipment, non-humans or a premade adventure with ready-made foes?
Comment: @quillbreaker it depends on what question you are actually asking.  If you want "foes to challenge a somewhat overpowered group" this is a great technique that I wish I had thought of a long time ago and will use in the future.  If you want a supplement that has monsters, look for a bestiary.  I haven't played 4th ed at all, but for 2nd edition they had Paranormal Animals of North America which had lost of fun critters.
Answer: I guess you specifically want an enemy that would provide an interesting and difficult fight, rather than an interesting plot.
Then you'll find some nice treats in :

Core Rulebook, check the dragons stats, they are quite the big boss in-universe
Augmentations, which describes cyborgs (metahuman brain in a jar, rigged in a killing machine robot)
Runner's companion give stats for vampires (also present in core rulebook) and others "monsters", but they're meant to be playable, so maybe not powerfull enough
Street Magic, if you're looking for spirits (they have some real nice powers, especially if they can negate your party's mage). If they're really that high end, well, throw a god at them. A spirit with a Force 10 or 15 should be quite the challenge, if you're into rolling 30 dice at a time
Unwired, if you're looking for a fight only a hacker could win (an infinite swarm of killing robot-wasp, produced by a factory gone wild...)

That said, numerous boss fights ends too quickly because in the end, one guy rarely is enough to beat several PCs, or is powerfull enough to one-shot an unlucky PC. A room full of mooks is generally a much better option if you want to challenge your party.
Comment: I'm looking for a creature that would provide an interesting and difficult fight, which I can shape to my plot.  Thanks for your answer.

Where can I find some tough creatures?


Deleting Content type from "List Items" using Powershell

Question: I want to delete a custom content type from all items that are using that content type in a list/library. Is that possible using powershell?
if yes, then I want to know after deleting CT, which content type the existing items will use then? OR if there is any kind of problem will occur with those items?
Comment: I think you will have to rethink your strategy.. a item need to always belong to a content type, and you will need to change content type on a item as you cannot simply delete it. And you need to make sure that the new content type matches the old when it comes to number of columns and columns types.
Answer: You cannot delete content types from items, instead you can remove content types from lists or web sites. If you would try to delete a content type which is still used, you would get an error: "Content Type in use". What you want to do (most probably) is lookup all items with the specific content type, change the content type for those items first and then remove the content type from lists and web sites.
You can check content type usage and delete the content type if it's not used with the following script:
<code>$siteURL = "The Site url"
$contentType = "Content type Name"

$web = Get-SPWeb $siteURL
$ct = $web.ContentTypes[$contentType]

if ($ct) {
$ctusage = [Microsoft.SharePoint.SPContentTypeUsage]::GetUsages($ct)
      foreach ($ctuse in $ctusage) {
        $list = $web.GetList($ctuse.Url)
        $contentTypeCollection = $list.ContentTypes;
        $contentTypeCollection.Delete($contentTypeCollection[$ContentType].Id);
        Write-host "Deleted $contentType content type from $ctuse.Url"
        }
$ct.Delete()
Write-host "Deleted $contentType from site."

} else { Write-host "Nothing to delete." }

$web.Dispose()
</code>
Answer: You CAN delete the content types from existing list, just make sure to apply default/other content type before deleting any existing content types. In fact, content type cannot be removed from a list if there are items currently using it in that list. Therefore, before you can attempt to remove a list content type, you must make sure that any items associated with it have either been assigned a different content type (see this article for details on how to do this) or deleted from the list completely.
Removing a content type from a list or library does not delete any items that were created from the content type.
I would suggest the following content type script to begin with


how apps bypass VPN?

Question: I installed flipkart from apk. And without logging in searched for mobile phones.Then cleared app data and started VPN and then opened the app again but I was getting recommendations of searched phones. How flipkart bypassed VPN? How can we sure that browsers don't really bypass VPN?
Comment: Apps use device/OS identifiers to do profiling of you which don't change by using VPN or by clearing apps data.
Answer: It didn't bypass the VPN. The apps use your other identifications such as "Advertising ID" identify you. Then this information is used to give you suggestions/recommendations based on your previous browsing or search history.
Most apps will also keep a local cache. So, unless you have cleared data for the app, the app knows everything you previously did.

how apps bypass VPN?


How many Dominion sets are there?

Question: How many Dominion sets are there? List them all? Including base set, expansions, special, etc. Additionally, how many promo cards are there, and list those as well?
Answer: As of February 2024, there are 16 sets and 12 promo cards1.
In release order:

Dominion (Base game)
Intrigue
Seaside
Alchemy
Prosperity
Cornucopia
Hinterlands
Dark Ages
Guilds
Adventures
Empires
Nocturne
Renaissance
Menagerie
Allies
Plunder

A new expansion called Rising Sun will be coming in 2024.
And the list of Promo cards:

Envoy (November 2008)
Black Market (March 2009)
Stash (February 2010)
Walled Village (June 2011)
Governor (October 2011)
Prince (June 2014)
Summon (November 2015)
Sauna/Avanto (September 2016) 2
Dismantle (December 2017)
Church (2019)
Captain (2019)
Marchland (2024)

Separately there is also the Dominion Base Cards product; which includes the treasures and victory cards you need to play any setup of Dominion; without including any Kingdom cards. This allows players to purchase just an expansion without needing the base game, and allows 5-6 player games.
Guilds and Cornucopia, each being half-sized expansions, are currently only sold as a combined Guilds & Cornucopia set.
Dominion Base Game, Intrigue, Seaside, Prosperity, Hinterlands, and Cornucopia & Guilds each have both a first and second edition, with the second edition for each removing some cards and adding different ones. Due to some cards being different; you could count first edition and second edition as separate sets. Upgrade packs including just the new cards were released for each second edition. Other sets have received minor updates in later printings; but nothing as big as brand new cards.
Note that all sets through Guilds were planned as part of the original design of Dominion; while Adventures and beyond were created later due to Dominion's popularity.
All information taken from http://wiki.dominionstrategy.com.
1 "Cards" is used here to refer to all promos including Summon, even though Summon is an Event, not a Card, within the rules of Dominion.
2 Sauna/Avanto is a split pile; counted here as 1 card even though it is technically 2 separate cards.
Comment: @Jontia Sort of. The Base Cards pack combined with the original Dominion or Intrigue will give you enough cards to play 5-6 players. Otherwise there are only enough cards to play any other expansion with 4 players.
Comment: There's also the Kingdom Dominion set, which is a stand-alone demo version of the game, featuring a selection of cards from various sets.
Comment: Interestingly, I can only find it on boardgamegeek in its Dutch release: https://boardgamegeek.com/boardgame/184207/het-koninkrijk-dominion
Comment: Is the Dominion Base cards pack also the 5-6 player expansion "kit"?

How many Dominion sets are there?


Electric power steering column noise

Question: I have a 2014 Honda Accord coupe equipped with Electric Power Steering (EPS). When cranking the steering wheel, I can hear a noise coming from the steering column, mostly at slow speed like backing out of a parking spot. It's not overly noisy, but I certainly never noticed any noise coming from the steering column with hydraulic power steering. The noise is kind of a rattling noise, sort of like a loose or improperly lubricated bearing. At first I thought this was just something common to EPS and nothing to be concerned about, but I'm beginning to wonder if I should have it looked at. I have not taken the car to the dealer yet, for fear that they will just tell me it's normal and tell me to go away. Opinions?Edit: I took the car in to the Honda dealer. They think (are pretty sure) that the noise is coming from the SRS cable reel.I did a quick Google search, and it looks like the part can be a problem. If it seizes and the cable breaks (it's just a thin, flat ribbon cable coiled up inside), you can lose all the steering wheel controls (cruise, volume, air bag, etc).I'm glad I'm having it looked at while the car is still under warranty. I will post the final outcome.
Answer: There is a chance that the pinion of the power steering assistance motor has worn off . It is enclosed in a complete assembly which is located just behind the dash board !
Comment: Thanks for the answer. The car was purchased brand new and has made that sound since its first day. I'm going to have the dealer take a look at it.
Comment: Honda tests cars very well before delivery! It is a great chance that the noise you hear is normal ! My car also makes a sound at low speeds ! But if the sound is well audible , then it is a matter of concern!
Answer: I just got my car back from the dealer, and it turns out the noise I was hearing in the steering column was coming from the cable reel rubbing against the cable reel bracket. Honda is aware of the problem and has a redesigned bracket that addresses the issue. The redesigned bracket gives the cable reel a bit more room to rotate in without it rubbing against the bracket. Eventually, the cable reel would probably jam against the bracket causing the ribbon cable to snap, which would disable all steering wheel electronics including the air bag and horn.I'm glad I had it looked at. The steering column is now completely silent.

Electric power steering column noise


What does "trading with the street" mean?

Question: When someone is talking about their job duties in various positions, and then says that, as a trader, they were "trading with the street," what does that mean? And opposed to what? Is it that they were working with institutions and not retail?
Comment: My first thought was trading directly with wall street firms (e.g. CDSs, bond, or other non-exchange instruments). IOW, wall street firms were the _counterparty_ in their deals, whether they were working for an institution or not.
Answer: From my understanding that would most likely mean trading alongside consensus analyst estimates, and published analyst sentiment.
(They could also be using jargon that nobody knows and they could also have no idea what they are talking about.)


Password storage in source control

Question: We store all our application and db passwords in plain text in source control.  We do this as our build/deploy process generates required configuration files and also does actual deploys that require these passwords (ie: running sql against a database requires you logon to the db using valid credentials).  Has anyone had a similar need where you were able to implement this type of functionality while not storing the passwords in plain text?
Comment: Put the passwords in o/s user environment variables.
Answer: If your plan is to store all the code and configuration information to run a production system directly from version control, and without human intervention, you're screwed.  Why?  This is all just a violation of the old security axiom "never write your password down".  Let's do a proof by negation.
First cut, you have plain text passwords in the configuration files.  That's no good, they can be read by anyone who can see the files.
Second cut, we'll encrypt the passwords!  But now the code needs to know how to decrypt the passwords, so you need to put the decryption key somewhere in the code.  The problem has just been pushed down a level.
How about using public/private keys?  Same problem as the passwords, the key has to be in the code.
The use of a local configuration file not stored in version control still puts the password, and the means to read them if they're encrypted, on disk and available to an attacker.  You can harden things a little by ensuring that configuration file's permissions are very limited, but should the box be rooted you're screwed.
Which brings us to why putting passwords on disk is a bad idea.  It violates the concept of a security firewall.  One compromised machine containing login information means other machines will be compromised.  One poorly maintained machine can tear down your whole organization.
At some point a human is going to have to inject the critical secret to start the chain of trust going.  What you could do is encrypt all the secrets in the code and then when the system starts up have a human manually enter the key to decrypt all the passwords.  This is like the master password system Firefox uses.  It is open to abuse since once that one password is compromised, many systems may be compromised, but it is convenient and probably more secure since users only have to remember one password and are less likely to write it down.
The final touch is to ensure that should the login information be compromised (and you should always assume that it will be) that A) the attacker can't do much with it and B) you can quickly shut down the compromised accounts.  The former means to only give the accounts as much access as they need.  For example, if your program only ever needs to read from a database have it log in on an account restricted to SELECT.  In general, remove all access and then add it only as necessary.  Be stingy about the rights to delete lest you get a visit from little Bobby Tables.
The latter means you give each user/organization/project their own login, even if they can have the exact same rights and privileges and access the same data.  It's a bit more of a hassle, but it means that if one system is compromised you can quickly shut down that account without shutting down your whole business.
Comment: @christianbundy Store all the passwords encrypted.  When the process starts, enter the key to decrypt them.  It will only be in memory.  While reading `/dev/mem` may be easy once you have root, finding something specific in there is not; certainly significantly more difficult than reading it from a file.  This is my understanding of how keychain servers work.  This is certainly better than having clear passwords in source control checked out to a bunch of dev machines.  For a more definitive answer, ask on [Security.SE](https://security.stackexchange.com/?source=lh).
Comment: "but should the box be rooted you're screwed" I'm confused – are there security protocols where being rooted is part of the threat model? I can't imagine how you would possibly defend against a root attack.
Comment: @christianbundy When one system is penetrated, you want to make sure they can't use that to penetrate another system.  In this case, if you store your database password on disk and a single machine is penetrated, the attacker can now access your database.  I am assuming the application code and database are running on different servers.  Also you don't need to be root to read the application config file, you just need to be the application user which is much easier. You don't even need that, you just need to fool the app into letting you view its config file.
Comment: if your system is penetrated, how is it possible to keep the attacker from reading the password? Saving it to the filesystem is easy to read via FS I/O, saving it to an environment is easy to read via /proc/, and saving it to the RAM is easy to read via `/dev/mem`. What alternative are you suggesting?
Answer: I assume the objective is that you don't want your company's private passwords to be available, encrypted, decrypted, or otherwise, to anyone that should otherwise be allowed access to the rest of the source.
Here's how I do it.  I've duplicated this pattern from TikiWiki, which does this too.
in some file that normally contains passwords, set them to dummy values, doesn't matter what.  Set it to whatever your customer should see.  Put a comment nearby for developers to leave this file alone and alter a second file.
In the second file, which gets created if it's not there, put the actual passwords.  arrange for this file to be included, imported, whatever, by the first file.
Arrange for your source control to ignore that file.  Could look something like this:
# in .gitignore
localsettings.py

# in settings.py
## Alter this value to log into the snack machine:
## developers: DON'T alter this, instead alter 'localsettings.py'
SECRET_VALUE = ""
try:
  from localsettings import *
except:
  pass

# in localsettings.py
SECRET_VALUE = "vi>emacs"

Answer: I've built systems where database userid/password pairs are not part of the code drop. The key is to setup a site-specific configuration mechanism. Then you can put such information on the box in question, without it being part of the code-base.
There's a bonus: you can not only have different passwords for different code drops, but also for different developers. :-)
Comment: Good point.  One scenario we have is where our deploy script runs sql against a db (could be dev, qa, prod, etc).  All this gets done on a single deploy server.  Not sure how to implement this solution in that case.
Comment: The way to do that is for the sql-update script to run on the end-target server. Then it can use the local configuration to find the database. :-)
Answer: You didn't mention the language, so here is a vb.net solution we use:
Imports System.Web.Security
Imports System.Security.Cryptography
Imports System.Text
Imports Microsoft.Win32

Public Class myCrypt

Private myKey As String = "somekeyhere"
Private cryptDES3 As New TripleDESCryptoServiceProvider()
Private cryptMD5Hash As New MD5CryptoServiceProvider()

Private Function Decrypt(ByVal myString As String) As String
    cryptDES3.Key = cryptMD5Hash.ComputeHash(ASCIIEncoding.ASCII.GetBytes(myKey))
    cryptDES3.Mode = CipherMode.ECB
    Dim desdencrypt As ICryptoTransform = cryptDES3.CreateDecryptor()
    Dim buff() As Byte = Convert.FromBase64String(myString)
    Decrypt = ASCIIEncoding.ASCII.GetString(desdencrypt.TransformFinalBlock(buff, 0, buff.Length))
End Function

Private Function Encrypt(ByVal myString As String) As String
    cryptDES3.Key = cryptMD5Hash.ComputeHash(ASCIIEncoding.ASCII.GetBytes(myKey))
    cryptDES3.Mode = CipherMode.ECB
    Dim desdencrypt As ICryptoTransform = cryptDES3.CreateEncryptor()
    Dim MyASCIIEncoding = New ASCIIEncoding()
    Dim buff() As Byte = ASCIIEncoding.ASCII.GetBytes(myString)
    Encrypt = Convert.ToBase64String(desdencrypt.TransformFinalBlock(buff, 0, buff.Length))
End Function

End Class

Comment: MD5?  TripleDES?  Damn, MD5 is already compromised and 3DES is on its way out.  Use AES and SHA256.  More importantly, once you've encrypted the login credentials, where do you put the decryption key?  Chicken-egg.
Comment: Our build/deploy process is ANT.  Our application code happens to be Java.
Answer: Store passwords in encrypted form. Write a custom routine that decrypts the passwords and updates the configuration files at build time. This can be easily integrated with the build tool like Ant.
Comment: So where do you put the decryption key?
Answer: If doing in C you could store in as an array of characters and put the characters in as decimal references.  Not sure if this will break strings or not, but might help to alleviate some of that problem.
char pass[]={72, 101, 108, 108, 111};

Comment: Boshfpngvba qbrf abg cebivqr frphevgl!

Password storage in source control


Flush cache of DNS on macOS Sierra & High Sierra

Question: How to flush the cache of the DNS system on a macOS Sierra or High Sierra Mac?
I have seen discussion of the following, but am not sure if this is the modern approach. And I am not sure what each does exactly.
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Answer: sudo dscacheutil -flushcache does nothing useful related to DNS cache entries - at least in non-LDAP environments and 10.9-10.13.
sudo killall -HUP mDNSResponder sends a hang up to mDNSResponder, launchd will restart the daemon and the DNS cache will be cleared as spillover effect.
This can easily be tested with the following command sequence:
sudo killall -INFO mDNSResponder

default    03:54:55.672826 +0200   mDNSResponder   Cache size 282 entities; 189 in use (73 group, 29 multicast, 87 unicast); 2 referenced by active questions
  default    03:54:55.694219 +0200   mDNSResponder   Unicast Cache size              1769

sudo dscacheutil -flushcache
sudo killall -INFO mDNSResponder

default    03:55:52.148629 +0200   mDNSResponder   Cache size 282 entities; 180 in use (79 group, 19 multicast, 82 unicast); 2 referenced by active questions
  default    03:55:52.157180 +0200   mDNSResponder   Unicast Cache size              1992

sudo killall -HUP mDNSResponder
sudo killall -INFO mDNSResponder

default    03:56:39.446829 +0200   mDNSResponder   Cache size 282 entities; 8 in use (4 group, 0 multicast, 4 unicast); 2 referenced by active questions
  default    03:56:39.466259 +0200   mDNSResponder   Unicast Cache size              121

To get the results above open Console.app, choose your hostname in "Devices" and use a filter mDNSResponder & Cache size:
Comment: There is no inevitability that a cache is cleared after -HUPing an app/service. If you -HUP mDNSResponder, it does. Other apps/services won't clear their caches if -HUPed.
Comment: What exactly do you mean by "spillover" effect?
Answer: I've discovered an alternate way to clear the DNS cache, and you don't need any root permissions. Here's the shell script I use to help automate this.
NETWORKSVC="Wi-Fi"
DNSSERVERS=`networksetup -getdnsservers $NETWORKSVC | tr '\n' ' '`

if [ "$DNSSERVERS" = "There aren't any DNS Servers set on Wi-Fi. " ]; then
    DNSSERVERS="Empty"
fi

networksetup -setdnsservers $NETWORKSVC 0.1.2.3
networksetup -setdnsservers $NETWORKSVC $DNSSERVERS

Set your network service name in the first line. The second line gets your currently set DNS Servers. As the getdnsservers subcommand returns one DNS server per line, we use tr (transform) to change the newlines into spaces.
The if statement handles the special case of where your DNS servers have been handed down via DHCP.
Next, we change the DNS server to an obviously fake one. This triggers the DNS cache to be cleared. You can confirm that it is actually cleared using klanomath's technique.
The last line restores your original DNS servers. The setdnsservers subcommand expects the list of DNS servers to be space separated.
You can also just do all of this in System Preferences, but the shell script is faster and is basically instant.