Version tags considered harmful

Question: We've noticed that a huge percentage of questions are tagged drupal-6 or drupal-7.
This is a dangerous pattern for your community to fall into. Here's why:

Version tags are redundant. The site is already called "drupal". We don't need to know that it's drupal-6, drupal-7, drupal-8, drupal-9 in every single tag on every single question. It's redundant.
Version tags are a crutch. Because these tags dominate the site, and contain the name, they are the first thing users will turn to when tagging their questions. This means users will fail to tag questions with any other meaningful tags, since "I already tagged my question with drupal-6!" This isn't hypothetical. We've seen this happen time and time again. Version tags are a mindless replacement for thinking about what your question is about. "Oh, this question is about drupal-7. Done."
Version tags make questions disposable. The entire point of Stack Exchange is for questions to be editable, timeless resources -- a version tag implies exactly the opposite and ties questions to specific moments in time, with no incentive to improve them to be relevant to future versions. This is extremely dangerous!
Version tags encourage needless question duplication. Rather than "How do I do X?" which can cover both supported versions, now there has to be "How do I do X in Version 1?" and "How do I do X in Version 2?"
Version tags aren't necessary for most new questions. New questions are very likely to be about the current version of the software -- so for all new questions, tagging with the current version is usually not helpful.

On top of that, how many versions (outside of freakish "I still use Windows 2000" edge conditions) will really matter at any given time? Two at best? And certainly any OSS project worth its salt will strongly urge people to regularly migrate to the latest version as soon as they can, so that the community can move forward to bigger and better things.
Thus, here is what I propose.

Eliminating the version tags on existing questions. We can do this in one click globally.
Treating version tags as the exception not the rule on new questions -- if you have a strong case to make that the question you are asking is ONLY relevant to one version and can NEVER EVER be relevant to any other version, then -- and only then -- add the version tag.
If you encounter an old question that is truly specific to a version, and cannot be edited to be version-agnostic, retag it with a version tag.

The bottom line is that version tags have to be treated as the exception, not the rule. It is important to fix this now while your community is young? Otherwise you are creating some deep problems in your community that will be very hard to fix 1 or 2 or 3 years from now.
Comment: I'm not going to waste my time attempting to figure out which version of Drupal a question is referring to in order to answer it properly, and I would never use a technique I found on a website that did not specify the Drupal version. It looks like @Jeff Atwood is going to be rigid in his viewpoint and has just destroyed this site with this rule. We use Ubuntu, we use Wordpress, we use Java, and we are trying to say that Drupal is different when it comes to versions.  We have to tag everything with the version number, even our lunch conversations.
Comment: @jody everyone thinks they are different and special, then they end up repeating the same mistakes as everyone before them. I cannot in good conscience let any community repeat these bad decisions. The correct way to handle this is for askers to specify the version (if necessary) in the body text. Having a policy of "everything must be tagged X to start" is toxic and inappropriate.
Comment: @kia that's no more dangerous than the C# or Java tags on Stack Overflow. Note that we discourage language version tags for similar reasons. A string is a string is a string, in C# 1.0 to C# 4.0. The exception is when you talk about a new string function introduced later; this is rare, as you would expect.
Comment: This site is now infinitely more useless without the Drupal 6/7 tags. Anyone who has used more than one version of Drupal knows this.
Comment: @kia if a single tag was on 50% of Stack Overflow questions I would be lobbying for its removal as well. See http://blog.stackoverflow.com/2010/08/the-death-of-meta-tags/ and stuff like the [subjective] tag which was a top 20 tag as I recall. If a tag applies to everything -- or half of everything -- it applies to nothing.
Comment: @tim so you prefer drupal6.stackexchange.com and drupal7.stackexchange.com? Apparently each version of drupal has nothing in common with the previous one, they rewrite it from scratch on new technology?
Comment: I think removing the version tags without alternative will not help drupal.stackexchange. It will do the opposit.
Comment: To say "any OSS project worth its salt will strongly urge people to regularly migrate to the latest version as soon as they can, so that the community can move forward to bigger and better things" is completely unrealistic as a reason for not tagging answers with a version. How many clients can simply upgrade from 6 to 7 because the developer urges them to do so? I find that without these tags, this site is bordering on unusable.
Comment: It's not clear to me why tags for the Drupal version are dangerous for Drupal Answers, but they are allowed on Stack Overflow.
Comment: @Jeff Atwood What would happen if half of the questions would be about [Views](http://drupal.org/project/views)? Would the tag be removed on that basis?
Comment: @Jeff Atwood Just a last question: Should those tags be added as blocked tags, or should they made synonyms of pseudo-tags that are then removed? In other words, who needs to do something, the moderators or you Stack Exchange?
Comment: @Jeff Atwood No, each Drupal version is not rewritten from scratch; the old version development snapshot is patched to get the new version, in the same way it is happening now for [Drupal 8](http://drupal.org/project/issues/drupal?text=&status=Open&priorities=All&categories=All&version=8.x&component=All). The reason Drupal users don't understand what reported here is that we are used to report the Drupal version in any issue report done. Clearly, a Q&A site is different, and I can understand why version tags are not welcome.
Comment: @Jody The problem is when the OP tags a question with "drupal-6" when the question is not specific for Drupal 6; it happens that the OP tags a question with "drupal-6" because that is the Drupal version used from their site, but the question asked is not specific for Drupal 6. In that case, supposing that you want to answer to questions only for Drupal 7, what would you do? You would not read the question because it has been tagged "drupal-6."
Comment: @Jody The problem is also for who is looking for a question with the answer for a problem he has; if the questions would be tagged with "drupal-6," he would not read the question because he is using Drupal 7, and the question is for a different Drupal version. The version tags should have been used only when strictly necessary, for example when asking for features that are specific for Drupal 7. The problem is that such features don't exist in Drupal; a feature that is introduced in Drupal 7 is also present in the next versions.
Answer: This might all be true about many other versioned things, but in case of Drupal, the difference between 6 and 7 is huge and the answer depends in many cases on the version used.
Drupal 7 was in many areas a major redesign, many things just don't work like they did in 6. The same things will likely happen with Drupal 8. Drupal core isn't backwards compatible

We already had a similar discussion if version-6 should be used instead of drupal-6. We went back to drupal-6/7 however, because these are the official terms (Nobody talks about Version 6, but always "Drupal 6") and some contributed modules also have different major versions where a differentiation might be useful.
It is IMHO important that users choose one of these tags. Because a large amount of the questions that do not have this tag initially have a comment that asks which version they are using so that it can be answered properly.
While this is true, this is not how Drupal works. Drupal versions and "ways of doing things" are not timeless, they often change together with new core versions. One example is the new entity/field concept which allows to add various types of "fields" to entities (nodes, users, comments, ...) while in Drupal 6, this was only possible for nodes and was not in Core but a contributed module. Many modules exist to work around that limitation in Drupal 6 which are simply not necessary anymore.
As explained above, chances are pretty high that the answer to these two question is different based on the version used. Maybe at some point Drupal core will stabilize and such a differentation wouldn't be necessary anymore but it is also very possible that at the same point new frameworks/systems will appear and Drupal's rise will stop and it will eventually vanish.
Just look at the numbers of how often those two tags (drupal-6, drupal-7) are used. We have 627 Drupal 6 questions vs. 543 Drupal 7 questions. (Drupal 7 was released in Januar 2011). So it's pretty equal and it would be wrong to assume that new questions are for Drupal 7. That again might be Drupal specific, but because of the vast amount of changes and the fact that contributed modules often lag behind a bit (and you usually use a lot of contributed modules on every site you build with Drupal), the shift to the next major version usually takes a bit of time (People still work on improving existing D6 sites, some new projects still might use Drupal 6 right now because an important module they're depending on might not yet be available for Drupal 7 and so on).

That said, I totally see what you are saying and that it might/will be a problem in 1/2/3 years. But not using version tags right now is just not possible/doable.
Maybe we can find a different way to specify the used version and/or if a question/answer is version specific or not.
Comment: for #2 there is no reason this needs to be captured in a tag. Saying to someone "you gotta pick a version tag!" is the same as saying to them "you gotta tell us what version!" -- enforcing this in tags is a bad idea.
Comment: @Jeff Atwood I see the problem you mention, but I don't think that simply *not* using version tags would help (by simply adding the version information into the text, it is still version-based, just harder to see). In Drupal, we have a saying that goes like this "The drop is always moving". This means that with every new core version, major *backwards-incompatible* changes happen. And Drupal is not a programming language or an API, it is a whole ecosystem.
Comment: @Jeff Atwood Is then just a matter of not using those tags? In that case, I don't see how the absence of a version tag makes the question not disposable.
Comment: @berdir if this is so, it sounds like you guys need drupal6.stackexchange.com and drupal7.stackexchange.com and this site should be forcibly terminated... since the two versions have absolutely nothing in common.
Comment: @Jeff Atwood Saying that they have nothing in common is quite wrong. Drupal 7 has not been written from scratch; there are parts of the core code that has been modified and there are core modules that have been added since the previous version. What I think it's difficult to understand (at least for me) is why "drupal-7" is allowed on Stack Overflow, and not here; if version tags are bad, then they are bad on Stack Overflow too. Saying that on SO the tag is not the most used one is pointless, in someway, as the topic for the questions on SO is not so narrow as on DA.
Comment: @kia please go re-read my original post on this at the top of the page. Then go look at the /tags page on both sites and tell me what percent they cover. If *everything* is tagged the same thing (or the same 2 things) then *nothing* is tagged. It is the institutionalization of a "must have a required version tag" philosophy that is at odds with the network here.
Comment: @Jeff What I mean with that is not "SO has it too, so we are allowed to do it" but "SO has the same problem". And if there would be a site about visual studio, those version tags would be among the most used of the whole site. So what can we do about it instead of simply removing that?
Comment: @berdir no, they wouldn't -- most questions would be about the current version of Visual Studio. And we would insist that only questions which *can never apply to any other version of Visual Studio for the rest of recorded human history* have version tags. **VERSION TAGS SHOULD ONLY BE ADDED WHEN THEY _MUST_ BE**. Any site which institutionalizes version tags will not last long on our network; after seeing this same pattern play out on Wordpress and Ask Ubuntu, I can tell you that everyone thinks they are "exceptional" and "these mistakes don't apply to us, we are special and different."
Comment: @Jeff Just wondering, are there other sites that are specific to a *Software* that is updated on regular basis that *did not* show this pattern? Because it is obvious to me that questions about cooking, mathematics, .. and so on don't need versioning and are much more timeless than a software. Evolution is much quicker here.
Comment: @berdir you need to come to terms with this if you want to stay on our network. The other alternative is I can set up drupal6.stackexchange.com and drupal7.stackexchange.com for you. Make your choice.
Comment: No, I don't think multiple sites would make sense. Drupal 7 started only few month ago, it is obvious to me that the shift is slowly. In a year, there will probably be much less questions about Drupal 6 and in 2-3, Drupal 8 will come out, what then? Yet another site? I am not trying to defend "us" or something, just trying to find an alternative to version tags (and point out that the same pattern exists on SO, look at visual-studio-2008 and visual-studio-2010 tags, both still active...). If you do not want version tags, they have to go. You're the boss ;)
Comment: @berdir the argument is ridiculous; because there are 10k [visual-studio-2008] questions out of 1.65 million on Stack Overflow -- that's a whopping ZERO POINT SIX PERCENT, you think that makes it somehow OK for this site to have 1100/1360 or 80% of all its questions covered by two tags? Heck even the most populous tag on Stack Overflow, [c#], is only 177k out of 1.65 MILLION questions, just over 10%. I hope you are not ever put in charge of environmental pollution level standards. :)
Comment: @berdir and I am not against the version tags *existing*, I am against them covering 80% of the site, becoming institutionalized, and causing the severe cultural problems I mentioned in my question.
Comment: Yes, those VS version tags are only a minor part of the whole SO site. That is argument 2 of your post. But there are more VS-2008 questions than VS questions, so argument 3-5 IMHO applies to those as well. Single questions tagged with one of those version tags are just as time-specific as ours. That is what I meant. Anyway, not relevant. You want those tags gone (or better, only used for specific purposes), so how do we do it? Delete? Block? Both would completely remove them and might remove relevant information of existing questions which might not mention the version in the text.
Comment: Not everything is different :). And for example questions that involve coding, the differences might be minor (but important!). I'm sure many drupal-x wouldn't need that tag. The problem, as kiamlaluno already mentioned is that the person who is asking the question often does not know that, only the person who answers does (maybe they only know that their answer works on D6 but are not sure if it works for D7 or not). I am not opposed to remove the version tags if there is another way to deal with this problem, I just think simply removing them without any kind of replacement doesn't work.
Comment: @Jeff I added a few example answers with questions as typical examples of D6/7 differences. I hope that better explains the issue that we have here. I still think we need *something* to indicate for which core version(s) a question/answer is relevant/tested/confirmed/correct.
Comment: @Jeff Also, about the tags. SO has 6k drupal tagged questions and 1.7k also have the drupal-6 tag (+600 drupal-6 questions without drupal tag). One of the differences is that SO is around much longer than this site or D7 so that there are not as many drupal-7 tagged questions (400). Also, SO has a much bigger scope than this site (and is much older), but already if you look at the second page of the tags, you can see many "version tags". actionscript-3, visual-studio-2008, sql-server-2005, ruby-on-rails-3 and so on. See for example http://stackoverflow.com/questions/tagged/visual-studio
Comment: @Jeff Atwood I have already said I am not against removing those tags, but I would also understand the criteria for which a version tag is not acceptable. So far you were referring to "drupal-X;" would the same criteria apply to "views-X," if one of those tags would be used for 25%, 50% of the questions?
Comment: I would say that those tags should not be allowed, in a way or the other. The reason is that on Drupal.org, the Drupal version is always reported in the issue queues (although not through a tag), and in forum posts the Drupal version is always asked; it would not be possible to avoid that between 2 months we are back to exactly the same situation.
Answer: Trying to give some examples for questions that would be answered more or less differently based on the core version. This is too long for a comment, so I'm doing it as a new answer.
Maybe this can help to explain what I and kiamlaluno mean...
Q1: How can I relate two nodes together?
D6 A: With the CCK project, you can add fields to nodes. Make sure to enable the Node reference module and then add a Node reference field to the node type you want to connect to another.
D7 A: The ability to add fields to nodes (and other things) has been added to Drupal 7 core. However, the node reference module did not make it into core and is now part of the References project. There is also a new project called Relations which aims to provide a generic solution to relate entity X (node, comment, user, ...) to entity Y. Additionally, that module makes the relation between two entities also an entity so you can add information/fields directly to the relationship between two things.
Explanation: The answer is similar, but you need different modules in D6/D7 and even within a core version, new contributed modules/ideas are developed which can change how things are usually done.
Q2: How do I load a user with a specific name?
D6 A:
<?php
$account = user_load(array('name' => 'user name'));
?>

