Can I add a colored button to a UIToolbar?

Question: It seems like I can't add any buttons that contain colors in a UIToolbar, they always get replaced with a white mask. How can I add a colored image to a custom button in a UIToolbar?
Answer: Yes you can, but its not really a uibarbuttonitem.
here is the link.
http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/
PS.
If you want to have an IBAction for that button, then call it on valuechanged event.
Answer: No, I dont think you can directly. It looks like it has to be as you said.
You might be able to hack things though by putting your image over the toolbar's image and letting the touch events pass through it by tweaking the hit testing.
Answer: Without using private API's, you can't.  Apple will block your app if you use the private API's, so you might as well construct your own control and use that.
Answer: You can also look at the UIApperance protocol this is very useful for customising the look and feel of many of the UI elements. You can change a specific item or every instance of that item using the static method.
<code>[[UIToolBar appearance] setTintColor:[UIColor blueColor]]
</code>
This would change every instance of a UIToolBar in your app blue.
Answer: You can use custom toolbar, where you can use any toolbar background and colored images: http://github.com/marichka/Custom-UIToolbar


Maya Python referencing optionMenu returns as non-existent

Question: I am trying to write a script that, on button press with a joint selected, will copy the transform values from the selected joint(s) and then create a controller selected from an option menu. My problem is getting the code to read the option menu. I've tried several variations and all say there is no option menu with the selected name.
Code follows....
import maya.cmds as maya

def testWin():
    winName = maya.window(title="test", rtf = True, mxb = False)
    maya.columnLayout()

    maya.button(label = "run test", c = "test()")
    shapeMenu = maya.optionMenu( label='Shape Menu', changeCommand="test()" )
    maya.menuItem( label='Circle' )
    maya.menuItem( label='Square' )
    maya.menuItem( label='Triangle' )

    maya.showWindow(winName)

testWin()

def test():
    sel = maya.ls(type = "joint", sl=True)
    if not sel:
        print "select at least 1 JOINT"

    else:
        new_pos = maya.xform(q=True, t=True, ws=True)
        new_rot = maya.xform(q=True, rotation=True, ws=True)
        shape = maya.optionMenu("Shape Menu", q = True, value = True)

        if shape == "Circle":
            new_control = maya.circle(center = new_pos)
        elif shape == "Square":
            new_control = maya.nurbsSquare(center = new_pos)
        elif shape == "Triangle":
            new_control = maya.circle(center = new_pos, degree = 1, sections = 3)

Answer: You can't be sure that maya will give you the name you asked for when creating a GUI object -- an in this case it will never work because the name that comes back will not have the space.
You should capture the name of the option menu by returning the value of shapeMenu from your testWin() function then use that in your test() function


Does Google Analytics track links that use onclick="parent.location='Something.html' "?

Question: I am using onclick="parent.location='#'" to make a table into a link, but will Google Analytics see this as a link or will it cause mayhem in the reports?
Answer: If the link is internal to your site, yes Google will track it, because the target page should contain the tracking script as well.
If the link is external, then no. You need to call:
<code>pageTracker._trackPageview('...your url...');
</code>
then direct the user to the new page.
Answer: From the server's perspective there is no difference between an actual link being clicked and a request sent by JavaScript. Both are HTTP requests. I'd assume that Google Analytics counts them.


2 Layers of 5/8" Drywall in Garage Side

Question: DO I need to provide 2 layers of 5/8" type x gyp board on garage side?
Plan checker is telling me I need to specify 2 layers.
Comment: May be local code dependent. What city /state /country?
Comment: LAGUNA BEACH CALIFORNIA
Comment: IT HAS ALWAYS BEEN 1 LAYER OF 5/8".
Answer: Garages are to be separated from single family residences by 1/2" gypsum board on garage side ONLY, provided the garage does not open into a sleeping room. (See 2017 edition ICC Table R302.6.)
Also the door between the garage and house shall be a solid wood door a minimum of 1 3/8" thick and is not permitted into a sleeping room. (See ICC R302.5.1.1.)
However, town houses require 2 hour separation, which requires 2 layers.

2 Layers of 5/8" Drywall in Garage Side


Increasing the surface area of an electro magnet

Question: I am trying to design an electro magnet with a large surface area at the end.  The first design used a 1/4" rod wound with magnet wire resulting in about 10 ohms of resistance driven with 12 V.  This produced a fairly strong magnet with a small area at the end.  My desire is to create a magnet of similar strength but with more surface area at the end to allow for easier location with another magnet.  So I soldiered a 1"x1" plate of approximately 1/8" thickness to the end of the 1/4" rod thinking that the flux would then spread out over the area.  It turns out that the magnet has very weak magnetism on the surface but is strong around the edges so I think that the plate is directing the flux to turn and flow out of the edges (not the desired effect).  I know that I could just increase the diameter of the rod to say 1" but this will cause the magnet to weigh more and reduce the number of turns.  It there a way to couple the small diameter core (i.e. to get more turns) and spread out the flux at the end over a wider area without the flux being drawn to the edges?
Answer: Even you are not specify the holding or attracting "strength" of your electromagnet,
increasing the area of your pole tip, you spread the flux and increase the leakage.
Usually conical, or sharp pole tips design resulting a flux density gain especially in short distances. You can see this in magnetic tweezers.

The pole tip of your core also highly related with the dimensions of the object you are going to lift, because the ferromagnetic object acts as a mirror of your electromagnet core. If your core tip area is much larger than your object, then it will shift to the edge of the core. Good performance starts with an analogy of 0.8:1.
In your case you can construct a "jacketed" electromagnet in case of a holding electromagnet desired, or try to make the coil longer (longer core) increasing the magnetic lines return path and strengthen the attractive force.
So I think the answer is no.
EDIT
The traction force of the electromagnet will be

where
P is pull in Kgr, Ag the cross sectional area of gap, lg the length of the air gap in cm, and NI is the ampere-tirns. (Charles R. Underhill "Solenoids Electromagnets and Electromagnetic Windings" 2nd edition NY 1914)
Comment: @Commodore63 Horseshoe supports lifting force by design i.e close magnetic circuit through armature.
Comment: Thank you for the answer. I am trying to create two magnets which will attract each other when close.  Increasing the area seemed to be the best way to do that.  If a conical design is used, will it improve the proximity performance?
Comment: I did some FEM modeling and it seems like the lines of flux are leaking out of the sides of the cone.
Comment: @Commodore63 1- If you want a polarized electromagnet, use a combination of electromagnet and permanent magnet. 2- Try to model the conical shape, using angles between 40-55 deg. and keep the conical length part less than a quarter of core diameter.
Comment: Would there be any advantage to using a horseshoe configuration or "C" configuration as opposed to a bar?


Contiguous blocks of memory and VM

Question: I was reading up on Virtual Memory and from what I understand is that each process has its own VM table that maps VM addresses to Physical Addresses in real memory. So if a process allocated objects continuously they can potentially be stored in completely different places in Physical Memory. My question is that if I allocate and array which is supposed to be stored in a contiguous block of memory and if the size of the array requires more space than one page can provide, from what I understand is that array will be stored contiguously in VM but possibly in completely different location in PM. Is this correct? please correct me if I misunderstood how VM works.  And if it is correct does that mean we are only concerned whether allocation is contiguous in VM?
Answer: That's right. Arrays must only looks contiguous for your application, but may be physically scattered on memory.
Comment: ... and there's no problem about it
Answer: Whether or not something that overlaps a page boundary is actually contiguous in Physical Memory is never really knowable with modern memory handlers.  Memory glue logic essentially treats all addressable memory pages as an unordered set, and the ordering is essentially associated with a process; there's no guarantee that for different processes that end up getting assigned the same two physical memory pages (at different points in time) that the expressed relationship between those physical pages will be the same.  Effectively, there's a translation layer between the CPU and the memory that handles this stuff.
Answer: I just wanted to add/make it clear that from a user space program's point of view, a chunk of allocated memory always appears contiguous. The operating system in conjunction with the CPU's Memory Management Unit (MMU) handles all virtual to physical memory mappings and the programmer never needs to worry about how this mapping is handled (unless, of course, said programmer is writing an operating system).
A compiler (or one who writes code in assembly) can treat a program's addresses as starting from 0 and going up until the largest address needed for that particular program. The operating system then creates a page table for each process and uses this table to partially decode a physical address for each virtual memory location. The OS treats an address in a program as two separate parts, the page address and the offset into that page. Then, the MMU translates a page address into a physical frame address. Note that a physical memory "frame" is analogous to the conceptual "page" from the standpoint of the OS; these two are of the same size (eg 4096 bytes).
Since physical memory is divided into equally sized frames, and page size is the same as frame size you can know how much of your virtual address is used as a page location and how much is an offset into that page. For instance, if your OS "allocates" 4 gigabytes to each process (as is the case in Linux), and your page/frame size is 4096 bytes, you can know that 20 bits (4,294,967,296 bytes / 4096 bytes = 2 ^ 20 = 1,048,576 pages/page addresses) of a 32 bit address are used as a page address, which will then be converted to a physical frame address by the MMU, and the remaining 12 bits are used as an offset to determine the location of the address starting from the beginning of the page/frame.
VM (user pace) address --> page + offset (OS) --> frame + offset (MMU) = physical address

Contiguous blocks of memory and VM


(M2EPro) Determine if FBA Order

Question: I'm using the M2Epro extension to gather ebay and amazon orders. We want to differentiate between FBA orders and MFN for Amazon Orders. I can't find a column in SQL that differentiates between FBA and MFN, but there is an option to disable adding FBA orders... so figure it must be in the system somewhere. Does anyone know?
Comment: The question describes a problem that can be reproduced when a person has m2epro...
Comment: The problem went away after digging deep into the SQL tables associated with M2Epro... not on its own.
Answer: I found the data in m2epro_amazon_order. There's a column for is_afn_channel.

(M2EPro) Determine if FBA Order


My Bitcoin client has stopped syncing

