Is there a way for the contract to test what cluster (mainnet, devnet, testnet) it is on?

Question: In my project, I have some code that is unable to run on testnet, so I want to just pass sample data there.  I'm wondering if it's possible to detect the environment so that I do not have to run different contracts for each environment.
Comment: are you trying to deploy a program in some other cluster than before? `solana config set --url localhost` (can substitute localhost for devnet etc), and `solana config get` returns your RPC url
Answer: You might be able to pre-load an account with configuration data on each of the clusters which just has the name of the cluster in the account data field.  Then your program can check that address to make a decision about how to proceed.
When you run your program, you'll still need to include the address of that "config"/"environment" account with each instruction so your program can read from it. As long as you use the same address on all clusters I think it would work.
From a security standpoint, your program obviously shouldn't assume whatever address it receives as configuration/environment is trustworthy.
For a simpler solution, you could also consider just sending in the behaviour you want as part of the instruction call.
Comment: That's pretty clever.  I'll probably end up just doing it the slow, manual way to avoid the potential security risk, but this is probably the best way
Comment: Thanks @web3man. If you think it might speed up your workflow I think the on-chain program can just compare the passed-in "config" address with the _expected_ "config" address (like hard-code it in the program). If they match, the program should be able to trust the data it finds there assuming you control the private key. Bonus: if they don't match, the program can refuse to do the "wrong" thing for the environment and just error out.


How to make lights flash like in stranger things

Question: So i have this scene where there's a lot of on tube lights and i wanna dim some of them and turn them back on (replicating the flashing effect in stranger things) so does anyone have an app that can do that? Do make sure to tell me how to do it in said app please.
Comment: Can you find a clip of what you are talking about, and add it into your question. If you can, also add a clip of your footage.  When you say tube, do you mean fluorescent lights? Or tube like a metro station? Also add what platform you're working on, what software you have access too, etc.
Answer: This is the kind of thing they use these days -

It looks like a 'neon' or fluorescent tube, but it's actually LED driven. They can be remotely controlled or programmed into virtually any pattern, any colour. They drive from a phone/pad app or over DMX.
In the old days, they'd have to use actual fluorescent tubes, individually switched, some with intentionally bad starters to make them flicker. They were horrible to work with because they weren't really very controllable, so it's LED all the way now.
Downside: They're damned expensive - $£€ 650 each - but you can rent them.
Example - https://astera-led.com/products/titan/
& watch the video to really see what they can do -


No access to files in iis7 mvc app - server 2008 r2

Question: I've just installed windows server 2008 r2 along with visual studio and dropbox. I'm using it as a VM for development and dropbox helps me keep my files in sync with other machines.
I've got my site set up in IIS but I'm getting an access denied error when trying to view the site. I've had this before and to get around it in the past I've gone through and added the IIS_User account to the list of permissions to read/modify the files. I assume because the file's have been copied down with drop box the files don't have the necessary permissions. Here's the bugger, I can't batch update the files by modifying permissions on a folder, I'm having to do it right to the file level and even worse, one at a time! I can't have this.
I'm relatively new to 2008 r2 and IIS 7 so I have no idea what's happening here. Can someone explain what is going on and if there's an IIS/file permission setting I can update to resolve it at the top level folder?
I've tried adding anonymous permssions on the website in IIS and I've added permissions on the folder for IIS_User (even Everyone). I have an Administrator account and that's already set to allow me to read/write/modify the files.
This is typically the message I'm getting 'An error occurred loading a configuration file: Access to the path X is denied'.
This is happening on ascx & aspx files as well as config files.
Edits:
The site is visible when debugging from Visual Studio.
The site is operating in Full Trust (internal)
Please help, this is stopping me from working and driving me insane!
Answer: By default in IIS 7, websites run as the local system's network account (NetworkService), not as IIS_User.
To verify, in IIS Manager, select the Site in question, click Basic Settings... and check the Application Pool it is assigned to.  Then go into Application Pools and check the Identity for that Application Pool.  Make sure that user listed is in the ACL.
Adding Everyone to the ACL should work instead, but just in case I would suggest you check the above.  Also of course make sure when you set the ACL to check the box for resetting inheritance on all subfolders, if that is appropriate for your application.
You could also try setting the identity of the application pool to a local (or domain) user you have created which has access to your application directory.
Hope that helps.
Comment: What's the ACL - sorry told you I was a noob :)
Comment: I've set up a new AppPool for my website which has the Identity set to  ApplicationPoolIdentity - not sure what to do from here. :s
Comment: I've just added my username/password as a local user on the app pool and that has done the job. It's got me working at least but I wouldn't mind understanding if there is something more 'global' I can use in the future. Would setting it to NetworkService work? Why doesn't ApplicationPoolIdentity work? How do you reset the inheritence on the ACL - which I now know is Access Control List.
Answer: Regarding whether other identities would work for your app pool, that depends entirely on whether those identities have permissions to all the files and/or databases and other resources you application needs to access.  Right now you have the application running under your user account, which is generally not recommended.  IIS has your password cached, and if you change it, your application will stop working until you update the application pool configuration.
As far as setting NTFS permissions, it can get tricky.  Once you have disabled permissions inheritance, that file or folder will need to be updated individually every time you need a permission change.  The flip side of this is that you cannot remove inherited entries on an ACL, you can only add to them.  However you can design a strategy that offers a baseline level of permission at the root of a file structure, and then add permissions to subfolders/files.
In order to check & reset inheritance on a folder, go into its properties, security tab, click advanced, then click Edit.  You can see whether this folder inherits permissions from its parent, and optionally wipe out all subfolder/file permissions and enable inheritance on all child folders & files.
Hope this helps.


Some successful Paypal transactions are showing "Pending (incomplete transaction)"