D7 A:
<?php
$account = user_load_by_name('user name');
?>

Explanation: user_load_by_name() is a new helper function, see http://api.drupal.org/api/drupal/modules--user--user.module/function/user_load_by_name/7, that does not exist in D6 and uses the new function user_load_multiple() that did not exist in D6. Using either code in the other version would not work.
Q3: How do I load a user based on the user id?
A
<?php
$account = user_load($id);
?>

Explanation: This time, the answer is the same and does not depend on the used version (But it could theoretically change in Drupal 8 or 9, who knows). Also, in Drupal 6, it was also possible to pass an array to user_load() like this: user_load(array('uid' => $id)), this does not work anymore in Drupal 7.
So, how would one know that the answer for Q1 and 2 is a bit different, but not for Q3?
The question now is, how to de expose that information without misusing the tagging system? I honestly have no idea...
Comment: this seems fine to me; unless I see otherwise, I will assume the technique works for both versions. And having solutions for both versions in the question is far more efficient for visitors arriving via Google -- it is also instructional in that it illustrates what changed, and why.
Comment: @Jeff: I'm not sure if Berdir meant this as a proposal how to answer questions. Didn't he just mean to illustrate that D6 solutions often differ from D7 solutions? Anyway, while covering all versions in a single answer would be great for Google results and documentation purposes, I think it would really harm the number of answers. When I see a question about D6 and I know the solution, I can write an answer in no time. When it's not tagged with a version and I know I'm supposed to cover all versions in my answer, I will probably not write an answer at all.
Comment: @marc the point is that questions here are editable like wikipedia articles. You can answer with the part you know, and others can contribute "yes, and.." answers of their own (and get votes), or click edit even as an anonymous user to contribute an edit.
Answer: Jeff, you and kiamlaluno are making such a mess of this site. Please stop making rash changes like banning tags…
You may have different ideas, but everywhere in the documentation on Drupal.org, it's tagged with what version it pertains to. If that causes problems with the StackExchange software, perhaps it's the software we need to fix?
If we were to build a QnA site in Drupal, we would just have the version as a separate attribute instead of tags, but since that's not possible with SE, tags will have to do. Versioning info is so important that the QnA is useless without it.
Examples are fairly easily translated from one version to another, but you need to know what version the example code is, to realise that you should expect an object instead of an array or whatnot.
Comment: The version, if relevant, should be mentioned in the body (or even the title). Requiring it as a tag is part of the problem for all the reasons in the body of my question.
Answer:
I agree that using tags containing the word drupal is not helpful, as the site is about Drupal. Others reported that "Drupal 7" is the way a Drupal version is reported, but that has nothing to do with how a tag should be named. If the problem were users keeping to use drupal-7 instead of version-7, the first could be made a synonym of the latter; in that way, no tag used in questions would contain "drupal."
It seems it is already happening, as some of the recent questions just contain the tag for the Drupal version:

How do I change a MySQL query into a Drupal query?
https://drupal.stackexchange.com/questions/3968/the-specified-date-is-invalid-error
https://drupal.stackexchange.com/questions/3967/why-admin-can-not-create-new-content
My implementation of template_preprocess_block() isn't working

I don't think that questions for Drupal 5, for example, are restricted in time; it is still possible to download Drupal 5 and, for what it matters, Drupal 4.7. The fact they are not supported anymore means only that bugs will not be fixed anymore, in the same way there are things in Drupal 7 that are not changed anymore; it does't mean Drupal 5 could not be used for a website.
It is possible that the same question is asked for Drupal 6 and Drupal 7, in the same way similar questions are asked about Perl 5 and Perl 6. Supposing there is already a question about Perl 5, what should a user who is interested to know the answer for the same question for Perl 6 do? There are many things that are changed in Perl 6; for example, in Perl 6 is not possible to use __PACKAGE__ anymore; where Perl 5 uses foreach my $x (@whatever) { … }, Perl 6 uses for @whatever -> $x { … }; where Perl 5 uses $str =~ m/^\d{2,5}\s/i, Perl 6 uses $str ~~ m:P5:i/^\d{2,5}\s/.
The difference between a programming language, and a CMS is the time between new releases. How long did we had to wait before to pass from PHP 4 to PHP 5? How much time will pass between the first release of Perl 5 and the first release of Perl 6?
Considering that the current Drupal version (as defined in drupal.org) is Drupal 7, taking the assumption that new questions are about Drupal 7 is a wrong assumption. There are 627 questions tagged drupal-6, 573 questions tagged drupal-7, and 5 questions tagged drupal-5. All those questions have been asked when Drupal 7 already had an official release (which means any release that is not a development snapshot).

To make a summary, I am not against removing the Drupal version tags, but that will not stop questions for which the user is interested in how to do something using a specific Drupal version, in the same way nothing has stopped users to ask a question about the regular expression to use to resolve a specific task, instead of making the question as much generic as possible.
If we are going to remove those tags, then they should be blocked; questions about Drupal on Stack Overflow are using those version tags, and we would need to avoid the tags are imported into Drupal Answers.
Comment: we have to teach users that version tags should *only* be added when they have actual evidence that what they are asking about will only be relevant to that one version, for the rest of recorded human history. I'm not against them existing, **I am against a culture of indoctrinating users that every question has to have a version tag** -- and that is kind of what is happening right now on this site.
Comment: @Jeff Atwood The problem is that such evidence could not be provided by who asks the question, who is not supposed to know the differences existing between a Drupal version and the other. There are many questions for which to know the Drupal version is necessary to give an answer that doesn't say "if you are using Drupal 5, then […]; if you are using Drupal 6, then […]; if you are using Drupal 7, then […]." Drupal is not C++; with C++ you would not ask for which version of C++ the question is being asked, but with Drupal the version is a necessary information, if the question is not generic.
Comment: this implies there needs to be drupal6.stackexchange.com and drupal7.stackexchange.com because the two are so radically different. I am moving to close this site if that is true.
Comment: For example, I could ask if it is possible to do X with Drupal, and in that case, an answer that would report that it is possible in Drupal 6 (and how) and in Drupal 7 (and how) is perfectly fine. In the case somebody is trying to resolve a problem, or to achieve a task on their site, they are interested to know the answer for their site, which is using a specific Drupal version. You cannot use two Drupal versions to run a site.
Comment: @Jeff Atwood I don't think the situation for Drupal is different from the situation for WordPress. I am sure there are features, functions, settings that are available starting from version X. I fail to believe that the user interface of WordPress 2.x is the same used by WordPress 3.x.
Answer:
Version tags are redundant. The site is already called "drupal". We don't need to know that it's drupal-6, drupal-7, drupal-8, drupal-9 in every single tag on every single question. It's redundant.