Question:
As you can see my client is stuck on 99,7% with unknown. Syncing Headers(577895), It has been in this state since last day synced(which you can see). How can I get it to work since I have plenty of disk space and I run a computer maintenance program quite often.
Comment: Can you include the contents of the debug.log file?
Comment: Contents of debug.log:
`2019-06-08T07:51:14Z Potential stale tip detected, will try using extra outbound peer (last tip update: 230677 seconds ago)
2019-06-08T07:51:20Z New outbound peer connected: version: 70015, blocks=579781, peer=8097
2019-06-08T08:01:09Z Timeout downloading headers from peer=8084, disconnecting
2019-06-08T08:01:09Z ERROR: AcceptBlockHeader: block 0000000000000000000267fdf54d391d7e63d24c92f9437f94897fbc0c63c1e1 is marked invalid
2019-06-08T08:01:10Z ERROR: AcceptBlockHeader: block 0000000000000000000267fdf54d391d7e63d24c92f9437f94897fbc0c63c1e1 is marked invalid`
Answer: Take a look at the lower right corner of your "Bitcoin Core - Wallet" window where you see icons of BTC, a lock icon, HD, and two more to the right. The icon on the right to the HD shows how many nodes you are connected to. And, it seems like your node is not connected to any peers.
There might be two causes of this:

Your node is not connected to the internet.
There are no other bitcoin nodes available at that specific moment.

For these two problems, you should check and make sure you are connected to the internet, and wait for your node to pick up on other peers on the network.

My Bitcoin client has stopped syncing


Difference between "perception" and "view"?

