WiFi continually turns off and on Sony Xperia Compact (Android 8.0)

Question: I have a Sony Xperia Compact running Android 8.0.0.
Recently I noticed that the WiFi constantly turns off and on. That is to say, I turn on WiFi, it searches for signal, shows a list of available networks and then turns off again by itself. It will then turn itself on again, and the cycle continues.
If I have airplane mode on, this sometimes allows me to hold a WiFi connection - but not always.
I am at a loss as how to approach this problem. I've tried resetting the network settings to default, which renders the same problem. I've tried running the phone in safe mode, to see if it was a 3rd party app, which also did not solve the problem.
Answer: Downgrade to nougat. Tried everything (reset router, delete network settings, software repair via companion etc etc.) nothing worked except the downgrade.
Comment: great thanks. Could you point me to a resource that shows me how to do that?


Cheapest hotel in Europe

Question: In this video a hotel in Belarus is shown with rooms for $4.10 per night. But the city is not mentioned. So, is this the cheapest hotel in Europe and where is it located?
Comment: Could "Where are the cheapest hotels in Europe located?" be a better title for the question?
Answer: No, it is not the cheapest hotel in Europe.
There is no clear definition of the difference between e.g. hotels, hostels and bed & breakfasts, but it is not difficult to find cheaper hotel-like lodging on booking.com in other European countries. I just tried a search in Ukraine for an arbitrary date in October and found about 60 offers for €4 per night or less.
I would also assume that many of the cheaper offers are not even advertising on the better-known booking sites, since it is too expensive. In Ukraine, there is e.g. very cheap lodging available on most train and larger bus stations, but you will not be able to book these online.
The hotel shown in the video is Zhilkommunhoza in Krasnapolle. That was already answered in comments to the YouTube video.
Comment: @SpehroPefhany Most of the cheapest listings are just for a bed in a dormitory, but there are several options for a private room. For example a private room in Hostel №2 in Alchevs'k is UAH 54 per night, or about USD 2.10. Even if this is a hostel, I would consider a private room 'hotel-like' enough to be comparable.
Comment: I ask because I didn't find that on booking.com, the cheapest listings were dorm beds which are hostel accommodation, not a hotel room.
Comment: What site did you search on for those offers? Did you search in English?
Comment: @SpehroPefhany Are you asking about the offers I already stated that I found on booking.com. No, I did not use booking.com in English, but I don't think that they show search results depending on the user interface language.
Answer: Not sure if the hotel is the cheapest in Europe, but I found one for $4.80 a night called the Old Road Apartments, link. (Not affiliated with the service). Or the cheapest in Belarus classified as a hotel is Райский сад for $4.99.

Cheapest hotel in Europe


Does iowait include time waiting for network calls?

Question: The proc(5) manpage describes iowait as "time waiting for IO to complete". This was mostly explained in an earlier question. My question is: while waiting in blocking IO, does this include waiting on blocking network IO, or only local IO?
Answer: It means waiting for "File I/O", that's to say, any read/write call on a file which is in the mounted filesystem, but also probably counts time waiting to swap in or demand-load pages into memory, e.g. libraries not in memory yet, or pages of mmap()'d files which aren't in ram.
It does NOT count time spent waiting for IPC objects such as sockets, pipes, ttys, select(), poll(), sleep(), pause() etc.
Basically it's time that a thread spends waiting for synchronous disc-IO - during this time it is theoretically able to run but can't because some data it needs isn't there yet. Such processes usually show up in "D" state and contribute to the load average of a box.
Confusingly I think this probably includes file IO on network filesystems.
Comment: As nfs IO is File I/O too, I guess you are right ;-)
Comment: `Confusingly I think this probably includes file IO on network filesystems.`   https://unix.stackexchange.com/a/203322/120198 according to that network io isn't counted in iowait
Comment: What about loopback interfaces? How does linux treat this kind of interfaces?
Answer: the iowait time is the amount of time a process spends in the kernel I/O scheduler. As far as I know, this doesn't have anything to do with network I/O insofar as regular socket connections go. However, it will include time spent waiting for network file systems like NFS.
Answer: It does.
Incidentally, one of the servers that I manage is experiencing high iowait which is caused by a bad NFS mount.
top - 06:19:03 up 14 days, 10:15,  3 users,  load average: 9.67, 11.83, 12.31
Tasks: 135 total,   1 running, 134 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us,  0.2%sy,  0.0%ni,  0.0%id, 99.7%wa,  0.0%hi,  0.0%si,  0.0%st

top - 06:22:55 up 14 days, 10:19,  3 users,  load average: 10.58, 11.13, 11.89
Tasks: 137 total,   1 running, 136 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.2%sy,  0.0%ni,  0.0%id, 99.8%wa,  0.0%hi,  0.0%si,  0.0%st

And look at the processes in the D state.
root     27011  0.0  0.0      0     0 ?        S    03:12   0:00 [nfsd4]
root     27012  0.0  0.0      0     0 ?        S    03:12   0:00 [nfsd4_callbacks]
root     27013  0.0  0.0      0     0 ?        D    03:12   0:01 [nfsd]
root     27014  0.0  0.0      0     0 ?        D    03:12   0:01 [nfsd]
root     27015  0.0  0.0      0     0 ?        D    03:12   0:01 [nfsd]
root     27016  0.0  0.0      0     0 ?        D    03:12   0:01 [nfsd]

Answer: The iowait includes the network calls. I say this, because NFS is handled as many linux local filesystems from the kernel's point of view:
$ vim linux-22.214.171.124/fs/nfs/file.c

const struct file_operations nfs_file_operations = {
        .llseek         = nfs_file_llseek,
        .read           = do_sync_read,
        .write          = do_sync_write,
        .aio_read       = nfs_file_read,
        .aio_write      = nfs_file_write,
        .mmap           = nfs_file_mmap,
        .open           = nfs_file_open,
        .flush          = nfs_file_flush,
        .release        = nfs_file_release,
        .fsync          = nfs_file_fsync,
        .lock           = nfs_lock,
        .flock          = nfs_flock,
        .splice_read    = nfs_file_splice_read,
        .splice_write   = nfs_file_splice_write,
        .check_flags    = nfs_check_flags,
        .setlease       = nfs_setlease,
};

When processes call a write on file descriptor 5, something like this will happen:
files->fd_array[5]->f_op->write(argv.......)

So, the processes doesn't knows what kind of filesystem are using (vfs magic) and the iowait is the same to a local filesystem.


Is there an herbicide that will kill broad-leafs and not hurt moss?

Question: My small pond is 20 years old and has flagstone around it. Over the years I have encouraged a native moss to grow around the stones. When I pull broad leaf weeds , they pull up the moss. Can I poison the weeds and not hurt the moss? Some of the weeds are ; houttuynia, violets, money-wort, all very invasive , and a few others like taro and aspidistra that are not much problem to pull.
Answer: Most systemic herbicides (including glyphosate) do not kill moss. Moss is a "non-vascular" plant, so herbicides which work by getting into the plant's sap and killing its roots have no effect on moss.
Just take care that you don't buy a mixture of glyphosate with something else which does kill moss, algae, etc. "Roundup" is advertised as moss-safe.
If you want to be cautious, try it on a small area first, but it should be fine.
Note, while systemic herbicides do not kill moss, many products sold as "moss killer" will kill everything, not just moss!
Answer: I know what you are going through.  Pulling baby weeds from the moss will tear up bits of it.  Think of it as renovation and aerating?  I got a little OCD pulling baby weeds out of gorgeous moss beds.  Even beds of woolly thyme.
You could use chemical gloves and a small sponge soaked with glyphosate that sits in a little dish with a dry cloth beneath so absolutely not a drip will drip...wipe a few leaves of the weeds and they will die, roots and all.  Takes about 3 weeks.
Way easier to just grab a cup of tea or a glass of great wine and sit and pull baby weeds.  I say baby weeds because big weeds will cause a lot more carnage of your pretty moss bed.  Big weeds will have already seeded to boot causing more weeds soon.
The bigger problem or rather more difficult task is maintaining the perfect environment for the moss.  Grass dislikes the acid soil and shade.  Grass as one of the weeds most common in a moss bed.  Plucking baby weeds out of your moss bed is worth its weight in gold for stress relief.  Just sayin'.  I loved going out on breaks to pluck erroneous plants out of the gorgeous woolly thyme bed.  There is no better treatment.  Win - Win?
Houtynnia (arghhh sp.) is major invasive.  Best to use a thin barrier of plastic or galvanized metal around that mass of plants.  I would use glyphosate as I've described for the houtynnia outside of that barrier.  Or just sit in your special space and pluck.  Sounds like a wonderful spot, blacksmith!
Comment: Thanks, too late for the Houttuynia , it has run up to 100 ft. Apparently , I have ideal habitat. No problem with grasses , maybe because of the surrounding acid sand soil; the moss stays on the limestone . PS; I could probably win a contest for who has planted the greatest number of invasive plants.
Comment: @blacksmith37  Hey!  What better way to get to understand how we defined a 'bad' plant?  I did part of my 'pay back' my first Mst. Gardener course (it was totally free at that time, you had to pay back by being at Fairs and Home and Garden Shows and having a contribution in this Historical Farm gardens.  I did mine on weeds.  52  top baddies on the noxious weed list...I got exotics as well to do that very controversial.  Part of the weed garden were ways to inhibit roots and regular pruning to ensure no seed.  Educational plaques  Very popular plot.  Houttuynia is gnarly but still containable.
Comment: Moss is growing on limestone?  That is weird, isn't it?  There is some sort of thing one can spray on a structure that promotes moss.  It is like spraying drywall texture on some structure/area like... a chia pet?  Artists making these living 'sculptures' also use grass seed.  I've see a gorgeous little concrete stairway sprayed with grass seed?  wow, not for the public of course and they must have used artificial lighting to pull it off.
Comment: I promise I won't call the weed cops on you!  Grins!  I have found Purple Loosestrife in every nursery visited for the past 30 years or more.  For sale.  What kind of soil DO you have?  Acid and sand don't normally go together.  Limestone and moss rarely go together?  Grins!  What planet are you on??
Comment: @Stormy "Moss is growing on limestone? That is weird, isn't it?" Not weird at all, in my part of the UK. You find dry stone walls built from limestone boulders (and nothing else - no mortar,etc) running along the edge of a group trees that shade them from direct sun, with moss literally a foot thick growing all over them.
Comment: I am sure it does fine growing on any rock or tree, I was considering the alkalinity of the stone when moss loves acidic.  Sounds beautiful alephzero...send a picture!
Comment: You got me; It is sandstone flagstone , I spoke too fast. Shade and moist around the pond in East TX ( "Piney Woods/ Big Thicket").


Parts of the mesh don't move when moving bones

Question: I just started using Blender, so I don't have much knowledge about its tool and stuff. Anyway, I was trying to animate an object, put the bones and assigned the vertex that wanted, etc. But when I move a bone that moves other bones together, some parts of my mesh stays behind. I checked to see if I have selected some wrong vertex, but nope. I believe it has something to do with loose faces that has no edge and vertex, but I'm not sure and have no idea of how to fix it. If anybody could help, please! I'm desperate! And thanks!
Answer: The vertex of those parts that stay behind means you don't have them assigned to any bones to move them. Check all the vertex groups in weight painting mode and most likely they will be blue for all vertex groups.
You can select a vertex group while the mouse pointer is still in the list you can use the up/down arrow key to select all the vertex in the list to check quicker.
Then you need to weight paint them with the Add brush to the desired vertex group.
Comment: Thanks for the help! It worked on the leg and upper tail bones, but at the base of the tail is still the same, no matter how much I paint it red with the weight brush...
Comment: @RodrigoOliveira You paint it red to which vertex? Make sure your bones and vertex have the same name (case sensitive)
Answer: Select mesh object (e.g. dino) and go to edit mode. Apply selected mesh you want to move, click the Data icon (one with 3-dot triangle icon, highlighted in blue) at the right, go to Vertex Group under Data. Select the bones to assign (e.g. neck) and click assign.
Try move that bone in Pose mode.
Also, you have to be less messy in assigning bones to each of the selected vertex group carefully.


Simulate Wireless Network in Emulator

Question: How do I simulate a WiFi network using the Emulator?
Answer: Simple answer: you can't. Also, this has been asked before (and yes, it's still valid).
Answer: The emulator does not emulate WiFi specifically. It emulates a generic network connection. You can use telnet commands to configure its characteristics (e.g., speed, latency).
Comment: You have more rep than me. Can you please edit the question and fix the title? The "Imulator" makes me cringe :)
Answer: Here is the solution I came up with for simulating total network connection loss on the emulator:
Write the following script and name it "nonetwork.sh"
netcfg eth0 down
sleep 10
netcfg eth0 up
netcfg eth0 dhcp

