Learning rate of a Q learning agent

Question: The question how the learning rate influences the convergence rate and convergence itself.
If the learning rate is constant, will Q function converge to the optimal on or learning rate should necessarily decay to guarantee convergence?
Comment: With a sufficiently **small** learning rate you have a convergence guarantee for a convex q learning problem.
Comment: I assume there is also a dependence on the nature of the MDP. I ASSUME the requirements for convergence on an MDP with stochasticity in state transitions and/or in the reward function will need to satisfy the requirement posted by @purpletentacle. However, I also ASSUME if there is no stochasticity in either the process or the reward the learning rate does not need to decay. Insights from someone who knows (preferably with supporting literature) would be appreciated.
Answer: Learning rate tells the magnitude of step that is taken towards the solution.
It should not be too big a number as it may continuously oscillate around the minima and it should not be too small of a number else it will take a lot of time and iterations to reach the minima.
The reason why decay is advised in learning rate is because initially when we are at a totally random point in solution space we need to take big leaps towards the solution and later when we come close to it, we make small jumps and hence small improvements to finally reach the minima.
Analogy can be made as: in the game of golf when the ball is far away from the hole, the player hits it very hard to get as close as possible to the hole. Later when he reaches the flagged area, he choses a different stick to get accurate short shot.
So its not that he won't be able to put the ball in the hole without choosing the short shot stick, he may send the ball ahead of the target two or three times. But it would be best if he plays optimally and uses the right amount of power to reach the hole. Same is for decayed learning rate.
Answer: The learning rate must decay but not too fast.
The conditions for convergence are the following (sorry, no latex):

sum(alpha(t), 1, inf) = inf
sum(alpha(t)^2, 1, inf) < inf