Question: What is the difference between view (as in "right view" in the Noble Eightfold Path) and perception (as in the 3rd of the five Skandha's)?
Grateful for help! Peace, Tord
Answer: Perception is making memory.
Everytime we are making memory. One is touching (construction), feeling (feeling), and making memory (perception), while seeing (consciousness) a color at same moment.
Perception must arises everytime, except asannasatta-brahma and sannavedayitanirodhasamapatti, with a wholesome aggregate, unwholesome and neither wholesome nor unwholesome.
View is understanding of relations.
Right view is understanding in the relations of aggregates in the dependention origination cycle.
It is a kind of construction aggregates, sankhara. It can arise only with wholesome and neither wholesome nor unwholesome.
Wrong view is misunderstanding in  the relations of aggregates in the dependention origination cycle. It is a kind of construction aggregates, sankhara as well. It can arise only with unwholesome.
See the path of purification chapters: aggregates,  and dependent origination.
Answer: Perhaps if you search this site for "What is perception?" and "What is a view?" you will answer your question in two steps.
To summarize very briefly, in my understanding,
Perception is what happens when (for example) you look at some visual features and from them recognize the whole object, then you take the more abstract features of the object and recognize situation, then you take the more abstract features of the situation and recognize your position and so on. It's a cyclic process of recognition and association, from features to a higher-level concept.
View is an entirely different thing altogether, it's your philosophical framework, the basic structure according to which you see life and choose course of action.
As Bonn said, both rely on accumulated tendencies (sankhara), what we could, perhaps superficially, call memories or imprints left by previous experiences. But even though both rely on the same foundation, they are entirely different-order phenomena. Perception is momentary, view is permanent or at least long-term. Perception is the result, view is the source. Perception is objective content, view is subjective frame of reference.
Answer: 'Perception' in the suttas (MN 43; SN 22.79) is described as something very basic, namely, the perception of different colours.

'It perceives, it perceives': Thus, friend, it is said to be 'perception.' And what does it perceive? It perceives blue. It
  perceives yellow. It perceives red. It perceives white. 'It perceives,
  it perceives': Thus it is said to be 'perception.
MN 43

Thus, on its most primitive level, it seems perception perceives differences in shape, colours, sound vibrations, smells, etc.
'View' is views & opinions that are made up many accumulated ideas or experiences. For example, in Dependent Origination, views & opinions are a type of attachment (which is 'sankhara').
'View' is also the ignorance or wrong view people are born with; which is unrelated to experience. This is an in-born underlying tendency. For example, that a small child expects to permanently get what it wants is unrelated to experience. Its mere ignorance.  Thus in AN 7.11, both ignorance (avijjānusayo) & views (diṭṭhānusayo) are included as underlying tendencies.
In terms of 'khandha' ('aggregates'), perception is sanna khandha and views are sankhara khandha.
Perception does not rely on  accumulated tendencies (anusaya; sankhara). That a small child feels the shape, warmth & taste of its mother's breasts is unrelated to accumulate tendencies. That sugar tastes sweet to a small child and tastes sweet to basically all people shows perception of sweetness is unrelated to accumulated tendencies. If accumulated tendencies determined perception then all people would not perceive 'blue', 'green', 'red', 'round', 'square', 'bitter', 'sweet' the same and basic communication could not occur. Therefore, would be chaos!


IAR Idatastack error with CC2510

Question: I am using IAR with Texas Instruments CC2510.
I do not have any eval kit plugged in. When I try to "Debug without download", I get the following error when I try to run the code - "The stack pointer for stack 'IdataStack' (currently IData:0x07) is outside the stack range (IData:0xC0 to IData:0x100)"
Any idea how to solve this?
The debug is set to simulator. The correct device is selected under project options.
Answer: Yo have selected to debug in the simulator without downloading the code that you want to debug.  There will therefore not be any code to take the simulated processor from its default power up state to the start of main.  Try debugging with download so that the simulator is initialised with the image that you want to debug.

IAR Idatastack error with CC2510


Close Button on Title Bar in MFC

Question: In Vc++ 6.0 Dialog Based MFC application:
I do not want my user close the window by pressing the button [X] in the top-right side of the window itself and also (Alt+F4). I want to display a messageBox ("Do you really want to close the application"); if the user clicks the OK button then the application has to close, else if user clicks the CANCEL button then the application must not be closed.
Answer: You need to implement OnClose() and only call the base class's OnClose() if you want to quit.
Answer: Handle the WM_SYSCOMMAND message and do something like this in it.
void CMyApp::OnSysCommand(UINT nID, LPARAM lParam)
{
    if(nID == SC_CLOSE)
    {
        if(MessageBox(_T("Really"), _T("What"), MB_YESNO) == IDYES);
            //Do What you want here.
        else
            //Do something else
    }
    else
    {
        CDialog::OnSysCommand(nID, lParam);
    }
}

Here is how to add WM_SYSCOMMAND Handler to your Code:
Go to ClassView. Right click your dialog class if it is a dialog based application OR your mainframe class if it is a SDI/MDI Application. Click Properties.
In Properties Window, click on the Messages button. Scroll down to WM_SYSCOMMAND and on drop-down combo double-click to add the handler.
OR
You can do it manually as well by adding an entry in the message map. And adding declaration/definition in .h/.cpp respectively.
Comment: OnSysCommand(UINT nID, LPARAM lParam) how to add this member funtion to my application. please i am new in VC++
Comment: this option is in .net but i am using vc++ 6.0 , in vc++ 6.0 if you right click on dialog class of dialog based application there is no option like properties. better i will try manually but sory to ask you , i dont know to how to add manually if give steps it is helpful to me.
Comment: Wow its working nice , Thank You Aamir final i got the result
Comment: In VC++ 6.0 you can do it through class wizard which comes up by pressing Ctrl + W (I think)

Close Button on Title Bar in MFC


Why does my sentence seem to require an adjective?

Question: In the midst of a paragraph, one of my students write, 'They taught us a way of cleaning.'  I felt it sounded exponentially better to say, 'They taught us a new method of cleaning,' or 'new way'.  Why is that?  Is there a grammatical principle?
Comment: Possibly because the sentence does not fit with the purpose of the essay?
Answer: Grammatically, they taught us a way of cleaning is fine, so your desire to add an adjective is a personal preference.
The next question is why do you have that preference? It is probably a pragmatic thing. You want a reason for them being taught a way of cleaning because it is obviously not a random act. Is it because it is a new way of cleaning, or a better way, or a faster way, or an easier way? In technical terms, the sentence violates Grice's maxim of quantity by not giving enough information.
Answer: As a native English speaker in North America, it does perhaps sound a tad odd, but that's a hard call to make without reading it in context. Several thoughts:

if you want to keep the word "way", I would use the infinitive: "way to clean"
if you like "method", I would use "of": "method of cleaning"
the most natural to me, without any other context, is "they taught us how to clean"

Edit/response to comment: I emphasize native because I feel it's important to point out I'm not an ELL. If I were responding to a question about another language, I would highlight that I am NOT a native speaker and to take my response with a huge grain of salt, as my ear may not be good.
I'm sorry, I can't give reasons. In my experience, what I said stands. I suspect the things that bother you reflect the difference between our two languages. (Tongue in cheek there, but they really do seem that way.)
Comment: As a native English speaker from UK (and why do you need to emphasise 'native speaker'?) using a to- infinitive after *a way* sounds even odder in the absence of a specified object to clean. A gerundive *cleaning* to label the general action of cleaning seems more natural and sensible. Oddest of all is that *a way* and *method* are practically the same thing, but you use an -ing form after *method*. Could give reasons for your choices?
Answer: The sentence is fine as it stands. I believe this is a more common form of expression in the UK than in the US.  I think of it as a slight understatement.  In the US one would usually say, "That's a good idea". In the UK you often hear, "That's an idea".
I've heard from people from the U.K., "You know, it might be an idea if you ...."
In the US I almost always hear, "It might be a good idea...."
I think it sounds just a tad less pretentious not to add the word "better" or even the word "good" and let people decide for themselves if one's way is really better or even good. Actually, it might indicate a certain confidence that it is.
Edit: Forgot to address "new".  "New" is similar to my "better" example which is more common, and new usually implies better.
Answer: May be since you are using "a" in this sentence you feel like adding "new" in this sentence. What if you just say "They taught us, way of cleaning."
Comment: What if you just say "They taught us, way of cleaning."? That is easy. If you said that, you would be wrong...
Comment: This answer would make the sentence utterly ungrammatical.
Answer: I would say 'They taught us how to clean in a particular way.' I think the original sentence sound awkward because the meaning was not very clear. For example, I would ask: what was the focus of this sentence? emphasizing 'they taught us'? or 'a way of cleaning'.
Comment: Your suggestion does not flow anywhere near as well as the original version, and it is more ambiguous to boot (did they perform the instruction in a particular way, or did show a particular way of cleaning). Moreover, it still adds an adjective without mentioning why, which is what the question was all about.


What is meant by difference in electric potential?

Question: I know this question like this has been asked many times but I am still so confused about the concept of electric potential and voltage etc… Like I know what voltage and electric potential energy is when example involves single plus charge and single negative charge. But when example involves bunch of positive and negative charges in two different position (in all combinations, like only plus charge, only negative charges together, or some mixed) and you are told to see if there is electric difference between two location than I feel like I don't understand these concepts properly. Like there is an example online that shows two bunch of negative charges only that were lovated at two different location. One bunch has more negative charges than other, and the teacher says that there is actually voltage difference between them. I couldn't understand this, because wouldn't these bunch of charges repel each other? Why wouldn't these negative charges in one bunch would want to travel to location of negative bunch with less negative charges? I don't know if I am rambling. But Please help!!!!
Comment: "Like there is an example online that shows two bunch of negative charges only that were lovated at two different location." - Please provide the link.
Comment: 4:23, he starts talking about it. https://www.youtube.com/watch?v=g287MugJC9E&t=633s
Answer: The fact that a grouping of several charges will exert forces on each other is irrelevant to what the potential difference between two locations in space is. Assuming that you know the instantaneous positions of all the charges what you do is calculate the sum of the individual potentials due to each charge for the first location, then for the second location:
$$\Phi_1=\Sigma \dfrac{kq_j}{r_{j1}}\text{ and }\Phi_2=\Sigma \dfrac{kq_j}{r_{j2}}$$
where $r_{j1}$ and $r_{j2}$ are the respective distances from the individual charges to location 1 and location 2, and $\Phi_1$ and $\Phi_2$ are the potentials at those locations due to the charges.
Notice that we don't care how the charges interact with each other while calculating these potentials.  Those interactions may cause the charges to change position which will, consequently, change the values of the potentials, but they don't change the method we use to calculate the instantaneous  potentials at the locations.
If someone tells us that the charges are fixed in position, that means the potentials won't change, but, again, the charges interacting with each other is irrelevant.
Answer: Because potential is related to the work done by a unit positive charge I have changed the charges on the conducting spheres to be positive to make the explanation a bit easier and I have also assumed that the conducting spheres are sufficiently far apart that the charges on one sphere do not influence the distribution of charges on the other sphere.
Note that as the spheres are conductors the charges reside on the surface of the spheres.
The surface of a conductor is all at the same potential and potential at a point is defined as the work done in taking unit positive charge from infinity (the arbitrary zero of potential) to the point.

Now imagine bringing a unit positive charge from infinity up to the each of the sphere.
Less work would be done in bringing the unit positive charge up to the sphere with the larger radius because the charge on that sphere is more spread out than the charge on the smaller sphere.
So the potential of the larger sphere is less than the potential of the smaller sphere.
So there is a potential difference between the two spheres with the smaller sphere being at the higher potential.
If the two spheres were connected together the because there is a potential difference between the sphere charges would move along the conductor (a current would flow) until the potentials of each sphere was the same as shown in the diagram below.
I will explain later where the numbers come from.

In fact a positively charge conductor means that it has a deficit of electron so in this case it is not really positive charges moving from the smaller sphere to the larger sphere but electrons moving from the larger sphere to the smaller sphere.

With the assumptions that I have made above one can be a bit more formal in the analysis.
The potential $V$ of a conduction sphere of radius $R$ carrying a charge $q$ is given by $V = \dfrac{1}{4 \pi \epsilon_o} \dfrac q R$ so initially the potentials of the two spheres are $\dfrac{1}{4 \pi \epsilon_o} \dfrac {Q} {2r}$ and $\dfrac{1}{4 \pi \epsilon_o} \dfrac Q r$
Joining them with a conductor means that charge moves from one sphere to the other with the charges on the spheres now being $Q_2$ and $Q_1$ as in the diagram below.

The final state must be that the potentials of the spheres must be the same so $\dfrac{1}{4 \pi \epsilon_o} \dfrac {Q_2} {2r} =\dfrac{1}{4 \pi \epsilon_o} \dfrac {Q_1} {r} \Rightarrow Q_2 = 2Q_1$
Charge must be conserved so $Q_2+Q_1 = 2Q$ which gives $Q_2 = \dfrac {4Q}{3}$ and $Q_1 = \dfrac {2Q}{3}$
Comment: Hello. Thanks for the detailed answer. It was informative. But can I ask you, how does electron traveling from larger sphere to smaller sphere equal out the potential difference? I think this may deal with electric field canceling out of one proton, one electrons making it neutral. But what is happening at a fundamental level that one positive and one negative charge coming together in the sphere equalizes the potential difference between them one by one? Thanks in advance.
Comment: At the beginning there is a deficit of electrons on both spheres.  On connecting the conductor between two he two spheres electrons move from the larger sphere, making it have more positive charge, to the smaller sphere, making it have less positive charge.


How to skip Yahoo! news page and go directly to inbox?

Question: How do you skip the Yahoo! news page and go directly to your inbox? All  suggestions have not worked.
Comment: This question is not a good fit for this site as it doesn't look like a practical, detailed question. It's entirely unclear what suggestions have not worked.
Answer: Access the URL for the subdirectory for Yahoo Mail at mail.yahoo.com rather than going to yahoo.com to access your account. This will redirect you to a cookied link to the login page if you are not already logged in, and when you enter your credentials, you will be directed by cookie to the Yahoo webmail rather than the Yahoo homepage. Also, you can use any email software that allows access to mail servers through POP3 or IMAP.


Is bathroom sink pipe configuration up to code and does it have a trap?

Question: We recently renovated our bathroom in our apartment building and noticed the bathroom sink wasn't draining poorly. Our contractor said it just needed to be unclogged, which he said he did and now it appears to be draining properly. However, upon inspection of the pipes underneath the sink and enclosed in the vanity, we noticed the configuration of the pipes looks strange, like a roller coaster with multiple loops. We were told they did it that way to accommodate the drawers so the bottom drawer would close since it didn't have a cutout to accommodate the pipes. We are concerned that the pipes may not be be up to code and have recently heard about P trap drain and was wondering if our pipes have that trap or any trap for that matter. Any possibility of this configuration causing blockage/backups again in the future and possible leaks/burst pipes also?
Comment: Quick tip: when you see a single section of pipe with both ends facing up, it is most likely a trap.
Answer: It looks like the original installer didn't quite have the correct combination of pipes and and fudged things a bit. It's perhaps not optimal but fine to leave as is.
There is a trap which is the bit that goes down and then back up in a classical U-trap. There is water in that section to block the foul smelling air coming back up the drain.
Comment: I have seen a lot worse over the years. As ratchet Freak points out there is a trap and it works when clean so it is fine.
Comment: Thanks Rachet Freak & Ed Beal for your comments. Was just worried that all those bends and compression joints are bound to fail or clog.
Answer: This is equivalent to an s-trap and is not allowed by code.  I'm guessing this was done without a plumbing inspection.  It is not dangerous unless you fill up the sink and it all drains at once.  This might cause a siphon effect which could empty enough water from the trap to allow sewer gasses to escape, defeating the purpose of the trap.  If you slowly add a little water after draining a filled sink it will restore the trap to safety.  When you go to sell your house this will probably pop up as an issue with the home inspector (if they are any good).


Prove using the Pumping Lemma

Question: Can I prove that the language of the palindromes in the alphabet consisting of the ASCII symbols is not regular by proving that L = {$1^n21^n$ | n⩾0} is not a regular language?
Answer: Yes, I believe so.  If we had an an FSA $M_1$ that accepted palindromes, then we could build an FSA that accepted L, by building another machine $M_2$ that accepts strings consisting only of $1$s and a single $2$.  (This language is obviously regular, but it would be easy to build an NFSA to recognize it.)  Feed any string accepted by $M_2$ into $M_1$ and we have an FSA that recognizes $L$.

Prove using the Pumping Lemma


Is there a way to merge polygons with the same values in a layer created from gdal.Polygonize()?

Question: i have a tif file which I polygonized using gdal.Polygonize() method. As a result I got a vector layer with millions of polygons and values from 1 to 255 in the attribute table. Although I don't mind such huge number of polygons I would like to merge those which have the same values in the attribute table. Could you tell me if there is a way to do it programmatically using any GDAL/OGR tools?
Comment: The gdal_polygonize manual page informs: `This utility creates vector polygons for all connected regions of pixels in the raster sharing a common pixel value.` So what you have now are not-connected polygons (or maybe connected at corners). If you union them you will get multipolygons which may be huge with very many members. Is that what you want?
Comment: Yes, I suppose so. I'll try to union them now, thanks for the hint.
Answer: You're looking for a "Dissolve polygons" tool.
QGIS by default offers two implementations, one as part of its internal toolset (QGIS geoalgorithms --> Vector Geometry Tools --> Dissolve ) and one part of the GDAL/OGR toolset (GDAL/OGR --> OGR Geoprocessing --> Dissolve Polygons ).
There's one more in the SAGA toolset as well.
All of them differ slightly in the options they offer, but the GDAL/OGR tool is the most "verbose", allowing a lot of customization. So I'd recommend that for most cases.
If you want to use any of these programmatically, I'd recommend using processing.runalg() to run them properly in your script.
Comment: If you can't see the toolbox, make sure you have that panel enabled (right-click anywhere, tick 'Toolbox'). If you don't know the algorithm name, run the process once from the toolbox. Then go to Processing->History (in the main toolbar at the top) and you can see the full pyqgis call to that algorithm, including all the parameters(!) . The tool I mean is called `gdalogr:dissolvepolygons`
Comment: Hm, I found "gdalogr:merge" tool to run with `processing.runlag()` but it seems to be working only to merge rasters. Is it applicable to vectors or I am looking in the wrong direction?
Comment: In addition, check out https://gis.stackexchange.com/a/219036/29005 for how to easily query processing algorithms from a python script/console.
Comment: Yes, I believe it's just what I need. I found the tool you were talking about and manage to use this algorithm in the script. Thank you very much.


ArcPy - Module error

Question: I'm trying to use the ArcPy Python module to create a geodatabase to store information.
I am currently running ArcPy in Visual Studio on a Windows 10 machine.
The function I am trying to use is:
arcpy.management.CreateFileGDB(out_folder_path, out_name, {out_version})
With following inputs defined as:
out_folder_path = 'C:/FILEPATH',
out_name = "geodatabase.gdb",
out_version = '10.0'

When I run the function I receive the following error

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 23214, in CreateFileGDB
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 23211, in CreateFileGDB
retval =
convertArcObjectToPythonObject(gp.CreateFileGDB_management(*gp_fixargs((out_folder_path, out_name, out_version), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing_base.py", line 512, in
return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool

PS C:\Users\USER
I have set up ArcPy on my PC in Visual Studio, I receive the following error upon running it which may be related however this does not seem to impact the module for other functions:

PS C:\Users\USER> conda activate arcgispro-py3
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1

conda activate arcgispro-py3

+ CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Answer: As a first start I would try to run your code in the Python console within ArcGIS Pro. If that runs as expected it would at least confirm the arcpy installation is OK. Then search the Esri website on how to set up visual studio correctly. I don't use Visual Studio, I use the spyder IDE which integrates seamlessly with ArcGIS Pro. I put a document together at Installing spyder IDE for ArcGIS Pro if you are interested.

ArcPy - Module error


How is the set of displacement operators best called?

Question: Displacement operators $\hat D(x,p), \ \ x,p\in\mathbb{R},$ follow a composition rule
$$D(x,p) D(x',p') = \exp\frac{i(px'-xp')}2 D(x+x',p+p').$$
Because of the extraneous phase factor, the set of all displacements is not a group. I could take a set of all displacements multiplied by all possible phase factors and I believe that would be isomorphic to $U(1) \rtimes \mathbb{R}^2$, but if there was an algebraic name for the kind of object that the set of displacements alone forms, that would suit my purpose better.
Answer: The set of all possible elements of the form $e^{i\alpha}D(x,p)$ with $\alpha, x,p \in \mathbb R$ verifying  the commutation relations you wrote in addition to:
$$D(x,p)^* = D(-x,-p)\:,\quad D(0,0)=I$$
is a group and it is called Heisenberg group, it is homeomorphic (diffeomorphic)  to $U(1) \times \mathbb R^2$ but not isomorphic as a Lie group. It is a real three-dimensional simply-connected Lie group with Lie algebra generated by three elements, one commuting with the others which, in turn, verify the standard position momentum relation commutations.
The *-algebra of all possible complex linear combinations of elements $D(x,y)$
with $x,p \in \mathbb R$ verifying  the commutation relations you wrote in addition to:
$$D(x,p)^* = D(-x,-p)$$ is called Weyl *-algebra (actually there is only one way to equip it with a norm making it a $C^*$algebra.)
The objects $D(x,p)$ are called Weyl generators.
Comment: Oh yes, of course :-) I knew Heisenberg Lie algebra and did not realize that this was exactly the group generated thereby (and thus would obviously be called Heisenberg group).
Comment: I edited your second last sentence so that it sounds more like a statement of the uniquenss theorem you're alluding to. Please check sense carefully (i.e. I think you're saying that the norm is unique).
Comment: Thanks Rod, I was a bit sloppy. Indeed the C* norm is unique as you wrote. Bye, Valter
Answer: We can realize the displacement operator as
$$\tag{1}\hat{D}(x,p)~=~e^{x\hat{P}+p\hat{X}},$$
where the elements $\hat{X}$, $\hat{P}$ and ${\bf 1}$ generates the Heisenberg algebra
$$\tag{2} [\hat{X},\hat{P}]=i{\bf 1}.$$
These elements can be realizes as differential operators in the Schrödinger representation. (See also the Stone-von Neumann theorem.) Under operator composition $\circ$, we get a 2-cocycle
$$\tag{3} \hat{D}(x,p) \circ \hat{D}(x^{\prime},p^{\prime})~=~ e^{\frac{i}{2}(x^{\prime}p-p^{\prime}x)}\hat{D}(x+x^{\prime},p+p^{\prime}), $$
due to a simple special case of the BCH formula. The operation composition (3) is associative. The formula for three operators reads
$$\tag{4} \hat{D}(x,p) \circ \hat{D}(x^{\prime},p^{\prime})\circ \hat{D}(x^{\prime\prime},p^{\prime\prime})$$
$$~=~ e^{\frac{i}{2}(x^{\prime}p+x^{\prime\prime}p+x^{\prime\prime}p^{\prime}-p^{\prime}x-p^{\prime\prime}x-p^{\prime\prime}x^{\prime})}
\hat{D}(x+x^{\prime}+x^{\prime\prime},p+p^{\prime}+p^{\prime\prime}). $$
The displacement operators are closely related to the Heisenberg group, cf. this paragraph.


Can I use 53-39T chain rings with compact cranks?

Question: I have shimano 105 5700 compact  crank(50-34T).
Can I use 53-39T chain rings with compact right arm.
Comment: As stated in the answer below, what you need to look for is the bolt circle diameter (BCD) of your crank. The crank **arm** has no impact on compact or standard chainrings.
Answer: When you're matching chainrings to a crank, you need to match the bolt pattern (i.e. are there 4 bolts, 5 bolts) and the bolt circle diameter (BCD) measured in mm -- the diameter of the circle which all the bolts lie on [or equivalently, the center-to-center distance (C-C) of adjacent bolts. Multiply this (in mm) by 1.701 to get the BCD for 5 bolt patterns, 1.414 for 4 bolt, etc. -- its just a simple exercise in trigonometry to figure this out].
Compact cranks have a 110 BCD with a 5 bolt pattern while a regular road double has 130 BCD 5 bolt pattern.
There are some 53t and 39t 110 BCD chainrings, but they are less common than those sold in 130 BCD. As pointed out by ojs in the comments, Stronglight and TA (among other manufacturers) do make them.
Note that you will also have to adjust the front derailleur (and check everything is within spec for the front derailleur) if you do this swap. And you defeat the point of buying a compact double in the first place.
Comment: These sizes are easily available from third party manufacturers like Stronglight and TA. I'm not naming any names, but many European mail order shops have these and will ship everywhere in the world.
Comment: @ojs - Thanks. I'd seen a 53t 110 bcd ring but not a 39t 110 bcd before. I think with Euro-US shipping and the prices i found for the 110 bcd rings, I'd probably opt for just buying the regular 105 double crank (which is about 110 dollars), and maybe selling the 105 compact crank.


Switching the desktop enviroment

Question: Would it be possible to change the default environment to something like Cinnamon? Or to a window manager like openbox or awesomewm?
Comment: Looking at my and @cksum different answers suggests that the question is not clear and you need to explain how you want to use the desktop and window managers
Answer: Yes. Reference the XQuartz Project, which is developing an OS X friendly version of Xorg: http://xquartz.macosforge.org/trac/wiki
Awesome WM has been successfully installed by at least this user: http://permalink.gmane.org/gmane.comp.window-managers.awesome/7939
They go on to list a step by step. Your mileage may vary, but it looks like it is possible to replace the default:
Once Xquartz was installed, set the following prefences:
 CHECK option key sends alt instead of mode_switch
 UNCHECK enable key equivelants

I installed the following ports from macports
 port install awesome
 port install xmodmap
 port install xev
 port install rxvt-unicode

Then, I made the following configuration file changes to get it
configured with the X server.  B
.xinitrc
  cd /Users/≤username>
 xmodmap .Xmodmap
 exec /opt/local/bin/awesome

.xmodmap
 remove mod1 = Alt_L
 add mod4 = Alt_L

Now, create an rc.lua file based on the stock version from macports,
and make a few changes to set the keys up
 mkdir -p ~/.config/awesome
 cp /opt/local/etc/xdg/awesome/rc.lua ~/.config/awesome

Making it more Mac-like
Define the commandkey as a variable.  Also set urxvt-unicode as

the default terminal:
    commandkey = "mod2"
    terminal = "/opt/local/bin/urxvt"

Command-W to close a window, like the default MacOS shortcut

    awful.key({ commandkey }, "w", function (c) c:kill() end)

Fixing the Tag navigation
The Mod4 + N key combination doesn't actually send you to tag N
using the default rc.lua.  You must add the following

    tagkeys = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }

and then change

    "#" .. i,

to
    tagkeys[i],

In the section where the awful.keys() functions switch tags

There are still some quirks with this setup, but overall I find it
better than having to resize and place terminal windows by hand.
Answer: the answer to all the suggestions you have made is basically no.
This is these are X11 based desktops or window managers. OSX does not use X11 as its main desktop. It uses is called Aqua to manage the desktop (I can't find the Apple doc that describes this - a newer one is here which describes the Cocoa application layer.

The term Aqua refers to the overall appearance and behavior of OS X. The Aqua look and feel is characterized by consistent, user-friendly behaviors combined with a masterful use of layout, color, and texture. Although much of the Aqua look and feel comes for free when you use Cocoa technologies to develop your app, there are still many steps you should take to distinguish your app from the competition. To create a beautiful, compelling app that users will love, be sure to follow the guidance provided in OS X Human Interface Guidelines.

You can run X11 applications on OSX using the normal OSX desktop but it will do the window management. I think you can run X11 on a background and so can use an X11 window manage to manage X11 windows but not anyones written to Apple's GUI APIs. (I think you can also boot OSX to a console (you are then just running Darwin) and then run X11 as the only graphics the you can use the environment you mentioned but again no  apps using Apple's GUI APIs)
Comment: Aqua is the visual theme, not the default window manager. Quartz Compositor is the actual display server/window manager used by OS X.

Switching the desktop enviroment


What is energy really?

Question: When we talk of momentum , we can say that momentum is a measure of amount of motion contained in the body but I cannot get a similar intuition for energy energy is a measure of what? Or is it just a certain mathematical quantity that just remains conserved and is thus used for solving problems etc.
And I don't seem to be satisfied with statements like 'energy is capacity to do work' because then again I ask what is work then...it's just not very clear I'm unable to get a hold of the concept..not even sure of what exactly I am confused about..maybe a historical significance of the concept of energy and the progresses made to define it might help,requesting suitable directions.
Comment: This is a very deep question with no clear single "sound bite" kind of answer. The concept of energy is pretty fundamental to physics and is tied, via Noether's theorem, to the concept of time-translation symmetry. At an intro to physics level, Energy is simply "the ability to do work".
Comment: Possible duplicates: https://physics.stackexchange.com/q/3014/2451 and links therein.
Answer: On an elementary level, you can think of energy like money in a bank account. Spending money is like performing work and saving money is like storing up work.
If you dump a large amount of money out of your account in a short time, you are exerting lots of influence, which is like saying that the rate of performing work is equal to power.
If you have lots of money saved up in your account, you can think of it as if it were "stored work" which you can tap into in the future.
And when you are broke, you have no ability to exert influence, which is like saying that without energy on hand, you cannot perform work.
Comment: If only bank account zeroes were as arbitrary as the zeroes of energy...
Comment: there are, of course, limits to the analogy...
Answer: When you think of energy you can think about an internal powerful resource that a body has. More amount of this resource means that the body can reach more velocity $E = \frac{1}{2}\cdot m \cdot v^2$ in some way. Or he can otherwise transfer this resource through thermic activity, for example if it gives it it becomes colder and slower (looses velocity), gaining it it becomes hotter and faster (gains velocity). It can also gain this resource if the energy is potential, for example being in a high place on earth, falling, it will gain velocity.
Maybe think about energy as resource that can be consumed to make the body move faster, gain velocity.
This is not a scientific answer but a general-intuition one.

What is energy really?


Database design for multiple tenant application

Question: I am building a web application where we have the concept of groups.
A group can be roughly thought of like a Facebook group where you have a number of people attached to it.
The DB for the app is going to be Postgres.
Ideally, all data relating to a group would be independent of others and hence a need to isolate all tables pertaining to a group.
What is the right way to do it so that we can scale, backup easily as usage grows?
Should we have one DB per group OR one schema per group?
Comment: You could call "groups" in the above case "manbearpigs" and it would tell us nothing more of the concept you're trying to implement. How about telling us what you mean by a "concept of a groups" and what you're doing in the app or business?
Comment: added more info
Answer:
A group can be roughly thought of like a Facebook group where you have a number of people attached to it.

There is nothing about a Facebook Group that in any fashion requires a new a database, schema, nor table; and, there is nothing to be gained by the added complexity. All groups on Facebook have the same capabilities. They have the same meta-data. They're for the same-type of thing "Facebook Users." There all accessed through the same endpoints on their graph API, and they're all rendered with the CSS, and HTML.
Comment: That still wouldn't be another database, you'd have table for `institutions` and likely another one for `staff` and `students` or whatever (or even have that combined too)
Comment: alright if its still not clear let's draw another analogy.
let's say a `college/school` can be a group and each college would have many entities(which I want to map as tables) like teachers/students/staffs etc.
Now the schema is the same for all such colleges but for each college, I want to store data in isolation.
Comment: so for each college should i have a schema?
e.g institution_cornell, institution_stanford
Comment: No... Schemas are to separate discrete *concepts* of a database, not different *values* or sets of values. For example, admission, cafeteria, and accounting could be different *schemas*.


Why is it not called a דבר שאינו מדעת?

Question: Why is it called a דבר שאינו מתכיון. Since twice in Gemara Shabbos Rashi understanding and explaining to us what forgetting is when one leaves a rock on top of a barrel says this first on Shabbos 125b  uses the word מתכיון then on Shabbos 142b he uses the word מדעת. So seemingly the words are the same, so why did Chazal find it fit to use דבר שאינו מתכיון and not דבר שאינו מדעת?
Answer: The term מתכוין refers to intention.
מדעת means awareness.
There are times when the main point is one's awareness of an action, not one's intent.
For example, we find in the gemara the concept of אבידה מדעת where something is considered to be "lost" with awareness.
Example: putting items in a garbage pile which will be emptied (Baba Metzia 25b).
It's not a question of whether or not I "intend" on the items being permanently lost; it's a question of whether I was aware that I was putting the items in a place where I might not be able to get them back.
Regarding Shabbos, the main issue is my intention- what I am intending to do?
If I'm not intending on doing something, the fact that I know it might happen will be irrelevant.
(The exception to this is פסיק רישא, a type of action where the result is so definite and clear that we say that your knowledge of the action is the equivalent to having intent. See Shabbos 133a)
Comment: I don't know off hand, and it's a great question which is likely discussed in the achronim (I can't check up right now.) Off hand it reminds me of the machlokes trumas hadeshen and beis Yosef about if you have item X on top of item Y, but not on purpose (i.e. they're in a drawer and there's not enough space for them both to lie flat). Does Y become a bosis or not? It could be in one gemara there's a tzad that "maniach" is better since it turns into a kli, so maybe rashi needed to distinguish why you're maniach it, while in the other there was no need to specify. וצ"ע כעת
Comment: Well if that is the case why does Rashi use different words when clearly there are the same thing?
Comment: Very interesting.

Why is it not called a דבר שאינו מדעת?


Automation testing of mainframe application using Selenium

Question: is it feasible to test mainframe, which is a desktop based application with selenium? If yes, then how?
Answer: Selenium allows to test any UI that can provide WebDriver implementation to interact with it.
If UI framework that runs your app provides a webdriver that can:

associate the commands WebDriver implementations should implement with the particular actions on UI
associate the way how the locators are built with the particular UI objects

then you can utilize that driver for your UI automation.
Comment: Indeed, would be nice to have a webdriver implementation to support it. But it would likely be limited in API coverage, such as open up terminal/command, SendKeys, and switch to window commands for the most part.
Answer: Selenium is browser automation tool.
It is commonly used to website test automation, but it is not limited to it.
Mainframe/desktop do not have HTML locators, which webdriver uses to locate webelements to be interacted with, AFAIK.
Answer: To be practical... you can perform automation to some extent. but not recommended. You might consider winium which implements the JSON wire protocol to automate windows based application(with limited achievability).
I would suggest consider UFT with terminal emulator addin.


Flag content once seen in a slideshow

Question: Is there a way with either flags or rules or another module to make content being displayed in a slideshow flagged/marked as "viewed"? Then on refresh that content wouldn't display again to that user. Functionality of swiping for the mobile experience is key here. Think of it as a simplified tinder functionality.
Comment: I'm afraid there isn't. This is quite the unique use case, which will require custom code.
Comment: (a) Who or what is "*tinder*"? (b) Is the slideshow created using Views? (c) If a slideshow has (eg) 10 sides, and after viewing (eg) 3 of those slides, what should happen to the other 7 slides? (d) is this about Drupal 5, or any release above that?
Comment: a) Tinder is a dating app in which you swipe left or right to indicate that you are interesting in someone or not.

b) Slideshow is created using views