Upload the following script to the emulator via this command:
adb push nonetwork.sh /data/local/nonetwork.sh

Change the permissions
adb shell chmod 700 /data/local/nonetwork.sh

Run it
adb shell /data/local/nonetwork.sh

While the network is down on the device you'll lose access to adb as well but once the connection is re-established it will work again. Hope this helps.
Comment: What does this have to do with simulating WiFi?

Simulate Wireless Network in Emulator


ESP8266 + HC-05 on same arduino

Question: I'm absolutely new to arduino, so please excuse me if this is a noob question.
I want to use a ESP8266 esp-03 Wifi module with a HC-05 bluetooth module together with my arduino uno.
Unfortunately both use the TX and RX pins on the board.
Is there a way to use both, the wifi and the bluetooth modules?
Or do I have to purchase a wifi board?
Answer: You can (just about) use any combination of two of:

Serial to PC,
HC-05
ESP-03

You have, basically, a hardware UART (pins 0/1), and a software UART (any pins of your choice).
Only the hardware UART can be used for communication with the PC, and you can only reliably use one instance of SoftwareSerial.
So, you could:

Use Serial to the PC (0/1) and HC-05 (SoftwareSerial, your choice of pins), or
Use Serial to the PC (0/1) and ESP-03 (SoftwareSerial, your choice of pins), or
Hardware Serial for ESP-03 (0/1) and SoftwareSerial for HC-05 (your choice of pins), or
Hardware Serial for HC-05 (0/1) and SoftwareSerial for ESP-03 (your choice of pins)

If you want anything more complex than that then you need to use a board with more than one hardware Serial port (such as a Mega2560).
Comment: You can't have anything *connected* to the UART pins when actually doing the programming. Once programmed you can't use the UART pins *and* communicate with the PC. I.e., if you want to use the UART pins for a peripheral you will (most likely) have to disconnect it to get the programming to work, and you won't be able to debug your program through serial.  And yes, those are Serial2 and Serial3 etc that you point to there.
Comment: Thank you for your reply! So do I understand correctly, that when I use the serial port (e.g. to program the arduino) I cannot use the hardware UART pins at all? I also bought the Mega2560, are the 14TX3, 15RX3, 16TX2, 17RX2, ... pins the hardware serial ports you are talking about?

ESP8266 + HC-05 on same arduino


How do I establish international copyright to my works?

Question: What should I do to establish rights on my work? Does it depend on the country where it was created?
Comment: +1. Even before the edit, this is *exactly* the kind of question we would like to see here. Welcome to the community!
Answer: Yes - it completely depends on which country you are in. If you want to make it really fun, post it on the internet and then try to chase after copyright infringement in multiple countries.
Copyright laws of the United States: http://www.copyright.gov/title17/
Copyright laws in Canada: http://www.media-awareness.ca/english/resources/legislation/canadian_law/federal/copyright_act/cdn_copyright_ov.cfm
Copyright laws in Great Britian: http://www.copyrightservice.co.uk/copyright/p01_uk_copyright_law
Copyright laws of Burkino Faso: http://afro-ip.blogspot.com/2011/07/to-z-of-african-official-ip-websites-no_18.html
What you have to do to register your image (file a form, put a copyright notice on it, rent a billboard, etc.) as well as your rights and options will vary from country to country. Best bet is to google the copyright laws of your particular country.
Answer: Regardless of what country your in one of the first things you can do is establish evidence that shows when the work was created (or when you claim you created the work).
You can do this using the free online copyright protection service Myows.
This can't prove that you created the work but it can establish evidence that could be used if you ever needed to defend your copyright.

As soon as you upload an Original work on Myows, a copy of that work
  is time- and date-stamped and saved on our secure servers.
Uploading your work on Myows provides you with valuable evidence as
  well as an effective deterence measure designed to prevent theft.
Comment: Certainly. If you have the working materials for a work—page layout files, hi-res versions, design sketches, documentation—then that's not too hard. But that's not really the point. That site has the same "smell" as creating a copy of a work and then mailing it to yourself to establish ownership. That was disproved ages ago and I see that site being the digital equivalent. Knowing what I know about copyright, the *only* thing that I have ever seen to unequivocally establish copyright is to register the work with the appropriate government entity because that also folds the work into treaties.
Comment: "This can't prove that you created the work but it can establish evidence that could be used if you ever needed to defend your copyright." I am not a lawyer, but I see one handily arguing the usefulness of that site out of court in no time.
Comment: I think the service could be useful for resolving a dispute with a client or to help prevent content theft.  Is it even possible to establish proof that you actually created a work?
Comment: I haven't looked at that site in detail, but I would really like to see cases that have gone to trial where that site was used to successfully establish someone's copyright. It would be a great service if it actually worked.
Comment: copyright is purely a legal concept. This web site seems to have no more legal validity that the old wive's tale of mailing yourself a copy of the work.


International Wire from Brazil to Puerto Rico

Question: My husband has a side company that has its HQ in Puerto Rico. The company closed a contract in Brazil and was told they are wiring the funds to Puerto Rico. I was told that Homeland Security has the "wire" on hold due to the nature of the amount. I feel like things are not adding up. If the wire "left" Brazil and Homeland Security is holding the "wire" who and what steps should be taken to relieve the "hold"? The partner is telling my company they need to hire an "expeditor" to get things complete. Can someone shed some light on what this "process" should look like b/c I have no idea what is real or isn't real anymore and my family's livelihood is on the line.
Comment: most likely you are being scammed, despite AML, BSA and the patriot act. None of those laws would have stopped the terrorists from wiring money to a bank in florida. Wires are subject to Suspicious Activity Reports which are investigated retroactively, I'm not really sure about the holds as wires are instant or at most come with overnight settlement into your account.
Comment: I'm afraid CQM is correct, that was my first reaction as well.
Comment: My husband feels that this isn't a scam, but think he is too trusting. He was told that the transfer was "flagged" and now they have to hire a consultant that is former State Dept official to get the transfer approved, which could take a day or a year. Logically, this sounds insane and that is why I don't believe anything, but I have nothing to show my husband. Are there any websites that explain how these transfers normally work? Any info I can show him that his partner is filling him with stories?
Comment: @CQM: AML is post facto, it after the transaction is done. Typically its matched with 6 months data. OFAC is immediate, every transaction when it enter or leaves the Bank is OFAC screened for list of banned entities. If there is a hit, it gets stopped. I am not too sure if this activity is now done by Homeland Security.
Answer: In General:
All transactions are investigated for AML [Anit Money Laundering], and OFAC [Office of Foreign Assests under Control] to detect any illegal activities. Incase any suspecious transaction is detected, it is investigated further. In your case the funds would[Guessing] have been received by your Bank and if it trigger alarms, its further investigated. Normally more details are asked from the Originating Bank. At times this activity takes few days and there is no invervention required or possible. The funds would be received automatically once the investigation is complete.
If its determined its fradulent [involved in AML or terriorist funding or any other such activity], it would not get credited and law will come knocking on the doors of people involved.
If the sending Bank is Brazil is a US based bank, then these investigations will be done before they send the funds to US Bank.
Comment: Thank you for replying. I don't have any background with anything like this. He was told the Brazil bank wire would not "go through" because Homeland Security "flagged" it. Does the Brazil bank have to prove the transfer is legit since or does the client in Puerto Rico have to "prove" this? Who carries the burden on proving the transaction is not illegal?
Comment: If its held at receiving bank, the authorities would ask clarifications to receiving bank and since they will not have info, they will contact the sending bank, who may in turn contact the sender if they themselves do not have the info.