This is not true. To answer a question properly we need to know what version of Drupal is involved. Drupal 4, 5, 6 and 7 are vastly different. Any answer beyond the most basic given to Drupal 4 or 5 would be completely useless for a Drupal 7 site. What you are saying is like saying We don't need to know what programming language is used, all we need to know is that it's about programming for the SO site. I know it's not exactly the same thing, but what I'm saying is that Drupal versions are vastly different and an answer for one version could be outright wrong for another one.

Version tags are a crutch. Because these tags dominate the site, and contain the name, they are the first thing users will turn to when tagging their questions. This means users will fail to tag questions with any other meaningful tags, since "I already tagged my question with drupal-6!" This isn't hypothetical. We've seen this happen time and time again. Version tags are a mindless replacement for thinking about what your question is about. "Oh, this question is about drupal-7. Done."

I can see how this can be a problem

Version tags make questions disposable. The entire point of Stack Exchange is for questions to be editable, timeless resources -- a version tag implies exactly the opposite and ties questions to specific moments in time, with no incentive to improve them to be relevant to future versions. This is extremely dangerous!

You cannot make timeless answers for Drupal for many reasons. The API changes a lot, the modules used changes as well, and standard ways of solve certain problems is created. My guess is that about 90% or more of the answers created thus far is completely irrelevant in 4 years, since Drupal will have evolved. Not tagging questions can fix this, you would have to stop the development of Drupal core.

Version tags encourage needless question duplication. Rather than "How do I do X?" which can cover both supported versions, now there has to be "How do I do X in Version 1?" and "How do I do X in Version 2?"

This is both true and false. It's true that you would have to create the same question for Drupal 6 and 7, the alternative is to create an answer for each version with some answers. IMO this is much more problematic. You can't tag answers so you have no other way than writing it in the text field that an answer is related to this and this version. Over time such a question would have many different types of answers, some to one version or the other, some to multiple versions. The number of upvotes can be related to which version was used most at the time etc. So when a user is redirected from Google, how should he be able to figure out which answer is useful. He need a Drupal-9 solution, but since there is no way to filter the question or answer he would have to read through all the answers making the voting system useless.

Version tags aren't necessary for most new questions. New questions are very likely to be about the current version of the software -- so for all new questions, tagging with the current version is usually not helpful.

This is true maybe 1/2 of the time. Drupal have a very long period where two vesions are used equally, since a lot modules which is used all the time, need to be ported to the new version, which last time took about a year or so.
I understand some of the dangers and problems that can arise by using version tags, but it seems to me that not using them will create a lot of problems as well, only different ones. For this site to succeed, we need a way to be able to filter on version. It would make more sense to "tag" an answer with a version tag and not the question. This would be a great feature to allow tagging answers with a small selection of tags, but this is not possible atm. So we only have one thing to do, and that is tagging the question. The alternative is to write the Drupal version in the title of the body, or figure it out by asking in comments, which would slow down the whole answering process.
Comment: The version, if relevant, should be mentioned in the body (or even the title). Requiring it as a tag is part of the problem for all the reasons in the body of my question.
Comment: @google [drupal-7] is a meta tag, by these rules. http://blog.stackoverflow.com/2010/08/the-death-of-meta-tags/ Ask yourself this: could a question be tagged *only* [drupal-7]? No, it cannot. Therefore this tag is a meta-tag. I support this tag being used **ONLY WHEN THE QUESTION IS IRREVOCABLY TIED TO A SPECIFIC VERSION** and obviously in combination with other tags.
Comment: Another thing that strikes me as strange is that if we migrate the Drupal site with a bunch of other site like SO, it would be fine to use the version tag for all Drupal questions, but in it's own site this is bad behavior. So on SO you would tag questions drupal and drupal-X. This is done for maybe 50% of all new drupal questions on SO, which you deem perfectly fine.
Comment: @google correct, on the wordpress site nothing needs to be tagged [wordpress], on the apple site nothing needs to be tagged [apple], on the GIS site nothing needs to be tagged [gis], on the math site nothing needs to be tagged [math]. You are here because .. wait for it.. you expect ALL questions to be about Drupal. The tag is unnecessary. And in fact *harmful*. Questions need to contain enough information to be answerable without relying on meta-tags.
Comment: @Jeff putting it into the title or depending on users remembering to write it in the body text is even worse. StackExchange really needs a system for this kind of metadata. If you can't provide that, we're forced to do nasty hacks, be it abusing the tags or the title. We don't want to ask "What version of Drupal are you using?" every time a new question is posted.
The high and almighty Stack Exchange Inc. have decided that meta tags are bad. You can't come up with a better alternative, but it's your ball, so you can just take it and go home…
Comment: @Jeff So you would considder it an improvement to have most questions called "Drupal-x: How..." instead of using the tag? This doesn't change anything for point 3-5, it will simply move the info away as an tag and into the title instead. As for #2, how many questions do we have only tagged drupal-x ?
Comment: @jeff Actually I don't agree with the above comment. If I want to answer the question, the most helpful information I could get is the major version of Drupal involved. Also it's not a meta tag as it describes the content of the question. Fx, the `node_load` function in the code text, which API is used? This is explained via the version tag.

Version tags considered harmful


Line is not drawn in Kivy python

Question: Code:
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color
from kivy.graphics import Line

class Draw(Widget):
    def __init__(self, **kwargs):
        super(Draw, self).__init__(**kwargs)

        # Widget has a property called canvas
        with self.canvas:
            Color(0, 1, 0, .5, mode='rgba')
            Line(points=(350, 400, 500, 800, 650, 400, 300, 650, 700, 650, 350, 400), width=3)

            Color(0, 0, 1, .5, mode='rgba')
            Line(bezier=(200, 100, 250, 150, 300, 50, 350, 100), width=3)

class MyApp(App):
    def build(self):
        return Draw()

if __name__ == "__main__":
    MyApp().run()

The result:
Both the green line and the blue line should show up, but only the green line shows up
The Green line shows a star
The Blue line shows a wave
Answer: self.pos
If you resize the application from your code, you should notice that sometimes the blue line is plotted. This is because you did not bind the position of the widget with the canvas drawing (Line, Rectangle, etc...)
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color
from kivy.graphics import Line

class Draw(Widget):
    def __init__(self, **kwargs):
        super(Draw, self).__init__(**kwargs)
        self.update_canvas()

    def update_canvas(self, *args):
        # Widget has a property called canvas
        with self.canvas:
            # add self.pos to the line position
            Color(0, 1, 0, .5, mode='rgba')
            Line(pos=self.pos, points=(350, 400, 500, 800, 650, 400, 300, 650, 700, 650, 350, 400), width=3)

            Color(0, 0, 1, .5, mode='rgba')
            Line(pos=self.pos, bezier=(200, 100, 250, 150, 300, 50, 350, 100), width=3)

class MyApp(App):
    def build(self):
        return Draw()

if __name__ == "__main__":
    MyApp().run()

However, I noticed that sometimes the blue line is not visible depending on the OpenGL Context initialization.
The issue is, in general, caused by alpha channel of the color.

... if the current color has an alpha less than 1.0, a stencil will be used internally to draw the line.

This internal stencil has not a stable behavior.
Source: Kivy.Lines
Comment: Thank you very much. But what will happen if I add pos=self.pos?
Comment: It should bind the line drawing position with the *widget position*

Line is not drawn in Kivy python


PS4 Gamertag ID Changing

Question: Someone has the name on playstation that I want. They haven't played in over 2 years and I was wondering could I get their/the name that I want. I know that on Twitch if you're affiliated and someone doesn't stream in a certain amount of time - you can just take their user name.
Simple Form: Is there any way to take someone's username?
Answer: PSN IDs don't expire, at least not yet, so no, there is no way to get someone else's PSN ID, active or inactive, unless they change it themselves.
Wondercricket pointed out in the comment that even if they change it you still can't get it.
Note that Sony does reserve the right to delete accounts after 2 years of inactivity, but this is not applied with any level of consistency (if it is applied at all).
Comment: Even if they were to change it to something else, another account still wouldn't be able to take the name. This is mentioned [here](https://blog.playstation.com/2019/04/10/online-id-change-on-psn-your-questions-answered/)

PS4 Gamertag ID Changing


Can you use similar security questions used on email registration for a more corporate tool?

Question: I am developing a set of security questions for a corporate website. The usual security questions I come across are mothers birthplace, best childhood friend, ect. These questions don't seem fitting for someone who is setting up their company with an account. What security questions should be used in this instance or are the usual security questions fine.
Comment: The very fact that there are 'the usual security questions' in the first place to my mind makes the very idea *less* secure than just having a single email validation route. *"Can't remember your email address? Just enter you mothers maiden name here to gain access instead!".*
Comment: Don't use security questions if you can avoid it. Instead 2nd factor authentication 2FA is a good alternative. There's also a related question here: http://ux.stackexchange.com/questions/13530/forgotten-passwords-is-there-a-real-benefit-to-asking-for-memorable-password-h
Answer: Note that these kinds of questions are not very secure to begin with. Much of the information asked for can often be found using public resources like Facebook or genealogy data. There are well-documented cases of hacks based on these 'personal security question'. Personally, if forced to give answers to such questions, I just fill them with random data.
Do you really need such a password-restore service that uses these questions, or would it suffice to just have the just personally drop by a support desk (or call in) and have their password reset that way if and when needed?


Programmatically emit a deprecation in older versions for dynamic properties

Question: In PHP 8.2, dynamic properties are deprecated. I am currently developing on PHP 8.1 and would like the code also to work on PHP 8.2.
Near the bottom of the linked page it says:

It is possible to programmatically emit a deprecation in older versions in the interest of consistency across multiple PHP versions.