c) You'd still be able to view the other 7 slides, upon refreshing the page the slides that you have seen should no longer display.

d) Drupal 7 all the way
Answer: I think No Sssweat comment is right in that this requires custom code.. And you should include some extra details regarding Pierre's questions.
Assuming that you want it like Tinder, I think triggering a hidden flag on each node for each swipe event could be the easiest option. Then on refresh, a views filter would hide flagged content by that user.
This answer describes a method for doing similar. I haven't tested it myself yet but it's an accepted answer and quite recent so it should still work.
It's hard to give a more thorough answer for this without knowing more about the slideshow. And my jQuery is rudimentary at best. If this is a viable approach, post some more details and hopefully myself or another user can help with getting the event. If not, I'll remove this.
Comment: Your assumption is correct. Hidden flag on each node, when swiped it marks it as flagged. On refresh the filters would then hide any flagged nodes.

The other link that you mentioned could also work, seems close to what I'm looking for. I'm looking for a little less code, but I'm not affraid to get my hands dirty.

Flag content once seen in a slideshow


How can I set up poclbm (a bitcoin miner)?

Question: I'm trying to set up poclbm on my 12.10 machine. My graphics card (as stated in system settings) is an 'Intel® 965GM x86/MMX/SSE2'. I am trying to use the guide here but python-pyopencl can't be installed -
The following packages have unmet dependencies.
 python-pyopencl : Depends: opencl-icd but it is not installable
                   Depends: python-pyopencl-headers (= 2012.1-1ubuntu1) but it is not going to be installed
                   Recommends: python-pyopencl-doc but it is not going to be installed
                   Recommends: python-opengl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Has anyone got any ideas on how to fix this?