Can I travel to Canada on a visitor visa if I have been deported from the United States?

Question: I was recently deported from the USA. My status was as F1 student Visa I was studying well but was doing a job. At the time of immigration, they found that I was working and gave me justification of deportation for 5 years. I requested them to complete my study as it was only 6 months left. I also have a Canada visitor Visa for 10 years. Now my question is that can I travel to Canada with my passport.
Comment: Canada and the US (and Australia, New Zealand, and the U.K.) share biometric data. I think it's likely you'd be denied entry.
Answer: This information came from my wife who is an immigration consultant working in Ontario Canada
A person can say he was deported when he actually just received a removal notice (usually it says you have violated Rules XXX and you no longer have a legal temporary status in the USA. You are required to leave USA on this day.) but a formal deportation order is a different thing. usually you get it when you are arrested and detained for a period of time. You will not be released until you are removed directly.
If you leave voluntarily, your Canadian visa might still work, but if you have been issued a deportation order, you most likely won't be able to enter Canada.


How will outputs be migrated to RingCT, in the transaction building level?

Question: I am aware that a similar question has been asked, but it doesn't go into the details of whether in the wallet level the individual user will be able to send rct and non-rct transactions, and wheather it will be possible to migrate each non-rct output to a rct output in their single transaction, instead of having to visibly mix all the user's non-rct outputs one last time in a sweep_all transaction? Even now I think it is kind of bad that it is not possible for the user to decide explicitly what outputs could go together, and which ones shouldn't, and I realize that after ringCT that concern will be mute, but I was hoping for the most privacy concious transition into rct possible.
Answer: If you have unspent outputs from non-rct transactions, they are mixed with other non-rct transaction outputs in the same manner as before (an attempt is made to find a mixin number of other outputs of same amount). Then, the amounts of each output in the new rct-transaction are separately "masked". Each verifier (all other nodes), create an "identity" commitment for the inputs to verify no XMR was created in the process - this is identical to how miner outputs now work.
A picture might help, two unspent transactions with mixin 2:
[input amt: 2]--
                \
[input amt: 2]----[ring signature] --+
                /                    |
[input amt: 2]--                     |
                                     |
                                     +--[proof: (inputs - outputs) == 0]--+
                                     |                                    |
[input amt: 5]--                     |                                    |
                \                    |                                    |
[input amt: 5]----[ring signature] --+                                    |
                /                                                         |
[input amt: 5]--                                  [output amt: ?] ----    |
                                                                      \   |
                                                  [output amt: ?]---------+
                                                                      /
                                                  [output amt: ?] ----

I omitted transaction fees in this diagram (irrelevant for this discussion) - the 3 outputs must add up to 7 but the actual amounts are masked. So basically, the inputs to the transaction behave identical to pre-rct transactions, but the amount in each output is hidden.
So no sweep is necessary, until you have unmixable pre-rct unspent outputs. And even then, it is possible to do a transaction/sweep where the amounts in the input ring do not match (but this has not been implemented AFAIK).


How does a salt get chosen?

Question: I feel like I am missing some information regarding salting.  How does one choose the salt? If you reuse the same salt for all passwords, can it just be figured out and then used in conjunction with normal brute-forcing.  And what are the common ways to generate the salt?
Answer: Salt is not secret. This is the open part of the encrypted data. It should be open to decrypt the data.
Reusing the salt is not good. The whole purpose of salt is to prevent usage of rainbow table. If an attacker has descrypted one text, it should not be easy to use it for other texts. Where as if you reuse the same salt for many texts, it may make sense for the attacker to create a rainbow table because he can then decrypt your multiple texts via the same rainbow table.
To your question, how salt is chosen: As @Swashbuckler said, it should be random. Important: Not once random, but it should be randomly generated for each your text or password.
Comment: *factor of 2*? Doesn't it depend on how you construct rainbow table?
Comment: salts predated rainbow tables by a wide margin. They prevent attacking multiple passwords at once. Even before rainbow tables I could mount a dictionary attack  against an entire database of unsalted hashes at once. Time memory attacks only became popular after rainbow tables were introduced in 2003(Even though rainbow tables only give a factor of 2 over previous time memory tradeoffs)
Comment: rainbow tables give a time-memory-data tradeoff curve. It is the same curve as previous multi table time memory tradeoff but with a factor of 2 on runtime. compared to brute force with no pre computed tables these can be many orders of magnitude faster.
Answer: TL;DR: Use 16-32 bytes from something like /dev/urandom for your salt. This type of salt best defends against certain types of threats against password hashes. Pairing a unique salt with every password hash is a lot like using a separate hash function for each password.
Threat 1: Precomputed Tables
Password cracking can take advantage of precomputed tables. The straightforward method is to pre-generate a table that maps hashes to passwords. When you have a database of password hashes you want to crack then start with hashes that match entries in the table. New password/password-hash pairs can be added to the list whenever a new password is cracked or leaked. The table can grow ever larger without significant increase in lookup-time. Even if you use a strong password stretching hash function, not using a salt means you only need to hash a candidate password once as long as you have space to store new entries.
Rainbow tables are a different type of pre-computed table that use less space. They take advantage of a time-memory-trade-off. I will omit the details because they aren't relevant and because rainbow tables are easily defeated.
Solution: Use a decently unpredictable salt. If you use an $n$ bit (unpredictable) salt, then you increase the number of required "stored" passwords by a factor of $2^n$. This makes the two types of tables infeasible for sufficiently large $n$.  If someone has already generated tables then adding a salt to your hash function makes those tables useless. If they have a table for one specific salt, then it is useless for other salts.
Threat 1½: Tables for preditable salts
If your salt is predictable (or known)  then someone preparing to crack your website's passwords could generate tables to attack your specific website or specific users' passwords in advance of your password database getting stolen. Therefore you should make your salt:

A username. Tables can be generated for common usernames. Not just "John", "Bob","Lucy", but also things like "Admin".
A userid. Web app developers have already thought of using the automatically assigned ID numbers as a salt. Two problems. 1) URLs or network traffic with a user's ID can leak these numbers. 2) When it is an auto-increment field in a database pregenerated tables can be made for low numbers. ie. 0, 1, 2, 3, ...  There is also an increased chance those low number user ID will correspond to an account with admin priveleges.
Email addresses. This lets someone prepare for a targeted attack in advance.
Your website's name or domain name.  There are problems beyond predictability with using a constant salt for every password.