Something like alpha = k/(k+t) can work well.
This paper discusses exactly this topic:
http://www.jmlr.org/papers/volume5/evendar03a/evendar03a.pdf
Comment: Even-Dar & Mansour 2003 provide sufficient conditions. [Azar et alt., 2011](https://hal.inria.fr/inria-00636615v2/document) contains, among other results, lower bounds on how good an approximation is possible when the learning rate is $\alpha_k = 1/(k+1)$
Answer: It should decay otherwise there will be some fluctuations provoking small changes in the policy.

Learning rate of a Q learning agent


algebraic multivariate power series over a field

Question: Is there a "simple" proof that any power series in $\mathbb Q[[X,Y]]$ algebraic over
$\mathbb Q(X,Y)$ is in the Henselization of $\mathbb Q[X,Y]$ localised in $(X,Y)$?
Comment: What is the meaning of a "simple" proof? Do you mean a proof which avoids using certain kind of notions, theories or constructions?
Comment: It is a direct consequence of Artin's  approximation theorem.
Comment: @AndrewStout To get the ball rolling: would you consider explaining your comment in an answer?
Answer: I am not sure if this is what the OP really wants, but this is the proof I had in mind.
Theorem. Let $(A,m)$ be a local ring which is obtained by localizing a finitely generated $k$-algebra where $k$ is a field. Let $\hat A$ be the $m$-adic completion of $A$. Let $\mathcal{E}$ be collection of elements of $A[x_1,\ldots,x_n]$ where $x_i$ are variables. If $\mathcal{E}$ has a solution $(a_1,\ldots,a_n)$ with $a_i \in \hat A$, then it has a solution $(b_1,\ldots,b_n)$ with  $b_i\in A^h$ where $A^h$ is the henselization of $A$.  Moreover, given any $t$, we can choose the solution in $A^h$ such that the residues of $a_i$ and $b_i$ in $\hat A/m^t\hat A$ are equal for all $i$.
This is almost a verbatim restatement of Theorem 8.4.5 of the great book Cohen-Macaulay Rings by Bruns and Herzog, which is more or less a restatement of Artin's Approximation Theorem.
So, if $A = \mathbb{Q}[X,Y]_{(X,Y)}$, then $\hat A = \mathbb{Q}[[X,Y]]$.Then choosing n=1, $\mathcal{E}=\{P(x_1)\}$ for some arbitrary monic polynomial $P(x_1)$, and t=1 gives the result provided one accepts the following trick: we may apply affine transformations to the coefficients (possibly, defined over $\bar{\mathbb{Q}}$) of a monic polynomial $P(x_1)$ in $\mathbb{Q}(X,Y)[x_1]$ so that each coefficient of $P(x_1)$ lies in $A$.
Comment: Sure, my pleasure. I can think of another proof in the univariant case. I believe it should follow from cell-decomposition for definable subassignments in the language of Denef-Pas over $\mathbb{Q}[[X]]$, but this model-theoretic. Even though this is neither here nor there, I would like to know how to prove the multivariant case model-theoretically.
Answer: This is also a direct consequence of a result of M. Nagata (see Theorem 44.1 of his book "Local Rings"). And this result of Nagata is much more easier to prove than Artin's approximation theorem.


Undo Delete Field in QGIS

Question: I am working on a very large point file and had deleted some field that I thought were not necessary from my attribute table. It turns out that I jumped the gun and should not have deleted the fields. Is there a way to undo the Delete Field function or to restore a previous version of the attribute table?
Comment: Certainly, by pulling and restoring your backup.
Answer: If you have saved the changes there is no way to get your data back.
If you have deleted the fields but have not saved your data just stop editing and discard changes. Otherwise you will need to use your back up data or worse recreate it.
Comment: thanks for the advice. I got Lucky (this time) and had a backup copy saved.

Undo Delete Field in QGIS


Interruption in canning process

Question: I was processing venison in 14 pint jars at 10 lb. pressure. It had only begun to process, approx. 10 min.  I got an emergency phone call from my Mother and had to turn off the pressure cooker.  I left and did not get back for 5 hrs.  By that time the cooker was barely warm.  I turned the stove back on and began processing all over at 10 lb. pressure but left it go for 90 min. instead of the 75 min. for pints.  All sealed, looks great, good color.  However, would sitting and cooling down before the 2nd processing cause add'l bacteria to grow in the sitting jars?  Or, would the 240+ degrees from the pressure cooker take care of any and all bacteria, whether a little or a lot?  I have been canning and putting up foods for 51 years and have never had to stop and restart processing.  I'm unsure if the meat would be safe.  Anyone else ever have this happen to a low-acid food?
Comment: Did it reach temperature before you turned it off?
Comment: Yes, but only for 10 min.  Petcock started to jiggle properly for 10 min. then I had to shut it down.
Answer: I would not keep it or eat it and just consider it a loss. That is a long time for the food to cool down/seal, etc. The processing time is usually carefully calculated so that the core of the product in the jar gets to the proper temp. With the processing time only being 10 mins it would mean only the jar and maybe a small amount on the edges would have gotten to 240 deg F.
I suppose it could make a difference if it was a hot pack vs. cold pack, but I would still not risk it.
Since you're an experienced canner, I assume you already know that it's possible to lose pressure during the process and then restart the time when the canner gets back up to pressure, but that is usually a few minutes at most, not hours.
Comment: Yes, I agree and knew that was the best outcome to be safe....., just wanted to have someone else tell me to throw the meat away.
Comment: @DebraKerlin I know it's so frustrating! Sorry that happened to you!
Answer: The doubling time for bacteria cultures is 20 minutes under optimal conditions. You can assume your interrupted canning session produced ideal culture conditions somewhere in the can.
5 hours is 15 doubling times, or 32,000 times more bacteria. That's alot.
The concern with canned meats is for botulism. it kills people. A half dozen botulism bugs can  produce a fatal dose of toxin without affecting the taste or smell of the food.
If you re-sterilized the cans properly, it should have killed any botulism which grew during the "pause". However, "should have" is a statistical thing. there may have been a surviving bug out of the hundreds of thousands that grew (50/50 chance ?). Even one botulism bug survivor could grow after the can cooled down.
It's like playing Russian Roulette with 1 bullet and a gun with 1,000,000 chambers.
If you are not convinced you should throw it all away, you can boil the can for an hour before opening it. The boiling is not to kill bugs, but to denature any botulism toxin present. The toxin is a protein .
In a past life I worked the autoclaves (pressure cookers) in a commercial cannery. To this day, if someone gives me home-canned salmon I boil the can before opening it. The boiling does not change the flavor of salmon (it has already had the s**t cooked out of it in the pressure cooker). I assume venison would be the same.

Interruption in canning process


Rigging a tank without distortion

Question: I've made a tank model,
kinda futuristic so there is actually less rigging to do (the idea is a tank that has 4 treads that are each rotating at their joint with the body at the outermost. this would somewhat compensate terrain deformation, it could also allow for a "partform-sniper-mode", anyways) , the way I see it there should only be 7 bones.
One for each part of the tank :

And as you can see I've thought ahead and made a separate mesh for each part.
My first attempt at rigging went porly, I had correct joint rotation but despite my meshes being separate the bones brought along some of the closest bits of the next mesh as they moved. which made the tank look more jello then steel...
Here's what I did :
First I added transform constraints on the bones as inspired by : https://blender.stackexchange.com/a/116376/95840 this answer is critically outdated because that UI no longer exists in Blender 2.8 but it set me on the path of looking for the equivalent to bone transform constraints in 2.8. which I stumbled upon haphazardly in this video : https://www.youtube.com/watch?v=1_LcXcNnieQ
Where in the first 15 seconds he sais these are applicable to meshes and bones alike and then goes on to ignore all those viewers who would have loved to know how you access that menu for bones which is not visible in either edit mode, object mode or bone creation mode.
But I figured it out, you use the edit pose mode which you access though ctrl-tab (when no mesh is selected?)
which reveals an extra menu, called "bone constraint" :

form which you can add transform constraints
Once my transform constraints were added to all the bones I then moved on to merging the bones with the meshes.
Which I did by selecting all bones (A), ctrl-P, select "Armature with envelope weights", then I went into pose mode, and first selected one segment, shift-select the corresponding bone bone, ctrl-P and click "bone", I did this for each segment.
So where did I go wrong?
Ideally I would want the bones to alter no trigs on movement.
I'm fine with the meshes spinning independently of one another. I modeled them that way so it would seem natural.
Answer: the solution is all of the above plus:
while you have a bone selected :

in the third-to-last little tab with the same green bone icon :

untick "Deform" like so :

Do this for every single bone that mush not deform meshes (in my case all the bones)

Rigging a tank without distortion


What does return number && number do in javascript?

Question: I have a code that returns number && number in javascript.
I have tried to write in the console return num1 && num2 and it has always returned num2.
Answer: If num1 is "falsy" (false, undefined, zero, or null, or an empty string), you'll get the value of num1. Otherwise you'll get the value of num2.
This is because (like in many other computer languages) && is what's called a "short-circuit" boolean. If the first operand is falsy the second operand doesn't matter for a logical AND operation, so it isn't evaluated.
If the first operand is "truthy", evaluation continues to the second operand, and the result is the value of that second operand.
Unlike many other languages, JavaScript boolean operators don't necessarily yield boolean values. Non-boolean operands can be used to get non-boolean results.
Answer: The && operator is commonly called logical and. It can also be called guard. If the first operand is false, null, undefined, "" (the empty string), or the number 0 then it returns the first operand. Otherwise, it returns the second operand.
read it:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_AND


Can a low side N-channel MOSFET in a DC-DC converter limit inrush current?

Question: I want to add an NMOS just before the supply negative side and thereby controlling its slew rate so as to create a soft start.
I've seen many examples but mostly with high side PMOS (high Rds on) or NMOS (additional circuitry to drive in high side). I doubt there must be some reason.
Can we use a low side N-channel MOSFET in a DC-DC converter for limiting inrush current? Are there any drawbacks?
Comment: I am not totally clear on where you want to put the NMOS. Maybe a sketch schematic would help. But do show the input and output filter caps and inductor. One thing to watch out for any time you use NMOS to open a ground path, is that it may be accidentally bypassed by earth ground connections to external devices. This may be a reason why some people avoid doing it under some conditions.
Comment: Yes this can be done.
Comment: It's been done, for example [here](https://endless-sphere.com/forums/viewtopic.php?f=3&t=40142&start=100) is a nice thread about it (includes schematics & layouts) - you may need to adjust for your voltages / currents, but the N-channel mosfet principle is the same, and it has a few details you may be interested in (slow turn-on resistor, zener diode to clamp gate voltage, options for an on/off switch, etc.) - P.S. - I am posting this as a comment instead of an answer as it's basically only a link, if someone wants to summarize it into an answer & attribute properly I would not be opposed.
Answer: This can definitely be done. However, like any low side control, you should only do this if the return of your load is isolated from the ground of the source.
In many electrical and electronic systems, exposed conductors (like shields or chassis) are at ground potential. Thus it's not safe to have two systems (your power supply and load, for example) with different "ground" potentials, because they could easily be shorted together. This, combined with the convention of positive supplies (i.e. systems where ground is the lowest potential) probably explain why it is easier to find high-side inrush control solutions.
Answer: You can find both ways of achieving this. You may also use a series resistor with input cap that you will bypass using a fet/thyristor/triac. It was mentioned your "ground" won't be exactly "ground" anymore but it's close enough that it usually won't matter.
If you google for inrush current limiting you will find many examples. Motorola AN1542 shows a simple method of high/low side limiting with mosfet using gate capacitance to do something useful.
Note that on AC/DC circuit the current limiting resistor is subject to a lot of power. It may be only for an instant but a regular 1W resistor would die horribly.
Comment: If it's only an instant, where an instant is less than a few milliseconds, then you should refer to the datasheet. E.g. even little 0.2 W MELF resistors can cope with an instantaneous rate of 10 W for up to 1 ms. Ref: [Pulse Load Handling for Fixed Linear Resistors](http://www.vishay.com/docs/28810/pulseloadhandling.pdf).
Comment: 10W? Not nearly enough. For 230VAC you're dealing with around 335V peak so with a 10R resistor that'd work out to 11**kilo**watts. I'm not going to dig out application notes this late night but typically resistors designed for this particular job are used. If you ramp up the resistance to, say, 1k, you'd need 47ms to get 2/3 charge to that 47uF input cap, at comfy 112 watts.. Depends on your power level and cap size of course.
Answer: Using another mosfet just for soft-start is probably not economical, but would most likely be possible.
On Linear technology switching regulators / controllers, there is usually a soft start pin that you can hang a capacitor on.  This limits the current that the IC will allow the circuit to draw from the supply, ramping it up slowly.  This is the preferred way to do it, as a capacitor in mass production costs less than a penny, and mosfets can be in the dollar range.


How to display a GUI Texture for a certain amount of time

Question: Is it possible to make a gui Texture display for a certain amount of Time.
Answer: Try attaching the following class to the GameObject containing your GUITexture. The texture should have gone hidden 3 seconds after being activated.
[RequireComponent(typeof(GUITexture))]
public class GUITestClass : MonoBehaviour {
    GUITexture gt;

    void Awake() {
        gt = GetComponent<GUITexture>();
    }

    void Start() {
        StartCoroutine("HideGt");
    }

    IEnumerator HideGt() {
        yield return new WaitForSeconds(3);
        gt.enabled = false;
    }
}

Comment: Why do you need the coroutine?
Comment: Surely this is just one of the many different ways to solve the case.
Comment: Using a threaded coroutine to simply wait 3 seconds seems overkill.
Comment: @Blue I disagree, this is a great way to deal with the problem. Using CRs is a very efficient and clean way to do things in general. It may be over kill in certain cases but what if you also wanted to play a sound when the texture is hidden? Now you have two things to do on the same 'event'. That single line Destroy now becomes useless. With a CR on the other hand you will have no headaches.
Answer: You can do this with one line of code:
Destroy(gameObject, 3);

This will destroy the object after three seconds.
Put this in your script after you have sorted out your text and GUI related stuff and you're sorted.
Answer: using UnityEngine;
using System.Collections;

public class scene9 : MonoBehaviour {

    // Use this for initialization
    public Texture2D startWin;
    public Texture2D setupWin;

    private bool startwindow = true;
    private bool setupWindow = false;
    void Start () {
        Invoke ("startwindowFun", 2);
        Invoke ("setupwindowFun",3);
        Invoke ("loadScene11",5);
    }

    // Update is called once per frame
    void Update () {

    }
    public void startwindowFun() {
        startwindow = !setupWindow;
        }
    public void setupwindowFun() {
        startwindow = setupWindow;
        setupWindow = !setupWindow;
    }
    public void loadScene11() {
        Application.LoadLevel ("Scene11");
    }

    void OnGUI() {

                if (startwindow) {
                        GUI.Label (new Rect (270, 300, 160, 100), startWin);

                }

                if (setupWindow) {
                        GUI.Label (new Rect (270, 300, 300, 100), setupWin);

                }

        }

}

The above code works to load a texture one after the another at a specified time.It worked for me.


Cache control headers vs using CDNs: What's the difference?

Question: We want to implement caching to speed up the website performance.
What would be beneficial in this case - using CDN or Cache control HTTP headers?
Answer: They provide different speed boosts. I doubt headers would speed things up measurably for you. Unless you have significant performance issues on the server side.
CDN could speed up things for visitors from other countries that may have significant routing delays reaching your server.
To properly speed up a website, you need to first analyze page loading bottlenecks and address them rather than just do random improvements hoping for results.
Answer: Depending on where your servers are located relative to your audience, and the type of audience, these do different (but overlapping) things.
Using cache control headers on your web server will mean that visitors looking at content on your site they have seen recently will load fast.   If your clients are all close to you (ie close as in the paths between your server and theirs), a CDN will not give a significant speed boost if your server has the bandwidth and speed to handle the requests (and bandwidth is likely more relevant as cached content is often quite lightweight in terms of CPU)
Using a CDN will in many cases distribute the content closer to your client, so it is read once per region, and then fed to the clients - thus if more then 1 client in a caching region accesses the CDN, it will be faster for the second client then to serve from your servers directly.  You will likely find that CDN's will use Cache Control as well.   Likewise, using a CDN can provide a level of robustness if your site is overloaded or temporarily unavailable. (Also, CDNs can reduce your swrvers bandwidth requirements)


How to "Commit" changes to GitHub with GitHub Desktop

Question: I have recently downloaded GitHub Desktop and clone a repository. I am trying to upload new project files in it by GitHub Desktop. How do I go about doing this?
Answer: Okay, I too had the same problem and i figured it out.
Make whatever the changes that you want to make in your local repository.
open github desktop app.
click on the repository at the left hand pane.
On the top you will see a drop down menu (by default set to master in my case), change it if you so desire or leave it the way it is.
click on the changes tab.
type something in the summary section.
type something in the description section.
The commit to master gets highlighted. Click on it and it will commit to the master on your desktop app.
Now click on sync on the top right corner of your github desktop app and it will sync to the online repository.
Comment: This was a very useful answer for me.
Comment: Very nice, thanks for actually answering a question no one else seemed to be able to answer!
Comment: This is really a comment, not an answer. With a bit more rep, [you will be able to post comments](//stackoverflow.com/privileges/comment).
Comment: @GajendraDAmbi Don't you need to first click on `sync` before clicking on `Commit....` link?
Answer: You must first create the repository within GitHub,
Then you open GitHub Desktop

Click the New Button (The plus icon top left)
Click "Clone"
Select the repository you just created.
It will ask you to choose a directory, your chosen directory must contain a folder with the same name as the repository.
Click the "Sync" button located top-right of the application.

GitHub Desktop will automatically detect any changes within the directory, and will show "Uncommited Changes" within the application.
Commit means you are willing to submit your changes to the repository and when you are ready to do so click on "Uncommited Changes", provide it with a title and an optional description and then click "Commit".
Done!
Answer: I've noticed with the latest version I had to maximize the window for the "Summary" and "Description" text boxes to become visible. Below those fields you will notice the "Commit to master" button.


Geometry nodes, select faces that are connected to the selected edges

Question: I have these edges, and I need to separate the faces that are connected to these edges.
I think it's possible by using "evaluate on domain node", but I couldn't make it.
Answer: Boolean edge won't interpolate into faces by spilling onto faces that have just one true edge. Capture the boolean true as float $1$, this will spill to a face depending on the number of edges of that face: $1 \over 3$ for triangles, $0.25$ for quads, $1 \over n$ for $n$-gons ($s \over n$ for all faces, where $s$ is the number of selected edges). Since for any face if at least one edge is selected, the resulting interpolation will be non-zero, it converts back to boolean as true.


dhclient with '-s ' flag

Question: I want to understand under which circumstance this command is valid. As i can see, using this command the discover packets have unicast destination ip same as that of the provided server ip while the destination mac is broadcast. Is this a valid packet, as I am not able to get ip using this flag.
Answer: I think that receiving an answer with -s flag it depends on the listening dhcp server (or its configuration).
Short answer, it works with dhcpd server but it fails with dnsmasq one.
Long(er) answer, using "dhclient -v -s 172.16.0.1 eth1" will get an IP if the listening server is dhcpd:
<code>[root@c602 ~]# dhclient -v -s 172.16.0.1 eth1
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/08:00:27:31:f2:d6
Sending on   LPF/eth1/08:00:27:31:f2:d6
Sending on   Socket/fallback
DHCPDISCOVER on eth1 to 172.16.0.1 port 67 interval 7 (xid=0x6161a797)
DHCPOFFER from 172.16.0.1
DHCPREQUEST on eth1 to 172.16.0.1 port 67 (xid=0x6161a797)
DHCPACK from 172.16.0.1 (xid=0x6161a797)

bound to 172.16.0.230 -- renewal in 19087 seconds.

[root@c602 ~]# ip -4 a show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 172.16.0.230/24 brd 172.16.0.255 scope global eth1
</code>
In both circumstances, when dhcpd or dnsmasq are the acting dhcp server, the DHCPDISCOVER is reaching the server but is not answered by dnsmasq; seen this with tcpdump on server machine. (tcpdump -nnnvvvi eth1 port 67 and port 68)

dhclient with '-s ' flag


ASP Classic Webapp - Connect to different SQL DB via login

Question: Need a way to connect to a unique SQL db via login in ASP classic.
THE SETUP

Webapp: ASP classic/SQL 2005.
Webapp stores information for multiple companies.
All data stored in one master SQL 2005.  All db's will be on same server.
Each user  has a unique login (Company, User ID, Password)
Connection is with master db include file using DSN-less connection
IE: (dbConn.Open "driver={SQL Server};server=11.22.333.444;database=mywebdb","mylogin","mypassword")

THE NEED:
Want to split companies into their own database. When the user logins, the company name will tell the APP to use a unique SQL db connection for each company.
Since dynamic include files are not an option, what is best route to go?
Thank you!
Comment: [gripe]"logins" is a plural noun, not a verb. Try "When the user logs in, ...".[/gripe]
Answer: The connection string must be stored some where right?  A include .asp I guess.
Add code in that include to examine the company name (stored in the session?) and fixup the connection string accordingly.
Edit:
The issue is you may have code out there in a myriad different ASP pages that assumes the appropriate connection string is available in a variable declared in you db.asp include file (lets call it m_connStr).  You don't want to have to modify all these pages in order to meet this new requirement.
Thus you only want to edit the db.asp include file and you just want m_connStr to magically point at the correct DB.
Have your logon page once you know the company set the database name in a Session variable.
Your existing code has the connection string like this:-
m_connStr = "driver={SQL Server};server=11.22.333.444 database=mywebdb", "mylogin", "mypassword"

So we'll use a template:-
m_connStrTemplate = "driver={SQL Server};server=11.22.333.444 database=%db%", "mylogin", "mypassword"

If Session("database") <> "" Then
    m_connStr = Replace(m_connStrTemplate, "%db%", Session("database"))
End If

Note a non-existant database session variable causes the connection string to not be defined hence you can't accidentally connect to a default database.
Now as far as all your ASP pages are concerned it's business as usual but the connection string will vary by session according to the company associated with the logged on user.
Comment: Thank you everyone for the excellent feedback - AWJ code template should work ideal - integrates into my existing db_include file - a few lines of code change gets my entire app to go to the respective company DB.
Answer: However you do it, you'll end up varying your connection string based on user input.  Don't use user input directly, but validate it against a list of acceptable values.  I suggest a Select Case statement to do this:
' Do this when logging in: '
Dim companyName
companyName = Request.Form("companyName")

Select Case companyName
Case "company1"
    Session("companyDB") = "company1"
Case "company2"
    Session("companyDB") = "company2"
Case Else
    Session.Contents.Remove("companyDB")
    ' Invalid login! '
End Select

' Do this when connecting to the database: '
Dim connectionString
If Session("companyDB") Then
    connectionString = "...database=" & Session("companyDB") & "..."
Else
    '  Invalid login, go log in again '
End If

Keep in mind that this will lead to trouble if you have users who will want to open one company in one tab and another company in another tab. They are going to wonder why they can only see information for the company they logged into most recently.
If this is going to be an issue, you will probably want to pass a token around in the query string on each link.  This adds complexity, but not terribly much (aside from the tedious task of changing every link).  It would then look like this:
' Do this when logging in: '
Dim companyName
companyName = Request.Form("companyName")

Select Case companyName
Case "company1"
    Session("company1 - db") = "company1DBName"
Case "company2"
    Session("company2 - db") = "company2DBName"
Case Else
    ' Invalid login! '
End Select

' Do this when connecting to the database: '
Dim connectionString, companyToken
companyToken = Request("companyToken")
If Session(companyToken & " - db") Then
    connectionString = "...database=" & Session(companyToken & " - db") & "..."
Else
    '  Invalid login, go log in again
End If

This assumes that the token will be the same as the company name, for simplicity.  So, for instance, somebody will log in for "company1."  Having done so successfully, they get a session variable called "company1 - db", which contains the name of the database (in this case, "company1DBName").
Now, every link they follow should have a query string, like "?companyToken=company1"  So, when you are connecting to the database, you take that token and use it to find the right database name: Session("company1" + " - db") = "company1DBName"
If they haven't logged in to that company yet (or if they just make up a company name), they won't have that session variable, and they have to go to the log in screen.
If they log in under two companies at once, you can now handle it because you'll be obtaining the database name on every link.
Make sense?
Whatever you do, do not use the user input to create the connection string directly.  In other words, the following is the wrong way:
Dim connectionString
connectionString = "...database=" & Request.Form("companyDB") & "..."

Good luck!
Comment: Where are the existing pages getting the connection string from?
Comment: WOW - fast response! Connection string is stored in INCLUDE file.

The above select case example was something I was playing with. It works but I have to add a company to the string everytime.

How about validating the login to ensure a valid company, then store that as session variable to build the connection string?
Comment: That is also a viable solution; I've edited my answer to show how that would be done, and to show how to avoid a potential pitfall of using the Session like that.


Will the Star Wars LCG game have Force power cards?

Question: Will the Star Wars Living Card Game have Force power cards, like Force lightning and Force push?
Comment: @RoToRa, although this question is regarding the future, the game was previewed recently, and is slated for a Christmas launch (or early next year). Although, that is kind of what they said last time before they pushed the release. I personally don't like this question, because it feels like a promotional piece for FFG to get people to go out and watch their video.
Comment: Your question is quite speculative. It's not really suitable for this site, where you should ask ["practical, answerable questions based on actual problems that you face".](http://boardgames.stackexchange.com/faq#dontask)
Answer: Yes. The demo at GenCon 2012 featured at least 3 force power cards, Force Lightning, Force Choke, and Force Rejuvination.


Joining different UVmaps from different objects

Question: I have 7 separated objects with different UV maps, but since i want to export to unity i would like to join all the UV in order to reduce draw calls keeping the objects separated. Is it possible?
Comment: You could try the "Draw Call Minimizer" plugin in Unity https://www.assetstore.unity3d.com/en/#!/content/2859
Answer: You can't combine the UV maps of multipe objects in Blender. Officialy the the TextureAtlas plugin only supports lightmaps (the link could be outdated).
But wait Gleb Alexandrov made a promising tutorial:

John Carmack from id Software used megatexture. You use megatexture.

game-level-texturing-texture-atlas
Related Unity Links:

Draw Call Minimizer
whats-the-best-way-to-reduce-draw-calls
Answer: Today you can use the "Smart UV Project" function in Blender.

Select all objects, press spacebar and type in "Smart".
Then activate the UV arrangement by clicking on "Smart UV Project" in the search results.

Blender will handle all selected objects like they were one single mesh and arrange the UVs in this way.
Answer: A very useful tool for making texture atlases for multiple separate objects is to check "Draw other objects" in the settings panel (T) in the UV/image editor window:

This will show the UV maps of every object you have selected when in edit mode, so you can manually scale and place all the UVs into the same texture space.


New to UX, what are the things to focus on UX design?

Question: I was working in print design. Recently i switched into UX. So what are the things  I should focus on.
Answer: User Interface (UI) designer:

the what person
deals primarily with the visual details, the graphic aspect of applications
is more commonly familiar with only the static states of applications
partially responsible for focusing the user's attention on elements
keeps up with current trends and styles

User Experience (UX) practitioner:

the why person
many are not designers, and UX is not just about design
has his or her hands in every aspect of the product's development
is more of a coordinator, project manager and director
they concern themselves with everything from the tone and voice of
the copy, the information architecture, taxonomy, to the color and
texture of the UI elements
they focus on research, psychology, testing and advocacy
the best UX'ers are the ones that constantly advocate for the user
they ensure that everything is balanced and the experience doesn't
lose out to other business interests (bottom-line), department
conflicts (we need more advertising space) and other non-user minded
things

There always got some one who vote and devote just try to gain it from social.
Comment: Although you'll find that there are basically UX Designer jobs (primarily focussed on design and software - and UX Researcher jobs (Primarily focussed on user research and psychology).  Some companies try to do cover both roles with the one person, but personally I think it's such a broad skill range that it's not covered properly.
Comment: @PhillipW agree!
Comment: @PhillipW Yeah you are correct. I have this issue, the company I work for officially claims I'm a "Interaction and UX designer", yet I'm also an information architect and visual designer.. even a little bit of front-end developing. It's called unicorn in this business :)
Comment: I've generally stuck to being an expert on people and the way they think. It has got easier since 2010 since there's more recognition that in a bigger organisation that you need different people to handle the overall UX process.


Count the number of times a visualforce Page is opened using APEX only

Question: How to get the count of number of times a Visualforce Page is opened using APEX only(if possible)?
Answer: You must be using some controller with the visualforce page, so I would suggest:

You should create a custom setting with a number field with 18 length.
you can write an action method in your controller and use that in action attribute of the page, this method will be executed as soon as your page will be loaded.

You can not use constructor here because constructor doesn't allow
  DMLs.

<apex:page controller="yourController" action="{!updateCustomSetting}">

Your controller would be like:
public class yourController{
  public void updateCustomSetting(){
    //update your custom setting here with increment.
  }
}

Answer:
Call the apex method from controller.

this should be called from action attribute in apex:page

Increment the counter

create a custom setting and store the counter value there. This value should be incremented when you load the vf page.
Answer: I would do this by creating a custom object, and creating a new record whenever your page is visited.  This has a few advantages over incrementing a single record:

It avoids the concurrency problem (two people access the page at the same time, both get back the same number of accesses (say 5), both update with the same increment (6), and now it says 6 when it should say 7).  This can be overcome by specifying FOR UPDATE in the SOQL call to retrieve the object, but that introduces other issues
It keeps track of when the page was accessed and who accessed it, so you can report on traffic patterns with more granularity
It opens the door for more tracking later on, such as the user's browser, what links they clicked on, etc

As noted in the other answers, this record would have to be created in an action method in the controller, as DML is not permitted while the Page Constructor is running.


Starting mining for bitcoins

Question: I have 16gb of ram,gtx 1070,intel i5 6500k(i beleive) and pretty good internet.   What would i need to start bitcoin mining and how much would it cost?  If you can help or give advice please let me know
Comment: Welcome.  Be sure to take the tour at https://bitcoin.stackexchange.com
Answer: To start mining bitcoins you need to buy some mining hardware. A PC is useless. You will need modern ASIC miners.
Things are changing quickly and this isn't the place to discuss specific models. But don't buy ancient USB-stick ASICs that have barely any hashrate. In April 2017 a hashrate of 1 TH/s (1000 GH/s) is slow. Fast miners can do over 10 TH/s.
Make sure you compare the price per GH/s of different options. Make sure you add the price of a power supply, if not included.
Try a bitcoin mining calculator (google it). Some people try to sell ASIC miners at ridiculous prices. If the calculator says it takes 10 years to break even then you've found one of them.
The Bitcoin wiki has a list of miners at https://en.bitcoin.it/wiki/Mining_hardware_comparison
Answer: Just like in any other business, what you would need is some advantage over everyone else. That might be in the form of a very low cost of capital that would allow you to acquire mining hardware at a lower effective cost than others. That might be an exceptionally low cost of electricity. That might be something you can do with the heat bitcoin miners generate rather than having to pay to remove it.
But absent that, you can't make a profit bitcoin mining. That's because the difficulty of bitcoin mining (how much work you have to do to mine a block) adjusts automatically to keep the block rate constant. So if mining was generally profitable without requiring anything special, more people would mine and the difficulty would go up.
That is precisely what has happened. The difficulty has gone up to the point where unless you have some special advantage over others, you cannot make money by mining.
You will be competing against businesses that have covered every base -- the lowest cost for the ASICS, the lowest cost for electricity, the lowest cost for physical space, and so on. If you have no plan to match that, don't mine.
Comment: This should be the default answer for questions like this.

Starting mining for bitcoins


request timed out error while creating User profile service application after long time

Question: in order to configure my sites in sharepoint 2013, we need to start user profile synchronization service. while starting that service it should populate user profile application. for me it is not populating. so im trying to create user profile service application,then im getting this request timed out error.
Comment: My SharePoint 2013 Farm does not have a user profile service application. So, I am trying to create a new User Profile Service Application. But it is failed to create after taking a long time it thrown Request Timed Out Error. Please Help me out.
Answer: Let's do it step by step:

Make sure that Farm Administrator account must be a Local
Administrator on the server where the User Profile Synchronization
Service will be provisioned.
Navigate to Central
Administration >> Application Management >> Manage Service Manage
Application>> Click on New >> Select

Enter Name, Application Pool Name and account

Now enter the name of other databases like Social, profile etc. I will leave it by default

Now start the User profile service by going into Central Admin >>
System Service>> Manage Services on the server

Now start User Profile Synchronization Service by giving the Farm admin credentials

Make sure that ForeFront Identity Manager Services (FIM) are correctly configured and started

Perform an IISReset and go get a coffee cup :)
Now, set up the sync connection by going to Manage Service Application > User Profile Service > Configure Synchronization Connection > Create new Connection (Note sync account in this case, dev_spadaccount must be granted the Create Child Objects (permissions) on the OU you are Syncing with.

Populate the containers and select the required AD's Organization
Unit to be Synced. Click on and Start the Full Import.
Remove the Farm account from local admins on the box running FIM

Happy SharePointing!


What is the greatest sin in Hinduism. According to vedas

Question: Is eating beef greatest sin. Not worshipping God is greatest sin. Or some thing else.
Comment: There is the concept of 5 great sins in Hinduism. See [this answer](https://hinduism.stackexchange.com/questions/19611/what-are-the-panch-maha-paap/19613#19613) . There you can get one reference from one Upanishad.
Answer: Papa and Punya is not defined in absolute term. Gita in Ch.4 solka 17 says गहना कर्मणोगति (The intricacies of action are very hard to understand.).
As an example read the story of Mandavya in Mahabharat (here). Even the great Rishi is punished for a small trivial action.
Vyasa knows the best. He says:
"Ashtadasa Puraneshu Vyasena Vachanam Dwayam, Paropakaraya Punyaya – Papaya Para Peedanam". Meaning: Two important sentence of Vyasa which can be the essence of 18 puranas are "helping others is punya and hurting others is papa".
Comment: If you don't know where this shloka appears, how can the answer say it was said by Vyasa and where was t said by him. Let this question be answered first https://hinduism.stackexchange.com/questions/43948/there-does-this-shloka-appear then you could post this as an answer
Comment: Mandavya risihu was not punished for killing insect according to MBTN of sirman madhvaacharya he is punished for aspiring to become sage vasista with his penance that is wrong same case sambhuka in ramayana where he aspired to become siva himself so that he can get sri parvati devi. But only differerence  is Rishi is not out of lust. But despite being all knowing Rishi he did penance which have got wrong motive @Kaushik
Comment: If you mean papa is not defined/described in Vedas, then do mention it clearly. Also since the question is looking for greatest sin, need to answer that in specific way.


map iframe not showing properly before refreshing manually the document mode

Question: I have an iframe that displays a google map. It has always been working well but it seems like that the new update from google is causing me troubles. At least that's what I think.
There is one thing that make it work: When we do F12, change the document mode to IE7 , then go back to IE8 , the map
displays correclty.
This is how it is displayed in localhost

And this is what it looks like on both my test and production servers

My code is :

We've cleared the browser cache and restarted the service corresponding to the IIS server on the remote server.
There is one thing that make it work: When we do F12, change the document mode to IE7 , then go back to IE8 , the map
displays correclty.
Is it possible that this single iframe does not understand the code below ?

Does someone have a clue what's causing this problem?
Thanks a lot
UPDATE: the code from this page http://www.richiroutreach.com/blog/embedding-google-maps  doesn't work either on my pages....
But the website itself (richiroutreach) displays perfectly.
So it is a problem with my servers?
Answer: DId you try google.maps.event.trigger(map, "resize");
Call this on onload event.
Comment: Hum, I didn't mention it but I'm not using google maps APIs because I can't in my context


Fantasy book about a princess who was mind-swapped with a cat by a witch

Question: In the '90s, I read a book about a princess whose governess was a witch that mind-swapped her and a cat. The governess did this so she could control the princess. The cat who had the princess' mind ran to another kingdom and became the pet of the prince. The main story is the puppet princess coming to the prince's kingdom and the cat-princess trying to get back into her own body.
Comment: A book as in a novel, or a comicbook?
Answer: I think you might be talking about The Perfect Princess by Irene Radford, published in '95. It's the sequel to The Glass Dragon.
Just as you described, the princess Rossemikka's (can't vouch for the spelling) mind has been swapped with that of a cat to make her more docile and obedient- while the cat, guided by the princess' mind, becomes the closest companion of Prince Darville. He then has to figure out the whole conspiracy to save his kingdom and hers.
https://www.goodreads.com/en/book/show/803007
This is it on Goodreads, though it doesn't mention the whole cat thing.
Editing because I found this blurb:

"Hidden among dragons, cats, magicians, and a golden wolf lives the Perfect Princess for a new king. But who, and what is she?
Crown Prince of Coronnan, Darville de Draconis, fell ill after being kidnapped by a rogue magician and ensorcelled into the form of a golden wolf. Though he feels fully recovered, the Council of Provinces and his regent—the same rogue magician who kidnapped him—will not allow him to be crowned king until he marries the princess of their choice.
Princess Rossemikka of Rossemeyer comes with an impressive dowry and a vital military alliance. The problem is that she too has been the victim of a magical transformation and exchanged bodies and spirits with her pet cat. The placid and boring princess presented to Darville is less than suitable. However, on a magical night, with the aid of the deposed senior magician of the commune of magicians, the real Rossemikka is revealed to him. He will settle for no one less than his perfect princess, but time is running out. If Mikka is not returned to her own body soon, she will forever be only a beloved pet and not his queen. But how will his few friends and allies reverse the spell that traps her in an alien body, thus saving the love of his life and his kingdom from a power mad magician."

https://bookviewcafe.com/book/the-perfect-princess/


Importing AI pages into InDesign

Question: Is it better to save AI pages as pdf and then export them as jpg files for input into master indesign document? (Lots of photos, minimal text)
Comment: Welcome to the Graphic Design StackExchange! What exactly are you trying to do? Is there a reason you're using Illustrator instead of InDesign for your page layout? If you could provide more context behind your question we can provide better answers. Also see http://graphicdesign.stackexchange.com/help/ for tips on how to make the most of the Graphic Design StackExchange.
Comment: I have been laying out a rather large book, approx 250 pages. It's an annual project and I have been learning as I go along over the past couple of years. I use AI to build the pages and collect the elements (photos, art, text, etc.) then save the AI file, save as a pdf and then once all the changes have been made export as jpg and place into InDesign. There are some layers added in InDesign. The reason for all the steps has been to eliminate artifacts etc in the digital print run. MY question is for the best quality it it better to upload jpg, PDF or just AI files into InDesign? Thanks.
Answer: Just save Illustrator files as .ai and place the .ai files into InDesign. No need for other formats.
Answer: Scott's correct, in that there is no need to convert the .ai files to any other format before placing in InDesign, but I would highly recommend foregoing Illustrator completely and building your image-heavy pages directly in the .indd.
Assembly and simple compositing of the kind you can do in Illustrator are much faster (on the order of two to three times faster) and simpler in Id, especially when you have a lot of cropping to do, you need to fit images within odd-shaped frames, or you find yourself tweaking the position or size of images within their frames. Not only do you get your page layouts done faster, you also eliminate the extra step of placing already-composed pages in InDesign.
Answer: I agree with both previous responses and would add that it's always best to decide upon the appropriate application for the type of job you're doing - in this case, that would be Indesign as it is specifically a layout tool. Thus it's best configured to do all the things you want to do to unite the various elements - text and images - into your 250-page publication. While Illustrator has the same elements of this functionality built into it, page layout is not its core purpose - it is better suited to creating vector-based illustrations, logos and graphic elements for use WITHIN layouts. I have a very simple rule for all my work - Photoshop for photos, Illustrator for illustrations, Indesign for layout.
Best of luck with your work :-)
Answer: Or use .pdf - it allows you to control the vector/pixel ratio and compression.
Answer: I've just been facing this problem, for placing webpages comps into an Indesign presentation. After multiple tests (JPF high quality, PNG, PDF) playing with settings, matching the target size I need etc, I feel placing the AI file in inDesign then using the option "Object Layer Option" to select the layers you want works the best.
Hope this helps.

Importing AI pages into InDesign


Feature boosting via rescaling in logistic regression and linear SVMs

Question: If I were expressing a problem in terms of binary features, all encoded as {0,1}, could I boost some features by encoding them as {0,2}?  Would the effect change based on whether I used either of the approaches above (logistic regression or linear SVMs?)  Any paper recommendations that would explain the mathematics?
Answer: No, those are linear methods, the results would be equivalent. Multiplying $x$ by two would be offset by halfing the coefficient estimate.
Comment: i guess you'd need to tweak the optimization algorithm (e.g.  gradient descent) to favor some of the parameters over others?


Android Chrome browser - how to make it always open to BLANK page? And new tab open to blank as well?

Question: When opening Chrome browser on Android (brand new Pixel 2 XL with no root or customization and with all latest updates), it goes to a cluttered page with the Google logo and a bunch of nonsense I'll never use. How do I get this to be BLANK when I open it, and that goes for new tabs as well?
Answer: Doesn't seem to be anyone out there who can answer this, so I'll post my workaround. Make a home screen shortcut to "about:blank". Using the Nova launcher, you can change the name to "Chrome" and the icon to be identical, and just use that to launch the app.
Unfortunately it still doesn't do anything for new tabs though. I mainly use Adblock Plus browser because Chrome is ridiculously notorious for pushing Google content, and will continue to do so until they add more options for control.
Answer: You can use kiwi browser and install Automa extension
Answer: Here's how to set it so that when you open chrome, it should go to a blank page.
Open chrome, press on the three dots found in the top right of the screen, go to 'settings' then, click on 'home page' enable the home page option, and change the home page URL to  about:blank just that, no www or anything.
This way, when you open chrome and you don't have previously opens tabs, you will get a blank page instead of the default one.
According to AndroidPolice there is no way to have the new tab open in a blank page, but he does mention some workarounds that might suit you.
Comment: There is no "home page" under settings.
Comment: @BuddyZ just found that the home page option is not available in pixel phones!!? https://www.reddit.com/r/GooglePixel/comments/5d6f2z/cant_figure_out_how_to_set_a_homepage_on_chrome/ really not sure why it wouldn't be there.
Answer: I finally figured it out. Even if you have the default website set, when you open Chrome, it gets stuck on another website that opens up.

If you open Chrome, you have to hit the "house shaped" button on the upper left and that will take you to the home page.
In order to get your Chrome to open to the home page, you need to delete all of your tabs. To do this, make sure you are on the home page, and then click on the box on the upper right side. There should be a number in that box, that is the number of tabs open.
Then click on the hamburger symbol (a line of 3 dots on the upper right) and you will see "close all tabs". You will only see this after clicking the tab box first and then clicking the 3 dots.
Now your Chrome will open to your default home page.

I was racking my brain trying to figure how why it wouldn't open to default. It's the multiple tabs open!


Is there a way to block a Stack Overflow user?

Question: There are a lot of people on here with serious ego problems, and I have been having increasing problems lately with people getting upset that I mark their answers as wrong, then stalking me and going around downvoting everything I do on this site. I need a way to block users so that they can't take their ignorance out on me.
Comment: If a user is harassing you then you can raise a mod flag.
Comment: It takes some time to take effect, but StackOverflow has serial downvote/upvote detection. Give it a few days, and you'll see the mass down-votes reverted
Comment: (sort-of) Happened to me lately as well. To be able to "target" you, you must have commented. I learned the hard way to try and reduce that. By simply down-voting posts you already provide implicit feedback and doesn't necessarily need to comment as well. This will greatly reduce the chances of someone "targeting" you (as votes are of course anonymous)
Comment: "_I mark their answers as wrong_" How do you do that? Or do you mean downvote?
Comment: Maybe it's your tone? I've just read one of your answers about FileSystemWatcher and you appear to get on your high horse pretty quickly, attacking SO users in general when you're not happy about something. Calm down a bit.
Comment: Just in case - be aware of this: [Why shouldn't I assume I know who downvoted my post?](https://meta.stackoverflow.com/q/388686)
Comment: @Adalcar it is in your own best interest to take grains of salt with a rene.
Comment: @BryanWilliams - Your attitude towards the community could be dramatically improved.  You have literally received a single downvote in the last 3 months.  I see absolutely no downvotes on anything in 2020 until March 2020.  **So not a single one of your answers have been downvoted in the last year.**  If you are talking about deleted questions and answers, well if they received downvotes, and are deleted then they were not helpful.
Comment: "start harassing me" how? Do you know that meta votes reasons include agreeing/disagreeing & that (other than at [meta.se] it has no effect on your rep?
Comment: Maybe relevant: https://meta.stackoverflow.com/questions/270229/what-to-do-when-you-have-a-stack-overflow-stalker
Comment: Bryan, as it seems you know who *exactly* is targeting you (which I am not sure how, but let's say it is possible), please *do* report them by flagging a post and explaining the reasoning why you think you are being harassed (but be sure you have proof and not just a hunch). P.s. Unless you delete content as soon as it gets downvoted, there is nothing in your [rep history](https://stackoverflow.com/users/11244339/bryan-williams?tab=reputation&sort=time) that suggests stalking.
Comment: It is worth noting that if you block me I'm also unable to upvote your well received content. Is that a side-effect you're happy with?
Comment: I think feedback is nice even if it's saying something is not working. I'll comment on someone's post if I think something is wrong with it, and I sometimes get positive feedback from it, or mostly no feedback at all. Perhaps it depends on the nature of the feedback and how it's phrased?
Comment: I should have expected that simply posting this question has triggered people to start harassing me, lol. The irony in the air is thick today.
Answer: Thanks for making us aware of potential problems on Stack Overflow.

There are a lot of people on here with serious ego problems

Call it ego or call it proud or inexperienced or not seen the light yet. But if we want to address this at all, it needs some examples of what a serious ego problem looks like, because it is hard to have a mutual correct understanding of serious problems.

I have been having increasing problems lately with people getting upset that I mark their answers as wrong

Getting upset is not a very productive emotion. I think it is perfectly fine 'to mark answers wrong' by any method you use for that. Preferable a downvote as that is a strong signal to future visitors, and leave a comment if you feel like it, but that is not mandatory at all. If you still feel your assessment of a post is correct even after your call is challenged then simply move on. There is no requirement on the site that you're held responsible or are required to make the same judgement call as all other users.

then stalking me and going around downvoting everything I do on this site.

Serial downvoting is detected by the system and reversed after 24 or 48 hours. If downvotes are left in retaliation and are without doubt targeted, but not reversed, flag one of your posts for moderation attention and explain clearly why the votes on your post are not cast due to users stumbling on your posts. Moderators can escalate to SE staff to investigate voting against your content.

I need a way to block users so that they can't take their ignorance out on me.

Well, that might solve your problem, but not the unacceptable behavior from the blocked user. They continue their unruly behavior making the life on the site for other users unbearable. A better approach is to document the misbehaving, use the code of conduct as a behavioral base line and then flag the troublesome exchanges for a moderator. That might not give immediate results, but if you've found a pattern and that pattern becomes more clear over time it is more likely that users get warned and suspended.
We can only make Stack Overflow an inclusive and safe site if we do not tolerate off-limits behavior, but we need eyes on the ground to spot these few individuals that try to spoil the fun for many. Blocking users doesn't help in that sense. Reporting their behavior does.
Comment: In effect, there is a way to block a user who has actually violated the code of conduct: Its called getting them suspended by a moderator, and any such offensive content deleted from the site.
Comment: @user1937198 true that. If every user that wanted to block me had led to my suspension I think I would still be serving jail time ...
Answer: The feature you're discussing would have the effect of preventing someone from downvoting your posts entirely, which is inconsistent with the site's moderation model.
That being said, targeting other users for revenge downvoting is also inconsistent with the site's moderation model. Others have pointed this out, but if you know who's doing it raise a custom flag explaining the situation. Otherwise, you can use the contact form to ask SE to look into it. If someone is behaving inappropriately in this way, they should be suspended for abusing the voting system.


How do I create a material that is only visible under one specific light?

Question: I would like to know how to create a material that is invisible unless it is exposed to one specific light source, like invisible ink.
Comment: I don't mean to be facetious, but  _everything_  is invisible unless it's exposed to a light, so can you elaborate? Does it need to emerge slowly? React to one light in particular? .. that sort of thing ..
Comment: @RobinBetts maybe like shining a UV light on a motel roof.  Now you see it, now you don't.  Interesting question.
Comment: @batFINGER    Oh, I'm not denying that! I just want to make sure, before thinking about the problem, that I'm thinking about the right one.
Comment: I guess, when the intensity of the light is low, the material should be invisible. And if the intensity is high, then the material should pop-up.
Comment: Answers to [this question](https://blender.stackexchange.com/q/114178/935) might help. Another approach could be to have a boolean modifier and the other boolean object being a child of the lamp?
Comment: Why don't you manually turn visibility on and off for render since I guess you are making a video/animation, and/or you could use mix shader and plug in transparency and slowly turn switch to other shader when light is hovering for fade in effect.
Answer: As sambler pointed out in his comment, Rich Sedman's answer to how to vary a material's response to shadow rays, depending on the light to which they are cast, is very complete. This suggestion  takes the same basic approach, but instead of using drivers to feed the location of a lamp into a node tree, looks ahead down a shadow ray using OSL, to figure out which lamp is casting the shadow.
The setup for this example has cubes which are going to receive shadows, and shadow-casting circular planes just above them. The spotlight we're interested in has a plane just behind it, and parented to it, as a target for the forward-probing ray. Everything in the scene has the default Pass Index of 0, except the target plane, which has an index of 20.
(The target plane is there, because I couldn't manage to hit the spotlight with the forward ray.. perhaps someone can explain why?)

There's a little OSL script which casts a ray forward from a shading point continuing in the same direction as it arrived, and returns the index of the next object encountered.
<code>#include "stdosl.h"
shader NextObj(
  output float nextObjIdx  = 0.0
)
{
  if (trace(P,-I,"mindist",0.0001)){
    getmessage("trace", "object:index", nextObjIdx);
  }
}
</code>
It's used in this tree: If a ray is a shadow ray and the next object encountered has a Pass Index greater than 15, the multiply returns 1, else 0.

The material is applied to the circles, which are blue-transparent to any light associated with index greater than 15, but fully transparent to all other lights.
this is the sort of result:

For lots of reasons I think the geometric approach is better than this one, but maybe someone can improve it? Or come up with a way of manipulating surfaces more directly?


Maximum transfer of energy to the pan

Question: On an induction cook-top, does it make a difference in the efficiency of the pan that is getting heated if the pan has more or less a concentration of like stainless steel?  Is efficiency less if the pan has a lower amount of stainless steel on the bottom vs. all stainless steel?  Will the pan heat faster, cook hotter?  Or will the pan with less stainless steel heat and cook at the same rate?
Answer: Define efficiency.
Efficiency of energy use, or cooking?
A heavy-based pan will maintain a more even temperature, which improves cooking efficiency, but takes more energy to heat initially & 'wastes' energy cooling down afterwards, so is less efficient on power.

Maximum transfer of energy to the pan


Why are some royal mothers omitted from scripture?

Question: One of the differences between the account of the Davidic kings and the non-Davidic kings in scripture is the inclusion of mothers for most of the Davidic kings. None of the non-Davidic kings have their mothers listed in the summary of their reigns, though in the case of Jeroboam we are told his mother's name at the time of his rebellion against Solomon (Kings 1.11.26) and Jehoram of Israel's mother is identified by Jehu as Jezebel (Kings 2.9.22). One wonders why mothers are provided for 18 of the 21 Davidic kings but not for David, Jehoram of Judah and Ahaz. One further wonders if this reason is the same reason no mothers are listed in the summaries of all non-Davidic kings.
Comment: It should be noted that 'king's mother' does not always correspond to biological mother. This is clear in the case of Asa of Judah where his 'mother' is actually his grandmother.
Comment: I think she is only mentioned if she was historically significant. What that significance was is no longer obvious to us, unfortunately.
Comment: The simplest solution is the one I wrote in my answer -  that all royal mothers held some sort of office under the king and the kings who have no mothers listed with them did not have that office in their time or kingdom.
Answer: The solution to this problem lies with Maacah daughter of Abishalom. Maacah serves as 'king's mother' first for her son Abijah of Judah and then for her grandson Asa of Judah. When Maacah strayed after idolatry, Asa removed her from her office (Kings 1.15.13). The prophet never tells us what office she occupied, but the most obvious option is the office of royal mother. Because royal mother was an office and not a biological status, Maacah could both occupy the office of royal mother for her grandson and subsequently be removed from that office even though it is obviously impossible to 'unmother' someone.
Once we accept that royal mother was an office and not a biological relationship, we can further suppose that this office only existed in the Davidic kingdom from Solomon's reign on and that this office was vacant for two of the Davidic kings (Jehoram and Ahaz).  This vacancy can be understood as occurring when there was no appropriate matriarch available due to death, misconduct or illness.
In David's time the office had not been established yet. We might speculate that it was created by Solomon in recognition of Bathsheba's efforts to prevent succession controversy. Perhaps the prophet hints at the creation of a new office when he says about Solomon וישם כסא לאם המלך (Kings 1.2.19).
Answer: Excellent question.
The issue is discussed here (search for the text "why in the list of the kings of the Northern Kingdom")
An answer is offered that the Ramban writes:

שהכתובים מזכירים במלכים שמות אמותם

That it's the norm to mention the the names of mothers of kings (seemingly out of honor to the king).
The author of that blog posits that the Ramban's position is that non-Davidic kings don't have a real status of kings and therefore the name of the mother doesn't get mentioned.

רמב"ן בראשית מט:י
הנה, שנו בכאן שאין מושחין מלכים מן הכהנים בני אהרן. ופירש תחלה שהוא לכבוד יהודה, שאין השררה סרה מן השבט ההוא. ולפיכך, אף על פי שישראל מקימים עליהם מלך משאר השבטים כפי צורך השעה, אין מושחים אותן שלא יהיה עליהם הוד מלכות אלא כמו שופטים ושוטרים יהיו. והזכירו הכהנים, שאף על פי שהן בעצמן ראויים למשיחה, אין מושחין אותן לשם מלכות, וכל שכן שאר השבטים, וכמו שאמרו בגמרא (הוריות יא) שאין מושחין אלא מלכי בית דוד.

As an aside, the following image which lists all the occurrences of the phrase "ושם אמו" in Tanach.

An interesting pattern emerges (that I currently cannot explain) that "שלם" (highlighted) appears adjacent (or at least near) the phrase "ושם אמו". The "שלם" appears within Shlomis bas Divri and Shlomo haMelech and Yerushalayim.  This pattern appears in all but one occurrence.  That occurrence happens to be with Na'ama, the mother of Rechavam who, as can be seen, is already mentioned several pesukim earlier.
Comment: It is difficult to see only Davidic kings as 'real' kings. Scripture speaks very highly of Cyrus and Nebuchadnezzar II is called God's servant yet neither of their mothers are provided. Additionally, surely David himself is a legit king even though the prophet omits his mother.
Comment: @MosheWise the author of the quoted blog quotes this as the opinion of the Ramban re: kings of the Jewish people (Koresh and others are real kings of other nations but aren't under consideration for the issue at hand). I have edited to include the words of the Ramban above.  Yes this still doesn't answer the lack re: a mention of David's mother.
Answer: The Books of Kings were written from the standpoint of Judah, not (northern) Israel. For these writers, the non-Davidic kings were not so important lineage-wise, because G-d had not promised these kings that their royal lineage would be unbroken. To quote Psalm 132:
<code>The Lord swore to David a sure oath
    from which he will not turn back:
"One of the sons of your body
    I will set on your throne.
If your sons keep my covenant
    and my testimonies which I shall teach them,
their sons also for ever
    shall sit upon your throne."
</code>
Also, whether the authors thought of the non-Davidic kings as legitimate or not, the details of these kings' lineages were not as well known to these writers, who were, themselves, citizens of the Kingdom of Judah. Indeed, the book directly refers the reader elsewhere for additional information. So we see, for example, in the case of King Ahab:

Now the rest of the acts of Ahab, and all that he did, and the ivory
house which he built, and all the cities that he built, are they not
written in the Book of the Chronicles of the Kings of Israel?

There are at least 17 instances in the Books of Kings, in which the reader is referred to the "Chronicles of the Kings of Israel" for additional information about the non-Davidic king whose reign has just been summarized. It may well be that the names of the northern kings' mothers were listed there.
The simplest answer to the OP question is thus that the authors of the Books of Kings generally provided much less information about the kings of Israel than about the kings of Judah. The lineages of the latter were more important because of God's promise to David. Also, additional information was thought to be available to the reader in the Chronicles of the Kings of Israel.
Comment: Why are the mothers of David, Jehoram of Judah and Ahaz missing?


How to write a forced resignation letter?

Question: The university that I work at is asking me to resign in lieu of termination. I have basically been told that if I don't resign I will be terminated. My manager and HR have asked me to send them my resignation letter. In the letter, should I write that I was "asked to resign" as the reason for leaving my position? Or should I not include this? For more context, this is a private university in the New England area.
Comment: Check with your state's unemployment laws.  Depending on your reason for resigning, you may not be eligible for unemployment benefits.  You may be better off being terminated (assuming you don't already have another job lined up)
Comment: "The HR lady said I would be able to receive unemployment" sounds **like a flat lie**
Comment: HR serves the needs of the organization. As you are no longer a part of it, be careful of what you assume from them.  If the resignation is not your fault, why must you resign?
Comment: @Joe Strazzere: I ended up having a meeting with HR & my manager last week and they said this would lead to termination if I didn't resign. They said they wanted to give me a way to exit the university more gracefully instead of being terminated.  I felt strong pressure from both of them to agree to this. The HR lady said I would be able to receive unemployment as this counts as a termination, but it would be written as a resignation on my file. I ended up talking more to my manager and we negotiated one more week, which he had to get approval for. My end date will be the end of the month.
Answer:
In the letter, should I write that I was "asked to resign" as the
reason for leaving my position?

No, just do something along the lines of:
"I regret to inform you that I will be resigning my position with [blah place], effective on [mm/dd/yyy]."  Keep it as simple and brief as possible.
If you are serving a notice period, add that as well if you wish.
Resigning is viewed more favorably than being terminated, so be appreciative of the fact they are asking you to resign versus being terminated.
One thing for you to consider, are unemployment benefits/insurance an option for you?  If so check out your state's regulations as if you resign versus being fired you may not qualify.
Comment: @Nia They who?  Check with the unemployment office to be 100% certain.
Comment: What @Neo said a thousand times, its in their interest to have you out of the doors, and there is no penalty for them for giving you bad advice regarding unemployment benefits, so before you will send over this letter triple check the unemployment eligibility yourself.
Comment: When it comes to forced resignation letters you cannot beat the short, simple example of Richard Nixon. https://images.app.goo.gl/dGj9zS2k8dT7xPQt7
Comment: This is basically wrong, delete "I regret to inform you that" and "will be"
Comment: Yes, they did let me know i could collect unemployment.
Comment: Why *isn't* there a penalty for lying in this context?
Comment: @Bwmat: how would you prove it if it was verbal? And if it's written, how do you prove that it was deliberately wrong? And if that doesn't matter, companies are going to do what is safest, nothing they aren't legally required to do.  If letting the OP resign is allowed, but non mandatory, that would be changed to summary termination as it doesn't incur any additional risk.
Comment: Easy, if it's written, and wrong, the company itself is on the hook for unemployment.
Comment: @Bwmat What do you base that opinion on? It's a nice ideal, but not reality afaik. And that's assuming that you have all the evidence perfectly lined up.
Comment: I'm saying how I think it should work, not how it does
Answer: The university will ask you to do what's in their best interest. You can be reasonably sure that it's not in your best interest. The only times when you would resign yourself are (1) if you want to leave and they don't want to let you go, and (2) if you did something that exposes you to criminal charges, and you are given the choice of resigning or the police getting involved.
If they want to get rid of you, make them pay for it.
Comment: As I never -1 without a comment: there is a third reason to resign, so you can honestly say that you've quite the job and control the narrative this way, without having to lie or otherwise hide the fact that you've been fired. It can also easier for the HR department, but that certainly is a relatively often given out and better for the soon-to-be-ex employee.
Comment: @TymoteuszPaul In the last five years, resigning would have cost me a very large five digit number.
Answer: If you need unemployment insurance benefits more than a spotless employment history, then let them terminate you. If you need to control your employment history so that there's nothing to explain from this job, then resign. (If you resign, make the letter short and to the point; disregard the 'forced' part.)
Answer: They want you to resign instead of directly terminating your employment.  They have a reason - it can only be guessed at why.
Use this to your advantage.  Negotiate as to what they will do for you to resign as opposed to firing you outright.  Severance pay?  Continuation of benefits at employee rates for a period of time?  Usage of outplacement resources?
Do not tale the HR opinion that you will remain eligible if you resign as opposed to being terminated.  Get an answer from your states employment security office before resigning.  Do not believe HR - they represent the company and not your interests.


How can I filter a library using multiple columns?

Question: I'm trying to filter a library using multiple columns, by project number, type, and an additional category, however when I use multiple filters, the filters applied last don't apply properly. For example, if I apply the type "pdf" filter last, some docx  items are included. If I apply the project number filter for "8" last, then some 9 10 11 items are included. Has anyone experienced this issue?
Comment: Are you using classic view or modern view? which type did you use for these fields that you use to filter? Please create a view and set filters to see if it could work.
Comment: I'm using modern view. All of the fields are choice fields, same issue when creating a view.
Answer: I haven't experienced that issue. However, if you are having trouble getting filters to do what you want, you could try creating a view instead.
Comment: I experience the same issue when creating a view.


Resolution of short exact sequences by the split ones

Question: Given a short exact sequence of vector bundles on a projective variety, after tensoring with an $\mathcal{O}(n)$ with high $n$ that makes all terms globally generated (so that taking global sections becomes an exact functor), we can lift short exact sequence to a short split exact sequence of trivial bundles. This means that there is a short split exact sequence of vector bundles that surjects to our initial SES. Now the by taking kernels we get a new SES. My question is which short exact sequences admit a finite resolution by split short exact sequences? Does the original SES needs to be split or most SES admit such a resolution?
Answer: Every short exact sequence $0\to X\stackrel{\alpha}{\to}Y\stackrel{\beta}{\to}Z\to0$ is the quotient of a split short exact sequence by a split short exact subsequence. This answer is copied from my answer on math.stackexchange.
$$\require{AMScd}\begin{CD}
@.0@.0@.0\\
@.@VVV@VVV@VVV\\
0@>>>0@>>>X@>1>>X@>>>0\\
@.@VVV@VV\begin{pmatrix}1\\\alpha\end{pmatrix}V@VV\alpha V\\
0@>>>X@>\begin{pmatrix}1\\0\end{pmatrix}>>X\oplus Y@>\begin{pmatrix}0&1\end{pmatrix}>>Y@>>>0\\
@.@VV1V@VV\begin{pmatrix}\alpha&-1\end{pmatrix}V@VV-\beta V\\
0@>>>X@>\alpha>>Y@>\beta>>Z@>>>0\\
@.@VVV@VVV@VVV\\
@.0@.0@.0
\end{CD}$$
Comment: This technically answer my question so I accept it, although doesn't solve my problem!


to be in present progressive

Question: Sometimes in songs I see sentences in present progressive without verb to be, like - she getting down. Is it right?
Comment: I suspect [a previous question about AAVE](https://english.stackexchange.com/questions/152323/) is relevant here, and possibly a duplicate.
Comment: People who write song lyrics don't have to follow the same rules as people learning the language. First, be sure you're hearing the words correctly; they get transcribed wrong very often. Second, consider the sentence that those words might have been, if they had followed the rules you learned. Third, see if you can say that sentence fast enough to generate the song words you think you heard. If you can, that's most likely what happened. While singing and talking fast, words can change quite a lot.
Comment: Is it right?  No, but it's a thing right now, and it's not just with the present progressive but includes omitting the verb "to be" in general, like saying "She crazy," instead of "She's crazy."  There's even an episode from season seven (episode four) of Modern Family titled that -- "She Crazy."
Comment: https://www.youtube.com/watch?v=nBh8l54NF-g
Answer: Asking whether this is "right" is a tricky question in linguistics. There are two ends of the spectrum for viewing language, one being prescriptivism and the other descriptivism. The former has connotations of a 19th century grammar school teacher that will rap your knuckles for misspelling a word, while the latter can be thought of as a brilliant alien who comes to earth to observe and record the language it encounters in ALL settings (registers) to present the data to its own people back on its home planet.
From a descriptivist standpoint, the phenomenon you're observing here is called Zero Copula and is in this instance likely a feature of the African American Vernacular English dialect (AAVE; sometimes referred to as Ebonics). It is a recognized, spoken dialect that has observable patterns and rules—so much so that the Holy Bible has been translated into this dialect.
A genre of music (that includes spoken word) will often adopt a characteristic dialect based on the genre's origins, so that you even see artists whose native dialects are not the same as that of the genre's, writing lyrics that fit that of the genre (e.g., Vanilla Ice).
Your question as to whether this grammatical construction is "right" might be rephrased to, "is this Standard American English?" The prescriptivist answer to that would be: No.

to be in present progressive


Variable from class doesn't show in editor

Question: this may be another beginner question. I have a simple data holding script and want to pass one variable from it as parameter to a function. But in the editor it only shows me the script name, not the option of any variable. What attribute or change do I need to make to make the variable visible for selection? (Passing the whole object works, but I don't like the parsing of the object inside the called method and would just to pass the parameter directly) Picture for easier understanding.
Answer: A UnityEvent, like the Button's OnClick event acts on methods, not on variables.
The reason it looks like it's setting variables in the cases you showed is that it's acting on something in C# called a property. That's where you define something like this:
int _internalValue;
public int exposedValue {
    get {
        return _hiddenValue;
    }
    set {
        _hiddenValue = value;
    }
}

This creates something that looks to your code like it's a variable: I can say exposedValue = 5 or if(exposedValue > 0) for example. But it "de-sugars" to methods: SetExposedValue(5) or if(GetExposedValue() == 5.
This is syntactic sugar to make it easier to write and work with simple getter and setter methods common in certain programming styles/patterns. In practice we'll often put validation/update/copying logic inside these methods, or make the getter or the setter private, to ensure outside interference can't put our internal hidden variables into an invalid state.
C# will let you sweeten this even more for simple cases that don't need extra logic, with an auto-implemented property:
public int exposedValue { get; set; }

Here we don't even have to explicitly declare and manipulate our "backing store" variable _hiddenValue - the compiler generates code equivalent to the example above.
Since the set part of this property is a method that takes one argument, our UnityEvent can call it - as long as the argument (the type of our property) is a primitive type (eg. int, float, string, bool...) or something descending from UnityEngine.Object (eg. GameObject, ScriptableObject, Component/MonoBehaviour/descendents, Material, Texture...)
So your Tile.tag & Tile.name examples are referencing the setter methods of the properties called tag and name, not variables.
Since your TileHelper isn't a primitive type or descended from UnityEngine.Object, we won't be able to assign the whole object with a button click event this way. But we could add some properties to set parts of it at a time:
public TileHelper tileHelper;

public string tileHelper_CorrespondingLevel {
    set { tileHelper.correspondingLevel = value; }
}

This will expose the tileHelper's correspondingLevel field to be set by a UnityEvent.
Or, you could make your helper class derive from ScriptableObject to assign it all at once by reference to an asset in your assets folder.
Comment: Thank you for your time. This gave me some insight in how to handle it, although the root problem seems to be something else. The On Click is custom parsing from NGUI and can't handle it if the variable is not a basic one and on the same script. (And no getter needed) But the links gave me an idea in how to extend the code to implement to make it work with custom classes/ struct to get the same result.


Django crispy forms language settings

Question: I am a beginner at web application development using django framework.
I am creating a crispy form to update the user information and upload an image.
The html file contains two forms, one for updating the information and second for uploading the image.
While the rest of the form language setting is us-en, only the button and text next to the upload button are seen in german language.
The settings.py file has the chosen language code as 'en-us'.

In the model.py file the forms are defined like below:

The forms are then used in the html file:

But the webpage shows the following:

could anyone please help me understand, what is making only the upload button language change to german and how could I possibly fix it?
Thank you :)
already tried: checking the language code in the settings.py file
Answer: So it turns out that the file chooser language is determined by the browser language settings and not the language given in the settings.py file of the django project. This is because the file chooser is provided by the browser and not native to the crispy form.
FYI: Instead of deleting the post, I am answering my own question as the answer might help someone else who is facing a similar issue :)

Django crispy forms language settings


Assigning an address of an array to a variable and delete

Question: My assignment wants me to do this: "Allocate an array of seven ints; initialize it to 1,2,4,8, etc...; and assign its address to a variable  p2"
This was my code:
int* p2 = new int[7] {1,2,4,8,16,32,64};
    cout << "Drill 3 & 4 (allocating 7 element array): " << endl;
    for (int i = 0; i < 7; ++i) {
        cout << p2[i];
    }

but I am concerned that I am misunderstanding the instructions. Because of that, I tried this code I found online:
int* sev = new int[7];
for (int i = 0; i<7; ++i)
    sev[i] = i+1;
int* p2 = sev;
cout << "p2= " << p2 << ", *p2=" << *p2 << endl;
cout << "sev= " << sev << ", *sev=" << *sev << endl;

But it outputs the address and then 1. And when I add a for loop to do it seven times for all of the elements, it's just 1111111.
Is my code above assigning the address to the pointer or doing something different?
I later have to make it equal to p1, which is a pointer (*int p1 = &x, x = 7 <--not code, for reference). And I need to deallocate p1 and p2 (and p3, but that's not relevant). It lets me deallocate p2, but not p1. So, I am thinking maybe I am not understanding the question or am not approaching it correctly.
Answer: Both the variable sev and the variable p2 are pointing to the first element of the data you have allocated. That's really all you have.
So when you dereference the pointers (with e.g. *sev) you dereference the pointer to that element only, and get that value only.
A more "graphical" way of looking at your "array" might be like this:

+--------+--------+--------+--------+--------+--------+--------+
| sev[0] | sev[1] | sev[2] | sev[3] | sev[4] | sev[5] | sev[6] |
+--------+--------+--------+--------+--------+--------+--------+
^
|
sev / p2

The arrow points to the first element only.


Authentication precedence

Question: In nsswitch.conf file I have an entry "passwd files sss". Also I have the evidence that the server is having LDAP authentication. Since the "files" for passwd is enabled and it points the local authentication , which one take the precedence?
Answer: The file /etc/nsswitch.conf defines the order of NSS modules used to do lookups in NSS maps. Strictly speaking lookups in the passwd map are not used for authentication, only for checking the existence of a user trying to login.
Password authentication is done via the PAM stack configured in /etc/pam.d for earch service using PAM.

For local users the PAM module pam_unix.so does a NSS lookup in the shadow map to get the hashed password and check the user's password against this.
For remote LDAP users the shadow map should not be used. For example sssd sends a LDAP simple bind request to let the LDAP server check the user's password remotely. It does not query password hashes.

So to find out the order of PAM authc modules used you have to examime the files in directory /etc/pam.d. Most Linux systems today have common include files they use for every service such as /etc/pam.d/common-auth, most times a symlink to common-auth-pc created by tool pam-config.
Answer: See man 5 nsswitch.conf (bold added):

The first column is the database name.  The remaining columns specify:

One or more service specifications, for example, "files", "db", or "nis".  The order of the  services on the line determines the order in which those services will be queried, in turn, until a result is found.

And your case, files takes precedence, which is as it should be - usually you don't want an LDAP entry for say, root, to override local entries.

Authentication precedence


Best techniques for hihat foot independence

Question: I am self taught regarding drum set and have neglected training hihat foot independence. I can keep with a metronome alright so the sense of timing is not much of an issue, but when I try to open/close the hihat on 2s and 4s, everything falls apart. I can play both hands and hihat foot independently but no kick, or I can play both hands and kick independently with no hihat. What are the best techniques to fix this?
Comment: same way you learned everything else, slowly and painfully
Comment: Aren't some methods slightly less slow and painful than others?
Comment: Seriously though, taking it apart is usually the way to go. For example start with only 8ths on the ride plus foot–hi-hat, then experiment with the kick – first only on 1 and 3, then try to make it independent. Once you have that dialled in, add the snare, again first only on 2 and 4 together with the hats, then try out the typical suspects ghost notes etc..
Comment: I tried and do hand rudiments with my feet on quarter and 8 notes while my hands keep the time
Comment: Sure. Here's one that's more slow and painful than those that you should use: omit the snare at first, and instead hold the left hand in the hi-hat whilst snapping it shut with the foot...
Answer: I'd recommend that you include your weak foot in the regular exercises from the beginning. Don't neglect it for 20 years and only then realize how important it can be.
Even though you may never actually play double-bass, I'd recommend to practice double bass exercises for coordination. The weak foot is considered "weak" for a reason. I found that I did not have control over it. After going through some double-bass courses, my whole posture adjusted.
Also, try to lead with the weak limb (foot or hand) in order to improve the control.
Using a second bass pedal instead of hi-hat helps because there is no difference in the sound and the technique between the two feet.
Comment: Not a bad suggestion, but I daresay double kick technique hardly translates to hi-hat foot technique. It'll teach left-foot control, but hardly left-foot _independence_ since in double kick playing, the feet are generally closely linked together.
Comment: @leftaroundabout, that depends on the exercises, of course. See Marvin Dahlgren, 4-Way Coordination, for example.


How to play half steps above 7th position on violin?

Question: It seems like no matter how closely I place one finger next to another a half step  always comes out sharp - and I don't have fat fingers. I can never seem to play in tune in high positions because of this. Are there any secrets to playing in tune in high positions? How do the pros do it?
Answer: Depending on your scale and the musical passage the half step may be played with the same finger. Playing A Major scale, as an example, has some forms where you shift to the 5th position on D and then play both the G# and A with the 4th finger.
In other cases the previous finger is lifted back and away on the transition when placing the next half step so as to give the next finger some room.
Answer: Itzhak Perlman is the classic example of a fat-fingered violin virtuoso. The way he describes what is required is that the new finger pushes the old finger out of the way. The problem with sliding the same finger up is that you get a slide. If the notes are supposed to be slurred you can't really lift the finger up and put it down again half a finger-width up.


Subgroups of order $p$ and $p^{n-1}$ in a group of order $p^n$.

Question: I have a group $G$ of order $p^n$ for $n \ge 1$ and $p$ a prime.  I am looking for two specific subgroups within $G$: one of order $p$ and one of order $p^{n-1}$. I don't think I would use the Sylow theorems here because those seem to apply to groups with a "messier" order than simply $p^n$. Would Cauchy's Theorem allow me to generate the two requisite subgroups? I could use it to find an element of order $p$ and an element of order $p^{n-1}$ and then consider the cyclic subgroups generated by these two elements?
Comment: Your idea is good for the subgroup of order $p$.  But you can't use Cauchy's theorem to get an element of order $p^{n-1}$ (and no such element will exist in many cases).
Comment: Then letting $a \in G$ be an element of order $p$, perhaps I should consider $G/\langle a \rangle$?
Comment: @JJR $\langle a\rangle$ need not be normal for arbitrary $a$.
Answer: Hints:
1) Use the class formula and deduce that $\,|Z(G)|>1\,$
2) Use induction now to show that $\,G\,$ has a normal subgroup of order $\,p^k\,\,,\,\,\forall\,\,0\le k\le n\,$
Comment: Looks tractable. Thanks for your help!
Answer:
 Let $P$ act on itself by conjugation. $1$ appears in an orbit of size $1$, and everything else appears in an orbit of size $p^k$ for some $k$.  Since the sum of the orbit sizes is equal to $|P|$, which is congruent to $0\mod{p}$, that means there has to be at least one more orbit of size $1$.  Orbits of size $1$ under conjugation contain elements which commute with everything in the group; they compose $Z(P)$.  Now suppose inductively that $\exists S\unlhd P$ with $|S|=p^k$.  Then by the above lemma and Cauchy's theorem $P/S$ has a central subgroup $\overline{Q}$ of order $p$.  Lifting $\overline{Q}$ back to $P$, we obtain a normal subgroup of order $p^{k+1}$.


Installing opencv on a raspberry pi zero

Question: I have been trying to install opencv on my raspberry pi zero loaded with buster. I have followed a couple of tutorials online with no success.  I thought this tutorial worked until I tried to import cv2 in python and it returned "Illegal instruction" and then kicked me out of python.  I opened up python again and typed "import garbage" and it returned ModuleNotFoundError: No module named 'garbage' and allowed me to stay in python.  I read somewhere online that "Illegal instruction" is displayed when there is a discrepancy in the architecture. This makes sense considering the tutorial was for a raspberry pi 2,3,4 and I am trying to install this on a zero. I am pretty new to this and not certain how to fix this or if it can be fixed. Does anybody have a solution or can point me to a tutorial that was successful installing opencv on a pi zero?  Thank you for your time.
Answer: I don't know what you have tried because I don't follow links to understand a question, but at a glance it seems that you tried to compile ``OpenCV` from source. That is not needed. Just install it from the repository with:
rpi ~$ sudo apt install python3-opencv

If you need additional modules look for them with:
rpi ~$ sudo apt list *opencv*

Comment: This will not work. The build in the repos is not for arm64 and will throw "Illegal operation" when cv2 is imported. On the pi zero, it seems one absolutely has to build from source.
Answer: I got bitten by this issue, too, and managed to solve it. The problem following the build instructions from the link is that the configuration command includes CPU instruction set optimization flags (neon, vfpv3) not supported by the slightly lesser CPU of pi zero.
Change the configuration command to
cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
    -D ENABLE_NEON=OFF \
    -D ENABLE_VFPV3=OFF \
    -D BUILD_TESTS=OFF \
    -D INSTALL_PYTHON_EXAMPLES=OFF \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D CMAKE_SHARED_LINKER_FLAGS=-latomic \
    -D BUILD_EXAMPLES=OFF ..

That should do the trick. Still, the build takes almost 24h. If you don't need the newest tricks from OpenCV, the solution from Ingo is the best, and I wish I had seen it before spending the days building from the source. (Installed from repository: 3.2.0, self-built: 4.4.0-pre.)