Thanks in advance, Microbug
Comment: there is a bit-coin site on stack-exchange that might be able to help too.
Answer: Tibor in his article creates a dummy deb that allows python-pyopencl to be installed fine.
http://tuxicate.blogspot.co.uk/2013_04_01_archive.html
This worked for me, I hope it works for you.
Answer: This is similar to this guys question here: basically poclbm requires opencl. This is the technology that allows your graphics card to be used as processor (in layman's terms). The guide you linked to is for Nvidia cards. ATI also has a good driver for opencl. But your graphics card is Intel and there is no Intel opencl driver available for Ubuntu.
The poclbm page says which graphic cards work in the first sentence: Works with AMD - 4xxx and up, Nvidia - 8xxx and up, video cards.


Windows script to create directories of 3,000 files

Question: We have some email archiving that is dumping all the emails into a directory. Because of some performance reasons with the server, I want to setup an automated task that will run a script once a day and if there is more than 3,000 (or whatever number) of files in the main directory, create a new directory with the date and move all the main directory files into it. I'm sure someone has already written something similar, so if anyone could point me at it that would be great. Batch file or Powershell would both be fine.
Comment: what performance issues are you having with directories over 3k?  Wouldn't you want to solve the performance problem, or is this homework?
Comment: The performance problem has to do with the way the mail server does its indexing in an xml file. As there are more files the time to read and write to the index file increases. So separating mail into directories fixes that.
Answer: Written and tested. Copy the following code into a *.bat file. You'll want to modify the directory where the emails exist at the start of the code. The variable cBig has already been set to 3000 but you can change this if you'd like. At the bottom, move *.txt will have to be changed to reflect the extension of the emails you're moving. Once you've tested it and are happy you can remove the pause commands... they just help see what's going on. Good luck!
echo off

REM **navigate to the directory
cd\bat_test

REM **store count of files to file count.txt (/a-d removes folders from count)
dir /b /a-d | find /v /c "::" > count.txt

REM **read count back in to variable (easiest way I knew how to do this)
set /p myvar=<count.txt

REM **set your upper limit (in your case 3000)
set cBig=3000

REM **quick display of the number of files
echo %myvar%

pause

REM **is the number of files larger than our upper limit? If so goto BIG
if '%myvar%' gtr '%cBig%' goto BIG

:SMALL
REM **do nothing
exit

:BIG
REM **create new directory with date and move all files
Set FDate=%Date:~-10,10%
Set Fdate=%FDate:/=-%
MD %FDate%
move *.txt ./%FDate%

pause

Comment: I think you need to use dir /b /a-d instead of dir /b to prevent counting directories
Comment: Thanks, still have to try it out, but looks very good
Answer: Untested .CMD script.
REM @echo off
setlocal enableextensions enabledelayedexpansion

  rem Print all filenames (excl. folders) in current directory into temporary text-file
  set TMPTXT=%TEMP%\%~n0.%RANDOM%.TMP
  dir /B /A-D  1>%TMPTXT%

  rem Count number of files (lines) in text-file
  set FILECNT=0
  for /F %%i in (%TMPTXT%) do (
    set /A FILECNT=!FILECNT!+1
  )
  echo Number of files in folder: !FILECNT!

  rem Is number of files greater than expected?
  if /I !FILECNT! GTR 2999  call :MoveFiles

  del %TMPTXT%
  goto :EOF

:MoveFiles
  rem Construct a folder-name based on date (remember date changes at midnight)
  rem Since the date value is locale specific, you might want to fiddle with string-replacing.
  set SUBFLDR=%DATE%
  mkdir "%SUBFLDR%"
  if /I !ERRORLEVEL! NEQ 0 (
    echo Failed to create sub-folder '%SUBFLDR%'.
    goto :EOF
  )

  rem Move only those files found in text-file to the new folder.
  for /F %%f in (%TMPTXT%) do (
    move  "%%f"  "%SUBFLDR%\."
    if /I !ERRORLEVEL! NEQ 0  echo Failed to move file '%%f'
  )
  goto :EOF


Performing outlier detection before semi-supervised anomaly (novelty) detection

Question: I want to perform semi-supervised anomaly (novelty) detection on data using machine learning methods (e.g. one class SVM). Is it sensible that in pre-processing step, I use outlier detection techniques (such as isolaton forests) to cleanse normal data? By semi-supervised anomaly detection I mean we only have limited data with normal label but most of the data does not has label.
Answer: Yes.
But first, you need to create a suitable evaluation data set. If you lack sufficient labeled data (a common problem in anomaly detection), you can generate synthetic test data by taking normal data that appears anomaly-free and injecting random anomalies of the kind(s) you wish to detect. You can perform other data augmentation (scaling, shifting, etc) to generate arbitrarily large data sets, and then use these for evaluation.
Once you have a good enough evaluation set, the real answer to your question is that the method that performs best is the best method. If performing outlier detection before-hand improves the evaluation metrics, then you should do it :)