Specific solution: Use a 16 byte value from the same RNG you use to generate new keys.
Threat 2: Identifying identical passwords:
Without a salt, it is pretty easy to determine if two accounts have the same password. If
$$x = H(p_1), \\
y = H(p_2), \\
x = y$$
then:
$$p_1 = p_2$$
When you add a salt those conditions become
$$x = H(s_1, p_1) \\
y = H(s_2, p_2) \\
x = y \\
s_1 = s_2$$
You have the same problem if you use one salt for every password entry. This information leak is much more serious than it seems. If someone can identify that two accounts have the same password then they also identify which accounts have weak passwords. Arrange every password hash in one column. List every account who password-hash matches in another column. Sort the table by the number of accounts in the second column.
You can tell without even testing one password that everyone listed in the first row has something like "password1" for their password. And even if you're wrong then pick one account, test each password in a top 1000 most common passwords list. Once you found the password for the one account, you then know the passwords of probably hundreds of specific users.
Solution: Generate a random salt. One 16 bytes long will work and will likely be globally unique. It is far easier to take bytes from Linux's randombytes(bufAddr, 16, 0), Windows' cryptgenrandom, Java's SecureRandom.generateSeed, Python's os.urandom, PHP's random_bytes, (and so on) to ensure uniqueness than to make up some hack involving usernames, email addresses, domain names, hard-coded constants, etc.
Random numbers from an ideal uniform distribution of $n$ bit numbers will be unique with high probability for up to $O(\sqrt{n})$ samples due to the birthday paradox. 64 bits isn't high enough to have any certainty that your value is globally unique. $\sqrt{2^{64}} = 2^{32} \approx 4 \text{ billion}$. That is a lot for one small website, but small for the whole internet.
You should generate a new salt every time someone sets a password. That includes the first time an account gets created and every time the password is changed.
Threat 3: Cracking Every Account's Password at Once
Adding a salt to a password does not make cracking an individual account's password slower, except in terms of the above attacks. It appears to be a common misconception that using a salt is sufficient to make password cracking slow. It's not.
There is, however, another crucial difference between unsalted (or identically salted) password hashes and individually salted hashes. If every account uses the same salt then I can compute a password's hash once then compare it against every account's password hash for matches. (In the amount of time it takes to do one hash and one table lookup.) If any account(s) hashes match then I have recovered the password of each one of them. Furthermore for every account with a hash that doesn't matched I can rule out that candidate password for every one of those accounts' passwords.
If instead every account uses a unique salt then I have to test every account separately to determine which ones use "password123". This does slow untargeted attacks down; I have to do $numberOfAccounts \times numberOfCandidatePasswords$ instead of just $numberOfCandidatePasswords$. However if I am targeting just one account then there is no difference because $numberOfCandidatePasswords = 1$.
Solution: Use a unique salt for every hash.
Threat 4: Side Channel attacks
During the Password Hashing Competition (the one that resulted in Argon2) people were concerned that RAM access patterns could enable side channel attacks via cache timings.
There were algorithms that used password-dependent and password-independent data access patterns. (Argon2d and Argon2i corresponding to dependent and independent respectively.) Both need to use unpredictable salts.
Argon2i needs a salt to prevent a different type of pre-computation. RAM usage heavy hashes (like Argon2, scrypt, and balloon hashing) need to make unpredictable access to RAM. Random RAM lookups are hard to optimize much beyond what commodity hardware already does. If RAM can be accessed less randomly (by reorganizing the layout of memory or by prefetching) then crackers can gain an advantage. If access patterns can be analyzed to skip or postpone certain computations, then attackers can gain an advantage. Making these optimizations requires significant pre-processing time. Argon2 prevents this by making the RAM access patterns dependent on the salt. Therefore Argon2i should use an unpredictable salt.
Argon2d access patterns are salt and password dependent. (It's stronger if timing attacks aren't a concern.) If your salt is unpredictable and secret then this helps mitigate potential timing attacks.
Solution: Use unpredictable salts. Keep them secret as best as you (practically) can.
Conclusion:
Use random salt values at least 16 bytes long. Use the same non-deterministic CSRNG you use for generating new keys in order to make them unpredictable and unique. (No need to use more than 32 bytes = 256 bits.) Use a different salt every time a password is assigned. (On account creation and when passwords get changed.)
You should generate salts this way if you're implementing something new. If you don't need to implement password hashing yourself then you shouldn't. Look for an existing library (one that is secure and bug-free) that does the work for you.
If you are using PHP, for example, you can use password_hash, password_verify, and password_needs_rehash. This generates salts for you, performs password stretching with a optimized native implementation of bcrypt or Argon2i, and does constant time hash comparison for you. I don't know enough about it to know if I can fully endorse it or the default configuration it uses.
Additional information:
You don't "encrypt" or "decrypt" passwords. Despite the sequence of letters "crypt" appearing in "crypt", "brcrypt", "md5crypt", "scrypt", etc. this is the wrong terminology. Encryption is invertible. Passwords should be hashed, meaning the only way to get a password from its hash should be by comparing the hash of a candidate password to the hash you store for the actual password. If salts are used correctly then the fasted way to crack a password should be by brute force starting with the more likely candidate passwords.
Hashing a password does not automatically make it safe. It's a garbage in garbage out scenario. You should use strong passwords to protect your stuff. You should use a stronger password to protect cryptographic secrets than you use for online services. (Random passwords with high entropy are stronger than "clever" solutions. You would be surprised by how many people think of the thing you thought nobody else would think of.)
You can use password stretching if you want to make your password harder to crack by making hashing slower. (And more expensive if someone isn't using a botnet for cracking.) This process is called password stretching. It makes hashing slower for both legitimate password checks and (hopefully) for password crackers.
You should use whatever password stretching hash function you have available that is optimized for your native hardware. Implementing Argon2 in Javascript, PHP, Python, or Bash is a bad idea. It will run slow for you, because it's not optimal, but the point is to slow down other people not yourself. (For the same reason using a call to sleep doesn't help at all.) It's better to use bcrypt if that's what is available than to use a slow implementation of something else.
You should not use scrypt for website password databases. It needs more RAM than you'd assume to be sufficiently expensive. The amount of RAM it uses can only be increased if you increase the amount of time it runs. You should use a password stretching function that uses a lot of RAM if you're using it as a key-derivation function, (Argon2i, scrypt, ballooon hashing) but more importantly you should use a higher entropy password.
The term salt is generally not applicable to things other than hash algorithms. Somewhat related terms are "nonce", "tweak", and "IV". There is also a related term "pepper" which can have several meanings, but usually refers to something like "like a salt, but secret." Peppering isn't a good idea because password stretching hash algorithms are a better option.
Don't combine two password stretching hash functions. It's never more effective than running one hash with double the cost parameters.
Answer: From Wikipedia: "In cryptography, a salt is random data ..."
So, just use CSPRNG to generate your salt.
Answer: Selecting salt should be random at the same same time it shouldn't be short. Below image indicates the usage of salt and the randomness salt value in action.

Salt is used to mitigate following attacks types by increasing the complexity of the cypertext with random salting as indicated above:

Dictionary attack
Brute force attack
Rainbow table attack

You shouldn't use/choose salt as per below recomendations:
Salt reuse - This is highly vulnerable to the reverse lookup attack and the plain text/password could be recovered easily. Hence it's always recommended to use random not hard-corded salts.
Short Salting - It is recommended to use complex salt instead of short and simple. If you use simple salt the probability of attacker recover your plain text would be high.
User name as salt - Since most of the user names are predictable or easily recoverable it is not recommended to use usernames as salt
Hope this clarifies your concerns...
You may refer following wiki for more details: https://en.wikipedia.org/wiki/Salt_(cryptography)
Answer: How exactly salt is chosen or generated does not matter a lot, nor does it need to be secret. What matters is that your salt is unique.
In principle, you could start at any one random number, and increment that number for each user. But of course, simply using a pseudorandom number (needs not be cryptographic) for every user is just as easy! If the number is reasonably large (say, at least 64 bits or so), you can assume that every pseudorandom number will be unique (likely enough anyway).
Ideally, when saying unique, that means unique for every record in your user database, not just unique in respect of someone else's system. It is possible to just use one salt for all users, but then you do not get the full benefit. Thus your assumption that you can reuse the salt for all passwords is, well, not outright wrong, but certainly sub-optimal (that usage is more like "pepper", too).
What a salt does is, it makes identical passwords appear different in their hash values. Identical passwords occur often because people re-use passwords on different sites, and many people use easily guessable passwords, such as normal words you'd find in a dictionary (or easy variations thereof).
This is something that can be exploited by precomputing. An attacker thus only needs to do the work once, and basically reduces the effort to crack any number of passwords to virtually zero. Plus, entire databases of hashes (the word for that is "rainbow table") already exist for exactly that purpose, so an attacker can just reuse someone else's work, too.
Having a salt which makes identical passwords different in their hash thwarts this attack. So far so good.
However, unless every user record has its own, individual salt, an attacker can still reuse work done while attacking your user database, and what's worst: You can tell at the first glance when several users have the same password!
If several have the same password, you know whom to attack first. Not only is it highly likely that this is a weak password, but also having found one password means having compromised several accounts.
That's why salt should really be unique for every user record, not just your site.

How does a salt get chosen?


How can I make moong dal crepe crispy?

Question: I'm making a north Indian snack for my toddler, he likes crispy textures.
Moong dal ground with water, added chopped onion and cilantro.
The batter was thin like a crepe batter and cooked in frying pan. The edges were crispy. The interior was like a crepe.

Would boiling off some water help (adding more water in the beginning helps the grinding process and smooths the moong dal)?
Would Rice flour help?
I know America test kitchen adds baking soda to things to increase browning, would that work?

How can I improve the texture to make the outside more crispy?
Answer: Just add some semolina and rice flour. This would help a lot to make your crepes crispy

How can I make moong dal crepe crispy?


Within code, can I notch a joist block?

Question: I'm replaceing a portion of drywall on the ceiling between floors 1 and 2. For the drywall, I plan to add backer boards on edges. The issue is there are joist blocker boards running perpendicular between the joists. Can I "legally" notch a quarter inch within the center one-third of the perpendicular joist blocker board?
Comment: Why do you need to notch? Can you not just install drywall over the joists and blocking? Your drywall backing does not have to run full length of the seams.
Comment: @P2000 thx for quick reply. The backer boards serve the purpose of "sucking up" the two joined drywall pieces (existing and new at the joint) to reduce the hump. If the joist block prevents any part of the joint from pulling up as intended then I'll still have a hump when taping and mudding. This is my first time using backer boards for joints so don't know how much 2" of a flush joist block might affect the intended pulling up part of the joint between the existing and new pieces.
Comment: Is this a special kind of backer board? Usually we'd use a piece of 1x lumber or some plywood strips to suck-up and align the drywall. If the blocking is uneven at the bottom, then back around it and don't screw at the blocking. Would that work for you?
Comment: There is commercially available OSB backer board which has a depression in the middle to create a depression in the drywall seam screwed to it.
Answer: You are adding nailing edges to the edges of the existing drywall to provide support for the edge of the new drywall sheet and the edge of the existing.  A lot of people will just get some 1x4 and span the old sheet to the new sheet.  The two sheets then align at the joint.  They might not be "sucked up" as much as if you adding a nailing edge that was connected to the joists but sheets of drywall are typically supported 16" on center so at most the existing sheet will have support < 16" away and the new sheet will have support < 16" away.  The 1x4 between the sheets then lends support from one sheet to the other.  These pieces don't even have to be continuous.  You also have texture on the ceiling which works to hide all kinds of defects so your work can be even less precise.
As far as your question goes, you can notch the blocking between the joists.  The solid blocking between the joists allows your floor assembly to work as a single unit.  Often cross bridging is installed instead of solid blocking and they have comparable performance.  Blocking is also routinely knocked out by plumbers.  A notch to the bottom of the blocking is not going to effect the function.  The bottom of the blocking is not being loaded in tension.  If you are worried about it
Comment: short answer, Yes, you can just plane the protruding edge of that blocker board flush with the joist
Comment: Or even notch the blocking 3/4" above the joist to allow the backer board to be inserted under the blocking.
Comment: Agree with this answer. To be clear it's not "backer board", just backing, which does not have to be continuous.
Comment: Thanks everyone for your input. I replaced the drywall but am still unsure about how to finish a corner piece that is sticking out (hangs lower than existing ceiling) that I can't force up any further without crumbling the drywall. I asked in a new question as this specific post is considered resolved. ().

Within code, can I notch a joist block?


Can you set events to be private by default in Google Calendar?