Please can anyone explain how to do this? I would like to see a deprecation notice for any use of dynamic properties when developing on PHP 8.1.
I have no idea how, so there's nothing specific that I tried already.
Comment: Good question. Is there any way to contact the author of that article to find out what they're referring to?
Comment: @Barmar Good idea thanks, but how? I don't see any indication of an author.
Answer: You could use the magic method __set like this:
<code>class User
{

    public function __set($name, $value) {
        trigger_error("Deprecated: Creation of dynamic property User::$name is deprecated");
    }

}
</code>
Because this method is run when writing data to non-existing properties.
By default trigger_error() generates a warning.
Here's an example: https://3v4l.org/kWbnN
Comment: Thanks for the suggestion. It's a neat idea, however it would require adding the method to every class in the code, right? I would prefer to avoid that.


Coincidence about nabla?

Question: I was surprised to notice that gradient of function and Levi-Civita connection have the same notation, i.e. nabla sign $\nabla$. Moreover, extending any connection on tensors, one let it be differential (or, equally in presence of Riemann metric, gradient) on functions. Is it just a strange coincidence?
Answer: Your observation is correct. This is not just a coincidence, but a smart choice of conventions, which allows to have the Leibniz rule written in a universal manner.

A connection in a vector bundle $E$ over manifold $M$ is a $\mathbb{R}$-linear differential operator $D \colon \Gamma(E) \to \Gamma(T^*M \otimes E)$ between sections of vector bundles $E$ and $T^*M$, which satisfies the Leibniz rule:
$$
D(f \, t) = \mathrm{d}f \otimes t + f \, Dt \tag{1}
$$
for any $f \in C^{\infty}(M)$ and $t \in \Gamma(E)$.
By requiring that the Leibniz rule
$$
D(s \otimes t) = D(s) \otimes t + s \otimes D(t) \tag{2}
$$
holds for any two sections $s,t$ of tensor products of a finite number of copies of the bundle $E$ and its dual $E$ (let us call them $E$-bundles), and for any contraction map $C$ we have $D \circ C = C \circ D$, we obtain a family of connections in all the $E$-bundles. The whole family of such connections is usually referred to as the connection $D$ in $E$-bundles.
The Levi-Civita connection in a Riemannina manifold $(M,g)$ is frequently denoted by $\nabla$. This is a connection in $TM$-bundles, which are better known under the name tensor bundles.
In the Riemannian setting we usually identify vectors and covectors, so the differential $\mathrm{d}f$ and the gradient $\nabla f$ are no longer distingushed, and we may write the Leibniz rule $(1)$ as
$$
\nabla (f \, t) = \nabla f \otimes t + f \, \nabla t \tag{3}
$$
wheres for two tensors $s,t$ we have
$$
\nabla(s \otimes t) = \nabla s \otimes t + s \otimes \nabla t \tag{4}
$$
Introducing another convention $f \otimes s := f s$ for a function $f \in C^{\infty}(M)$ and a tensor $s$, we may reinterpret the rule $(3)$ as a particular case of $(4)$.
Futhermore, it is also quite common to use the symbol $\nabla$ for arbitrary connections in vector bundles (instead of $D$), and taking by the convention that in this case $\nabla f := \mathrm{d}f$ for a smooth function $f$, we still have the Leibniz rule written as $(4)$, which is very convenient (the rule $(3)$ is then obtained from $(4)$ by setting $s := f$).

Coincidence about nabla?


Where is my Grub start menu after upgrade to 22.04?

Question: I made all upgrades from 16.04 Ubuntu Mate to 22.04 successfully.
From the first upgrade I noticed that I can't see my Grub start menu.
Also I noticed that my system takes longer to startup and first it starts in command line with a prompt to login and then it enters in graphical environment.
Don't know if this is suspicious:
sudo cat /var/log/boot.log| grep GRUB
[sudo] password for cent:
         Starting Record successful boot for GRUB...
[  OK  ] Finished Record successful boot for GRUB.
         Starting GRUB failed boot detection...
[  OK  ] Finished GRUB failed boot detection.
         Starting Record successful boot for GRUB...
[  OK  ] Finished Record successful boot for GRUB.
         Starting GRUB failed boot detection...
[  OK  ] Finished GRUB failed boot detection.
         Starting Record successful boot for GRUB...
[  OK  ] Finished Record successful boot for GRUB.
         Starting GRUB failed boot detection...
[  OK  ] Finished GRUB failed boot detection.

I thought that
sudo update-grub

would solve the problem but...it didn't!
Any ideas?
PS: this is not a dual boot system.
In case one needs this:
sudo cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Partitions:
sudo parted -l
Model: ATA WDC WD3200BEKT-7 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  40,0GB  40,0GB  primary   ext4            boot
 2      40,0GB  315GB   275GB   primary   ext4
 3      315GB   320GB   4999MB  extended
 5      315GB   320GB   4999MB  logical   linux-swap(v1)

Comment: Post output of *sudo parted -l* into question
Answer: change GRUB_TIMEOUT_STYLE=hidden to GRUB_TIMEOUT_STYLE=menu
Then run
sudo update-grub

From info grub
'GRUB_TIMEOUT_STYLE'
     If this option is unset or set to 'menu', then GRUB will display
     the menu and then wait for the timeout set by 'GRUB_TIMEOUT' to
     expire before booting the default entry.  Pressing a key interrupts
     the timeout.

Comment: That did the trick! Thank you. Also, I read that if someone presses Esc key during startup the menu will appear whatever the settings! https://wiki.ubuntu.com/Kernel/KernelBootParameters
Comment: online grub manual https://www.gnu.org/software/grub/manual/grub/grub.html


Do Heavy Ball variants work the same way in battle?

Question: The intent of the Heavy Ball, Leaden Ball, and Gigaton Ball seems to be that they have a higher catch rate than the basic balls in exchange for a much shorter throwing arc, rewarding you for sneaking up right next to a Pokémon.
But if you engage in battle first, there's no aiming involved and distance isn't a concern, you simply automatically hit the target. Do the balls' increased catch rates still apply in this case? If so, does it mean those balls are always the best option for catching alphas or if you fail to sneak up on an aggressive mon?
Answer: This part of your question is not fully accurate:

have a higher catch rate than the basic balls in exchange for a much shorter throwing arc

While Heavy Balls, Leaden Ball, and Gigaton Balls indeed cannot be thrown as far, this factor is not what provides the higher catch rate. These pokéballs provide a higher catch rate if the Pokémon has not noticed you.

[Heavy Balls] are thrown in a shorter arc and do not travel as far as the standard Poké Ball, but are highly effective when used to attempt a capture against a Pokémon that has not yet noticed the player.
Bulbapedia, emphasis my own

and

Heavy Balls are a special variety of Poké Ball that are more effective at catching Pokémon that haven't yet noticed you
legends.pokemon.com, emphasis my own

So to answer your question, using heavy balls and its upgraded versions do not provide its additional catch rate while in battle.
Comment: Do we know for sure that Heavy Balls have a better catch rate on Pokemon that haven't noticed you? The description could mean Heavy Balls are best used on unaware Pokemon because the short range makes them difficult to use otherwise.
Comment: @Stevoisiak I provided a second, and official, source with a similar statement to further support the mechanic that it provides said bonus
Answer: YES!!! They absolutely work in battle I have caught so many more alphas using the Leaden balls than great balls. Yes great balls work but not 100% usually if an alpha is being stubborn and is not being caught I will use a Leaden ball and it works first try. They definitely have an effect because the target is heavy. Feather and that class work on light Pokémon better. SO YES USE YOUR HEAVY TYPE BALLS ON ALPHAS.
Comment: Do you have a source to backup your statement "They definitely have an effect because the target is heavy"? This is how Heavy Balls worked in games previously, but not in Legends Arecus.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


sudoers for specific command

Question: I'm running Ubuntu 12.04. I want a script to be able to run "ip link blah blah...".
sudo ./myscript.sh

works as intended, but
./myscript.sh

gets me : RTNETLINK answers: Operation not permitted
I have these lines in my sodoers file:
myusername ALL = (ALL:ALL) NOPASSWD: ALL
%mygroup ALL = (ALL:ALL) NOPASSWD:/sbin/ip, /bin/ip

There are no lines following this except a timeout for the timestamp, and the default reference to /etc/sudoers.d
/etc/sudoers.d is empty except for the default README file.
NOPASSWD does not seem to be working either. I have tried moving the lines around so that the timeout and sudoers.d lines are before the ones I mostly care about, with no effect.
What have I missed?
Answer: The /etc/sudoers file only applies to sudo. That means that if you do not run programs with sudo, it will not get a chance to get elevated privileges. You must use sudo ./myscript.sh or edit the script and change something like:
ip link ...

to:
sudo ip link ...

Comment: Duh, of course. I knew it would be something simple... Thanks!

sudoers for specific command


SQLite table with integer column stores string

Question: I found something weired in my application. I created a table with a column named type which should store integers:
db.execSQL("CREATE TABLE " + CellColumns.TABLE + " ("
    + CellColumns._ID + " INTEGER PRIMARY KEY,"
    + CellColumns.TYPE + " INTEGER," // <-- this
    + CellColumns.CELL_ID + " INTEGER,"
    + CellColumns.CITY_ID + " INTEGER,"
    + CellColumns.LOAD + " INTEGER,"
    + CellColumns.ORIENTATION + " INTEGER);");

Reading:
String type = c.getString(c.getColumnIndex(CellColumns.TYPE));

But somehow I always store strings into it without any problems (seems I forgot that this column was meant for integers). Also reading the strings with a query works. Is this dynamic "type cast" of a column a feature of sqlite?
Answer: From here:

Most SQL database engines (every SQL database engine other than SQLite, as far as we know) uses static, rigid typing. With static typing, the datatype of a value is determined by its container - the particular column in which the value is stored.
SQLite uses a more general dynamic type system. In SQLite, the datatype of a value is associated with the value itself, not with its container. The dynamic type system of SQLite is backwards compatible with the more common static type systems of other database engines in the sense that SQL statement that work on statically typed databases should work the same way in SQLite. However, the dynamic typing in SQLite allows it to do things which are not possible in traditional rigidly typed databases.

So yes, this is a feature of sqlite. Read the whole page I linked, and read carefully :)
Comment: Thought I have done that, seems to be too long ago. Thank you!
Answer: you can get it via c.getInt(), c.getDouble().. etc etc
Comment: That might be so, but does not answer the question at all.


PHP cURL error: Could not resolve proxy