tikz diagram showing range, domain, and co-domain of a function

Question: While I am gradually becoming more proficient at TeX, I am still very new to TikZ. I am typesetting some notes for Analysis, and would like to be able to produce a map which shows 2 sets (X and Y) and a function (f: X \to Y) which also indicates a few points in the domain and shows where they land; in the codomain and also diagrams the range of the function f. I am not quite sure even how to start. Any help will be appreciated.
Comment: It would be helpful to show an image of what you are looking for. And, even if you are new, you should at least be able to make a start at it.  For instance, can you show a small filled circle to represent the points in the domain?
Answer: Here is a starter for you to speed up the learning curve.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,fit}
\begin{document}
\begin{tikzpicture}
%put some nodes on the left
\foreach \x in {1,2,3}{
\node[fill,circle,inner sep=2pt] (d\x) at (0,\x) {};
}
\node[fit=(d1) (d2) (d3),ellipse,draw,minimum width=1cm] {};
%put some nodes on the center
\foreach \x[count=\xi] in {0.5,1.5,...,4}{
\node[fill,circle,inner sep=2pt] (r\xi) at (2,\x) {};
}
\node[fit=(r1) (r2) (r3) (r4),ellipse,draw,minimum width=1.5cm] {};
%put some nodes on the right
\foreach \x[count=\xi] in {0.75,1.5,...,3}{
\node[fill,circle,inner sep=2pt] (c\xi) at (4,\x) {};
}
\node[fit=(c1) (c2) (c3) (c4) ,ellipse,draw,minimum width=1.5cm] {};
\draw[-latex] (d1) -- (r2);
\draw[-latex] (d2) -- (r2);
\draw[-latex] (d3) -- (r4);
\draw[-latex] (r1) -- (c2);
\draw[-latex] (r2) -- (c3);
\draw[-latex] (d3) -- (r4);
\end{tikzpicture}
\end{document}

Comment: Thank you very much. Later this evening, I shall try and make a few minor modifications to what you have here to suit what I would like to end up with. Thanks again.
Comment: @MichaelDykes  Thank you! But please next time include a minimal code so that we can also play around with it. As it is, it's rather a `draw-it-for-me` question.
Comment: I am looking for a way to draw function diagrams exactly like this one, with domain and co-domain (range) correspondences, but I get 101 errors when compiling the code above... Message of first error is: "Use of \x doesn't match its definition. \tikz@scan@no@calculator ... \edef \tikz@temp { (#2) }\expandafter \tikz@@scan@... 1.401} Am I doing something wrong? I just took everything between \begin{tikzpicture} and \end{tikzpicture} including, inserted it in file that already compiles and run it -- to no avail. Please help... Thanks, Colin.
Comment: @Diegis It compiles fine for me. Maybe there is an update needed or you missed the necessary TikZ libraries such that some commands are not recognized?
Answer: Took me a while to try the stuff out, I'm also pretty new to TikZ. There might be much nicer solutions that don't use absolute coordinates though.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
    % draw the sets
    \filldraw[fill=blue!20, draw=blue!60] (-1.5,0) circle (1cm);
    \filldraw[fill=red!20, draw=red!60] (1.5,0) circle (1cm);
    \filldraw[fill=green!20, draw=green!60] (1,0) circle (0.5cm);

    % the texts
    \node at (1,0) {\tiny$f(x)$};
    \node at (0,-2) {$f: X \to Y$};

    % the points in the sets (here I just create nodes to use them later on to position
    % the circles and the arrows
    \node (x1) at (-1,0.7) {};
    \node (x2) at (-1.3,-0.7) {};
    \node (y1) at (1.5,0.5) {};
    \node (y2) at (1.8,-0.5) {};

    % position the elements in the sets (at the nodes we just created)
    \fill[blue] (x1) circle (1pt);
    \fill[blue] (x2) circle (1pt);
    \fill[red] (y1) circle (1pt);
    \fill[red] (y2) circle (1pt);

    % draw the arrows
    \draw[->] (x1) -- (y1);
    \draw[->] (x2) -- (y2);
\end{tikzpicture}
\end{document}

If you are unsure where to start, the manual is a good place. Most of the stuff I wrote is from the tutorials.
If you are just getting started QTikz is a really nice tool, the editor has a panel that is refreshed every few seconds, makes trial/error much easier than having to compile/switch program all the time.


Book Request: Differential Geometry and Particle Physics

Question: I've been studying differential geometry for about a year (books I've read include An Introduction to Smooth Manifolds and Riemannian Manifolds: An Introduction to Curvature by Lee, and sections of Geometry of Physics by Frankel).  I really enjoy reading pages that go into detail about differential geometric aspects, such as gauge theories (Lie groups) or the Aharanov-Bohm Effect (flat connections over Lie groups).
Can anyone recommend books that discuss topics, such as particle physics, from a rigorous differential geometric/mathematical physics perspective? Bonus if it touches on the history of the deveoplment of the theory.
Answer: You can read " Modern Differential Geometry in Gauge Theories" by Anastasios Mallios.


How can I remove the coin doubler without reinstalling the game and losing my progress / downloaded characters?

Question: I'm hoping to be able to remove the coin doubler I bought a long time ago, but I don't want to lose my progress and downloaded characters. Is this possible?
Answer: You don't, and you can't.
Well, not without using save editors anyway...