Question: Is it possible to set your Google Calendar events to be private by default?  I don't want to mindlessly add public items to the calendar.
Comment: A "public" event means that details are allowed to be synced to other service or devices and can be seen when you share the calendar. They aren't listed publicly or accessible to the general public.
Comment: hmm I see your point...I've marked a few items as private however, and I'm still able to pull them in on my iPod Touch.
Comment: Some older syncing utilities ignore private flags, just like GCal itself doesn't sync FB events properly when they're private.
Answer: Very slow answer here, but you can always make your calendar private, which will prevent anyone from searching for and seeing your events.
You can also make your calendar public, but default to only show free/busy statuses.

When you select Make this calendar public, all of your events will
  appear in the public search results of Google Calendar and Google.
  Additionally, others will be able to view the calendar and its public
  events with your Calendar Address, or by adding the calendar to their
  'Calendars' list.
Making your calendar public and selecting See only free/busy (hide
  details) means that your calendar information will not appear in the
  search results of any Google Calendar or Google search. Additionally,
  only your free/busy information will be visible to those who access
  your calendar at its address, or by adding it to their 'Calendars'
  list.
To keep your calendar private and only shared with the people you
  designate, be sure the 'Make this calendar public' option is not
  selected. For information on sharing your calendar with specific
  people, please visit this page.


What can I use to create servo type sound effects without electronics?

Question: I'm making a cyborg/android type costume, and I'd like to rig something to produce that servo camerafocus type (vzzt vzzt ) sound. Without electronics. What could I use?
Comment: No comments to explain the downvote?
Comment: I can only guess that it's because the question is very board, asking for a solution to an entire problem. I'll point out though that while idea-generation & tutorial questions are not on topic, questions asking for a way to tackle a problem are fine. The grey area here is that this is essentially a sound-effects question, which the community hasn't dealt with before.
Comment: It's a long standing tradition of the Stack sites that comments are not required for down votes, though it is useful when it happens. In this case, I'd hazard that it's seen as being on the edge of an Arts and Crafts question and probably on the broad side of things to boot. It's also really not clear why electronics are being ruled out, especially given that they're a pretty obvious approach to the problem...
Comment: Thanks John. When looking for a cosplay area Arts & Crafts came up the most. I'll add detail to the question.
Comment: I looked into it, and since your question is about creating a practical sound effect, you may be better off asking on [sound.se]. I know this is for a costume, but what you're really looking for is reproducing a certain type of sound.
Comment: I'll open it there instead
Answer: Set up a hand crank, striker and two resonators as shown in the attached drawing should create the sound effect you are looking for without the use of electronics.
As you move the hand crank the axle turns the disk on which a striker has been fastened. As the striker passes the resonator (fixed in place) it will stroke the resonator to emit its characteristic sound.
Place two resonators 180 degrees apart and you should get your vzzt vzzt sound effect.
Note: you will have to play with the length and width of the resonartors to get the right sound out of it.
Comment: I'll have to look into this a bit more before I accept as the answer, but it looks good
Answer: I remember some hand-operated tin toys with spinning parts.  Probably close.  Alternatively you might want to try some of those hand copter toys where you crank a retracting cord in order to launch a plastic wheel with blades into the air.  Just omit the copter wheel, and the springed crank should like be good for that kind of noise.  If not, gluing somethink small and floppy on the axle might help.  Don't glue the copter wheel, though: if it can't disengage, it will likely break the launcher pretty fast.


How can I sing multiple notes at the same time?

Question: I am teaching myself sight singing right now, and I know how to sing single note(the left one as pictured) on both treble clef and bass clef but get stuck in multiple notes(the right one as pictured). Assuming that is the bass clef, do I need to sing out as mi do at the same time or just either one of them? Thanks.
Comment: Either begin practicing overtone singing or slur the notes...
Answer: If we exclude the cases where the score requests Overtone singing (very rare, quite specialized), it must mean that there are multiple voices (which implies multiple people) singing at the same time.
Here's some random example from Wikipedia (from the page Four-part harmony):

In it you can see 4 voices that would be sung by at least 4 different people at the same time.
Comment: Good point, however, it's not unusual for hand-written scores. Another thing that I forgot to mention: occasionally song scores use multiple notes with the same stem to indicate that in different verses different notes can be chosen, or that back vocalist can pick the alternative note to sing.
Comment: Notice in the OP's example, the stem is one way. In SATB, the T tails are up, B tails down.
Answer: Generally speaking (or singing!), a person only sings one note at a time. It's possible to sing two, but the vast majority would only sing one. I guess you have the choice here, sing mi, then do; or mi then mi again.


should I add a relay for headlight bulb

Question: I own a suzuki gixxer. The stock configuration of headlight is 12V 35/35W. Now I've upgraded it to philips extreme vision which is 12V 60/55W. Since the new bulb are 2x watts of stock configuration should I add a relay? I've already researched about this for the past 5 days both online/offline but all I get is answers on both sides.
Comment: Does the bike not have a headlight relay already?  Normally high draw items like the headlight already have a relay.
Comment: I don't know. I'm unable to find such thing already.
Comment: Well, you could call the parts department of a local Suzuki dealer and ask if your bike has one.  They should have a full parts catalog.  If there is one, see if they can tell you the Amp rating of the relay.
Comment: But both bulbs are 12v? So is external relay needed?
Comment: Maybe you're not sure what a relay does?  A relay is basically a heavy duty switch that can be controlled by a smaller basic switch (simplified explanation).  For instance instead of needing a large switch on the handlebars for the headlights, you could have a small, compact switch that controls a relay that actually switches the high wattage bulbs.  I'm saying the bike _probably_ has a relay already since headlights are already a high-wattage item.
Answer: It would be prudent to add a relay as manufacturers have been finding ways to reduce total weight and one method has been to use wires of the minimum thickness for each component.
So, fit a relay and avoid a possible problem and also give the new bulb a better supply as there will be fewer losses.
Comment: another trick could be just put the new bulb in and turn on (not recommended) and see if the headlight fuse blows or wires to headlight becoming warmer. If the fuse blows or wires started getting hotter then you should use a relay with proper amperage
Comment: @Nilabja and when you do that and the wire melts you give me and my other electrician friends lots of expensive work repairing it.... Better to err on the side of caution and fit the relay.
Comment: thats why I said not recommended :P
Comment: not good practise to suggest bad practise... and you only put that - the most important part in parentheses... as if it was not important.
Comment: I do not know how to put that in bold characters
Comment: well putting it in brackets was not the way to go...
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/66529/discussion-between-nilabja-and-solar-mike).

should I add a relay for headlight bulb


Current sense resistor using PCB tracks

Question: I want to save up in buying a sense resistor and just use the PCB tracks. I need to sense up to 2.5A and I wanted to design the trace so it has a 0.1 ohm resistance. Is this a good approach? Also, can anybody share the calculations about how to determine the track length and width assuming a 1 Oz copper thickness?
Comment: It is unlikely to work with any accuracy or repeatability. First copper has a temperature coefficient you have to deal with. Secondly the PCB house will plate the copper providing even more variance. Buy the sense resistor.
Comment: That's 0.25V drop and 0.6W of power loss. Are you sure you need that much? Typical hall sensors have about 1mOhm resistance, that resolves into 2.5mV feedback. Now, if you OK with that it changes a lot in calculations provided in many answers below. Especially if you do not need high precision.
Comment: This can be done but you will need fine gain and offset trim. Also the first time you have severe over current the trace will vaporize. Also board houses will do their best with dimensions, but if they get it to within 1% that is very good.
Comment: Thanks guys! I will buy a sense resistors then. Yeah actually 100mohm is too much I will use 47m instead
Answer: The two main drawbacks are accuracy related: initial tolerance, and temperature coefficient.
Initial tolerance
PCBs are made to loose tolerances. The copper thickness is nominal, not accurately controlled. Even the etch width is subject to large variations. You might achieve 20% cross-sectional area accuracy to start with if you're lucky, much worse if you're not.
Temperature coefficient (tempco)
Pure metals have a steep tempco, copper is 0.4%/C. That's a 10% change in resistance for a 25C change in temperature. Resistors are made from alloys which have been designed to have near zero tempco.
For detecting whether a current is flowing or not, or perhaps even for the current sense element in a current-controlled converter where it's within a feedback loop, it might be OK. For measuring anything with any semblance of accuracy, use a discrete current shunt resistor.
A discrete resistor will have much higher power handling than a track. And if you should overload it catastrophically, it can be replaced, whereas losing a track would trash the board.
Answer: First, let me say that I agree with all the answers already provided. However, with a simple change of requirements this solution might not be as outrageous as it sounds.
The design parameters provided by author resolve into 0.25V drop and 0.6W of power loss. This is way too much, considering that normal current sensors operate from as little as 1~10mV over resistors in 0.6~5mOhms.
If voltage differential of 1-10mV is compatible with whatever circuit is planned then required copper length reduces to centimeters, if not millimeters. Now, if the PCB already has power trace from input to output, why not tap into it for current sense? The voltage differential is already there! The argument that burning that trace will destroy PCB becomes void immediately.
Second most voiced argument is thermal coefficient. Very valid point. However i suspect that power trace on PCB will have much higher thermal dissipation capacity than a resistor. In fact, if done right it will be ambient. Still not precise enough, of course, but we haven't seen the requirements. As @neil-uk pointed out, there are applications where detecting current flow is enough. Or sudden spikes at currents several times above normal (e.g. motor stall).
Another argument is initial trim. Yes, in mass production it won't be plausible. But for one-off project it can be easily done with some careful application of fine sandpaper.
In short, just as others I would not recommend this. But I believe it is doable and acceptable in some specific circumstances.
UPDATE
Was reading app notes and stumbled upon AN894 from Microchip. On page 3 you  can find "Figure 3: PCB Shunt Resistor" as a valid option for designs where high precision is not required.
Comment: You actually were very helpful. And a little off-topic: I wonder if one day I would see a PCB with all passive components replaced by cleverly arranged traces :D
Comment: @Maple that is what is in its core what an integrated circuit is about. Yes we could do this its just not practical at the moment.
Comment: I think that trimming in software is also a very viable solution, in development or even in a production environment.  Have the unit measure volt drop, use test jig report actual current and calculate calibration constant(s).   Board temperature may be known or perhaps even a useful thing to monitor so the temperature correction can be compensated for as well with not too much code.
Comment: @Maple you are probably right but OP does not say.  I knew of a designer who would spend weeks to try and remove a resistor from a simple garage door key fob to reduce the BOM by a couple of cents.  This circuit had a discreet radio circuit and a PCM digital code hopping modulator IC that cost way more than the one resistor.  To stay competitive he had to optimise every thing and eventually moved his business and family from South Africa to Spain to reduce cost of shipping this core product to Europe.
Comment: Agree with you. I hope my answer did not come across as saying it couldn't or shouldn't be done. It was more intended to give the OP tools needed to figure out if it would work.
Comment: @Maple -- ask a microwave bloke sometime...
Comment: @KalleMP If OP wants to save on one resistor I don't think we are talking digital project here. Measuring board temperature is definitely not in the picture. The whole point of this exercise is balancing simplicity vs precision.
Answer: Copper resistors increase in resistance with temperature. It is about 0.4% per degree C. That makes them poor resistors. But perhaps you are OK with it. Just keep in mind that a 25 degree increase in temperature will give you a 10% increase of resistance.
In principal, if you had a way to measure the actual resistance, or a way to know the temperature of the trace, you could compensate for the temperature change. Usually that is not practical.
The way to calculate the resistance of a metal resistor with uniform cross-section is as follows:
R =  ρ * l / A.
R is the resistance, ρ is the bulk resistivity of the material, l is the length of the resistor, and A is the cross-sectional area of the resistor. For a trace, the cross-sectional area is trace thickness * trace width.
For copper, ρ is 1.72 * 10^-8 Ohm-meters. So use meters for all your widths and heights and lengths to avoid mistakes with units.
Hope that helps you evaluate whether to use a copper sense resistor and also how to calculate dimensions that might work.
Answer: Ok, let's see. There are two things.
First, for 2.5 A ampacity the trace width must be at least 42 mils, according to BITTELE calculator. Now, to get to 0.1 Ohm, the trace length must be about 8.3 inches. I am not sure if the cost of PCB space can offset the cost of a $1 resistor.
Second, there are manufacturing tolerances. The plating thickness may vary, and there is over-etch making the trace narrower. So the value of this shunt will vary from board to board. To get to typical 0.5% - 0.1% chip resistor tolerance, you would need to employ individual calibration of your resistor, which will cost a lot.
Now you decide if this is a good idea to use PCB trace instead of guaranteed $1 SMT resistor.
Comment: Ampacity ratings assume long traces. A short arrow segment connected to wide traces on both ends will use those wider traces as heat sinks and not be heated as much as the ampacity table assumes.
Comment: @ThePhoton, for a given set of parameters (copper, 100 mOhms) the 1-oz trace will have aspect ratio of  1:200, no matter how do you slice it or stretch it. This will be a LOOOONG trace, and your remark doesn't apply.
Answer: You can probably do this on a ceramic subtrate pcb. On normal FR4 you can do it, but the tolerance will be bad and the temperature coefficient will be horrible.
For 2.5A, and 0.1 Ohm you'd need 275mm of 1mm trace.