Question: I'm trying to send a cURL request from a Windows Server 2008 machine using PHP (version 5.3.12) and keep receiving the error Could not resolve proxy: http=127.0.0.1; Host not found. As far as I cal tell, I'm not using a proxy - CURLOPT_PROXY is not set, I've run netsh winhttp show proxy to make sure there's not a system-wide setting in place, I've even checked all the browsers on my machine to confirm none are configured to use a proxy (just in case this could possibly have an effect). I'm having trouble figuring out why cURL insists on telling me that 1) I'm using a proxy and 2) it can't connect to it.
I'm able to resolve the error by explicitly disabling the use of a proxy via curl_setopt($curl, CURLOPT_PROXY, '');, but this isn't the greatest solution - a lot of the places I use cURL are in libraries, and it'd be a pain (not to mention less than maintainable) to go around and hack this line into all of them. I'd rather find the root cause and fix it there.
If it helps, this has happened to me only with POST requests so far. Command-line cURL (from a Git bash prompt) works fine. These calls also work fine from our dev machine, so it seems to be something specific to my machine.
If I need to apply the above hack, I will, but I thought before I resorted to that I'd ask the good folks of SO - is there anywhere I'm missing that could be configuring the use of a proxy? Let me know if there's any additional helpful info I forgot to add.
Answer: cURL relies on environment variables for proxy settings.  You can set these on Windows via "Advanced System Settings".
The variables you need to set and/or change for optimum control are "http_proxy", "HTTPS_PROXY", "FTP_PROXY", "ALL_PROXY", and "NO_PROXY".
However, if you just want to avoid using a proxy at all, you can probably get away with creating the system variable http_proxy and setting it to localhost and then additionally creating the system variable NO_PROXY and setting it to *, which will tell cURL to avoid using a proxy for any connection.
In any case, be sure to restart any command windows to force recognition of the change in system environment variables.
[source - cURL Manual]

PHP cURL error: Could not resolve proxy


Go thru each CSS value in a HTMLElement, merge CSS styles

Question: I want to create a loop so I can walk thru all the CSS properties that are defined in an element. My goal is to create a function that merge the style of two elements.
Hello
World

And the JS function would look something like this:
function mergeStyle (obj,target){
    $.each(test.style.CSSStyleDeclaration,function(){ // This will not work?
       // Add to target
    })
    return;
};

Comment: what would you like to do with duplicate properties? does any of the two have a priority?
Comment: For what reason? The browser, internally, is going to separate the properties again anyway. Since there's no consistent rules for grouping properties in CSS, you'd have to merge them on a case-by-case basis every time.
Comment: Is it required only for inline styles?
Comment: Its a controlled environment so it will not happend. However for a more generic solution you maybe will have a overwrite argument that you also pass to the function
Comment: @ShankarSangoli Yes, I need only inline style.
Answer: I recommend using classes instead, since your need doesn't sound as a good design. If you still want it though, this should work:
$.fn.mergeCSS = function(other) {
  var $this  = $(this),
      $other = $(other),
      style  = $other.get(0).style;

  $.each(style, function(i, name) {
    $this.css(name, style[name]);
  });

  return this;
};

The .style property of an element contains its styles; CSSStyleDeclaration is .style's constructor which is not element-specific.
Usage:
$("
").mergeCSS("
");
//

It alters and returns the first element.
Comment: Oh that was a sweet one! Thanks!
Answer: In the most simplest form if you want to just apply the styles from a to b then you can try this.
function mergeStyle (obj,target){
    target.style.cssText = target.style.cssText + ";" + obj.style.cssText;
};
mergeStyle($('#a2')[0], $('#a1')[0]);

Working demo - http://jsfiddle.net/rDdMu/1/
Comment: One caveat is that some browsers need a literal ';' between the two cssText strings:  target.style.cssText += ';'+ obj.style.cssText; Better browsers insert a semicolon at the end of the cssText string, but the repeat doesn't hurt them.
Answer: I came up with this solution, that works for me:
function mergeStyle (obj,target){
    for(var i = 0; i<obj.style.length; i++){
        var stylename = obj.style[i];
        if(target.style[stylename]=="")
           target.style[obj.style[i]] = obj.style[stylename];
        };
    };
};


Prove $z=1+e^{\frac{2i \pi}{3}}=e^{\frac{i\pi}{3}}$

Question: I passed by a question that asks to prove the following equality in 3 different methods, I knew two of them, but I couldn't figure out the third one. If there are more than three, I would love to know as many as possible.
$z=1+e^{\frac{2i \pi}{3}}=e^{\frac{i\pi}{3}}$
The first method is switching everything into algebraic form, simplifying it and then changing it back to exponential form.
The second method is to take common and write it as follows,
$z=1+e^{\frac{2i \pi}{3}}=e^{\frac{i\pi}{3}}(2×\cos(\frac{\pi}{3})) =e^{\frac{i\pi}{3}}$
What else?
Answer: When $x=e^{\frac{i\pi}3}$, then $x^3=e^{i\pi}=-1$, and $x$ is complex number, which is not real.
So $x\ne-1$, then $0=x^3+1=(x+1)(x^2-x+1)$.
$x^2+1=x$, so $1+e^{\frac{2i\pi}3}=e^{\frac{i\pi}3}$.
Answer: Draw a picture of the complex plane with the points $0, 1, e^\frac{i\pi}3, e^\frac{2i\pi}3$ marked out.
Use Euclidean geometry to argue that they form a parallelogram.
Answer: You could use Taylor series of $1+e^{2ix}$ and $e^{ix}$ and show that they are the same when $x=\pi/3$. Hope this helps :)
Answer: If you solve the equation $1+x^2=x$, you will see that it only has two solutions: $e^{i\pi/3}$ and $e^{2\pi i/3}$.
Therefore, $1+\left(e^{\pi i/3}\right)^2=e^{\pi i/3}$; in other words, $1+e^{2\pi i/3}=e^{\pi i/3}$.
Answer: A point $ \ z \ = \ \alpha + i\beta \ \ $ is to be translated to the right by one unit, so that the modulus of $ \ z' \  = \ \alpha' + i\beta $ $ = \ (1 + \alpha) + i\beta \ \ $  is unchanged.  Thus,
$$  |z|^2 \ \ = \ \ \alpha^2 + \beta^2 \ \ = \ \ |z'|^2 \ \  = \ \ (1 + \alpha)^2 + \beta^2 \ \ \Rightarrow  \ \ 1 + 2 \alpha \ \ = \ \ 0 \ \ \Rightarrow \ \ \alpha \ \ = \ \ -\frac12 \ \ . $$
Geometrically in the Argand plane, the vectors (from the origin) $ \ z \ , \ z' \ , \ $ and $ \ 1 \ $ form the sides of an isosceles triangle symmetrical about the $ \ \mathfrak{Im}-$axis.  The vector $ \ z \ $ makes an angle $ \ \theta \ = \  \pi + \arctan \left(\frac{\beta}{-1/2} \right) \ $ to the positive $ \ \mathfrak{Re}-$axis, while $ \ z' \ $ makes an angle  $ \ \theta' \ = \ \arctan \left(\frac{\beta}{1/2} \right) \ $ to that direction.  Writing $ \ \rho \ = \ |z|  \ =  \ |z'| \ \ , \ $ we have $ \ z \ = \ \rho·e^{\ i·\theta} \ \ , \ \ z' \ = \ \rho·e^{\ i·\theta'} \ \ . $
If we now require that $ \ z \ $ have unit modulus, then
$$ \alpha^2  +  \beta^2 \ \ = \ \ \left(-\frac12 \right)^2 + \beta^2 \ \ = \ \ 1 \ \ \Rightarrow \ \ \beta^2 \ \ = \ \ \frac34 \ \ \Rightarrow \ \  \beta \ \ = \ \ \pm \frac{\sqrt3}{2} \ \ . $$
Hence, $ \ \theta \ = \  \pi + \arctan ( \ \mp \sqrt3 \ ) \ = \ \pi \mp \frac{\pi}{3} \ = \ \frac{2 \pi}{3} \ , \ \frac{4 \pi}{3} \ $ and $ \ \theta' \ = \  \arctan ( \ \pm \sqrt3 \ ) \ = \ \pm \frac{\pi}{3} \ = \ \frac{ \pi}{3} \ , \ \frac{5 \pi}{3} \ \ . $  We have then $ \ 1  \ + \  1·e^{\ i·2 \pi/3 } \ = \ 1·e^{\ i·\pi/3 }  $  and also $ \ 1  \ + \  1·e^{\ i·4 \pi/3 } \ = \ 1·e^{\ i·5\pi/3 } \ \ . $   From the aforementioned (infinite implied) family of isosceles triangles in the Argand plane, we have "selected" the two that are equilateral.
(We could also argue that the translation of $ \ z \ $ by one unit "to the right" is then equivalent to a rotation clockwise of the vector $ \ z \ $ by the angle $ \ \frac{\pi}{3} \ \ , \ $ or $ \  e^{\ i·2 \pi/3 } \ + \ 1 \ = \ e^{\ i·2 \pi/3 }·e^{\ -i·\pi/3 } \ = \ e^{\ i·\pi/3 } \ \ . ) $


Diagnosing Refridgerator Condensate Draining process

Question: SYMPTOM
Renter reports water on the floor from fridge.  It seems silly to buy a new fridge if the only issue is the condensate processing is needs correction, however, this is the second incident on the same fridge.
I inspected the fridge yesterday.  The plastic evaporator pan was full of water.  Renter indicated it had overflowed once last week.

What is the most common reason why the evaporator pan is full and overflowing?
Is there a clever method to determine why is the water not evaporating?

The freezer works fine.  The fridge occasionally freezes items (an onion, watermelon) but does work.  Does occasional freezing indicate an issue? or is this as simples dialing down the cooling setting?
Clogged Condensate Drain?
I noticed the fridge and freezer were very dirty.  I read that a clogged drain (from food or debris) in fridge/freezer compartment can lead to water overflow.  The entire fridge/freezer should be emptied and cleaned, and drain should be wiped out.  A warm solution of water and vinegar can be poured in the line.  Also can use a pipe cleaner.

If the evaporator pan is full can one conclude that the drain lines are not clogged and not the problem?
Are there any other questions that I should be answered to diagnose
root cause of problem?