You may be asking...
Why?!?
This is because of the way saves are implemented. On both iOS and Android, saves are tied to each device the game is played on, and that the status of whether or not a save has a coin doubler (like Jetpack Joyride) is in the save file.
Answer: No, because these features are all in-game purchases.
So if you decide to restore your purchases, your coin doubler and downloaded chars will be lost.
Otherwise your progress will not be impacted because it's stored on your Google Play Games account (if you linked them).
I recently re-installed the game after a One-year stop, and it kept my progress (I didn't buy any features).


SharePoint Foundation 2010 into Web Platform Installer

Question: Guys, I have a great idea - ask Microsoft to include SharePoint Foundation 2010 into Web Platform Installer. It'll be very usefull for all community. I do it by twitter: http://twitter.com/butaji/status/19322524336. What are you think about this petition?
Comment: This is really more of a community wiki-type post.
Answer: I think there are some architectural considerations frequently overlooked.  Even a Foundation 2010 system should be planned.  I would hate to find a company with 10 web servers each hosting 10 single server SharePoint farms with local databases.
Comment: The best scenario for checking out SharePoint is a web-based VM trial.  I know MS has some online training that already does this.  When a user signs up, they provision a new VM from a standard image and give the user an account to use.  This is all done in a few minutes, and there is no need to worry about how to install it or transitioning from that poorly planned temporary box to a real production environment.
Comment: I agree with you, but there are many ways to check out sharepoint installation and make it possible only one time, for example like WPI installed one instance of SQL Server
Comment: Now SharePoint already on WPI!
Answer: Agree with Mike, having SharePoint in the Web Platform Installer will certainly make even more bad installations of SharePoint (which of course make consultants busy :-), aka Standalone installations.
The standalone option is there for one single purpose - and that is trial and demo (and AFAIK MS added that feature to satisfy some research companies when they said SP was to cumbersome to install).
If SP was added to WPI it would certainly make companies beleive that the installation is production ready - which it is not when installed in Standalone mode.


Complexity of 1D CNN and 2D CNN

Question: Are the computational complexity of 1D CNN and 2D CNN the same? If not what are their computational complexity and what is the best way to compute them? Considering both forward and backward propagation.
Answer: For a fixed input size for both networks, the asymptotic complexities are identical, and, ceteris paribus, you would have to expect only a constant factor of difference in actual computation time.
You probably don't want to know the asymptotic complexity for increasing input sizes, right? Anyway, for this case, the 2D CNN would be quadratic in the complexity of the 1D CNN.
Comment: If you are satisfied with the answer, please accept it. If not, you could consider leaving a comment detailing what you are missing.
Answer: CNNs are quite diverse with lots of different settings, i.e., such as kernel size, strides etc, see Torch cnn1d. Considering these settings, it is conceivable to produce a setting of 1D CNN that has the same complexity (FLOPs) of 2D CNNs or equal complexity. Best bet is to really restrict the settings and compute the FLOPs using a practical library, such as flops-counter with pytorch.

Complexity of 1D CNN and 2D CNN


If you delete a post with downvotes, will you get your reputation back?

Question: What happens when someone downvotes your post and you delete the post? Will you get your reputation back? I have been losing a lot of reputation (from 17 to 9) and lost privileges.
Comment: Please don't add "Solved" to your questions. Accepting answer to a question is indication that you have appropriate solution. See: [What does it mean when an answer is "accepted"?](https://stackoverflow.com/help/accepted-answer)
Comment: You should avoid submitting a contribution and then deleting it due to downvotes. All contributions are considered once they are submitted in the determination if you are or are not able to submit additional contributions without a rate limit.
Answer: Yes, you will get back any reputation lost from downvotes on that post when you delete a post. (You will also lose any reputation gained from upvotes on that post. From a reputation perspective, it will be as if that post never existed.)
However, you need to be very careful when deleting questions, as you could easily end up with a question ban. As a relatively new user (having contributed very little content), the system has less "trust" for the quality of content you generate. If you post multiple questions that get downvotes, and then you delete them rather than improving them, you'll end up losing the privilege of asking questions. I'm sure you don't want that, so I strongly recommend against deleting questions you've asked simply because they've received downvotes. (Note that as it says in the linked FAQ, moderators don't control the question bans; these are automatic. We can give you advice on how to avoid them and how to get out of them, but we can't lift them, no matter how nicely you ask.)
Comment: It says you're a new user here on Meta, which you are; you haven't been on Meta very long. However, that's not what I'm referring to in my answer when I say that you're "a relatively new user". The length of time which you've had an account (~9 months) doesn't matter. What matters are your contributions. Your oldest post (a question) is from January 30th, and you've only got a total of 4 questions (including one deleted question). That doesn't give very much signal to the quality-control system, and especially if you start deleting downvoted questions, you'll be getting *very* close to a block
Comment: thanks for the answer. I'm not a new user I don't know why It says that. On stack overflow it says I'm not a new user and also in communities my only community is stack overflow and when I log in with google it asks me to create a new account


What are the different awards I can get and how do I get them?

Question: After a versus game, the players are awarded with awards based on things that happened during the game. What are all the different awards that you can get? How do I get each of them?
Comment: 15 new awards were added in an update, bringing the total to 70. [There is a full list on the Towerfall Wiki](http://towerfall.wikidot.com/awards).
Answer: Most Lethal - Dispatched the most archers.
Bubble Breaker Award - Destroyed the most shields.
Quick Draw Award - Be efficient. (don't hold the shoot button to aim)
Most Devious - Exploiting screen wrap.
Most Vindictive - Kills from beyond the grave.
Greediest - Swiped the most treasure.
Longest Innings - Survived the longest.
Late To The Party Award - Mostly Harmless. (only got the last kill in a round)
Most Prepared - Always ready for a fight!
Least Prepared - Gathered the least arrows.
Most Trigger-Happy - Shot the most arrows. Settle down!
Worst Accounting - Shooting with an empty quiver.
Who Needs Arrows? - For stomping archers to death.
Marksmanship Award - Best shot to kill ratio.
Longest Shot - Trick shot!
Pickpocket Award - Stole the most arrows.
Most Regal - Wore the crown the most.
Regicide Award - Assassinated the most queens and kings.
Fetal Position Award - Ducking the most.
Cannonball Award - Hold down to fall fast.
Koala Award - Clinging to ledges the most.
Koala Hunter Award - Killed those koalas.
Most Evasive - Dodged the most.
Most Zen - Caught the most arrows.
Least Composed - Dying during your dodge cool down.
Artless Dodger Award - Dodged a lot but never caught an arrow.
Most Twitchy - Barely catching arrows.
Super Booper - Crafty dodger. (get a kill while dodging)
Most Takebacks - Caught your own arrows.
Turncloak Award - Betrayed your teammates.
Damage Control Award - Crisis averted. (not sure, probably for killing someone who has a lot of dangerous arrows)
Most Reckless - Accident-prone. (dying on stage traps)
Most Compressed - Crushed by moving platforms :(
Most Fashionable - Retrieved your hat. Style points!
Usurper Award - For putting on other archers' crowns.
William Tell Award - Shot the hats off your enemies' heads.
Bottle Rocket Award - Adept at surviving explosions.
Double Kill - Two kills from one shot.
Triple Kill - Three kills from one shot.
Cause And Effect Award - Consequences.
Bank Shot Award - Best laser bounce kill.
Green Thumb Award - Call the Brambulance.
X-Ray Vision Award - Most Conductive.
Right Angle Award - Get a kill with a bolt arrow at 90 degrees.
From The Grave Award - Get a kill after dying.
Eagle Eye Award - Extreme accuracy.
Vendetta Award - Bullied a specific archer.
Most Thorough - Swept the most rounds.
Comeback King - won the match by just living (male characters)
Comeback Queen - won a match by just living (female characters)
Comeback Kid - won a match by just living (prancing puppet)
Steak In Mouth Award - reach the point limit but die in some way such that the match no longer ends.
Consolation Prize - Well, at least you showed up. (you didn't get any other awards)
Overachiever Award - finish with 2 kills more than the required kill limit.
Ironman Award - Didn't die at all.
Comment: @Seiyria Could you put explicit explanations for these awards?  I think the problem right now is that it looks like a copy and paste job.  I mean consider "Consolation Prize - Well, at least you showed up." Does that mean that you get it just for playing or what?  Also, the formatting leaves a lot to be desired, can you maybe bolden the award?
Comment: @spugsley Feel free to accept it if you feel it answers the question adequately.
Comment: [There is a list on GameRevolution](http://www.gamerevolution.com/guides/65353-towerfall-ascension-awards-list) which has more detailed descriptions for some of the awards. Would you be ok if I updated the descriptions and linked to the article, or should I post as a separate answer.
Comment: @StevenVascellaro given that there's already this list I think an edit would be more appropriate, since a new answer wouldn't be adding anything "new" in that sense.
Comment: It seems the Dark Word DLC added a few awards. The ingame archive now lists a total of 70 awards.
Answer: The Steak in Mouth award is given to a player who was about to win, but then died before the final point could be awarded, followed by that player losing the match instead. Hence the award image of a King being shot with arrows.
The Cause and Effect award is for players who fire a laser arrow, but have that laser arrow ricochet back onto them, killing them.
Answer: Someone over on Steam compiled a slightly more complete list. Here are the important differences from the list above:
Quick Draw Award - Didn't hold the Shoot button to aim.
Late To The Party Award - Only got the last kill in a round.
Mostly Harmless - In over your head.
Artless Dodger Award - Dodged a lot, but never caught an arrow.
Super Booper - Stomped someone while dodging horizontally.
Damage Control Award - Caught an arrow fired at them by a teammate in TDM.
X-Ray Vision Award - Most drill arrow kills.
Most Conductive - Electrocuted an opponent. [Catch a bolt arrow to electrocute enemies near you]
Right Angle Award - Most bolt arrow kills.
From The Grave Award - Got a kill as a ghost. [Use the "Return as Ghost" variant, and touch a living player]
Comeback King/Queen/Kid - Won the match after hanging behind. [The "Kid" one is exclusive to the Prancing Puppet, all others are based on the archer's gender]
Steak In Mouth Award - Reached the point limit, lost the point by suicide [or any other way to lose a point], and then lost the match.
Overachiever Award - Finished with at least 2 points more than required by the point limit.
Comment: Please summarize the information here.  That way, if ever the website goes down, your answer is still useful.  Besides, it saves people a click.
Comment: Done, but I recommend clicking the link anyway. That list is being updated and corrected regularly, meaning it's likely to be the best source online. (At least, until TowerFall gets a proper wiki.)
Comment: This really just should have been an edit to my post above.


What interferes in an astronomical interferometer?

Question: As I understand it, in an astronomical interferometer, both telescopes need to be aimed at the same light point in space to get an interference pattern. But I also understand that a single photon cannot be detected at two points simultaneously; it registers in one receptor or the other, not both. So what is interfering in the interferometer? Two photons in sequence from the same source?
Comment: you measure the light of the same light source from (i.e. two) distinct points in space and you combine the measured signals to obtain the interference pattern.
Comment: The light from a star is always varying in intensity, so this signal will reach 2 scopes at slightly different times, the time difference can be calculated and the extra time is converted to a distance based on c.  Interfering the signals computationally shows the time delta.  Its not quite the same as the DSE
Answer: If the angular extent of the source is sufficiently small the light from it can be considered coherent.  This means that the wavefront will have the same phase as seen from both of the receptors independent of when the signals arrive.
Often times it is easier to think of these situations from a classical perspective and consider just the wave nature of light and self-interference.  Of course you would have to arrive at the right answer when considering quantum effects and single photons.  That would make this example here similar to the double-slit experiment where you can observe interference fringes with only s single photon at a time.
Typically in optical systems there is only one sensor and the light beams are combined optically before detection.  In radio interferometers the detection is typically done per antenna where the phase of the received signal to a reference oscillator is measured and then the interference computed on digitized signals.
More information can be found in this Wikipedia article: Astronomical interferometer.


Making bottles of gold!

Question: I asked a question on how many gold coins it would take to craft a golden bottle for a gift. How would I go about making the bottle? I have no proficiency in it, and about how much would it cost me to do so? We're playing 5e. I would like to make it the size of a standard wine bottle. I know I need to smelt around 350 gold coins to get the correct amount of metal for it, but what else would I need to do? What skills would I need to use? All of this preferably without magic, if possible. I know I could use the wish spell, or just use an alchemy spell of sorts to change a normal bottle into gold. I'd prefer to do it manually, and make the gift mean more.
Answer: Page 128 of Xanathar's Guide to Everything covers the downtime activity of "Crafting an Item".

A character who has the time, the money, and the needed tools can use downtime to craft armor, weapons, clothing, or other kinds of nonmagical gear.
In addition to the appropriate tools for the item to be crafted, a character needs raw materials worth half of the item's selling cost. To determine how many workweeks it takes to create an item, divide its gold piece cost by 50. [...]
A character needs to be proficient with the tools needed to craft an item and have access to the appropriate equipment. (XGE, 128)

Strictly speaking, the only way you could possibly craft a wine bottle out of golden coins is to have proficiency in Smith's tools, which you don't.
Thankfully, not all is lost, as Xanathar's Guide also includes the downtime activity "Training", which allows a character to gain a proficiency in a tool.

Given enough free time and the services of an instructor, a character can learn a language or pick up proficiency with a tool.
Resources. Receiving training in a language or tool typically takes at least ten workweeks, but this time is reduced by a number of workweeks equal to the character's Intelligence modifier. Training costs 25 gp per workweek. (XGE, 134)

So, if you absolutely insist on crafting it yourself, by hand, using no magic, you would have to do the following:

Spend 10 weeks and 250 gp (potentially less, depending on Int) training under a willing blacksmith. This will give you proficiency in Smith's tools.

Resolve any complications, should your DM choose to roll for them.

Determine with your DM what the appropriate "selling cost" of the golden bottle would be worth. Since it will be using 350 gold coins, for the sake of argument, we'll say it has a value of 500 gp when we include labor.

Find a blacksmith that will allow you to use (or rent) their forge, and then spend 10 weeks (value divided by 50) crafting it, given its value.

Resolve any complications, should your DM choose to roll for them.

Enjoy your golden bottle, hand forged by your character.

Now, personally, I think ten weeks for the crafting itself is rather silly, but according to the actual rules for this, that is what it would take. Your DM may rule otherwise (and, were I your DM, I would).
Comment: Rather than dividing the full cost of the item by 50 to get the time it takes to create, it makes more sense to do so for only the labour part of the cost. In other words, subtract the material cost of the item before dividing by 50. Using this example it would be: (500 Gp - 350 Gp) / 50 Gp/week = 3 weeks. Three weeks makes more sense than ten weeks to make a bottle of gold, doesn't it?
Answer: Gold is exceptionally ductile and malleable.  A person with a good smithing skill could probably just hammer one out.
This question doesn't need a long detailed answer; it's a simple problem.  It doesn't need any rules either.  He's making a gift; all he really needs is for he GM to say he can do it, and then they can all say he did it.  He gives the gift, and everyone is happy.
But here you go anyway, in case too much is not enough.  Get enough gold to make a bottle of the size you want, of reasonable thickness.  He had previously figured out that 350 gp would make a bottle of gold with the same thickness as the glass bottle being copied.  Make a form for the inside shape of the bottle, out of (for example) a metal with a lower melting point than gold.  Hammer the gold around the form until you like the bottle.  Remove the form.  Voila!

Making bottles of gold!


Chromium +1 is unknown while Mn+2 is known?

Question: Although both $\ce{Cr+}$ and $\ce{Mn^2+}$ both ions have $d^5$ configuration, still only $\ce{Mn^2+}$  is well-known while $\ce{Cr+}$ is not common. What is so special about Cr that it does not form $\ce{Cr+}$?
Comment: @orthocresol Even if the answer is basically identical, the question is different. So: **not a dupe**.
Comment: @hBy2Py The way I see it, the crux of the linked question is not about Cr(II), it is about "why can't Cr(II) get reduced to Cr(I) to attain a stable half-filled  orbitals", or essentially "why can't I make Cr(I) even though it is d5". I guess you are seeing it more as "why can't I reduce Cr(II)", and fair enough, but I think we have to agree to disagree on this one.
Comment: Strongly related (possibly a dupe?): [Cr(II) and Mn(III) - their oxidizing and reducing properties?](http://chemistry.stackexchange.com/q/45153/16683)
Comment: @hBy2Py I know that and to be honest, I did not think the questions were very different at all. :/ To me, this is a subset of the other. I did opt to leave it open, though.
Comment: @orthocresol $\ce{Mn^{2+}/Cr^{+}}$ have odd numbers of electrons; $\ce{Mn^{3+}/Cr^{2+}}$ have even numbers. That fact alone I would think would make for appreciably different behavior.
Answer: Even with the stabilization of the $d^5$ electron configuration, chromium is quite electropositive and the (second) ionization energy for removing an additional electron from $\ce{Cr^+}$ is rather low.  It's outweighed by the extra electrostatic attraction or solvation energy available by having two charges on the chromium, therefore you are ordinarily going to go on to $\ce{Cr^{2+}}$.
Chromium can adopt a +1 oxidation state in certain complexes, such as $\ce{Cr(CN)_5NO^{3-}}$.  See https://en.wikipedia.org/wiki/Chromium.


Is the masters a requirement for applying to a Philosophy PhD program in the USA?

Question: I have a BE in Electronics and Communication and my work experience in the last decade has been in the field of Electronics. I have always nurtured a strong interest in Philosophy and have written a lot in the field (blog posts, plays, a book). Do I have a fair chance at being selected for a PhD program or would I need to do a masters first? The profiles of existing students in most of the good universities seem to outmatch mine by miles and so this is more a question on my chances rather than one on technical requirements for the application process.
Comment: Possible duplicate of [Graduate school admission with a degree in a different field](http://academia.stackexchange.com/questions/44651/graduate-school-admission-with-a-degree-in-a-different-field)
Answer: Best way is to approach the institutions/departments you are interested in considering for application, and ask for their specific requirements, which should be very clearly stated.
They will know better than anyone else. Different departments are likely to have different requirements.
That does not meant your set of circumstances will satisfy any of them.


Should I provide my transcripts for all years or only the last year?

Question: I am applying for a a PhD in the UK, and they ask for my bachelor transcript. Should I only include the third year transcripts or full three years ? Since I am translating it from another language it is better for me to only include the last year
Answer: This may vary by university, but a transcript is a full academic record of your time at an institution. As such, they will expect information on every course that you took, all three years. A partial transcript is obviously acceptable for degrees which have not yet been completed, but omitting completed courses may look like you have something to hide.
There will likely be a firm requirement to provide a full original transcript, and if not in English, an authorised translation, before your place is confirmed, regardless of whether a partial transcript is acceptable for an offer to be given.
Answer: The simple and clear answer is YES. Include all year's transcripts. This is especially important in the UK, where the final marks are more crude than other places (e.g., 70% and up is concerned to be A).
Also, many colleges in the UK might have independent offices for initial evaluation of your application, and they would require all transcripts.
In case of doubt just ask the relevant supervisor/faculty. This is a crucial point to understand.
Answer: When evaluating applicants for PhD studies, the reader of your application will check whether you seem to have a good chance of finishing the degree within the suggested time span. This is especially important in the UK, where the duration of PhD studies if relatively fixed.
Now for checking whether you have a good chance of finishing in time, they need to see what courses you took in the past. In some fields, there are considerable differences between universities (and countries of study), especially regarding whether the focus is more on the theoretical or more applied topics. Thus, the full transcript allows them to estimate whether you bring the needed background knowledge with you for the PhD program that you are applying to, as they want to avoid that you have to spend time on filling your gaps in knowledge before your can work on research in a productive way.
As a summary, full transcripts are essential for a good application! Even if you can - for some reason - only provide a partial translation, if your certificates are good enough for, say, Google translate to extract some of their meaning, it makes sense to include scans/copies of the original non-English transcript. This holds especially for languages such as Spanish or Italian, which are close enough to English for a rough translation.


Generate multiple contour lines at specific elevations

Question: Can anyone suggest a method by which I can produce several user-defined contour lines (from a DEM) within a single shapefile using QGIS/GRASS (2.12.x) and its plugins. Each approach I have tried has only allowed my to create contours in specific intervals, rather than at specific elevations
Answer: You can specify levels using the GRASS module, r.contour.level. It's available in the processing toolbox. You can search for it when the dropdown at the bottom of the Processing Toolbox window is switched from "Simplified interface" to "Advanced interface".

The "List of contour levels" parameter takes a comma separated list of elevation levels.
Here is the documentation for the GRASS command r.contours and the corresponding levels parameter.
Its use for this specific task is mentioned in this question.
Comment: exactly what I was looking for. I really need to spend more time investigating the GRASS toolbox.  Thanks.
Comment: @mastorey Great! So happy it helped.
Answer: If you make contours everywhere at some interval or set of intervals that includes all the elevations you want, you can then extract only those elevations from your whole set of contours to a new shapefile. To do that, go into the attribute table and select features by expression. Use an expression something like:
<code> "ID" >= 50 AND "ID" <= 75
</code>
where you replace "ID" with whatever field has your contour levels recorded. (Below is a dummy example using points and their sequential id numbers.)

Then, simply save those selected contours as their own layer by right-clicking them in the Layers Panel, and selecting "Save As," and making sure you choose only the selected layers.