Question: Some of my event transactions are showing "Pending (incomplete transaction)" when they have been successfully processed through Paypal. Not all of them just two since my event went live. I'm on Joomla! 3.6.5 and CiviCRM 4.7.16
Answer: We had trouble with this, it could be related to your IPN listener in paypal, (Log on to paypal, go to profile, my selling prefs, Instant payment notifications to check out what's going on - if it looks fine, send paypal a message)
Or you should certainly double check that you've got the correct paypal account details saved within the Payment Processor in Civi.
We had loads of trouble figuring out why our payments were not completing, and in the end it boiled down to which paypal email address was being referenced in the payment processor - the default email on paypal had been changed.
Comment: Thanks! I didn't have the IPN enabled, so I enabled it and added our URL and other pertinent information. The weird this is, some transactions were processing with it off. So, I'll see how it works going forward.
Comment: Has it helped at all? Paypal should be able to look in to it too - I think I contacted them through their developer site to to this.
Comment: So far, I think its working because I have not any issues since the first few. I'll contact Paypal if it happens again. Thanks!


What Magento Event fires on 'Reorder'?

Question: What event fires when the user clicks 'Reorder'? We are making an observer module that will execute after the user clicks 'Reorder' - we want to remove deprecated products from the order and replace them with current products.

The events I've tried are below and they don't fire when the user clicks reorder:

sales_order_place_before
adminhtml_customer_orders_add_action_renderer

PS: An alternative solution would be an observer that watches 'Cart Summary' page and lists what products are in the cart. Maybe you know of the event name for this event?
Answer: Try to catch following event

controller_action_predispatch_sales_order_reorder
Answer: I think event will be adminhtml_customer_orders_add_action_renderer

What Magento Event fires on 'Reorder'?


Will the Androids in Universe 7 be disqualified?

Question: Hey I was wondering if Androids 17 & 18 will get Universe 7 disqualified because they are not only modified humans but weapons all together. Since Frost was a modified being, he almost got disqualified in the Universe 6 Tournament Arc. 17 & 18 are made to be weapons! They could be erased, killed or replaced. Thoughts?
Comment: First off, by 19 don't you mean 17? 19 was the clown like Android that Vegeta destroyed. also At the start of the Majin Saga if i recall right Krillin said (responding to Goku how Krillin and 18 could have a baby) that 18 and 17 were originally human and they just had their Android Parts removed (they were more Cyborgs than Androids)
Comment: wasnt frost disqualified because he used a weapon/gadget when that was forbidden? Aside from that androids usually count as beings in dbz
Comment: Frost case was different because in episode 91 it was shown that frost's needles were not part of his body and were weapons. But in the androids case, all of it is part of its body. Therefore they won,t be disqualified.
Answer: First your question is wrong as it should be C17, C18 and not C19. The comments answer your question well, but still I will answer. According to Dragon Ball wiki:

Androids (人造人間, Jinzōningen; lit. "Artificial Human") are robotic/cyborg humans, most of which were created by the evil scientist Dr. Gero. Most of the androids are said to have unlimited energy and eternal life .

To be more specific, both 17 and 18 were human-based cyborgs, not purely artificial constructs like 16 and 19 were. In the original Japanese version of the manga and anime, they are referred to as "jinzou-ningen", or "artificial person", which is a catch-all term for cyborgs and androids alike. In English dub it got lost and all 4 got named as Androids.
So Androids in DBZ are actually better characterized as cyborgs, which are human beings enhanced with bio organic components to increase their strength and such. So technically, They are still human, just mechanically enhanced with bio organic components, so technically not weapons, thus giving them the ability to have children. I believe their alternative name in the manga is "C 17/18" meaning "Cyborg 17/18."

As we know Android 18 has a baby with Kuririn which proves she is partial human (humanoid).
Another interesting fact is that Android 17 also has a family of his own and has one kid and two adopted kids.
In an interview:

Interviewer: Where'd Artificial Human No. 17 go after the Cell arc, and what did he do?
Akira Toriyama: He works in the wildlife preserve area of a gigantic royal nature park, as an outstanding guard who doesn't hold back against poachers.
It's an ideal job for No. 17, who loves to be on his own and isn't big on cooperating with others; since he's so good at his job, he takes in a high salary. He's married to a zoologist; they have one child and two adopted children, and live happily in an isolated house inside the nature park.

He went and met No. 18 and Kuririn one time, but didn't talk about what he'd been up to, maybe because he considers such a wholesome lifestyle embarrassing.
Coming to the Frost scenario.
Frost was disqualified because he used a weapon (poisonous nail) which wasn't part of his body.
For Androids, it's just their natural body.
By the way Androids usually count as beings in DBZ.
Also, Mosco The God of Destruction of Universe 3 looks like a robot or android.

Watch the episode on 28/5/17. Everything must be clear now as Universe 3 are getting robots to enter the Tournament Of Power.
Mortals: All beings who don't have a godly status (divine) are mortals.
Furthermore there are 2 type of divine beings:

Born Naturally Divine: e.g. Supreme Kais, Angels, Zen-Oh, etc.
Mortals Turned Divine: e.g. God Of Destructions, Gods of other realms and sections where god is a position granted by capability not birth right.

For example:

Even Dende isn't a mortal, he is a God (Guardian Of Earth).
Don't confuse this with Godly-ki Or God-ki. Both are different, even mortals like Goku and Vegeta can have Godly-ki through training with Whis or SSG ritual.
OR
If Goku becomes a God Of Destruction and Beerus steps down then Goku would be a god and Beerus would again turn to a mortal.

This is from Dragon Ball wika:

The Gods of Destruction (破壊神, Hakaishin; Literal meaning "Destruction God"), also known as Destroyers, are beings who destroy planets, as opposed to the Supreme Kais, the Gods of Creation, who create and fill planets with life, in order to maintain the balance of the universe. Along with the Kais, they rule and oversee the formerly eighteen, currently twelve universes, with each universe having its own destroyer. Unlike the Angels and the Supreme Kais, whom they work alongside and with, and who are all are both and each members of their own species, both being naturally divine, the Gods of Destruction vary widely in species, with none sharing theirs, except for Beerus and Champa, who are twins, and are mortal-turned-divine individuals from naturally mortal species.
Comment: Yes its true that a god of destruction is a robot or robot-like but this is a tournament between MORTALS of all the universes not angels or gods of destruction. and like you said they have eternal life,so this stops them from being mortal. the ruels of the tournament of power are; no flying losers, by ring-outs, and no weapons. They were made and altered for the sole purpose of killing goku. they werent made to fight fair they were made to put goku at a disadvantage. they are not naturally occurring beings and this means they are not mortal. their very cells have been modified as weapons.
Comment: Did you watch today's episode everything must be clear now as universe 3 is having robots enter the tournament of Power


What's the best approach to adopting 1.d4?

Question: As a long time 1.e4 player and short time 1.c4 player, I'd like to add 1.d4 but there are so many defenses.    I am considering the London system against things, while adding mainlines vs. all the various openings one by one.  Or is the Catalan a better start?
Comment: A major difference between 1.e4 and 1.d4 is that against 1.e4 you can treat the various defences all individually, but with 1.d4 they're all interconnected as black can often switch around early move orders easily. So it's not easy to add mainlines one by one.
Comment: I casually play 1. d4 online as well, being a 1. e4 player since forever, and I think the London system is decent. This also aligns well with my black defenses (Slav, Scandinavian) where the pawn structure and piece placement is very similar for black. The main thing to worry about I feel is an early ...c5 by black, followed by e.g. Qb6 to pressure b2 and d4. Against all other lines, natural developing moves (even without knowing theory) should lead to pretty balanced positions.
Answer: If you want to start playing 1.d4 you should as first thing have a look at some theory about the Queen's gambit declined, as it is the most natural (and historical) way to play 1.d4: even if you will not end up adopting it in your repertoire, it will give you a taste of the major ideas behind the queen's pawn opening (minority attack usually against c5-c6, occupation of c-d files) and a sense of where the pieces belong.
After you do so you should start preparing for precise defences to play against (as in every opening although White has the first move, the order strongly depends on what Black plays next): in this respect you might have a look at any online database to find what is played most - but to spare the time, among all the most often played are:

Slav defence
semi-Slav
Indian defences (at least King's Indian and Grünfeld)

Or is the Catalan a better start?

I myself do play the Catalan (when given the chance to do so) and therefore by all means I suggest you to look into it: it is however a heavy theoretical opening (from both sides) but it does provide White with a slight edge throughout the whole game (at best play).

I am considering the London system against things

The London system is somehow more "natural" to play and it is lately gaining a lot of respect at high level (Carlsen and Aronian above all play it very often): you may find quite a few GM games to take examples from.
In general, as any other opening in chess, you cannot have your way around without putting some study into a few specific lines; however, there is a lot of free content online that you may surf, especially the Saint Louis Chess Club channel contains a lot of opening videos suitable for any level (according to me very thorough).
Answer: As you are probably aware of, d4 is a totally different territory. In one word, the amount of possible replies is lower and there are also fewer move-by-move trickery, but d4 is much more prone to transpositions, which makes it so interesting from my point of view. You'll have to know them. Some lines of the KID, Grünfeld or Benko are also very sharp of course, so be prepared.
You should obviously start with the Queen's gambit and build a repertoire for the main lines.
If you have been a c4 player already, I advise you to play the Reti, which will teach you power of transposition btw. As I've explained in another post, you can dodge sharp positions with it.
There are too much to say, so I'll advise you to see the 15 videos that Christof Sielecki did (aka Chessexplained) on d4 repertoire for White. These are excellent, and will introduce you to the main d4 openings and ideas. Here is the introduction video to d4 repertoire for White.
Comment: *" In one word, the amount of possible replies is lower and there are also fewer move-by-move trickery"* this is clearly wrong.
Comment: This statement - which might be sweeping - does not change anything to rest of my post. I can remove it if it bothers you that much.
Comment: I am not criticising your post, which I believe is correct; I only wanted to emphasise that such a statement can give the wrong impression to someone who wants to approach a new territory.
Comment: Sure, I understand your point of view :)
Answer: I recently switched from 1 e4 to d4 by following the repertoire book A Strategic Chess Opening Repertoire for White by John Watson. It recommends 1 d4, 2 c4, 3 Nc3 against everything, so the first three moves are easy ;-)
After a while, I experienced some pitfalls and I started playing other variations as well. For example, I don't particularly like his line against the Grünfeld (exchange, Bg5, Rc1). In fact, the antidote is mentioned in one of the sidelines as an interesting idea by Svidler.
So I'm not saying all of his choices are ideal, but this book will get you started. Also, it saves a lot of time, since you'll don't want to play the other stuff anymore (1 e4, 1 Nf3, 1 c4) :-)
Answer: I've personally been stuck on the same problem when I tried to learn d4 seriously. There are many solid systems for Black, with many reasonable looking moves on both sides, and move order or transposition problems. IMO, playing opening preparation is one of the best way to memorize it, so it's frustrating when the opponent plays a valid but totally different system.
My solution for that has been to learn d4 openings from the earliest, solid enough deviations up to the longest analysed variations. I started a month ago so I haven't progressed much, but up until now I've learned a lot about BDG (Blackmar-Diemer Gambit), and I'm starting to learn about Stonewall Attack, Richter-Veresov Attack and Colle System.
The point is that this way, I can steer the game into an opening I've prepared early on, which gives me more opportunities to gain experience in it while avoiding famous Black systems. In particular, BDG covers 1... d5, and Stonewall Attack covers basically everything else. Once I've gained enough experiences with these openings, I'll move on to others that go a few plys further, and so on, eventually covering the big openings.
The problem with that approach is that it's very slow, and commits me to learn openings that didn't really interest me in the first place, even though the openings themselves are nice to play. If you want to quickly learn a famous opening, the best is probably to buy a book talking about it, study the proposed lines and positions, and then play it online while adapting to other systems Black may choose.
If you'll excuse the self-promoting, I have started a Lichess study following the method I've described, which I update every few days with new variations from books, games (including my own), and mostly computer analysis. It's very empty right now though, with only a lot of material on the BDG, but you could also start a study of your own and fill it with what you've learned through games or exploring variations.
Answer: You could also consider the Queen's Gambit ("QGD") in addition to the Catalan.
One major difference with 1. d4 is that the pawn in question is supported by the White queen, whereas with 1. e4 the pawn is not supported. So you need to study how to adjust to that at the start of play.
Also, I have heard it said that 1. d4 tends to lead to more closed positions, although I don't know enough theory to explain why, or even if that is true overall. But it is also something to look into if you are considering adding 1. d4 to your repertoire. I do know from a bit of experience that many players from the black side are lulled into thinking 1. d4 is safer, but there are plenty of examples, including the QGD and the Catalan, where White can launch devastating attacks that come seemingly out of nowhere.
Finally, I would strongly suggest that you study the Dutch Defense and anti-Dutch strategies (to the extent that there are any), because the Dutch can be a really effective counter to 1. d4.
Also, if you haven't already read it, check out My System by Aron Nimzowitsch. His advice on chess fundamentals has become standard, but he also relied on a hypermodern chess style that was able to make good use of 1. d4.
Good luck.
Answer: d4 is the second best initial move because it frees a Bishop and the Queen while making e5 and c5 harder, but it does not stand on a winning line. Both you and your opponent will have many chances to make losing mistakes. Choice of opening rests with White, but after about 10 moves, both will have to deal with their opponent. You must play well to avoid losing. Your opponent must play poorly before you have any chance of victory. Pick an opening you like, and you may recognize your opponent's mistakes.
  Several following comments recommend following d-side openings in some order or another. Pick an order that is interesting and works for you. You will achieve your maximum playing strength because of who you are and how hard you work, not because you followed someone else's path. World champions accept worthwhile instruction, but they are not limited by it. Follow your path noting what others have accomplished, but keep remembering that your accomplishment must come from inside you.
Comment: Your philosophical advice sounds nice and all, but it doesn't really answer the question. The guy (girl?) came here to seek specific advice, an answer that can be summed up as just "do whatever your heart tells you" (embellished with some commonplace stuff like "play well to avoid losing") isn't very helpful imo.


Feeds Module Periodic Import not working

Question: I created a Job portal using the feeds module. I have the Periodic Import on every 3 hours. It says you have to configure your cron. I have read where there are others having issues a few years ago and they say to use Ultimate cron or Elysia Cron. I tried both and am not sure what/ where I am suppose to set and still isn't working.
Answer: If you are using Ultimate Cron, make sure you set the 3 hour cron to the Job Scheduler cron and and also to the Feeds crons (there are like 4 of them).


How do I remove the blur from a an object in Inkscape?

Question: I inserted a circle and blurred it.  Now I can't remove the blur, and subsequent shapes I insert are also blurred, including the square and star shapes. The blur is off in the "Fill and Stroke" section and I've gone through every option in the drop down menus.
Answer: It sounds like you've added a blur to the layer the object is on, rather than the object itself, and so now everything you draw on that layer will be blurred.
To fix it:
Open the Layers panel. Select each layer in turn until you find one that has a blur applied, and set the blur to 0.
Comment: This is so helpful - I believe that I did blur the layer rather than the object.  Thank you very much!  I appreciate your response!
Answer: Check the Objects panel. There you can see blur and opacity settings for individual objects, groups and layers:

If you have blurred a layer or group every new item in that layer or group gets blurred.
Select a group or layer in the objects panel and remove its blur. It doesn't make individually blurred objects sharp, you must adjust them separately.
BTW individual objects should be blurred in the Fill&Stroke panel because there you get better adjustment accuracy.
Comment: Thank you very much!!  I appreciate your quick response!  I believe I did blur the layer rather than the object!
Comment: @user156758 there's essentially the same answer by mr. Kerr,  but given earlier. Accept it if you are going to accept something as the right answer.


Is it legal to use counterfeit money as defense against burglars and robbers?

Question: I have produced small amounts of counterfeit money, I keep this in a few wallets in a few rooms in my house. When going outside I always have one such wallet with me in case I get robbed. Is using counterfeit money for this specific purpose legal?
Comment: In what jurisdiction?
Comment: This is quite the scheme to be able to give away fake cash if you are robbed.
Answer: Since you don't say which country you're in, it's likely that you're interested in United States law.
You are probably in the clear here, though you're getting close enough to the edge of breaking the law that I wouldn't be confident about not being prosecuted and/or convicted.  The relevant laws in this case appear to be 18 USC 471, 18 USC 472, and perhaps 18 USC 514.  All three of them begin "Whoever, with the intent to defraud...".  It's questionable whether creating counterfeit money as a burglar decoy counts as defrauding the burglar.
Comment: Bringing such counterfeit money into a shop may bring you closer to the threshold.


finding whether two string are anagrams of each other

Question: list1 = input("Enter words =").split()
list2 = input("Enter words =").split()

def twincheck(l):

    if sorted(l[0])==sorted(l[-1]):
        st=True
        print(True)
    else:
        st=False
        print("\nFalse")

    if st==True:
        for i in range(len(l[0])):
            for j in range(len(l[-1])):
              if l[0][i]==l[1][j]:
                print('('+str(i)+',',end="")

                print(str(j)+')',end="")

twincheck(list1)

twincheck(list2)

Comment: Your function seems to be doing two things (which is not good) but it's doing more than just checking if two strings are anagrams of each other.. what were you trying to achieve?
Comment: I think it unfortunate that you prompt for entry of *two* lines/lists of words. The way `twincheck()` (lacking a [docstring](https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring)) is called, only the first and last word of each is used. It is "difficult" to tell what is and isn't intentional with no documentation, no tests, no example of input and required output.
Comment: This function consists of one substantive line: `sorted(l[0])==sorted(l[-1])` and a bunch of diagnostic printing. As such, there's not enough here to be worthy of a code review. Voting to close under the "Other" category.
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/132233/discussion-between-peilonrayz-and-fmc). (Moving to chat to clean up comments)
Answer: A quick note about time complexity here: most of the time, Jakub's implementation of the is_anagram function is going to be pretty fast, but for large inputs, it can be slower than an implementation based on a hash-based data structure like Counter. Here is a small benchmark on strings of 10000 characters (this benchmark is pretty simple, and those results should be interpreted with caution):
import timeit
from collections import Counter

def is_anagram_counter(first_str: str, second_str: str) -> bool:
    """
    >>> is_anagram_counter("", "")
    True
    >>> is_anagram_counter("aba", "baa")
    True
    >>> is_anagram_counter("a", "b")
    False
    """
    return Counter(first_str) == Counter(second_str)

def is_anagram_sorted(first_str: str, second_str: str) -> bool:
    return sorted(first_str) == sorted(second_str)

def main():
    for implementation in "is_anagram_sorted", "is_anagram_counter":
        t = timeit.timeit(
            f"{implementation}(first, second)",
            setup=f"""
import random
from __main__ import is_anagram_sorted, is_anagram_counter
count = 10000

def generate_random_str(length):
    return "".join(map(str, (random.randint(0, 26) for _ in range(length))))

first = generate_random_str(count)
second = generate_random_str(count)
""",
            number=10000
        )
        print(f"{implementation}: {t} s")

if __name__ == "__main__":
    main()

On my machine, I got:
is_anagram_sorted: 22.178317 s
is_anagram_counter: 9.081907600000001 s

Comment: Yes, the counter should be much faster than sorting. Suggested sorted as it's dead easy to remember for anyone who is just starting. Sort them in the right order and check if they are the same :D Great work ;)
Answer: This is all you need to check if a string is an anagram of another:
def is_anagram(first_str: str, second_str: str) -> bool:
    return sorted(first_str) == sorted(second_str)

Your function doesn't test anything as it takes only one parameter. If your input will contain only one element it will decide input is an anagram. Simpler way is to use my function and call it:
is_anagram("test", "input what you want")

or

f_input = input()
s_input = input()
is_anagram(f_input, s_input)

This will work for both, single and multiple element inputs.
Comment: Actually in code i also have to return the index where alphabet of first string is present in string two.
Comment: You can add that bit to this code. like if statement. if is_anagram(string_1, string_2): and then rest of the code to check indexes, so that would only run if they are anagrams. Next time please add a better description as from the title you only saying about checking if they are anagrams. We can only guess why the code is there if the description doesn't say anything about it. A lot of times people ( I did it too) write code what does nothing, or just been left and suits no purpose.


2.93 - How to Align a diagonal UV seam for a repeating Texture?

Question: Practicing UV today ran into this issue. Trying to make this roof texture match exactly on the corners as shown in the image on right. How to Align this diagonal UV seam for a repeating Texture? The roof texture is a seamless repeating 2k image. Also, In the UV editor, When a single edge is selected there is this strange gradient. Where is the setting to turn that off?
Answer: You can do an Unwrap > Project from View from the top view, then, in the UV Editor, rotate the triangular part, move it, scale a bit:

you should be able to make the tiles match:


Users broadcasting who they are in WLAN and cell-phone networks

Question: In the same way that wifi-enabled devices and wireless APs broadcast their MAC addresses (FF:FF:FF:FF:FF:FF), do cell-phones/smartphones also broadcast such an ID too to connect to a cell tower? That is, besides their MAC address to connect to a wifi.
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
Answer: Your question is little bit vague and general in nature.However,I will explain it in layman terms.
The way your mobile works with a cell tower is totally different from it works or obtain an IP from a DHCP Server.
I will take LTE(4G) for example. The process of connecting to a cell tower/eNodeB is called as attach.You send your information about your mobile and sim card to the eNodeB. In the LTE architecture the component called PDN gateway is the anchoring point to UE/Mobile and it takes care of the IP address allocation to UE.
It is safe to say that you are comparing apple to oranges when you compare Wifi and cell tower.
To answer your question in short,No the cellphone doesn't broadcast its's ID rather it obtain the connection in RACH channel and attempt to attach to the network.


Glossary option in Search API indexed nodes

Question: Does anyone know how to add glossary for search index nodes? In Views+Search API you dont get glossary option in contextual filters as you get in Views with content nodes.
Currently I am using grouped filter with each alphabet equal to title (trimmed to one character) but not very efficient way. Looking for a better approach.
Thanks.
Answer: To my knowledge the Search API does not support making a Glossary listing in a Contextual Filter. The best it can do is provide Facet Searching (after a search is performed).
Solr may support this using Shingles or something to help create the Glossary item, but no such Drupal submodule exists at the moment.
Answer: this module can probably help some of you.
https://www.drupal.org/project/search_api_glossary
It is working on D7 and D8.
Have a good day.


In Jest coverage report, how can I find the test that was responsible for testing a specific line of code?

Question: This is a general question, that may apply to any code coverage report.

In my example above, highlighted line was tested over 77x times, but I'm unable to find the test itself which is testing it (I'm working on a very big repo).
What would be the best way to know this? Is there any flag I'm missing to add this info on top?
Thanks.
Answer: I don't believe that this is possible. Under the hood, the Istanbul code coverage tool is simply instrumenting your code into something like
cov_2ano4xc2b8().s[26]++;
const container = document.getElementById('container');
cov_2ano4xc2b8().s[27]++;
camera = new THREE.PerspectiveCamera();
cov_2ano4xc2b8().s[28]++;

(It may also be able to use V8's built-in code coverage features, but I expect the behavior for those is similar.)
To get per-test coverage, you could probably maintain a separate set of code coverage statistics for every test, then aggregate all of those when done, but I'm not aware of any existing tool that does this.
Absent that, there are manual alternatives, such as setting a breakpoint on an interesting line and then running the entire test suite in a debugger, or adding a throw new Error("THIS LINE WAS HIT"); at an interesting line then seeing which tests fail.


When does a villager from another town I asked to come to my town move in?

Question: I want to adopt a villager from another town. After asking the villager to move into my town, when does the house plot appear in my town?
Answer: To provide full answer, I'll just clarify a bit more of the background first.
It is possible to invite animals from other villages by speaking with them when you're in someone else's town, but the following conditions must be met in order for it to come up in conversation with them:

The villager you wish to invite must be about to move away, and currently in boxes (packing),
You must have space in your town, so you must have no more than 9 current villagers.

Assuming the above criteria is met and you successfully invite an animal, their plot will appear within 2 days (usually the next day), as long as you don't have a special event that day.
And remember to keep talking with them once they arrive to stop them moving away unexpected if they're a dream villager :D


upgrade:upgradation failed,13.10 issue

Question: I was upgrading 13.04 to 13.10.And suddenly it hanged and upper part of the screen went black.
So I stopped the upgradation and unfortunately I forcefully shutdown.But its already upgraded to 13.10(I feel upgradation is not complete though)
Problems
The desktop flickers now and sometimes the screen turns black.
Sound stopped.No sound output detected in sound settings.And the shutdown button also not working.
Is there a way to upgrade it again to 13.10(completely)?
Answer: press ctrl + Alt + F5 . login in . run sudo apt-get update and then sudo dpkg --configure -a .

upgrade:upgradation failed,13.10 issue


How are strings sent between computers when all that's available is an email address?

Question: Last January I asked a question about sending string information between computers. Using the responses as a starting point I've got machines communicating across the same LAN's. Now I am interested in expanding the code to permit communication between machines that are further apart. I constantly see games being played across networks where users supplied only email addresses. How does that work? What's the purpose for supplying an email address? (I'm not looking for code, just a general explanation about what's happening.)
Answer: The email address is just used to identify the user. It has nothing to do with the networking itself. The game typically just connects to a central server and sends the necessary information via a socket to the game server. Part of the information can be the identification but the communication is typically not done via SMTP (email) but direct connections.
Answer: Usually those games connect to a central server, where they register themselves, using their email address. Then the server is able to give out lists with IP addresses. From there, it's all the same as a local network. (well, mostly)
Answer: The email address is simply used as a unique identifier to access a specific account. The accounts are purposefully not tied to single machines in most cases.
You know how to communicate across the LAN, so I'll assume you know the basics of networking. The trick is simply that the game client connects to a central server that has a known address over the Internet, with the credentials to login (this is where the email address usually comes in, but really, it can be anything, as it doesn't serve as a machine identifier). The server then registers the IP address, and so the game system knows how to reach other people because the central server knows who's playing and how to reach them.
Answer: You would like to read more about XML Sockets: the basics of multiplayer games.
The basic idea of networking in most games is still client-server model communicating via messages:

In your case emails has not much to do with exchanging large amount of data between computers.


Extended chords in modes

Question: Im slightly confused
E-aeolian, Em9- E G B D F#, Em9/b9-  E G B D F
If im using E-phrygian the 9th is already flatted does it mean Em9 in phrygian is Em9/#9?
Or should the calculation of 9/11/13 should be done keeping major and minor(ionian&aeolian) in mind?
Answer: Chord symbols are absolute. The set of pitches defined by a chord symbol is not relative to any context like key or scale. If you have an Em9 chord, it means the notes E, G, B, D and F#, and to play it you don't have to look at a key signature or anything.
If you're playing an Em9 chord, then you can't be "using" E phrygian, that's a contradiction. It's more like the other way around. You play notes and chords, you listen to it, think about where your home note is and what other notes there are around the home note, and then you can describe the harmonic feeling you've created by saying that it's such and such mode. For example, if your tonic note is E and you switch between Em9 and A6 chords, what modal feeling do you create? That's E dorian.
Answer: Working with jazz chord symbols like Em9 or Emb9 is a separate system than being in a key or mode.
With jazz chord symbols I think of all signs in reference to a dominant 13th chord in major (ex. G B D F A C E G). Signs like min, #, b modify those default intervals. 9 by default is a major ninth. A flat sign b in b9 is a modification to lower the default major ninth to a minor ninth.
Being in a mode or key is different. All things are relative to a key signature (whether written or not.) In E Phrygian a ninth chord built on the tonic is an E minor seventh chord with an added minor ninth, and F natural. Notice how the F natural is not a modification of the key signature (zero sharps or flats.) Calling the interval a flat ninth doesn't make sense. Flat from what? Literally a flat is not used at all. Within this system it is probably better to call it a minor ninth, the actual interval name. As far as chord labeling in this system goes, there are different conventions. The key name needs to be given and Roman numerals are used for the chord roots. Sometimes capital M means major and lowercase m means minor. Like IM7 to mean a major seventh chord on the tonic.
I suppose Em: iM9 would be the same set of tones as Em9. Both being E G B D F#.

If im using E-phrygian the 9th is already flatted does it mean Em9 in phrygian is Em9/#9?