If it the root cause requires a new refridgerator, that's fine, however, if it doesn't that would be preferable: not just economically,it is a PITA to replace the fridge on the second story.  I don't want to buy a new fridge if the problem is a clogged drain line or involves a simple part replacement.
Insight and experience are highly appreciated: thank you.
Answer: If the door seal is leaking or the door left open the coils ice up and when the fridge goes into the defrost cycle it can overflow the drip tray. This is one thing I have seen folks toss a good unit for when sometimes the seal just needed a good cleaning other times the seal needed to be replaced still much cheaper than a new unit.
Comment: Is there a simple test to determine if  the door seal is leaking or the door left open?
Comment: Usually looking at the seal with the door closed it should be attached at all surfaces (magnetic strip holds it). With the door open there should be no gouged sections. As far as how long the door is open a chart recorder could be added but that would probably not work in this case.
Answer: There is also often a little fan on the bottom that pulls air across the condenser and compressor (where it gets warm) and blows it across the drain pan to aid in evaporation. If there is a lot of crud / cobwebs / animal hair around it, not enough air moves. If you roll out the fridge, you can see if that has been cleaned and if not, use a wand attachment of a vacuum cleaner.
Comment: Awesome photo!  You are on the right track.  It turned out the drain pan was not properly affixed to the heat source (compressor): condensate was not evaporate and thus overflowed.  Zip tying the pan properly to compressor ensured that the condensate is evaporated.
Comment: Glad you figured it out!


Stack of Activities in Android

Question: I am noob in android. I want to know that Does android keep multiple Stack for the activities for a single application ?? If it so then for what reason it keep multiple stacks
Answer: Yes, android does keep multiple tasks stack : http://developer.android.com/guide/components/tasks-and-back-stack.html
A task is composed of many activities, sometimes from differnt programs. A task is a user task. For instance this allows you to

have a task that browse the web with a browser
have a task to write an email

you can then switch from one task to the other, for instance to copy paste a phone number from the web into an email. You will switch tasks by long-pressing the home button and get a list of all current tasks.
Comment: I have updated my question, please see - `Does android keep multiple Stack for the activities for a single application ??`
Comment: Yes it can if you precise that activities are run in different tasks.

Stack of Activities in Android


Git repository on server reverts my changes but has same log as local

Question: I have a really weird issue that I can't seem to resolve, although I've search for 4 hours now.
Basically, I have a Git repository on a server. I managed to clone that repository locally through SSH.
If I make local changes, I can push them to the server. But the server will revert my changes.
Step 1: making local changes
I add a test.php file locally. It shows up if I do git log.

Step 2: pushing my changes
I push my changes to the remote repository. There is no error.

Step 3: check the server repository
If I ssh onto the server, and do git status, it should show no local changes. However, it shows changes to be committed. These changes actually undo exactly what I just pushed.
In this case, it will delete the file I just added.

Step 4: check log on server
If I run git log, I have the exact same log as my local repository.

I really don't understand what's happening. I can push changes but they're undone as soon as they reach the server.
Any help would be greatly appreciated because this is driving me crazy, as I can't find anyone who has encountered the same issue as me.
Comment: Thanks @RomainValeri. I just checked: there's only `*.sample` files in the `.git/hooks` directory. There is no `post-receive` file at all. Also, this is brand new repository, so I haven't done anything special.
Comment: Misleading comments on my part, I read too hastily I guess, iBug is right on spot.
Answer: That's because when pushing, the server only updates its commit history and index area, without touching your working tree. This way after pushing, your working tree on the server remains at its previous state, while its branch has been updated.
It's generally recommened against pushing to the checked-out branch a non-bare repo, so perhaps pushing to another server (e.g. GitHub) and pulling from there on your server might be a better idea.
If you're sure you're doing everything right on your server, manually run git checkout -f everything something's pushed onto it, to ensure its working tree matches its index area.
Comment: Thanks, that's really helpful. I was actually looking at making my repository a bare one instead, which should help. I was also thinking of having GitHub as a second remote but not as a "through" repo to my server.
Answer: The answer iBug provided was helpful as it explained why my changes were being reverted. I tried to make a bare git repo on the server but it didn't help me since I needed the files to actually be present on the server.
Anyway, here is what I did: I made the remote repo update when changes are pushed to it.
git config receive.denyCurrentBranch updateInstead

Now, when I push to the server, it keeps the changes and updates its working tree.
I found the solution on this page.


Touchpad issue after ubuntu 18.04 upgrade

Question: Few days earlier, I have updated my Ubuntu form 17.10 to 18.04.
Everything is running perfect, except touchpad.
Touchpad is not getting disabled while typing even if I have enabled this option in the settings. Fn key shortcut to disable the touchpad is also not working.
Every time, either I have to use synclient TouchpadOff=1 command to disable the touchpad or need to change the touchpad option in settings.
Currently I am using this method as a workaround. Can anyone suggest any better approach so the it gets disabled automatically while typing.
I am using Asus R558U and here is the otput of xinput command.
guru@guru-notebook:~$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Elan Touchpad                             id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Asus Wireless Radio Control               id=7    [slave  keyboard (3)]
    ↳ Video Bus                                 id=8    [slave  keyboard (3)]
    ↳ Video Bus                                 id=9    [slave  keyboard (3)]
    ↳ Power Button                              id=10   [slave  keyboard (3)]
    ↳ Sleep Button                              id=11   [slave  keyboard (3)]
    ↳ USB2.0 VGA UVC WebCam: USB2.0 V           id=12   [slave  keyboard (3)]
    ↳ Asus WMI hotkeys                          id=14   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=15   [slave  keyboard (3)]
guru@guru-notebook:~$

Comment: Please check, when booted from an Ubuntu 18.04 LTS boot drive 'Try Ubuntu', if the touchpad works like it should. This way you can see, if the problem is 'an 18.04 LTS problem' or if it is caused by the upgrade process  (for example some old configuration, that no longer works).
Comment: See this: https://askubuntu.com/questions/1033033/elantech-touchpad-does-not-work-i2c-hid
Answer: I'm having the same issue. XIAOMI AIR 13.
Before ubuntu 18, my touchpad only had his left button click working plus two finger touchpad and the right button was disabled. After 18 update, touchpad is working and also both buttons. But, the two fingers scroll stopped working. I'm struggling to get the two fingers scroll working again.
try this: remove readd the touchpad.
sudo modprobe -r psmouse
sudo modprobe psmouse


Running Wall-Rated HDMI Cable Horizontally

Question: I'm trying to run Wall-Rated HDMI Cable both vertically and horizontally behind the drywall. Have tried using fish tape to assist but have made zero progress because of the insulation and metal studs…anyone have success doing this? (See picture: going from a hole behind the TV to the cutout on the bottom-left). I'm able to reach the hole directly below the TV just fine.
Comment: Running cables horizontally through an insulated wall is... challenging. You might have to remove a strip of drywall in order to be able to hand-fish it through, then patch up the drywall. Or, use @Armand's comment-that-should-be-an-answer.
Comment: Ah ok great suggestion, thanks!
Comment: "What color would you like to change that wall to after you cut it open, do the work, and patch the drywall?" The direct route _is_ just dealing with drywall repair.
Comment: Ok, thanks for these suggestions. Thinking baseboard removal is my best bet.
Answer: It's often easy to temporarily remove the baseboard at floor level, then run your wire straight down to the floor. Then you can run it horizontally over to the stud bay of your destination and up to your destination. Any drilling or mods to run the cable horizontally down at an inch or so above floor level will be covered up by the baseboard when you put it back on.
Another option is to drill through the floor plate at the bottom of each of the 2 stud bays and run the wire horizontally in a basement or crawl space below rather than along the baseboard area of this wall.
Comment: Thanks for your help! I think removing the baseboards is my best bet
Answer: It looks like your ceiling is open-beam.  Can you see/access the top plate of that wall?  Having run many miles of low-voltage cable in office buildings with steel-stud walls full of rock wool, I've had to go vertical to avoid cutting into drywall.  I'd come up the stud bay behind the TV, out the top plate, back into the top plate, and down the other stud bay.
Comment: Ahh ok, no unfortunately I can't access the top plate. Will have to go to the baseboard. This is a good suggestion though, will remember to check if it's exposed for future projects


MySQL Query with multiple columns but exact matches?

Question: I've got my table called Device_tbl which has the following columns:

Image
Manufacturer
Model

An example of some of my Manufacturers are:

Sony Ericsson
HTC
Motorola

An example of some of my Models are:

One X
One S
Xperia Arc
Xperia X10
Xoom

The issue I have is that I pass the combination of a Manufacturer and a Model into the query.  For example:
SELECT Image, Manufacturer, Model FROM Device_tbl WHERE Manufacturer LIKE 'Sony Ericsson Xperia Arc' OR Model LIKE 'Sony Ericsson Xperia Arc'

As you can see, this would return nothing.  What I am after is an it to return an EXACT match of only that result above, however if I searched for Son it'd return all results where Son exists in either Manufacturer or Model.
Possible solution?
If its any help, I am using the JQuery Autocomplete function to generate the full names.  These suggestions are generated from an array which combines the  Manufacturer and Model.  Not sure if there's a way to split it in the background so the search is more accurate?
<?php
mysql_select_db($database_database_connection, $database_connection);
$query = "SELECT * FROM Device_tbl";
$result=mysql_query($query, $database_connection) or die(mysql_error());
$findrow = array();
while($row = mysql_fetch_assoc($result)){
    $manufac = $row['Manufacturer'];
    $mod = $row['Model'];
    $string = $manufac.' '.$mod;
    $findrow[] = $string;
}

?>

Answer: You could use CONCAT_WS() such as
SELECT * FROM Device_tbl WHERE CONCAT_WS(' ', Manufacturer, Model) = 'Sony EricssonXperia Arc';

Comment: Oh... Perfect, didn't realise you could do that. Cheers
Answer: Can you just do it like this:
SELECT Image, Manufacturer, Model
FROM Device_tbl
WHERE Manufacturer+' '+Model LIKE 'Sony Ericsson Xperia Arc'


continuous function without an extension to an open set.