Saturn PCB toolkit.
However, I recommend a current sense resistor, or a hall effect sensor from Allegro MicroSystems or similar.
Answer: The other answers have covered pretty well the how of this. Basically just use a calculator to figure out the trace width and length. But I think these comments are overly cautious. If you're just trying to detect a motor stall, over-current, or something like that I'd say it's fine. I've done this successfully before.
You should figure out what kind of accuracy you need. If it's very low (it should be, given this method), then figure out how much you can reduce the shunt voltage and still get that accuracy. If you start with a low vRef, and then settle for only 10-20 points of resolution you should be able to get the shunt resistance way down.

Current sense resistor using PCB tracks


Clearing Screen Layout List

Question: I have two items showing on my screen layout drop-down list (blender 2.71). Clicking on them takes me to the file browser screen, where the screen layout list doesn't show, so I can really delete them. If I click Back to Previous, it takes me to the addons screen.
How can I get rid of these two items, or clear the screen layout list?
Answer: The following code will remove all screens from bpy.data.screens except the last one (because there must always be at least one screen):
import bpy

for screen in bpy.data.screens:
    bpy.ops.screen.delete({'screen': screen})

There is no RNA method to remove screens. In general, you shouldn't deal with screens a lot with Python scripts, because the API is incomplete and not fully working (joining is buggy and requires coordinates of the split/join widgets for instance).
Modal areas like the file selector a special, as well as other maximized areas, which create a additional, temporary screen.
Comment: Thanks for the reply CoDEmanX. Unfortunately, the code didn't work, because for some reason, Blender doesn't recognize these two screen names in the list as layout screens. It deletes the current screen layout. Is there any other way to reset the screen settings to the default Blender list?
Comment: I just replaced the startup.blend file with one from a previous version I had, and that fixed the problem. Thanks anyway.
Comment: there is actually no default set of screens, as in from the factory settings. the ones you call default screen come from the startup.blend as you already discovered. It's not ideal IMO this way, but there is currently no other way than to replace that .blend
Answer: You say it takes you to a file browser screen. Change the window type to the Info type instead of File Browser in the header. If the header isn't visible, there should be "+" to make it visible again. Once you have the Info screen header you should be able to delete that screen layout type. Repeat as needed for other layouts.
Comment: if the area is maximized, then it's impossible to change the space type. you need to use the back to previous button.
Comment: That's correct, the area was maximized so I couldn't change the type. But when I used the previous button, it took me to a maximized addons screen. The only way I found to fix it is replacing the startup.blend file.

Clearing Screen Layout List


How did Dragon Ball "break the internet"?

Question: Having a discussion with some people who are saying Gokus MUI transformation and DBS are the best in all of anime because it broke the internet. What does this even mean? Did manga sales reach some sort of high or was there a huge amount of viewers or something?
Answer: Somewhat a hyperbole but not far from the truth.
Due to simulcast nature of streaming sites like Crunchyroll, sometimes, a surge in views can break a streaming service.
Here are just two news reports I found in 2018 and 2017 at a cursory search. Both refer to the Dragon Ball Super's hour-long special, although it may have happened elsewhere.

How did Dragon Ball “break the internet”?


What color swatch to use for cut lines?

Question: I'm designing some signage that will be printed and cut with a CNC machine. What would be the best color swatch to use for the lines that should be cut?
Answer: The industry standard for die-cut lines on laser cutting machines are as follows:

Red stroke: RGB (255,0,0)
Stroke weight: to 0.01mm / 0.25 pt

That being said, it's always a good idea to double check with the company you're planning on sending the vector files to just to make sure they use the same standards.
Sources:
File Setup GUIDELINES: CUT LINES - (red)
Drawing Resources: Adobe Illustrator CS® - Laser cutting lines
How to set a dieline (Keyline, die-cut) to spot colour?: FOLD/SCORE LINES
Comment: It's possible depending on the software the cutter is using. You're best bet would be to contact the company just to be 100% certain.
Comment: Thanks, does the same generally apply when its a mechanical knife/saw?
Answer: This may be an outdated method considering almost all production facilities have the programs to access and export the final art files as they like, but I was taught to:

create a spot color named "die-line"
export as postscript "seperation host-based" (include spot color "die-line")
export as postscript "composite"
convert to PDF using acrobat distiller
send to production

What color swatch to use for cut lines?


Is it ever posible to win if the only pieces left are two kings and a knight?

Question: If the only pieces left on the board are the two kings and a knight, is it ever possible to force check mate? I mean, if the bare king avoids the edges and stays close to the opponent's knight, I don't see how the game can ever end. I was in this situation for more than half an hour yesterday and we were forced to draw.
Comment: http://chess.stackexchange.com/questions/1239/is-it-possible-to-checkmate-with-knight-and-king-against-king
Answer: No, it is not possible.
The knight simply does not cover enough space to checkmate the black king.
When a position with insufficient material to checkmate occurs, a draw by insufficient material is declared.
Draw by insufficient material is declared when, and only when:
K vs K
K + N vs K
K + B vs K
Technically, a king and 2 knights versus a lone king can still result in checkmate. However, here the black king has to be dumb enough to cooperate and go into a corner and be checkmated. And so it is usually declared a draw by insufficient material.
Comment: I think in the OP's scenario, a helpmate would be possible.  If White has a king at h8 and knight at f5, and Black has a king at f7, and knight at h4 (a position the players could easily cooperate to achieve), that would allow 1. Nh7 Ng6++
Comment: Ooops.. I misread the question as both players having a king and knight each, which is an interesting scenario.
Answer: No, it is not possible to checkmate with a lone knight (K+N vs K).
However, Add another Bishop and you'll be able to Checkmate (K+N+B vs K)
There is a rule in Chess which goes like this "No Mating material = Draw"
So:
K vs K = Draw
K+N Vs K = Draw
K+B Vs K = Draw


Should I save scanned images of 35mm slides from a Nikon scanner in JPEG or Tiff?