With the jazz symbol system the symbols are never in a mode or key, so you must convey the mode through the symbols. To indicate E G B D Fuse Emb9. To actually get a Phrygian feel you need some kind of progression. Ex. Dm7 Em7b9 I think will feel Phrygian. To understand the chord symbols start from a default dominant ninth chord (E G# B D F#) and then modify. The signs m modifies the third to make it minor - a G natural - and the flat b lowers the ninth to a minor ninth - an F natural. Confusingly, that actually is a flat sign being used to play a natural tone. It's a misnomer to call it "flat" ninth. It's really a "lowered" ninth.
If you want E G B D F#, just use Em9. Again, the m modifies the default major third to make it minor, and the 9 is a default major ninth.
Answer: What do you mean by "using phygian"?  The definition of chord formulas are always in relation to the major scale (otherwise there would be no need to say a minor chord has a minor 3rd).
So Xmin9 would always be (1, b3, 5, b7, 9) regardless of the definition of X (the root).
That doesn't mean you cannot build chords off other modes.  That process determines what chords naturally occur in any key.
All Modes can be played as a 13th arpeggio by playing them in 3rds rather than steps.
(1, 3, 5, 7, 9, 11, 13)
The occurrence of the b/# 9 in the Phygian mode simply means you will be out of key if you play a iii(-9) chord, e.g. E phrygian is in the key of C so an E-9 in C would be "out", it would have an augmented fourth of the key signature in it.  That may still work depending on what comes next (the flow of chords in a cycle and the movement of the intervals therein are what matters).
In any Major key the naturally occurring chords are
Tonic: (1, 3, 5, 7, 9, 11, 13) (Major in 3rds)
Supertonic: (1, b3, 5, b7, 9, 11, 13) (Dorian in 3rds)
Mediant: (1, b3, 5, b7, b9, 11, 13) (Phrygian in 3rds)
Subdominant: (1, 3, 5, 7, 9, #11, 13) (Lydian in 3rds)
Dominant: (1, 3, 5, b7, 9, 11, 13) (Mixolydian in 3rds)
Submediant: (1, b3, 5, b7, 9, 11, b13) (Minor in 3rds)
Leading tone: (1, b3, b5, b7, b9, 11, b13) (Locrian in 3rds)
Answer: By E phrygian you will mean iii 79.
Well, like vii7-5 in C (or iim7b5 in Am) the b7 and b9 are assigned or have to be assigned regarding to the key they are standing,
V79 in Am  will have b9 (E, minor 7 and minor 9) and  iii9 in C (Em, minor 7 and minor 9).

Extended chords in modes


What is the exact difference between a chazakah and a rov?

Question: I was asked this question by a friend of mine and at first I thought it was so simple (and maybe it is, maybe I just don't have enough Torah knowledge to know the answer) but when I tried to explain the difference, I kept getting caught by my friend saying, that's the same thing as a rov/chazakah. They are both halachically accepted forms of assumptions based on the probability that a certain outcome will repeat itself.
Comment: Rov and chazakah can each to refer to a number of different concepts, some more similar to each other than others. Consider clarifying (maybe with examples) which types of rov and chazakah you're referring to here
Comment: Chazaka is a way in a situation of safek. Rov is a solution for a safek
Comment: Traditionally explained in yeshiva lomdus as *psak*/*hanhaga* vs *birur* ...
Answer: There are many types of chazakos and rovs, so it's good to define our terms before  we compare them. What both of them have in common is they tend to address sefeikos, or uncertainties.
Chazaka D'MeIkara חזקה דמעיקרא
Basically, assume what was, will be. For example: חזקת כשרות, חזקת פנויה, חזקת אשת איש, חזקת איסור, or in English: something is still kosher, someone is still single, someone is still married, something is still forbidden. Even if you see that something has changed, you assume it changed at the last possible moment. While assuming things don't change could be logical (status quo), this latter novelty is not logical. It is a decree of the writ, a גזרת הכתוב. See Chullin 10b for the source and discussion on this type of chazaka.
Chezkas HaGuf חזקת הגוף
Similar to חזקה דמעיקרא, basically put it's the assumption that something physical hasn't changed. See Kesubos 12b for an example. Some say that this is stronger that a typical חזקה דמעיקרא (see Shev Shemaatesa 1:15).
Chezkas Mammon חזקת ממון
The gemarra (Bava Kamma 46b) calls this logical, to the point that you don't even need a source for it. Essentially it's the assumption that your possessions are yours until proven otherwise.
Behavioral Chazakos חזקה אדם וגו'
This is the assumption that people usually act a certain way. For example חזקה אין אדם עושה סעודה ומפסידה, we assume a person won't make a wedding feast only to ruin his marriage the next day (Kesubos 10a). חזקה אין אשה מעיזה פניה בפני בעלה, a woman wouldn't brazenly lie in front of her husband that he divorced her (Gittin 64b). More on this below.
Chezkas Gimmel Pa'amim חזקת ג' פעמים
We assume something that happened three times will continue to happen (שור המועד (Exodus 21:29), קטלנית (Yevamos 64b)).
Soklin al HaChazakos סוקלין על החזקות
Something that we assumed was true due to some proof (a single witness (see Mishneh Torah Hilchos Sanhedrin 16:6), logic), we will use even to execute punishments. For example, a new couple comes to town with two children. They act as a family, so we assume they're all related. If they commit incest together, they are punished based off that chazaka (Kiddushin 80a).

The gemarra in Chullin 11a teaches that there are two types of rov:
Ruba DeIsa Kaman רובא דאיתא קמן
A rov where the majority is before us. The classic example is 9 stores in town sell kosher meat and one sells non-kosher, and you find a piece of meat. Rov tells you to assume this piece of meat came from the majority.
Ruba DeLeisa Kaman רובא דליתא קמן
A rov where the majority isn't before us. There are different ways to define this. One way is this rov isn't known with cold-hard facts, it's just something that is generally known to be true (see Kovetz Shiurim I Bava Basra § 83, see there further for other explanations). For example, most animals are not born with a life-threatening blemish or illness. Or most people are not born infertile.
There are also different applications of rov. The above are referred to as Heilach achar HaRov, following the majority. Another application is Bittul BeRov, where in a mixture the minority becomes nullified and is considered like the majority.

Now, coming back to your question. I'm not sure which chazakos and rovs you and your friend were discussing, but my assumption is Behavioral Chazakos and Ruba DeLeisa Kaman. These work very similarly, since another way to phrase "there's a chazaka that a person would/not do X" as "most people do/don't do X". As noted by @JoelK, there are those that explicitly equate the two. Rav Asher Weiss in Minchas Asher Vayikra § 25 provides a proof that this is true. Chullin 11b suggests a source for Ruba DeLeisa Kaman is the fact that someone who bruises their father is sentenced to death, even though it's not known for sure who their father is. Rather, it's because rov beilos achar haba'al, even if the mother was unfaithful, most of the time she is with her husband. We therefore assume she became pregnant from him. The gemarra calls this a rov, yet the Yerushalmi Kiddushin 4:10 explains this case is the source for chazaka. Seemingly it's referring to Behavioral Chazakos, and thus the terms chazaka and rov in this context are interchangeable. See also Kiddushin 80a, which seems to call a rov a chazaka at the same time.
Not so other chazakos and rovs. You're right they both are assumptions that solve uncertainties, but they work differently, and they have different rules and laws. Some want to say that a Chazaka D'MeIkara doesn't answer the question, just tells you how to act, while Rov answers your uncertainty (see here for some sources). There's a rule that rov is stronger than certain chazakos (Niddah 18a), yet rov doesn't beat Chezkas Mammon (Bava Kamma 27b). They're not interchangeable or equatable. As well, clearly Bittul BeRov is different than chazakos.
Answer: There are indeed opinions which essentially understand certain forms of chazakah as a rov.
For example, R. Yisrael Isserlein writes in Terumat HaDeshen 207:

חזקה שאינה פוסקת שהיא באה מכח הרוב כמו החזקה אין עדים חתומים על השטר אא"כ נעשה גדול וכן חזקה אין אדם פורע בגו זמנו וחזקה שאין אדם עושה בעילת בעילת זנות דכל הני חזקות באים מן הרוב כלומר רוב בני אדם אין עושים אלא בענין זה אפילו בדיני נפשות סמכינן אחזקה כה"ג
A chazakah  which does not cease, which comes from the power of rov, such as the chazakah that witnesses do not sign a document if they are underage, or the chazakah that a person does not repay a debt early, or the chazakah that a person will not make his act of sexual intercourse into an improper one, all these chazakot come from the power of rov i.e. most people only act in this way. We rely on such a chazakah even in capital cases.

R. Shimon Shkop in Sha'arei Yosher 3:3 distinguishes between a chazakah solely based on statistics (such as the chazakah that a woman will not falsely claim to her husband's face that he has divorced her) and a chazakah that is based on both statistics and a certain internal logic (such as the chazakah that people do not repay debts early).
He understands, based on the principle of ein holchin bemamon achar harov, that the former kind of chazakah cannot be used to extract money from a defendant, suggesting that this kind of chazakah is indistinguishable from rov. However, the latter kind of chazakah is strong enough to extract money; a chazakah based on logic as well as statistics is stronger than one based on statistics alone.
Another way to look at these types of chazakot in a way that is different from rov, is to understand them as discussing the way we perceive the world, rather than performing a statistical analysis.
For instance, R. Moshe Sofer in his Responsa Chatam Sofer Choshen Mishpat 67 writes of the chazakah that a debt is not repaid early that it is 'as if we are witnesses' (anan sahadi) that such is the case, and that such a chazakah can therefore be used to extract money. Similarly, R. Aryeh Leib HaKohen Heller in Shev Shmat'ta 6:22 writes that this chazakah is based on logic (sevara) and is thus stronger than rov.
The way I understand their approaches (although I grant that this is not necessarily the only way to read them) is that a chazakah, while it might be ultimately be based on a statistical phenomenon, takes on a life of its own when (for whatever reason) it becomes a feature of how people view the world. This is in distinction to a pure rov (such as the majority of animals do not have a fatal illness) where we are not coming in with any prior assumptions, and it is the questions that are asked which require us to perform a statistical analysis in order to come up with an answer.
Answer: I'm not going to go through the whole topic right now, and whatever I can say will be in contention. Rov is separated into 2 separate categories, one of which is based upon a פסוק in the Torah, אחרי הרבים להטות. This rov is called רובא דאיתא קמן and is based upon the majority of the current possibilities before us. What is considered 'before us' is a subject of debate. This is not a logical statistical conclusion. The רש"ש on בבא בתרא (צג:) brings down an argument in the פוסקים if in the classical case of תשעה חנויות (9 stores sells kosher and one sells non-kosher) what if the one large non-kosher store sells more meat per day than the other 9 kosher stores. Do we go based upon the number of stores or the volume of meat. This is a seemingly obvious question, as statistically the volume of meat is what determines the probability. But the question is if רובא דאיתא קמן looks at the amount of meat or the number of stores. This is to prove that רובא דליתא קמן is not statistics.
חזקה, as Robev explained earlier, is not one thing. There are many different types of חזקות, the most common of which is חזקה דמעיקרא. This is also based upon a פסוק and is not statistical. An example is if I have two knives, one of which is kosher for שחיטה and one of which is not, and I grab one of them and use it to perform שחיטה. Afterwards I realize that I don't know which knife I use. חזקה makes the cow not kosher. This is again illogical, as there is nothing that says that since the cow was not kosher before, therefore I picked up knife a instead of knife b. This type of חזקה is called a הנהגה, a halachik tool that says when in doubt pick me.
רובא דאיתא קמן is the most statistical of the bunch. It says that being that most people do x, or nature dictates y, they are more likely to be true. This type of rov is called a בירור by some, and actually establishes how we should look at the reality, not just a when in doubt do... sort of thing. I wrote a paper on this a while back if you're interested.
Answer: The terms can be used in slightly different ways (much as in the same way that the definition of "fact" changes when you compare it to "fiction" or "opinion") but one way to understand it is as follows:
A Chazaka has more depth because it inherently requires more "time" depth, more data points, to draw a conclusion.
Examples:
A Rov:
The dice has four red sides and two green sides. If we don't remember the roll, we presume a red came up.
A Chazaka.
After 100 throws, the dice came up red 66 times. We presume the dice has four red sides and two green sides and then presume that an an additional unrecorded roll was red.
Comment: What about רובא דליתא קמן? Eg רוב בהמות כשרות. That seems more similar to how you have defined chazaka
Answer: Both are usually associated with assumptions and clarifications in areas we lack certainty . The difference between them is what the assumption is based on.
Rov means majority. The assumption is being based on the statistical likelihood.
Additionally, a Rov/majority can influence the status of the minority in Halacha. For example, if a small amount of non-kosher food  falls into a large amount of kosher the rov/majority of koshr food can make everything koher (ask your LOR before relying on this in a practical case)
Chazaka is simply an assumption. Based on the information we have and the way the world works we can assume something. It usually upholds the status quo until we have more information
A Rov is a stronger type of assumption than Chazaka and if they are contradicting each other the Rov would usually override the Chazaka
Comment: You seem to be contrasting רובא דאיתא קמן with חזקה דמעיקרה. What about רובא דליתא קמן? What about a חזקה such as חזקה שליח עושה שליחותו?
Comment: I used the terms "usually" because there are too many types of chazokos to discuss them all in the answer here." the way the world works we can assume something"  is a reference to chazokos that are based on Umdina
Comment: If you're talking about umdina then this sentence "It usually upholds the status quo until we have more information" is a little misleading - consider חזקה אין אדם פורע חובו תוך זמנו which can be used להוציא ממון
Comment: Also, it's not at all clear that we apply רובא וחזקה רובא עדיף to a case of אומדנא


Home page heading

Question: I'm going to design a personal website with three pages: About, Projects, and Contact. Does the home page have to be "Home"? Can it be "About"? In other words, is it a right practice to have a website without a "Home" page? I want the users visiting myWebsite.com to go to "About" as my home page.
Answer: I think that following what users are used to is a good thing,
People are used to see the home page because it guides them, think of it like this:
when you enter at a big building for an establishment for example, first you'll see the reception area and probably a map telling you where you are in the building and how to reach other main parts of the building, I'm sure that the other parts of the building are more important than the reception area but this area helped them reach their goals more easily.
on the other hand, if you arrive at your friend's house you probably won't need a map for the small house and you can navigate it with ease or by the help of your friend.
and that's a website, if you have a big website that the user can easily get lost in, give them a proper navigation system and something more familiar to them
if you have a small website you can convert it to a single page website and guide them in they way you see fitting to the purpose of your website
Comment: "if you have a small website you can convert it to a single page website and guide them in they way you see fitting to the purpose of your website" I see what you mean. How about internal links or a table of contents on a single page?
Comment: I think internal links might be the simplest most straight forward way to do it, but table of contents seems interesting too!
Answer: Having a web with three different types of information doesn't mean having three pages. Imagine the website of a newspaper with sections on current affairs, politics, entertainment, sports, etc. I think there is no newspaper website having each section on a different page. Well, the case raised in the question is exactly the same: the design is about a project website with three sections. The question of whether they should be on three pages or on the same page is a later choice.
You can look for some POSTER-LIKE WEBS where the entire web is on a single page.
Here some examples:
nathan.tokyo
There are even them with just one click action:
peppasauce
Comment: "the design is about a project website with three sections." Not really: It's not about a single project. To clarify the content, on the _About_ page, I'm going to write a short bio, the _Projects_ page lists all my works, and the _Contact_ page shows different communication channels.

Home page heading


How many PIR Motion Sensors can I connect to my Arduino-Uno R3?

Question: I am doing a school project where I intend to measure the cafeteria line with motion sensors and the send that information with a WiFi module to a server. This is my first time using Arduino and I am not sure how many motion sensors does it support.
Comment: for both simple and good, use one per GPIO you have that supports interrupts. for simple and not as good, use one per GPIO. you can eventually add more with port expanders, charlie plexing, even shift registers.
Answer: Most PIR sensors provide a simple relay output. That means they are nothing more than a switch as far as the Arduino is concerned.
You can connect hundreds of switches to an Arduino. With judicious use of diodes and a matrix arrangement you can hundreds with not many IO pins.  For example an 8x8 matrix of switches gives you 64 PIR sensors with just 16 IO pins.  For n pins you can have (n/2)² switches with a balanced (n/2 by n/2) matrix.


Calculation for getting dimension of object in image

Question: I am trying to calculate the dimensions of an object in an image. This is a sample image I took to get height of the brown box.  I have this white box which measures 16cm and I would like to know the height of the brown box (in meter). This using only the focal length and the size of the camera sensor of my phone.
Focal Length: 3.99mm
Focal Length In 35mm Size: 29 mm
Sensor size: 4.8mm * 3.5mm
Height of the image: 4032px
Size of the brown box in pixels: 1459px
Distance between the sensor and the box: 1.8m

I did this:

So I found boxheight = 0.78m
In reality, this brown box measures 0.75m, so I want to know if it's possible to obtain a more accurate result by using the fact that I know the exact size of the white box next to it.
Does anyone know ? Thank you
Comment: What's the pixel height of the white box? Wouldn't 16cm * pixel_height_brown / pixel_height_white be a simpler approach? At least with the assumption that the vertical sides of the boxes are contained within the focus plane... If so, the white box pixel height should be ~311 pixels...
Comment: I'm voting to close this question as off-topic because it is about using a camera as a measuring device rather than to produce photographs for their artistic, documentary, or historical value. That, and the fact we already have 3,527 other versions of the same question.
Comment: You're close, so I am thinking one of your variables is off by a tad. Film frame size is commonly referred to as 6x6, 6x7, etc., but these dimensions often vary slightly for each camera model. Could it be that your sensor is actually not precisely what you wrote in your calculations?
Answer: You're making the calculations too complicated. When you have a known reference measurement in an image to compare the unknown against, just use the known reference as the unit of measurement.
In my image editor, I measure the height of the white box as ~176 pixels, and the height of the brown box as ~884 pixels. The brown box is thus 884/176 = 5.02 times taller than the white box.
And because the white box is given as 16 cm, the brown box is therefore 16 * 5 = 80 cm tall.
Note that this is exactly what crime scene photographers do when they lay down a forensic ruler / scale next to something they want to photograph at the scene.

Forensic photo scale
You also sometimes see police lay down a coin or a dollar bill next to the item being photographed if they don't have a forensic scale with them. (At least, you see it sometimes on law/police procedural TV shows and movies. Whether or not that is common or rare in real-world police work, I don't know). The point is to put a known reference measurement in the photograph, so future analysis of the photographed evidence will can always be done.
Comment: "a known reference measurement in an image to compare the unknown against" **on (almost) the same plane**
Comment: There is long standing tradition of putting the hammer in the frame in paleontoloogy photos.
Comment: @jhamon Absolutely. Good point.


How do we construct sentences ending in わけ?

Question: The is a certain way of talking where you can end just about anything you say in わけ.
What is the sentence structure for this way of talking?
Answer: While sawa's answer does cover the basic construction rules, it's definitely worth it to go over the different use cases of わけ. Grab a comfy chair and your favorite beverage, because this is a long one.
The best and most complete analysis I've found of this use of わけ is in this 2001 paper by Atsuko Yokota:
文末【ぶんまつ】表現【ひょうげん】「わけだ」の用法【ようほう】 : 「はずだ」「ことになる」との比較【ひかく】
It's freely available as a PDF (yay!) but it's entirely in Japanese (hrm), so the best I can give you here is a summary of the five (yes, five) distinct uses of わけだ which Yokota lists.
Yokota's Differentiation of わけだ
Diagrammatically, Yokota charts out the first four uses of わけだ in her paper. Here is a clarified and prettified version:

1. Marks a logical conclusion or result based on some known fact
The common thread in this type of sentence is that a known fact Y is used as the logical basis for a conclusion Z:

波【なみ】がずいぶん荒【あら】いですね。今日【きょう】は船【ふね】が出【だ】せないわけですか。
Y (known): The water is really rough today, isn't it?
Z (conclusion): As a result, will we not be able to put out to sea today?
時差【じさ】が四時間【よじかん】あるから、日本時間【にほんじかん】のちょうど正午【しょうご】につくわけだ。
Y (known): The time difference is four hours, so
Z (conclusion): based on this we'll arrive right at noon Japan time.
体重【たいじゅう】をはかったら52キロになっていた。先週【せんしゅう】は49キロだったから、一週間【いっしゅうかん】で3キロも太【ふと】ってしまったわけだ。
Y (known): When I weighed myself I was at 52 kilos. Last week I was 49 kilos, so
Z (conclusion): this means I gained a whole three kilos in one week.

2. Marks a reason or cause for some matter
This is like the first use, only in the opposite direction. We take some known fact Y, and use わけ to mark X, the reason for or cause of Y:

学校【がっこう】の中【なか】が静【しず】かですね。――あ、冬休【ふゆやす】みに入【はい】ったわけですね。
Y (known): It's quiet in the school, isn't it?
X (reason): Ah, it's because we're in winter break now, right?
今年【ことし】の米【こめ】のできが良【よ】くなかった。冷夏【れいか】だったわけだ。
Y (known): This year's rice crop was poor.
X (reason): This is due to the cool summer we had.
波【なみ】がずいぶん荒【あら】いでしょう。台風【たいふう】が近【ちか】づいているわけです。
Y (known): See how the water is really rough?
X (reason): It's because there's a typhoon approaching.

3. Marks the speaker's acceptance/acknowledgement of some truth
This is a little more complicated than the first two uses. Essentially, we again start with some known fact Y (which may be unspoken). An answer for why Y is true is presented as X, and this leads to the conclusion that X naturally yields Y:

フランスで中学【ちゅうがく】まで行【い】かれたのですか。道理【どうり】で、フランス語【ご】が流暢【りゅうちょう】なわけですね。
Y (known, unspoken): You are fluent in French.
X (why is Y true?): You were in France through junior high?
Y (acknowledged): No wonder you're fluent in French. (acknowledging that X naturally yields Y)
あかないわけです。かぎが違【ちが】っているのですから。
Y (known): It won't open. (Listener: Why not?)
X (why is Y true?): The keys are different. (Listener: Ah, so that's why.)
夫【おっと】:隣【となり】の鈴木【すずき】さん、退職【たいしょく】したらしいよ。
妻【つま】:そうか。だから平日【へいじつ】の昼間【ひるま】でも家【いえ】にいるわけだ。
Y (known by wife, unspoken): Mr. Suzuki is at home even during the middle of the day on weekdays.
X (why is Y true?): Husband: I heard that Mr. Suzuki next door resigned from his job.
Y (acknowledged): Wife: Ah, so that's why he's at home even during the middle of the day on weekdays.

4. Marks a restatement of some fact
This is one of the simplest uses of わけ. Here, a known fact Y is restated or presented from a different angle as Yʹ. Often you'll find this use of わけ paired with つまり:

彼女【かのじょ】の父親【ちちおや】は私【わたし】の母【はは】の弟【おとうと】だ。つまり彼女【かのじょ】と私【わたし】はいとこ同士【どうし】なわけだ。
Y: Her father is my mother's younger brother.
Yʹ: In other words, she and I are cousins.
山田【やまだ】さんは韓国【かんこく】の領事館【りょうじかん】勤務【きんむ】になった。つまり彼【かれ】は出世【しゅっせ】したわけだ。 (example adapted from this page)
Y: Mr. Yamada got a job at the South Korean consulate.
Yʹ: Essentially, he's moved up in the world.

5. Does something entirely untranslatable
Unfortunately, there has to be a catch-all category, since わけ gets used kind of like a sentence-final particle without any significant effect on the meaning of the sentence. Even Yokota admits that "speakers often use [わけ in this way] unconsciously."

こうして二人【ふたり】は結婚【けっこん】して、幸【しあわ】せに暮【く】らしたわけです。
And so the two married and lived happily.

This わけ doesn't fit nicely into any of the four preceding categories. You might think it falls under #1 (a conclusion based on some known fact), but this sentence isn't a conclusion of anything; it's merely a statement of some known fact, without any connection. We could, in fact, remove わけ entirely, without affecting the meaning, by replacing 暮【く】らしたわけです with 暮【く】らしました.
Inside this category is the use of わけ to set up a context or prologue for a succeeding statement. We find ~のだ being used in a similar way:

わたしは国史【こくし】を専門【せんもん】にしているわけですが、わたしのような文献【ぶんけん】を扱【あつか】う者【もの】の立場【たちば】からすれば、もっと史料【しりょう】を大切【たいせつ】にすべきではないかと思【おも】うんです。
I specialize in history, and from the standpoint of someone like me who handles literature, I think we should value historical sources more.

Here, わけ marks a prologue ("I specialize in history") and provides the foundation for the following statement: it informs the listener of how qualified the speaker is to make such a statement. わけ could be replaced by の (ん) in this example.
Forming Sentences with わけだ
The rules for わけ follow the normal rules for forming a subordinate clause before a noun: the clause must end in a plain form, with the exception that (plain present) な-adjectives connect to わけ with な, and (plain present) nouns can connect with either な or (less commonly) の:

行【い】くわけだ/行【い】ったわけだ/行【い】かないわけだ/行【い】かなかったわけだ
優【やさ】しいわけだ/優【やさ】しかったわけだ/優【やさ】しくないわけだ/優【やさ】しくなかったわけだ
静【しず】かなわけだ/静【しず】かだったわけだ/静【しず】かではないわけだ/静【しず】かではなかったわけだ
証拠【しょうこ】なわけだ/証拠【しょうこ】だったわけだ/証拠【しょうこ】ではないわけだ/証拠【しょうこ】ではなかったわけだ

Often the speaker will use という to "wrap up" the preceding clause (or sentences) and use it to modify わけ (というわけだ). This doesn't change the usage, and the rules for using という are the same as those for the use of と to mark a quote or thought. This use of という is often used at the beginning of a sentence as a transition:

というわけで、…
So with that, …

This is especially common in TV or radio shows when the host needs to press the show forward or move on to the next topic. The という wraps up the preceding statements into わけ and essentially means, "Now that all this has been said, let's move on." というわけで has the following colloquial forms:

ちゅうわけで (a slur of というわけで)
てなわけで (using て for という, but as to where the な comes from, your guess is as good as mine)

ということで is also used as a transition with a meaning similar to というわけで.
Negative Forms of わけ
There are at least four negative forms of わけ, each with slightly different meanings. One is using わけだ after a negative clause, which shows up in the examples here. This answer is getting too long to cover these, so I will simply list the other three here and wait for those interested in more complete explanations to ask a question:

~わけがない: There's no way that ~
~わけではない: It's not as though ~
~わけにはいかない: It's not possible to ~
Comment: @sawa: Duly noted. But since language hacker's question included the statement that there is "a certain way of talking where you can end just about anything you say in わけ", I deduced that the OP, in addition to wanting to know how to construct such sentences, is in fact unclear on why and how one would use わけ. (I also know from past teaching experience that this is a particularly tricky bit of Japanese for non-natives to learn, so I imagine many others on this site will benefit from a thorough explanation.)
Comment: @Derek Schaab: In my grammar book this is explained as follows: "In casual conversation wake, an informal form of wake da, is used quite frequently to give slight emphasis to a fact when the speaker does not expect the hearer to know about it.". Which I think sums it up quite nicely.
Comment: @William: Using わけ to give a conclusion (Y→Z) requires some level of objectivity. In other words, given the evidence, anyone could form the conclusion marked by わけ. This objectivity is not present in the example sentence you're referring to, since the preceding context (whatever it is) does not always lead to the logical conclusion that the two married and lived happily. It is a mere statement of fact known only to the speaker. This is why わけ can be left out without affecting the meaning, which is what Yokota was getting at in her paper.
Comment: @phirru: Part of the analysis in the paper I linked makes note of when you can replace each of the five uses of わけだ with either はずだ or ことになる (which can be very close to ということだ). There's a table in the conclusion that summarizes when these substitutions are allowed, but unfortunately there are many exceptional cases within each usage of わけだ (such as whether the clause marked by わけだ is unknown, known, or an unconfirmed past event), so the only way to fully explain the difference would be to translate the entire paper.
Comment: Derek, this is a great summary of the paper and will no doubt be helpful to people looking for info on わけ in general, but my interpretation of the question was that language hacker was asking about the common colloquial use of "category 5" in particular, where わけ appears like a sentence-final particle [specifically NOT followed by だ] affecting implication/discourse structure more than meaning. Maybe it would be nice to throw a note at the top covering that specific colloquial usage before diving in to the full story?
Comment: @Matt: Without an example sentence from the OP we can only guess at which usage is being questioned. :) As far as わけ not followed by だ, this is common in informal speech and not limited to わけ. Borrowing from an example of the first case, we could easily say: 「日本時間のちょうど正午につくわけ。」. The fact that だ is missing doesn't change the function of わけ. Similarly, 「今日は定休日。」 still means the same as 「今日は定休日だ。」, even though the だ is dropped.
Comment: @phirru: That matches usage #4 on [another page I found which sums up わけだ](http://homepage3.nifty.com/i-yasu/Lesson31.htm): 私が声をかけても彼は知らん顔をしているわけです。 ("I even try talking to him, and he's just standing there looking like he doesn't see me.") It's kind of a pain to translate into English well, and definitely counts as another one of those case-by-case constructions.
Comment: @language hacker: わけ and わけだ are merely alternate versions of the same thing, as has been clarified in the comments here. You'll have to provide an example sentence so I can tell you which usage pattern it fits into. There's no "わけ(だ) always means X" rule.
Comment: Regarding the usage, your answer is far more accurate than mine. My answer just concentrated on the structure of the sentence, which is what was asked. The usage part that I added was not intended to be extensive.
Comment: [[ てなわけで (using て for という, but as to where the な comes from, your guess is as good as mine) ]]  Maybe ~というようなわけで???
Comment: Perhaps this warrants its own question, however, is it possible to replace some of these with ということ? For example: "波がずいぶん荒いですね。今日は船が出せないわけですか。" into "波がずいぶん荒いですね。今日は船が出せないということですか。" How does the feeling of the sentence change if this is possible?
Comment: @istraci: That sounds plausible.
Comment: @Derek Schaab: Thank you! I haven't had a chance yet to read the paper yet, I'll give it a look as soon as possible.
Comment: To be fair, it's quite hard to determine what exactly the question was asking. There are many ways to "end a sentence in wake" which have been discussed here.
Comment: Yes, I know that だ-dropping is common in informal speech, but I am talking about a separate phenomenon, one where わけ is used almost as a sentence-final particle and actually can't be combined with だ without changing in nuance. But I accept that the line between this and a だ-dropped わけだ is very iffy and calls for better evidence than my "it seems to me", so, peace. (Re interpretation of the question, quite true! My assumption is based on the "just about anything you say" part of the question specifically; this struck me as a reference to the semantically bleached わけ I mention above.)
Comment: For "こうして二人は結婚して、幸せに暮らしたわけです。" would "And of course the two married and lived happily." be a better translation?  It has that same 'conclusion from reasoning' that the rest of it does.  The conclusion comes from facts outside the conversion, like the fact that all fairy tales have a happy ending.
Comment: As mentioned above I was asking about the use of わけ at the end of a sentence and not わけだ. I heard it used at the end of a series of questions. What does it mean when it's at the end of a question?
Comment: Hello great post.  May I ask, what category would this sentence fit in?  I initially thought 3, but then I am leaning towards 1?  ->確かに素晴らしいマンションですね。それで、こんなに家賃が高いわけですね。
Answer: わけ is a noun meaning 'reason', but it might be better translated as 'circumstances' as Matt comments. When you put it at the end of a sentence, you are turning that sentence into an appositive clause modifying わけ. When the predicate is an adjectival noun (also called na-adjective), you need to change the ending into the adnominal ending (-な). A word for word translation will be "(there is) reason that...", or "the circumstances were that...".
In actual usage, it does not mean much, but is used when you want to establish intermediate steps for explaining something.

彼がそこにいた。
'He was there.'
彼がそこにいたわけ。
'{Reasonably/The circumstances were that/Now/Actually}, he was there.'
彼は静かだ。
'He is quiet.'
彼は静かなわけ。
'{Reasonably/The circumstances were that/Now/Actually}, he is quiet.'
Comment: Might it be better to view the わけ in this case as having a meaning closer to English "circumstances" than "reason"? e.g. 彼がそこのいたわけ = "(The circumstances were that) he was there" The meaning (he was there) is the same, but the implication as a speech act is different. (Here I tend to agree with your explanation that it used as an intermediate step in an explanation; you are not just observing that he was there, but setting the scene in which his being there has bearing on what is to happen next.)


https://www.truecrypt.org forwards to http://www.truecrypt.org

Question: Why is the site doing this? Is that a security flaw? In general, I'd be wary about using a http site instead of a https, although regarding truecrypt specifically, I came to trust it. I wonder why not use the higher standard of https.
Comment: Ironically, www.w3c.org does this too!
Answer: The reason for this behavior is simply a poorly-run website. Today there's no logical reason to not serve a site over HTTPS, though that hasn't been true forever. Currently the only files I could find that are served over HTTPS are the PGP signatures. Though, critically, the page that links to those signatures is not served over HTTPS, which somewhat defeats the purpose.
It has been mentioned more than once that there is significant incentive for an attacker to MITM the truecrypt website and serve a modified version of their software, along with correspondingly updated PGP signatures and keys. And also the refusal of the truecrypt team to serve their website over SSL makes such an attack trivial for a correctly-positioned attacker.
So far, the truecrypt team hasn't cared.
Comment: Either that or at least publish the sha256. Hashs are published in the blog https://truecryptcheck.wordpress.com/. But why would someone trust it?
Comment: BTW, according to http://security.stackexchange.com/questions/4369/why-is-https-not-the-default-protocol?rq=1, apparently there are good reasons not to use HTTPS (but not in this case).
Answer: Don't worry about it, this is the actual intended behaviour from the site. Site that is serving TrueCrypt or KeePass should be using HTTPS. It's an embarrassment that such sites are completely reluctant to follow such basic security standards.
There's no legitimate reason for these sites not to use HTTPS. Unfortunately, this is the way it is and there's nothing to do about it.


Functional Equation $H(x,y,z)=f(x,y+z) + g(y,z) = h(y,x+z)+ j(x,z)$

Question: For all real numbers $x$, $y$ and $z$ we have:
\begin{align}
H(x,y,z)=&f(x,y+z) + g(y,z) \\=& h(y,x+z)+ j(x,z)
\end{align}
All functions $f$, $g$, $h$ and $j$ are continuous (or even continuously differentiable).
I originally suspected $H(x,y,z)= \phi_1(x)+\phi_2(y)+\phi_3(z)+\phi_4(x+y+z)$ to be the solution. However I cannot make any progress using the usual methods to solve Cauchy-like and transitivity equations. However, I also could not find any obvious counterexamples.
Answer: I think the following is the solution for the continuously differentiable case:
We differentiate with respect to $x$ on both sides to obtain:
\begin{align}
f_1(x,y+z)=h_2(y,x+z) + j_1(x,z)
\end{align}
Setting $x=0$ gives us:
\begin{align}
f_1(0,y+z)=h_2(y,z) + j_1(0,z)
\end{align}
Forming antiderivatives with respect to $z$ on both sides gives us:
\begin{align}
h(y,z) = \phi(z) + \psi(y) + \chi(y+z)
\end{align}
where $\phi(z)=\int j_1(0,z) dz$, $\chi(y+z)=\int f_1(0,y+z)dz$, and $\psi(y)$ is an arbitrary continuously differentiable function.
Solving in the same manner for $j(x,z)$ reduces our functional equation to an equation of the form:
\begin{align}
f(x,y+z) = h(y,x+z)+ u(x) + v(y) + w(x+z) + v(y+z)
\end{align}
which can be solved using standard methods.
Note:
The above method (transform equation, set x=0, undo transformation) also seems to work for functions which are only integrable. Instead of differentiating with respect to x, one can use the Laplace transforms with respect to x and z, set the transformed variable corresponding to $x$ to 0, and undo the transformation with respect to $z$. However, there are quite a few details which have to be verified for this to work.


Were the UK's assets in the EU used to calculate the divorce bill?

Question: Having been a net contributor for decades, the UK has assets in the EU. For example, shares in buildings and the European Investment Bank. Were these included in the £39 billion divorce bill?
Comment: How might they have been included?  Why would they have been included?  Will the UK be relinquishing any of these assets in connection with its departure from the EU?
Comment: EU buildings are a different beast, they do not belong to the member states and the EU itself does not "belong" to member states in proportion to their *net* contributions over time so the UK does not really have a "share" in them. There is also no accounting of the long-term economic benefits that could be ascribed to this or that investment the EU funded in the UK or elsewhere. The discussion is about commitments to fund on-going programmes during the current "Multiannual Financial Framework".
Comment: I don't know about the latest figure (the £39 billion) but shares in the EIB were certainly part of the negotiation (see https://www.independent.co.uk/news/uk/politics/theresa-may-european-union-brexit-martin-howe-david-davis-boris-johnson-article-50-a7625261.html and https://uk.reuters.com/article/us-britain-eu-eib-capital/eib-considering-capital-hike-changes-to-shareholding-post-brexit-idUKKCN1LO0EW).
Comment: +1 to the question, even if the premise is a bit simplistic, I would be curious to know more about this.
Comment: So you're specifically asking about the implicit loss of their interest in assets that are held by the EU or related institutions in which the UK is ceasing to be a member?  I say implicit because I don't think the members explicitly carry shares in these assets on their balance sheets, but maybe I'm wrong about that.
Comment: The UK will no longer have the use of EU buildings or access to EU computer systems. So some assets will be relinquished.
Comment: My question is about the positive side of the UK/EU balance sheet. My question is predicated on the assumption that the UK has a share in some EU assets. In other words: the calculated divorce bill is £39 billion: was that arrived at by adding assets and liabilities, or simply totting up liabilities?
Comment: A really fantastic answer to this would be to find the documents on the EU website that explain the calculation of this - they will be very large, but they will be there somewhere.
Answer: Wikipedia's page on the Brexit divorce bill has a section on UK assets. One of its sources is the UK's Office for Budget Responsibility, specifically this report titled Economic and fiscal outlook dated March 2018. The part about the financial settlement starts on page 17 of the report. The sentences about assets that drew my attention reads:

The
  remaining small fraction reflects pension liabilities less assets returned to the UK, such as
  our capital subscription at the European Investment Bank. Receipts and payments associated
  with these other elements of the settlement could extend for many years, although the
  precise modalities for meeting them have yet to be agreed.

A similar point is seen in the EU's report from the negotiators of the European Union and the United Kingdom Government dated December 2017 which explains what is and isn't part of the financial settlement. That report has the following on assets (there's more in full document):

The UK will contribute its share of the financing of the Union's liabilities incurred
  before 31 December 2020 except for liabilities with corresponding assets6
  and any
  assets and liabilities which are related to the operation of the budget and the Own
  Resources Decision7.

Footnotes 6 and 7 read:

6 In this context, the following will not be included in the financial settlement: Union financial assistance loan
  assets and the associated balance sheet liabilities, and assets corresponding to property, plant and equipment and
  provisions related to the Joint Research Centre nuclear sites dismantlement, and all lease-related obligations and
  all provisions other than in respect of fines, legal cases and financial guarantee liabilities, intangible assets and
  inventories, any assets and liabilities relating to the management of foreign currency risk, accrued and deferred
  income.
7 Outstanding pre-financing advances, receivables, cash, payables, and accrued charges including those related to
  EAGF or already included in the budgetary RAL will not be included for the calculation of liabilities.

To your questions

Having been net contributors for decades, the UK has assets in the EU. For example shares in buildings and the European Investment Bank. Were these included in the £39 billion divorce bill?

The buildings, as explained in a previous comment, are not owned by the member states. The quote on the EIB from the UK report is a bit vague, the following point from the European report is clearer:

In this context, the UK will provide a guarantee for an amount equal to its callable
  capital on the day of withdrawal. This guarantee will be decreased in line with the
  amortisation of the stock of EIB operations at the date of withdrawal, starting on the
  date on which the outstanding stock reaches an amount equal to the total subscribed
  capital on the date of withdrawal and ending on the date it equals the total paid-in
  capital on the date of withdrawal, both as defined in the EIB statute.

So if understand it correctly the UK's assets in the EIB will start at the current level on the withdrawal date and then slowly reduced to zero.
Note that none of this is yet agreed upon. And even if it were, the part about the EIB might change at the UK's request, again from the European report:

The UK considers that there could be mutual benefit from a continuing arrangement
  between the UK and the EIB. The UK wishes to explore these possible arrangements
  in the second phase of the negotiations.

Were the UK’s assets in the EU used to calculate the divorce bill?


What is the takeoff decision speed (V1) for a Gulfstream G500?

Question: Can someone tell me what is the decision speed (V1) of the Gulfstream G500? Is it 200kt as shown in this picture?
Answer: Your decision speed also called V1 is the speed at which ou have to commit to taking off whatever happens because you won't be able to stop before the end of the runway after that. This speed is related to the airfield runway length, aicraft TOW, temperature and altitude and will change for each take-off. Therefore there is not a fixed value for a given aicraft.
For the G500 I did find this review

Today our take-off weight with three persons on board and 11500 pounds  of jet fuel (one-third of the max fuel) is 60 000 pounds and our computed speeds are V1: 118 kt for a rotation speed (Vr: 123) and a take off safety speed V2: 129 kt.

And this other one

The G500 was relatively light, loaded with 12,000 pounds of fuel for our flight, which was scheduled for 1.5 hours. Takeoff weight was 59,863 pounds, well below the 79,600 mtow. The avionics calculated V1 at 116, Vr 118, V2 132, and Vref in case of immediate return at 136 knots.

As you can see the value changes slightly but V1 seems to stay around 120kts. Your 200kt speed limit and the altitude and range limit related seems more likely to be linked to the 91.117(b) FAA regulation

Unless otherwise authorized or required by ATC, no person may operate an aircraft at or below 2,500 feet above the surface within 4 nautical miles of the primary airport of a Class C or Class D airspace area at an indicated airspeed of more than 200 knots (230 mph.). This paragraph (b) does not apply to any operations within a Class B airspace area. Such operations shall comply with paragraph (a) of this section.
Comment: Yes, it's FAA. It's in [14 CFR 91.117](https://www.ecfr.gov/cgi-bin/text-idx?SID=7d3384c2354e7d7f123b8e3018f1b96f&node=se14.2.91_1117&rgn=div8).
Comment: The 200kt limit appears to be to comply with 91.117(b): there's a speed limit of 200kts below 2500' within 4nm of a class C or D airport. Those numbers match the departure numbers in the OP's picture.
Comment: You might be absolutely correct, is it FAA regulation?
Comment: Okay, flying in Europe I didn't knew, I'll edit my answer to stick to actual facts, thanks
Answer: There is no one speed for V1. It's dependent upon the loadout of the jet, as is Vr, Vref, etc.  To be honest for that kind of a small business jet, a V1 of 200 KIAS is way too fast; the value is probably in the neighborhood of 110-120 KIAS with Vr around 130-135 KIAS.
Comment: 200 KIAS for V1 is too fast for pretty much any aircraft. Even Concorde had typical V1 speeds of well below 200 KIAS (although VR was usually in that range).


JS spam protection

Question: How to use JS spam protection on email to hide the form from spam bots.
Comment: If you're talking about using action="mailto:emailaddress" on a form, and wanting to hide the email address from website scrapers, then I would say you shouldn't do that in the first place.

Have your form processed by a server-side script which emails the form data to you. This not only keeps your email address away from prying eyes, it also gives you the benefit of being able to format the user's data to be more readable, and allows users without a mail program (for example, webmail users) to submit your form.
Comment: Lots of people have asked similar questions (and you could consider this question to be a duplicate): http://stackoverflow.com/questions/483212/effective-method-to-hide-email-from-spam-bots http://stackoverflow.com/questions/163628/making-email-addresses-safe-from-bots-on-a-webpage http://stackoverflow.com/questions/1292326/do-you-hide-email-addresses-to-spam-bots-on-websites
Comment: It really isn't worth it. A number of address harvesters already run JS, and an email address is bound to leak at some point anyway. Just get good spam filtering on your mail server and avoid putting any barriers between users and their ability to email you.
Answer: You don't.  Putting JavaScript into email is a very bad idea for potential security and privacy violations.  Instead include a link in your emails to the form on a web page.  Email is inherently private and the web is inherently public.  If exposing the form to a user is not a private event then it should not go in an email.
Answer: I'm not sure that I'm answering your question correctly, there isn't much detail.
I think what you're asking is how you can hide email addresses, in html, from spam bots - in which case here is the answer (there is no point in me paraphrasing it):
http://joemaller.com/js-mailer.shtml
Answer: I'm not sure this is affective any longer, if it ever was, but I was under the impression that encoding your email address in hex was one effective way to limit spam harvesting.
e.g.; mailto: is the leading "mailto:"
I've been using it on my site, but I also use Google apps for domain email, so it catches all the foo that does come through.

JS spam protection


Vauxhall Vectra Automatic CDTI 150 Gearbox Problem

Question: Gearbox fine when cold.  After about 25 mile drive it sticks in some gears, revs up between changing gear.  Got oil changed. No difference. 2007 model.  79,000 miles. Can anyone help?   Thanks.
Comment: Have you checked if the fluid is at the correct level? Has it been changed recently?
Comment: hi i have the same problem..... love to hear if you got it sorted.. its very annoying. done same as you got gear oil changed and still happening
Comment: @Stephen Actually everyone would love to hear if you were able to resolve this.  If you did, post it as an answer please.
Answer: I have been having a similar problem especially when decelerating to islands and then accelerating away, the gear box has hesitated and not changed down before accelerating.
I have only done 36,000 miles, so I don't beleive it is the gearbox at all I beleive its the ECU not getting the right torque settings for a particular shift pattern. Last week stopped off at local post office to pick up a parcel and when restarting the car the engine light came on and in limp mode fopr 10 minutes. I stopped the car and restarted and all appeared ok but for the engine light which stayed on for 2 days.
After the initial problem the car has totally changed its driving performance, no hesitation or sticking in gears at all, turbo like acceleration throughout rev range and almost inpercetable changes.
I believe its either a small air leak in the boost line at the front of the engine, a dirty EGR valve or a clogged boost valve near the EGR. Try cleaning with carb cleaner before any drastic gearbox action.
Answer: Assuming that you've checked that the oil was of the correct specifications, and that it's at the correct level, there are three main options.

Gearbox rebuild
Gearbox replacement (new or used)
Drive until it breaks (which might be never)


What is the relation between ELBO and SGVB?

Question: Evidence lower bound (ELBO) can be maximized, so that to find the most appropriate approximative distribution of the target distribution, which is equivalent to the minimization of the corresponding Kullback–Leibler divergence. The paper that introduces variational auto-encoders (VAEs) uses the SGVB (stochastic gradient variational Bayes) formula rather than ELBO. What is the difference between these?
Answer: The evidence lower bound is a bound on the log probability of the data. But there is no straightforward way to compute the ELBO, since it requires taking an expectation over the variational posterior. Therefore we need a procedure to estimate the ELBO (more specifically we need some way to estimate the gradient of the ELBO so we can optimize it).
The straightforward method is simply to estimate the expectation by sampling from the variational posterior, and then to compute the gradient of the estimator using the score function gradient estimator. However the variance of this method is too high for practical use, which is why the authors introduce their "SGVB" estimator.
Comment: Can you explain why the SGVB estimator has a lower variance than the score function gradient?


Running a simple Spring batch job without using maven?

Question: I am new to Spring batch framework. Can we create a batch job and run that without using maven?
I have seen spring batch samples connecting spring batch with maven..
Can anyone give me a sample Spring batch project that can run without using maven dependencies? Or at least give an idea about this.
Answer: Yes, run them in a container like tomcat see here for more information; Spring-Batch-standalone-Server-architecture.