Question: What's a subset $A\subset \mathbb R$ and a continuous $f:A \to  \mathbb R$ that doesn't extend to an open $U$ containing $A$?
This question has no motivation.  It just occurred to me, and i couldn't find an example, but it seems natural enough. I feel like one probably exists, since otherwise there is a very strong extension theorem i haven't heard of.  But that's not that unlikely either.
Answer: Let $A$ be irrational numbers, then there's a function $f:A\to\mathbb{R}$ with no extension to a continuous function $f:A\cup \{q\}\to\mathbb{R}$ for any $q\in\mathbb{Q}$. In particular, we cannot extend it to a neighbourhood of $A$.
For $q\in\mathbb{Q}$ let $f_q = \begin{cases} 0 & x < q \\ 1 & x > q\end{cases}$, $f_q:A\to\mathbb{R}$, and enumerate rationals as $(q_n)_{n\geq 0}$. Then the function $f = \sum_{n\geq 0} 2^{-n}f_{q_n}$ is continuous as uniform limit of continuous functions.
But if $q\in\mathbb{Q}$ and $x_n, y_n$ are sequences of irrational numbers such that $x_n < q < y_n$ and $x_n, y_n\to q$ then $\lim_{n\to\infty} (f(y_n)-f(x_n)) = 2^{-m}$ where $q = q_m$, so $f$ doesn't have an extension to $A\cup \{q\}$.
However, note that any continuous function $f:A\to \mathbb{R}$, $A\subseteq\mathbb{R}$ extends to some continuous function $f:B\to\mathbb{R}$ for a $G_\delta$-set $B\subseteq\mathbb{R}$ (a result related to the famous Lavrentiev's theorem).
Comment: very cool construction. thank you


Accessing Angular element scope in User Script

Question: Let's assume you're writing a browser user-script (for Greasemonkey, Tampermonkey etc.) and you're customizing a web app implemented in Angular. Further, let's assume it serves you better to access its underlying data than to try and scrape it from HTML.
How do you access its Angular elements' scope to get the underlying properties?
For example:

{{ row.fullName }}

and assume you want to get row.firstName.
Answer: You can get the Angular element like this:
const myListEl = document.getElementById('my-list')
const myList = angular.element(myList);

but myList.scope() will be undefined. You can call angular.reloadWithDebugInfo() to fix it but that'll also reload the page. Instead, start your script with:
// This is actually what angular.reloadWithDebugInfo() does:
window.name = "NG_ENABLE_DEBUG_INFO!" + window.name;

and it'll make scope() return the scope for the rest of the page's lifetime, so you can get e.g. myList.scope().firstName.


Internal walls supported by rotten wood

Question: We've an old house from 1890 and are replacing rotten and wood worm eaten beams and floors.
But, whilst doing this we've found that the internal walls have been built on top of planks of wood placed on top of the foundations ... this has also rotted, but has been so compressed from the weight of the walks and the upstairs flat that they don't look like they're going anywhere!
Is there some kind of treatment I can use that may strengthen the edges of these compressed planks to strengthen what's most exposed to stop any more deterioration and crumbling away?
I'll try and include a photo as an example.
Thanks,
Tim!
small section of wood supporting walls
Comment: Do you know that the wood goes all the way across the wall? My first thought was that it might be a sort of furring strip that's been embedded for nailing other stuff to it. That said, they sell wood consolidation epoxies, but I have no firsthand experience to share.
Comment: Hi Aloysius, yes they go all the way through. They sit below floorboard level resting on the foundations.
Answer: My guess about these planks are that a builder made outer walls (that are carrying the loads) first, as well as interior support walls (if any present) and then laid a wooden floor. Just then, he(she?) managed to place internal walls that were not for supportive matters (dividing into rooms) on this floor. Years passed, loads made under-wall-planks to go deeper, while floor lasted on the same level. (all that I said was assuming that builder knew better; I'm afraid that past-technologies and construction commons were less sophisticated)
No matter what was the reason, it will be nice to do something about that. Leaving this as it is may or may not cause any problems in a near future, but making a reconstruction with that good access is tempting to solve this now.
Aloysius Defenestrate put an advice in his comment about wood consolidation epoxies. It may work, though I would hesitate to use it if the plank can be accessed to water/is totally rotten. Still, given a proper support from epoxy producer, it can be worthwhile.
Another way of 'replacing' that plank (or what is left of it) is putting concrete instead of it. It is something done in monuments or to make a less-harming change within older buildings' structure. You can replace the plank with concrete partially, say - by 20cm of plank per 1m of a wall. The wall will lose some of it's support (for a short time), but I guess it will handle that at ease. After some 1-2 weeks make another 20cm replace and so on. It's best if done by a specialist and I would advise consulting these distances (20cm replace per 1m of a wall), but I think that it will make this repair more solid.

Internal walls supported by rotten wood


Is this line voltage thermostat sufficient?

Question: I'm replacing a bad Aube line voltage thermostat for my electric baseboard heaters. I liked the model, so I purchased what I thought was the same one - however I missed a letter in the model. What I bought was a TH115-A-240D, while what I had originally was a TH115-A-240S. It looks like the difference is that the TH115-A-240S was rated for 4000 watts, while the TH115-A-240D is only rated for 3600. As far as I can tell, however, the new one is still sufficient. I'm just hoping someone can double check me.
There are 2 baseboard heaters, wired in parallel, on a 20-amp 240 volt circuit. The wiring is #12. Each baseboard is 72 inches. Unfortunately I can't find any manufacturer's information anywhere on them (I believe it's all painted over.) Everything that I can find indicates that a 72-inch electric baseboard heater will consume 1500 watts, meaning that the total 3000 needed by 2 is well within the thermostat's specs. Is there any caveat I might be missing, or should I be safe?
Comment: Manual [here](https://customer.honeywell.com/resources/Techlit/TechLitDocuments/69-0000s/69-2617EFS.pdf).
Answer: Six-foot baseboard heaters are sold in varying voltage and wattages. You can buy a 1250 watt, 1500 or even 2-3000 watt heaters in the six foot lengths. So, I would not assume anything about your old heaters. On a 20-amp circuit, you can have a maximum of  3850  watts. So, you might be within that limit, you might not. There's my caveat. So if you're installing exactly what you had, you could be "safe".
See this chart https://king-electric.com/pro-tips/sizing-the-heater-circuit/
Answer: Simple multimeter, ohmmeter can help you. Resistance of  heater don't change too much over temperature. Simple calculation for power U^2/R. Or current consumption  can be measured with current clamps. Every electrician has that kind of tool. Overload may cause thermostat contact degradation and it will be damageded over some time.


will running ubuntu from a live usb key affect my windows 10 installation in any way?

Question: I have made a live installation of ubuntu to a usb key using the provided usb universal installer and selected an amount of persistant hard drive space on the key. What I want to know is, will booting from and using the usb key ubuntu OS in anyway way, shape or form touch, affect, write to or modify my internal hard drive with windows 10 sitting on it?
Thanks in advance?
Comment: @DavidFoerster The OP seems to be asking if running the LiveCD causes any unexpected modifications to Windows partitions whereas the other question is asking whether intentional changes to the Windows partition are persistent.
Answer: If you're purely using the persistent storage on the USB key there will be no adverse effects to your windows system, it's completely separate, and you're only using resources such as the CPU and memory from the machine, not the HDD with the Windows OS installed.
However if you mount the HDD which contains Windows, and make any changes to the filesystem, this can affect the files on that disk, including files which are necessary for Windows to operate.
If you don't play around with anything on the internal HDD, you will be fine.


What´s the length of the segment AC in the triangle below?

Question: For reference: In the triangle $\angle A$ is right and $D$ is a point on the side $AC$ such that the segments $BD$ and $DC$ have length equal to $1 m$. Let $F$ be the point on the side $BC$ so that $AF$ is perpendicular to $BC$. If the segment $FC$ measures $1m$, determine the length of $AC$.(Answer$:\sqrt[3]{2})$

My progress:
$ AF = h\\
a=m+1\\
h^2 =m.FC = m.1 = m\\
\triangle AFC: AC^2 =b= h^2+FC^2 \implies b = \sqrt{m+1}\\
\triangle ABC: a^2 = b^2+ c^2 \implies (m+1)^2=c^2+(\sqrt{m+1})^2\\
\therefore c = \sqrt{m^2+m}\\
\triangle BAD: BD^2=AD^2+c^2\implies 1 = (\sqrt{m+1}-1)^2+m^2+m\\
\therefore: m^2+2m-2\sqrt{m+1}+1=0$
...????
Answer: Following on from $m^2+2m-2\sqrt{m+1}+1=0$, you already have $b=\sqrt{m+1}$, so substitute this in to get $b^4-2b=0 \implies b=\sqrt[3]2$.
Comment: thanks for help
Comment: no problem! @petaarantes
Answer: $\triangle ABF\sim \triangle AFC$
We have:
$$\frac {c+m}{c+AD}=\frac {c+AD}{c}$$
So:
$$(c+AD)^2=c^2+cm\Rightarrow AD=\sqrt{c^2+mc}-c$$
Therefore:
$$AC=c+AD=\sqrt{c^2+mc}$$
Comment: thanks for help
Answer: Let $E$ middle of $BC$. Then triangles DEC, AFC and BAC are similar. Then $$\frac{CD}{EC}=\frac{AC}{FC}=\frac{BC}{AC}=k$$
$$EC=\frac{CD}{k}=\frac{1}{k}, AC=k FC=k, BC=k AC=k^2$$
$$BC=2 EC \Rightarrow k^2 = \frac{2}{k} \Rightarrow k=\sqrt[3]{2}$$
$$AC=k=\sqrt[3]{2}$$
Comment: Very good ..thanks


Building an application with Schema-less database as embedded (no-server database)

Question: The need:
I am building a .NET application that reads large XML files and write them to a database.
The app is mainly an MVC 4 viewer for the data; sorting and searching.
For the development part I am using MySql with a DAL abstract layer.
The data suppose to grow in 1GB per day.
I am looking for a no-server solution (like sqlite) that can handle this amount of data.
There is no need of any security (db user management) on the database file.
Why Embeded

I dont want to maintain another PORT (i know its not really a need, but I prefer that way).
I want to have a very lightweight installation process. (copy to IIS folder and start to work, only dlls, no server).

I am looking for something that is well known in the .NET environment and is free for commercial use. (why free? because we dont have investment yet. we might switch to a commercial license once the product profit)
Thanks
Answer: Schema less, .NET and embedded?
Try Raven DB: http://ravendb.net/docs/server/deployment/embedded
You can start with the free version and considering adding paid enterprise features as needed.
Comment: There is no question about the fact that raven db is one of the bests there is. but I contact support and I need to pay 1500$ yearly. they dont offer free license unless your product is free and open source. thanks


pass value to button for jquery dialog

Question: I have multiple buttons that gets created in a table which all look like this:
<button class="editbutton">Edit</button>

In this table the button will have a type associated with it, either APPLE or ORANGE.
What I want to do is pass in this type into my javascript to open up a jquery dialog.  I could do something like this:
<button class="editbutton" onclick="edit('<?php echo $result[$i]["type"]; ?>');" >Edit</button>

Then do the processing in the edit function now that I have the type.  But the way my code is structured I'm looking for a way to pass in the type without creating a function (just because the way I've structured the code).  So I need to know when the button clicked if it is the APPLE or ORANGE so I can open up a specific jquery dialog.
Hopefully it is clear what I'm looking for.
Answer: Attach a click listener to your button - http://jsfiddle.net/XPQ5Y/
<button class="editbutton" data-type="apple">Edit</button>

$(".editbutton").on("click", function() {
    var type = $(this).attr("data-type");

    // do your stuff here
});

Comment: @ZoltanToth: you can even go further with Jquery's data() syntax: var type = $(this).data('type');

pass value to button for jquery dialog


What could be causing the washing machine waste pipe to overflow?

Question: I'm the opposite of knowledgeable when it comes to plumbing however I have done a fair amount of searching through forums to find an answer to my problem and unfortunately still have questions.
To make it easier, I have taken a picture of the pipes as well as the actual waste hose behind my machine.
The hose from the machine sits in what I believe is called the standpipe on the left and goes approximately half a foot down.

I have taken apart the p bend (or u bend - still don't know the difference) and confirmed that there is no blockage.
I have run a snake down and around all the pipes with no issues and also used some soda crystals just incase but water flows through the pipes easily.
What I believe is the issue is that the output from the machine is producing water faster than it can travel through the pipes which are 40mm in diameter.
I believe that if I removed the p bend and just replaced it with a 90° corner, it would work fine but obviously it's there for a reason and particularly with the pipes only a 6 feet from the drain, I'm very reluctant to do that.
One more thing to point out is that on the right hand side, there is a pipe which I have capped off. I was wondering if that trapped air could be preventing the water flowing down as quickly and if I need to find some kind of air valve which may allow air out?
As it stands, I have just put the waste hose into the sink next to the machine and that has let me at least use it for now.
Comment: With the pipe in the sink, does the sink partially fill and then drain slowly when the washer drains, or does the water flow freely out of the sink?
Answer: The first thing to do, is to figure out how this drain is vented. If you've got a big slug of water from the washer moving through the pipe, you've got to equalize the pressure in front of and behind the water. So you'll want to make sure the drain is properly vented.
Next, I'd probably remove all that extra plumbing.  With three 90° bends like that, you're making it more difficult for the water to move through the pipes.
Cut out the extra plumbing, and connect the trap assembly directly to the trap arm. Cut the plumbing at the orange line in the image below, then connect the trap and standpipe to the newly cut pipe. This eliminates all the extra bends, and should allow the water to drain better.

I'd also install a shallower P-trap. The shallower trap will hold less water, and allow better flow. As it's currently plumbed, you've got probably about 4-5" of water sitting in the trap.

Lastly, you may be able to make the standpipe longer. Check your local codes for the maximum length, as some say maximum 30", while others allow up to 42" pipes. (the standpipe is the vertical pipe coming up out of the trap). A longer standpipe obviously holds more water before overflowing, so it can provide a bit of extra time for the water to drain.
Comment: Thank you so much for the quick response - I will try the shallower p trap as soon as i get home tonight.

with regards to venting, I cannot see anywhere that air could be escaping at the moment since after this section, the pipe goes into the wall and straight out the other side into the drain outside.

Cutting the pipe sounds like something I should get a plumber in to do although I'm sure I could get through it with a hack saw if you think it would be ok?
Comment: @TheBag Could you include a photo of where this drain connects to the drain outside?  If you're not comfortable making changes to the drain yourself, calling in a professional is always an option.  You surely could cut the pipe with a hacksaw, just make sure you cut nice and straight.  However, you'll have to attach the trap to the cut pipe, which will require either "gluing", or a slip fitting. Make sure you know how to attach the new trap, before you cut anything.
Comment: Where the pipe disappears into the wall on the left is the last time you see it before the water is flowing into the outside drain. I can take a picture of the outside drain when I get home tonight if you want?

My local hardware store doesn't seem to have a p trade the same depth is the picture you posted but I have found one a little shallower still. It looks like it will hold around 1 inch less water. Do you think that would be ok?
Comment: Sure. The trap has to hold at least 3" of water, but you don't want it to hold much more than that. This is especially true for washer standpipes, since you're dealing with large rushes of water.  Where this drain empties into the outside drain, is the end of this pipe open to the air?
Comment: It comes out underground which I can see through a metal grill on the side of the house so I guess the answer is yes, it is open to the air.
Comment: If the pipe empties to open air within 3 1/2' or so, there shouldn't be a venting problem.
Comment: great - one thing i just thought of is that I will likely eventually get a dish washer to attach to the currently capped off pipe. If I cut the pipe I'm guessing I can just fit a different part like a y split for the dish washer?

Thanks again for all of your help!
Answer: I suspect that capped off pipe to the right used to be the vent.  Take off that cap and extend it up a few feet and see how it drains.  The vent should go to the outside of the building.  Unless there's another vent behind the wall to the left that we're not seeing.
Answer: What is the size of the copper pipe the white plastic pipe attaches to. It should be at least 1-1/2" but looks smaller. I do however, prefer to pipe a washer drain in 2" pipe to be able to handle the washing machine's drain water since the water is pumped out of the washer.


SAS macro changing variable type

Question: I am building macro whitch generates empty table by my own structure from other table. How to change variable type?
example from my code:
<code>`%let vname = %sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,varName))));
%let vtype = %sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,varType))));
%let vformat = %sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,varFormat))));

%if &vtype = C %then %do;
    &vname=putc(&vname,&vformat);
%end;`
</code>
And it's not working... Any other ideas how to change var type?
Answer: You should be clear whether you just need empty table with some columns in a changed data type (definition) or you'd also like to actually convert the data content/values. First case should be much easier.
Because currently in
<code>&vname=putc(&vname,&vformat);
</code>
you're trying to convert the data values, not the definition. The definition of variable is not changed and in data step actually can't be changed.
You can't create a "new" variable when there's still the original variable present inside your data step with same name.
In data step, you'd need to define new variables with different names inside data step and use RENAME (new to to original names) and DROP (original names) options on output dataset to end up with same name in output dataset (I can clarify if needed).
For just defining the empty table, PROC SQL could be easier, you need to create a code like:
<code>proc sql;
create table lib.table (
orig_var1 type format informat label
, orig_var2 NEWTYPE format informat label
, ...
);
quit;
</code>
which can be built from dictionary.columns. This is also easier to keep original order of variables (not so easy in data step).
You just need to take care to define appropriate length for character variables based on the length of the format used if you'd like to store formatted value of numeric variable in new character variable.

SAS macro changing variable type


How do I change the "Last-Modified" time format from the curl-head standard output?

Question: The following command can get the modification time of the remote file, how to modify the output time format?
# curl -sI https://sgp-ping.vultr.com/vultr.com.100MB.bin | grep Last-Modified | cut -c16-
Mon, 29 Apr 2019 20:22:54 GMT

I want to convert to Y-m-d H:i:s time format. any help is much appreciated.
Answer: pipe it to date command and use its formatting controls to format as you expect like:
... |date -f- '+%Y-%m-%d %T'

see more formatting controls in man date


Rails - How to render an image if a field is populated?

Question: In my application a user can say they have completed a piece of homework.
A field "completed_on" is populated with the date the homework was completed. If not completed the field is blank.
I would like to show a tick if the homework is completed or an x if the homework is not completed.
The column "completed_on" is located in a table called homework_students.
class Homework < ActiveRecord::Base
    has_many :homework_students, :class_name => 'HomeworkStudent'

class HomeworkStudent < ActiveRecord::Base
    belongs_to :homework, :class_name => 'Homework'

I have tried the following which does not work for me:
In my model:
def getCompletion
      homework_students.where("completed_on is not null")
end

View:
<% if homework.getCompletion %><%= image_tag "fi-check.svg", class: "homework_student_complete" %><% else %><%= image_tag "fi-x.svg", class: "homework_student_complete" %><% end %>

I also tried this:
Model
def completed?
    !homework.homework_student.completed_on.blank?
end

View
<% if homework.completed? %>
<%= image_tag "fi-check.svg", class: "homework_student_complete" %><% else %><%= image_tag "fi-x.svg", class: "homework_student_complete" %><% end %>

Appreciate any guidance.
UPDATE
This works:
def completed?
      homework_students.where("completed_on is not null").length == 0
    end

<% @homeworks.each do |homework| %>
...
 <% if homework.completed? %>
  <%= image_tag "fi-check.svg", class: "homework_student_complete" %>
<% else %>
  <%= image_tag "fi-x.svg", class: "homework_student_complete" %>
<% end %>
...
<% end %>

Comment: That `image_tag` section should only render if the `if` condition evaluates as true. Maybe put in `<%= homework.completed? %>` as a diagnostic.
Answer: The return type of your getCompletion method is an ActiveRecord::Relation. You are then asking if this relation exists by placing this inside a conditional. This will always be true, even if the relation contains an empty data set (e.g. []), because an empty Array is truthy.
You should be expecting getCompletion to return a collection of HomeworkStudent records. If you are wanting to show a tick, or an 'x' only if all students have completed the homework, then you need an aggregate method to check something about all of the records (if there are any, or none, etc). Try do something like:
# app/models/homework.rb

def completed?
  homework_students.where("completed_on is null").none?
end

# in the view

<% if homework.completed? %>
  <%= image_tag "fi-check.svg", class: "homework_student_complete" %>
<% else %>
  <%= image_tag "fi-x.svg", class: "homework_student_complete" %>
<% end %>

More information on ActiveRecord::Relation methods at http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-none-3F
Comment: @Co2 Use of `none?` method addressed by Ben seems more elegant ;-)
Answer: The result of your query can be an ActiveRecord::Relation or an empty array and on both cases the if statement evaluates to true. Try changing your query to:
def completion
      homework_students.where("completed_on is null").length == 0
end

Answer: your method get_completion is not returning anything. Try this
@homework_student = homework_students.where("completed_on is not null")
return @homework_student

may be it works. Also make sure that the completed_on is not null works correctly.
Comment: In Ruby, the last statement in a method is returned automatically. You basically took @Co2's code and made it do the same thing, but with more verbose code. And even if you were correct in the idea, there is no reason to store the value in an instance method like that.
Comment: ya, right. Sorry mate. Well, the above answers should already help out a bit. ..no time, sorry.