Question: I am scanning 35mm color slides, some 50 years old, with a Nikon scanner. Should I save the scanned image in jpeg or tiff format for saving on archival CDs?
Answer: JPEG is lossy, so the image loses some detail, but the file size may be smaller and compression and extraction can be faster. Wikipedia states, "[It] somewhat reduces the image fidelity... JPEG is also not well suited to files that will undergo multiple edits, as some image quality will usually be lost each time the image is decompressed and recompressed."
TIFF images are larger, but do support lossless ZIP and LZH compression.
If you use or ever plan to use high-end image editing tools (e.g. Adobe Photoshop), TIFF would be preferable. If you're concerned about disk space, JPEG might offer an advantage, though at the expense of image accuracy. JPEG's are also the most convenient form for using on a website or for sharing with friends.
One other option: have the photos scans saved in both formats, or at least in TIFF, and then use any of a number of free (e.g. IrfanView) or commercial utilities to convert to JPEG as you want to share them. It is easy to convert a batch of them. That way you'll always have the maximum-fidelity TIFF to fall back upon.
Comment: Thanks. With re to your comment about multiple edits and losing quality, do multiple viewings of photos on a CD meet your definition of multiple editing? Once I complete the editing at time of scanning/saving, I don't plan on further editing.
Answer: For archival purposes it makes sense to scan in a lossless format. Depending on what software you are using, you can save NEFs from Nikon Scan, or RAW from VueScan. I prefer that latter, because it saves the actual data coming from the sensor, thus allowing for lossless editing in the future.
Comment: Thanks for your response. I'm using a Nikon Coolscan VED scanner and the editing software that came with the scanner. I am scanning 35 mm slides, mostly Kodachrome, some Ektachrome. Some slides are 50 yr old. Once saved after scanning/editing onto CD's, I don't plan to edit further, but do plan to view them multiple times. Does that make a difference re what format to save them in?
Comment: @Bill : I would be saving NEFs for archival purposes, and JPEGs for viewing.
Answer: JPG: 8 bits per color channel, the data compression dismisses small details in the information provided by the scanner; i.e. the compression is "lossy".
TIF: Possibly 8 but also allows 16 bits per channel - Packbits, ZIP and LZH compressions are lossless.
For archival purposes I'd use TIF 16-bit.
The files may though become huge, especially in comparison to JPGs.
Scanning resolution:
Depending on actual model - a dedicated film-scanner of makes Nikon, Minolta, Plustek, Reflecta / Pacific Imaging come in somewhere in the range 3000 to 5000 dpi.
Note the difference between the SETTING in the software
and the ACTUAL result - the latter is the important and what I refer to above.
Even if you scan at a setting of 6400, 7200 or 10000 dpi (which some of the scanners allow) you won't get actual data above 5000 dpi, but rather a notch or two below.
From this follows that pulling up the scan dpi above a certain point (scanner dependent) is just a waste of time and harddisk space.
Comment: Thanks. I'm using a Nikon Coolscan VED scanner. It allows the choice of file size (MBytes) and Resolution (pixels per inch). What settings would you recommend in response to your comment? I am using the Nikon software that came with the scanner and don't plan to edit further after saving. Does multiple viewing of the saved photos on a CD constitute further editing?
Comment: http://www.filmscanner.info/en/NikonCoolscan5ED.html <- assuming that is the scanner you're using. If there is a "PPI" setting just higher than 4000 then use that for the highest achievable results. NOTE: This is a theoretical number, the actual result will depend on camera focus, and how well the scanner succeeds with focusing on the negative and other intermediate factors. 4000 dpi/ppi creates output in the vicinity of 22 megapixels under PERFECT conditions. Use any lower setting for less bulky files. Even 6MP is enough for A4 size prints (~12x8") at good quality - assuming "perfect" images.
Comment: `Does multiple viewing of the saved photos on a CD constitute further editing?` Ehh... no. You cannot normally change what has been written to a CD. Viewing an image is equal to reading it up into computer memory for display. The CD plastic ages, that is the only factor that might degrade or eventually destroy it apart from physically damaging the disk.
Comment: Thanks for your feedback. I plan to save the most valuable family photos on archival CD's. The others, I will periodically resave recognizing that CD's have limited life. My 35mm slides cover a period of about 50 yrs and the older ones, like me, have suffered some degradation.


Oil change on Volvo turbo

Question: I have a 2006 Volvo XC90 2.5 turbo with 175000 on it. I have kept up with maintenance totally. The other day I changed the oil and I used the normal Mobil 1 synthetic high mileage 10w/30 but this time I used 1 guart of Mobil 1 synthetic oil stabilizer along with regular oil I use. Well I started the engine to get the new oil moved around and it ran good but after checking oil level it was a little high about 1/4 inch above the upper mark on the dipstick and I heard a little slapping noise. Well today I went out to recheck it after I had ran about 40 miles around town and the level was ok but when I took the oil cap off to check on the slapping noise I hear a loud slapping sucking noise that was much worst than the other day. Help,have I ruined a $5000 engine? I used the correct amount of oil like I always do.
Bill
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Answer: No you didn't ruin your engine yet. However having more oil than thr max mark is bad. Can cause some problems. So i suggest you if the oil is too much to drain a bit. Also don't remove dipstick or oil cap while engine is running. Your engine is designed to pull a vacuum when the system is operating correctly. When you introduce an air leak you cause a change in the entire system which typically results in a rough idle and sucking sounds coming from inside the engine.
Comment: Thank for the info. I think I'm going to change the oil again and leave out the oil stabilizer.

Oil change on Volvo turbo


Is it possible to move the Tridion questions from other Stack Exchange sites to here?

Question: We have over 1000 Tridion specific questions on other Stack Exchange sites. Is it possible to move them to this site to prevent duplicate questions?
Comment: We could only do this after the site goes public. Also, can we prevent new questions from being asked on SO or ServerFault?
Comment: It's a shame you can't have questions in Stackoverflow tagged with #tridion automatically show up on the Tridion StackExchange site. I can see the Android tag is very populair in StackOverflow even though there is a dedicated site for it...
Comment: Would the plan not to be to select the cream of the crop and manually transfer them over to the new site with concise questions and answers to set a standard for the rest of the questions?
Comment: Yes, I wondered about this too. Seems a shame to have all of that valuable information in a different place
Answer: While it's technically possible to migrate questions, the migration paths are not set up until a site becomes well-established. But beyond that technical limitation, building this community from the old, pre-answered questions of another site would do this site a terrible disservice. That's not how you want to build this site.
Forget for a moment that other sites may not want their content removed like that (along with the the knowledge and reputation earned). Consider that, from day one, your brand new site will be filled with old, pre-answered anonymous questions, as the original authors are off on another site. Your tags will be inherited from another site, regardless of how this community wants to organize content here. Comments would be largely meaningless and scattered with links to another site. Voting wont reflect the activity on this community, which makes it difficult to build an avid higher-reputation community to watch over this site — Vote Early, Vote Often.
The idea of creating a site dedicated to Tridion is to build a community was supposedly not being well-served by another site. I wouldn't rush to simply migrate a lot of old content. Focus on building your own community. Give yourselves some time to figure out the scope and culture of this site. You should focus on building your own content with properly curated content, built with the community and expertise that genuinely belongs here.
That was the point of creating this site in the first place.
Comment: Thanks for this insight Robert, it indeed seems to make sense to focus more on the new than on the old right now.
Comment: Thanks Robert - I was worried about duplication of all the questions that are already out there, but you've provided a very compelling argument against moving questions here! We'll definitely keep the focus on the new site.
Comment: Now that our own site is already well-established, I think it might be time to revisit this issue. It's worth noting that the questioners and answerers on other sites like SO are in general the same people that you'll find here. We used to use SO, SF etc., until we had our own site, and then we moved here.
Comment: @Dominic unless those questions are deemed off topic elsewhere, we have no cause to remove them from another site, along with the reputation those users earned there. See https://blog.stackoverflow.com/2012/03/respect-the-community-your-own-and-others/
Answer: How to migrate question to programmers.stackexchange.com indicates it is possible to migrate questions, but this site needs to be public first so it looks.
Which means we will have to go over the existing questions when this site goes live (if we feel that is appropriate). At that point we could also migrate the new questions being asked there (which means vote to close them as off topic). At the time being there isn't much we can do with preventing new questions from being asked in other SE sites.


How to tackle a mobile which fell into water?

Question: I have a Samsung J7 mobile which fell into water in a drum, how to repair my mobile phone at this situation? I also open next 1 hour but it did not work correctly.
Answer: The linked question is very good; the most important all aspect of recovering an electronic device that has taken a bath, is to remove or disconnect the battery. Supplying power to an immersed circuit causes corrosion and leads to failure. Most phones including phones with non removable batteries like iPhones can still be opened up and have the battery connector unplugged and it should be performed as a matter of urgency. The rest of the tricks should be secondary to this action. Always wise to keep a screwdriver set that fits your phone and a bottle of distilled water hanging around - few bucks off of eBay
Answer: Simply put it into a container of rice deep inside and leave it for 2-3 hours.And luckily you have J-7 it has a non removable battery so remove the battery and leave it in sun for 1-2 hours.It will definitely work.


Run RAID 0 on SATA 3 on Windows 7 Home Prem, already installed

Question: I have a Gigabyte GA-990XA-UD3 with one HDD connected to SATA Port #0. Can I install RAID 0 on #4 and #5 without totally starting over? To enable RAID for these, I set the On-chip SATA type to RAID and On-chip SATA port 4 and 5 to "SATA type". I have two 250 GB HDDs sitting in the bays I would like to run games on, but would like the OS on the single HDD. I was not thinking about this when I installed the OS, so I'm stuck in IDE. From what I have read it, seems like a nightmare but everything is until you've done it. My CPU is an AMD 990x, southbridge AMD 950.
Answer: I used Acronis TrueImage Home to do something similar. I had Windows installed on a 500GB drive in IDE mode, and wanted to set up RAID0 with a second one. To do this, I imaged the drive completely with TrueImage and created a bootable recovery disc, downloaded the RAID drivers from my motherboard's website and saved it to an external USB drive, and then with the TrueImage recovery disc, used "Universal Restore" to restore the disc image backup I just created. During the process, you are prompted to point it to the RAID drivers, which allows it to install them into the Windows image while it restores it. If you don't do that, Windows won't be able to boot. But if all goes well, after the recovery process completes, Windows should boot and everything should run just fine, as if nothing happened.
But just keep in mind that since you'll be using RAID0, it will double the chances of a hard drive failure killing your computer (since your data is spread across two drives instead of just on one), so be sure to make regular backups, just in case.
NOTE: I am in no way affiliated with TrueImage or Acronis. There may be other software out there that can do the same thing; I just had good luck with this particular one.
Comment: When asked the difference between RAID 1 and RAID 0: The number is how many hard drives can fail before your array breaks :)


Check your gas amount error ERC721

Question: I am trying to deploy contracts to Ganache for testing using Truffle, but no matter what I set gas price / gas limit / gas to both in truffle.js and Ganache itself, it always get check gas amount on the first contract and it errors out. If you need more info let me know
Here is the contract to deploy:
pragma solidity ^0.4.22;

import "../CheckERC165.sol";
import "../standard/ERC721.sol";
import "../standard/ERC721TokenReceiver.sol";
import "../libraries/SafeMath.sol";

/// @title A scalable implementation of the ERC721 NFT standard
/// @author Andrew Parker
contract TokenERC721 is ERC721, CheckERC165{
    using SafeMath for uint256;

    //Tokens with owners of 0x0 revert to contract creator, makes the contract scalable.
    address internal creator;
    //maxId is used to check if a tokenId is valid.
    uint256 internal maxId;
    mapping(address => uint256) internal balances;
    mapping(uint256 => bool) internal burned;
    mapping(uint256 => address) internal owners;
    mapping (uint256 => address) internal allowance;
    mapping (address => mapping (address => bool)) internal authorised;

    /// @notice Contract constructor
    /// @param _initialSupply The number of tokens to mint initially
    constructor(uint _initialSupply) public CheckERC165(){
        creator = msg.sender;
        balances[msg.sender] = _initialSupply;
        maxId = _initialSupply;

        //Add to ERC165 Interface Check
        supportedInterfaces[
            this.balanceOf.selector ^
            this.ownerOf.selector ^
            //this.safeTransferFrom.selector ^
            //Have to manually do the two transferFroms because overloading confuse selector
            bytes4(keccak256("safeTransferFrom(address,address,uint256"))^
            bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes"))^
            this.transferFrom.selector ^
            this.approve.selector ^
            this.setApprovalForAll.selector ^
            this.getApproved.selector ^
            this.isApprovedForAll.selector
        ] = true;
    }

    /// @notice Checks if a given tokenId is valid
    /// @dev If adding the ability to burn tokens, this function will need to reflect that.
    /// @param _tokenId The tokenId to check
    /// @return (bool) True if valid, False if not valid.
    function isValidToken(uint256 _tokenId) internal view returns(bool){
        return _tokenId != 0 && _tokenId <= maxId && !burned[_tokenId];
    }

    /// @notice Count all NFTs assigned to an owner
    /// @dev NFTs assigned to the zero address are considered invalid, and this
    ///  function throws for queries about the zero address.
    /// @param _owner An address for whom to query the balance
    /// @return The number of NFTs owned by `_owner`, possibly zero
    function balanceOf(address _owner) external view returns (uint256){
        return balances[_owner];
    }

    /// @notice Find the owner of an NFT
    /// @param _tokenId The identifier for an NFT
    /// @dev NFTs assigned to zero address are considered invalid, and queries
    ///  about them do throw.
    /// @return The address of the owner of the NFT
    function ownerOf(uint256 _tokenId) public view returns(address){
        require(isValidToken(_tokenId));
        if(owners[_tokenId] != 0x0 ){
            return owners[_tokenId];
        }else{
            return creator;
        }
    }

    /// @notice Mints more tokens, can only be called by contract creator and
    /// all newly minted tokens will belong to creator.
    /// @dev This function is optional, it isn't required by the ERC721 spec,
    /// and is not needed if the initial supply of NFTs is all that is needed.
    /// @dev Throws if msg.sender isn't creator, or if added tokens overflows maxId (uint256)
    /// @param _extraTokens The number of extra tokens to mint.
    function issueTokens(uint256 _extraTokens) public{
        require(msg.sender == creator);
        balances[msg.sender] = balances[msg.sender].add(_extraTokens);

        //We have to emit an event for each token that gets created
        for(uint i = maxId.add(1); i <= maxId.add(_extraTokens); i++){
            emit Transfer(0x0, creator, i);
        }

        maxId += _extraTokens; //<- SafeMath for this operation was done in for loop above
    }

    function burnToken(uint256 _tokenId) external{
        address owner = ownerOf(_tokenId);
        require ( owner == msg.sender             //Require sender owns token
            //Doing the two below manually instead of referring to the external methods saves gas
            || allowance[_tokenId] == msg.sender      //or is approved for this token
            || authorised[owner][msg.sender]          //or is approved for all
        );
        burned[_tokenId] = true;
        balances[owner]--;

        //Have to emit an event when a token is burnt
        emit Transfer(owner, 0x0, _tokenId);
    }

    /// @notice Set or reaffirm the approved address for an NFT
    /// @dev The zero address indicates there is no approved address.
    /// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
    ///  operator of the current owner.
    /// @param _approved The new approved NFT controller
    /// @param _tokenId The NFT to approve
    function approve(address _approved, uint256 _tokenId)  external{
        address owner = ownerOf(_tokenId);
        require( owner == msg.sender                    //Require Sender Owns Token
            || authorised[owner][msg.sender]                //  or is approved for all.
        );
        emit Approval(owner, _approved, _tokenId);
        allowance[_tokenId] = _approved;
    }

    /// @notice Get the approved address for a single NFT
    /// @dev Throws if `_tokenId` is not a valid NFT
    /// @param _tokenId The NFT to find the approved address for
    /// @return The approved address for this NFT, or the zero address if there is none
    function getApproved(uint256 _tokenId) external view returns (address) {
        require(isValidToken(_tokenId));
        return allowance[_tokenId];
    }

    /// @notice Query if an address is an authorized operator for another address
    /// @param _owner The address that owns the NFTs
    /// @param _operator The address that acts on behalf of the owner
    /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
    function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
        return authorised[_owner][_operator];
    }

    /// @notice Enable or disable approval for a third party ("operator") to manage
    ///  all your assets.
    /// @dev Emits the ApprovalForAll event
    /// @param _operator Address to add to the set of authorized operators.
    /// @param _approved True if the operators is approved, false to revoke approval
    function setApprovalForAll(address _operator, bool _approved) external {
        emit ApprovalForAll(msg.sender,_operator, _approved);
        authorised[msg.sender][_operator] = _approved;
    }

    /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
    ///  TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
    ///  THEY MAY BE PERMANENTLY LOST
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function transferFrom(address _from, address _to, uint256 _tokenId) public {
        //Check Transferable
        //There is a token validity check in ownerOf
        address owner = ownerOf(_tokenId);

        require ( owner == msg.sender             //Require sender owns token
            //Doing the two below manually instead of referring to the external methods saves gas
            || allowance[_tokenId] == msg.sender      //or is approved for this token
            || authorised[owner][msg.sender]          //or is approved for all
        );
        require(owner == _from);
        require(_to != 0x0);
        //require(isValidToken(_tokenId)); <-- done by ownerOf

        emit Transfer(_from, _to, _tokenId);

        owners[_tokenId] = _to;
        balances[_from]--;
        balances[_to]++;
        //Reset approved if there is one
        if(allowance[_tokenId] != 0x0){
            delete allowance[_tokenId];
        }
    }

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT. When transfer is complete, this function
    ///  checks if `_to` is a smart contract (code size > 0). If so, it calls
    ///  `onERC721Received` on `_to` and throws if the return value is not
    ///  `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    /// @param data Additional data with no specified format, sent in call to `_to`
    function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) public {
        transferFrom(_from, _to, _tokenId);

        //Get size of "_to" address, if 0 it's a wallet
        uint32 size;
        assembly {
            size := extcodesize(_to)
        }
        if(size > 0){
            ERC721TokenReceiver receiver = ERC721TokenReceiver(_to);
            require(receiver.onERC721Received(msg.sender,_from,_tokenId,data) == bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")));
        }

    }

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev This works identically to the other function with an extra data parameter,
    ///  except this function just sets data to ""
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function safeTransferFrom(address _from, address _to, uint256 _tokenId) external {
        safeTransferFrom(_from,_to,_tokenId,"");
    }

}

Here is my migration script:
var TokenERC721 = artifacts.require("../contracts/ERC721.sol");
var TokenERC721Enumerable = artifacts.require("../contracts/TokenERC721Enumerable");
var TokenERC721Metadata = artifacts.require("../contracts/TokenERC721Metadata");

module.exports = function(deployer) {
  deployer.deploy(TokenERC721, 2);
  deployer.deploy(TokenERC721Enumerable);
  deployer.deploy(TokenERC721Metadata);
};

Ganache is set to 10x max gas limit of mainnet (80M), and gas price is 1. I am putting in the uint value necessary in the constructor of TokenERC721, and I don't have any indexed bytes/strings.
Answer: Try adding the gas amount as a part of the deployer.deploy() function calls like so:
module.exports = function(deployer) {
  deployer.deploy(TokenERC721, 2, {gas: 6721975});
  deployer.deploy(TokenERC721Enumerable, {gas: 6721975});
  deployer.deploy(TokenERC721Metadata, {gas: 6721975});
};

This will define the amount of gas to be used on each of these transactions. You might need to modify the gas number based on your needs, but that should hopefully solve the root problem here.
Answer: Although you haven't included it in your question, the TokenERC721Enumerable and TokenERC721Metadata contracts both require constructor arguments.
The Enumerable one just takes an initial supply,
 constructor(uint _initialSupply) public TokenERC721(_initialSupply){...

But the Metadata one takes initial supply, name, symbol and uriBase,
constructor(uint _initialSupply, string _name, string _symbol, string _uriBase) public TokenERC721(_initialSupply){ ...

I'm not sure why this would be causing a gas error, so specifying the gas as in Shawn Tabrizi's answer may also help with that.

Check your gas amount error ERC721