How long does it take to mine obsidian with your hands?

Question: How long would it take to mine obsidian with your hands? I also want to know how long it takes underwater. I'm sorry if you think it has to little detail. I just want to know.
Answer: A lot.
250 seconds, according to the wiki:

Tool
Time (s)

By hand
250

Wooden
125

Stone
62.5

Iron
41.7

Golden
20.85

Diamond
9.4

Netherite
8.35

Times are for unenchanted tools as wielded by players with no status effects, measured in seconds.

Also, it technically wouldn't be mining obsidian, just breaking the block, as you wouldn't obtain any obsidian from it unless you use a diamond or netherite pickaxe.
As for the water, you need to multiply ×5 if your head is underwater, and another ×5 if your feet aren't touching the ground, for a total of 250 seconds × 25 seconds = 6250 seconds, or 1 hour and 44 minutes. That would be harsh...
Comment: Also, it takes around 26 hours to mine by hand with Mining Fatigue.
Comment: Is there any way to trap a player so that they're forced to avoid touching the ground while underwater?
Answer: Obsidian takes 250 seconds to mine by hand, according to the wiki. These numbers are the same for Java and Bedrock editions. Keep in mind that mining obsidian by hand will drop nothing.
Mining blocks when underwater takes 5 times as long when standing on the ground and 25 times as long when floating (see on the wiki), for a total of 1250 seconds (almost 21 minutes) on the ground, all the way up to 6250 seconds (about 1 hour and 45 minutes) when floating.
However, the Aqua Affinity enchantment removes this mining speed penalty when underwater.


What is the significance of using shevet vs. mattot in Parshat Mattot?

Question: In Parashat Mattot the word matteh is used in place of the more commonly found shevet?  Why is that?  They both mean tribes no?
Comment: I heard in the name of one of the rebbes of Lubavitch (I forget which) that a _mate_ is a branch, supple and fresh, whereas a _shevet_ is a staff, old and hard. (Or maybe vice versa. I forget.) The tribes of Jews are called both because sometimes we need to be supple, bending to our environment (e.g. to take lessons from others), and sometimes hard and intransigent. Or something like that, anyway. He also explained why _mate_ is used here (_Matos_) specifically, but I forget that part of it, which is part of why I'm not posting this as an answer.
Comment: Both words also mean "stick". I don't know, yet, if there's a relationship between these 2 words. Need to research.
Comment: @msh210 - "Mateh" is related to "Noteh". meaning "to bend". So, your explanation makes much sense. I'm giving you 1st dibs on trying to connect your (and, if you want, mine) into an answer. Dig further :-)
Comment: @msh210 - I think it's the other way around: a mateh is a staff, old and hard, and a shevet is a branch.
Comment: @msh210 likutey sichos page 194. Shevet is moist and is attached to the moisture/nurture of the roots, correlating to when us jews are close to Hashem and keeping his ways properly.     Matte is dried and becomes harder. When we go through tribulations it makes us stronger. This is used for when we aren't 100% following hashem.
Answer: Both words mean stick or rod, as in Ishaya 28:27 כי במטה יחבט קצח וכמון בשבט. The one strikes harder than the other according to flexibility.
The word שבט designates a tribe, whilst the word מטה is the pole that identifies the שבט because each tribe has its identifying flag, sign and/or name engraved on it.
Consequently, in Parashat Mattot, the tribes are called מטות because that is the way they camped in the desert, each tribe around its identifying pole.
Comment: Do you have a source for "The one strikes harder than the other according to flexibility."?
Answer: Rav Hirsch writes on Bamidbar (30:2) at the beginning of the Mattos,

The Torah enables individuals, communities, and the entire nation to
  establish for themselves permanent norms for ensuring the faithful
  observance of the mitzvos. For this reason this section is addressed
  particularly to the nesi'im who significantly are here called Roshei
  Matos. As already noted in our commentary on chapter 1, "matteh"
  conceives of the tribe as a branch of the larger whole, with each
  branch working through its own unique characteristics to carry out the
  mission shared in common by the entire nation. It was the task of the
  roshei hamattos to attend to the customs arising from the
  individuality of each branch, and to attend also to common activities,
  aspirations, and purposes. It was their responsibility to properly
  channel all of these to promote the fulfillment of the national
  mission in accordance with the unique characteristics of each branch.
  The means for such activity, the prerequisite for the development of
  the nation as a whole and for communal life is the binding force of
  vows and of regulations instituted by man which is was the laws that
  now follow deal with. In addition, roshei hamattos are entrusted with
  hataras nedarim. They function as family counselors and spiritual
  advisors coming from among the people themselves. It is for this
  reason too that the section on vows in addressed first to roshei
  hamattos.

On the other hand, Rav Hirsch (Bamidbar 18:2) writes,

מטה is the horizontal direction which looks on the tribe as a branch
  of the basic stem, accordingly being on a line with the other tribes,
  so being excluded from the actual priestly service and would only be
  allowed to be allocated to assist at subsidiary offices. שבט is the
  tribe as an independent stem, 'stave', hence the word itself is an
  expression of strength and power, as a rule is the designation of the
  tribes of Israel in their independent strength and value - שבטי ישראל
  not מטות  ישראל. So that שבט אביך is the tribe in which your father
  lives on in his specialty, your father who subscribes such an
  important quota to the Jewish national body, the tribe that by its
  unreserved devotion to the cause of God showed itself as the born
  guard of the Sanctuary. As שבט אביך, the Levites received their
  position and mission towards the people, which was represented by the
  guard of their camp round the Sanctuary in the wilderness, which
  belongs to the משמרת אהל מועד.

In these succinct words from Rav Yaakov Beasely:

The term "shevet" connotes power and authority.  However, the word
  "matteh," staff, is essentially a support (from the Hebrew root
  n-t-h).  In the context of a describing a group, it connotes mutual
  aid and sustenance.
Comment: Contrasting this with a relevant passage from Rav Hirsch explaining the distinctive meaning of _shevet_ would improve the answer greatly.
Answer: The Rebbe in one of his sichas (Shabbos Parshas Mattos-Maasei , 28th Tammuz, 5747) explains that the word mattos emphasizes the attribute of power and rigidity. The two words "mateh" and "shevet" both mean a "staff".

The two words "mateh" and "shevet" both mean a "staff" (and are both used for "tribe"). Yet there is a subtle difference between a pliable branch (shevet) and a strong staff (mateh). Thus, "Mattos" symbolizes that a Jew must be firm and strong — not bending even a hairsbreadth when it comes to principles of Yiddishkeit, Torah and mitzvos.
This is congruous with the Mishnaic dictum to be as careful in
fulfilling a minor mitzvah as a major mitzvah — for when a Jew is
truly connected to G‑d and wants to fulfill the will of the King there
will be no difference between minor and major, since G‑d has commanded
the mitzvos and desires that all of them be carried out.

The Rebbe continues:

When "Mattos" and "Maasei" are combined the strength of "Mattos" takes on the progressive movement of "Maasei" so that steadfastness and strength grows stronger and stronger.
At the same time the steady growth in matters of holiness attains an
aspect of strength and even those aspects of Jewish life which
represent only custom or greater piety are also invigorated and
empowered. So that all aspects of Shabbos Mevarchim Menachem Av are
enhanced and invigorated.
May the final "move" come speedily, and bring us to the Holy Land with
the true and complete redemption through our righteous Mashiach. Then
we will no longer be obligated to request favors of patronizing
gentile nations for we will live freely in our land under the rule of
the Jewish monarchy.
To speed this we must increase our activities in Torah and mitzvos,
including our fervent plea for salvation: "Speedily cause the scion of
Dovid Your servant to flourish...," and, as we say in the prayer also
on Shabbos and Yom Tov: "May our eyes behold Your return to Tziyon in
mercy."


Is Shakha-Bhed marriage prohibited? If yes then explain

Question: Is Shakha-Bhed (inter-Shakha) marriage prohibited? If yes, then explain why and where is it mentioned? Can a Rigvedi Brahmin marry a Yajurvedi Brahmin?
Comment: No, there are no restrictions on marriage between Brahmanas of two different Shakhas of the same Veda or Brahmanas of two different Vedas.  By the way, my Dad is the son of a Yajur Veda Brahmin and a Sama Veda Brahmin.
Comment: In general, a Brahmana man can marry a Brahmana, Kshatriya, Vaishya or even Shudra woman.
Answer: I'm not aware of any such restriction.
Shakas (and most other Vedic traditions) are the son's responsibility to carry out, not daughters, because that is how lineage propagates.
If a Rigvedi brahmin man marries Yajurvedi brahmin woman, then the Rigveda tradition is continued by that couple. If it is Rigvedi woman and Yajurvedi man, then Yajurvedi tradition is continued.
Also, once a brahmin completes study of his birth-Veda, he can study the other Vedas.. so they are not prohibited from learning other Vedas, hence I don't see why they would be prohibited from marrying women born in families whose birth-veda is different.


How to know if a Canon lens is compatible with my Nikon camera body?

Question: I am looking at this Canon 50mm lens
for my Nikon D5200. How can I be sure that this lens will fit on my Nikon D5200? The camera manual does not have a list of lenses that are compatible with the camera. Where can I find the information what lenses are compatible with my camera before purchasing the lens?
Comment: Also not a zoom lens. :) Zoom = variable focal length. Prime = fixed focal length. You are probably looking for the [Nikkor AF-S 35/1.8](http://www.amazon.ca/Nikon-35mm-1-8G-Digital-Cameras/dp/B001S2PPT0/ref=sr_1_1?s=electronics&ie=UTF8&qid=1412978029&sr=1-1&keywords=Nikkor+35mm+f%2F1.8+AF-S) or [Nikkor AF-S 50/1.8](http://www.amazon.ca/Nikon-50mm-NIKKOR-Digital-Cameras/dp/B004Y1AYAC/ref=sr_1_1?s=electronics&ie=UTF8&qid=1412978004&sr=1-1&keywords=Nikkor+50mm+f%2F1.8+AF-S). There is a cheaper AF/D (vs. AF-S/G) version of the 50/1.8, but it won't autofocus on a D5200.
Comment: Possible duplicate of [Can I use lens brand X on interchangeable lens camera brand Y?](https://photo.stackexchange.com/questions/62000/can-i-use-lens-brand-x-on-interchangeable-lens-camera-brand-y)
Comment: The link was to a Cannon 50mm lens - probably not what you are looking at for your D5200.
Comment: Chevy/Mopar...Oil/Water...Paper/Plastic...Windows/Mac...iOS/Android...Canon/Nikon... ... ... these are things that are more opposed to one another than things that play nice together.
Answer: In general, all camera brands have their own proprietary system for connecting lenses. Modern mounts are all bayonet style, which means they twist and lock rather than needing to screw on, as older lenses did. These mounts are not interchangeable, so you'll need a lens that matches your camera bodies.
Most brands have different sub-variants of their mount, usually because they've been around so long and there have been changes over time.
Nikon's mount is called the F-mount, and it's one of the oldest. However, there are a lot of variations over the years and many older lenses are not compatible. Of more modern lenses, the main thing you'll need to watch out for is that your camera body doesn't have a motor to drive lens focus, so if you want to get autofocus, you'll need a lens which has its own motor. (This was a big concern when the first such Nikon bodies came out and you'll still see a lot of fretting over it, but these days there are many such lenses and especially at the entry level I wouldn't worry.) Nikon has an in-depth article about lens compatibility on their site: Which Nikkor Lens Type is Right for Your D-SLR?
Canon's mount is called the EF mount, and also has a variation called EF-S. The difference is that the EF-S lenses are designed only for APS-C cameras — the normal sensor size at entry- and mid-range levels now and for the forseeable future. More on this at What is the difference between EF and EF-S lenses? The EF mount is relatively young, and all lenses include their own focus motor.
Pentax's mount is the K-mount, and it's generally backwards compatible back half a century. However, newer bodies lack some mechanical couplings that older ones did, making some older lenses work only in limited form.
Sony's DSLR mount is called the A-mount, and actually comes from Sony's acquisition of Minolta. It also has pretty good old-lens compatibility.
And Sigma uses an incompatible variant of the K mount for lenses for their own camera bodies, but also makes models in many of the other mounts. There are a number of companies that make third party lenses in this way, either by reverse-engineering or by licensing agreements. In addition to Sigma, some of these are Tamron,Tokina, Samyang, and Zeiss.
Also, this is all for DSLRs. If we get into the mirrorless realm, there's a whole new set of letters — but the basic fact is that generally each brand has its own mount. (The Four Thirds consortium, which includes Panasonic and Olympus is the main exception; those brands share a mount, and there are also options from other names, including Kodak — but don't be fooled, because the real Kodak went bankrupt and this is a new company trading on the name, a strategy which hasn't resulted in any good products with names from similar classic companies like Polaroid or Vivitar.)
Answer: The lens you've linked to is the Canon EF 50mm f/1.8 II. It will not fit your camera, because it is a Canon EOS lens: neither the physical linkage nor the electronic contacts match those on your camera.  What you're looking for is a Nikon F-mount lens.
The easiest way to ensure you've got an F-mount lens is to buy a new lens that's Nikon-branded that is for dSLRs (i.e., not a Nikon 1 system CX lens).  Any new FX or DX lens will be compatible with your camera. However, only lenses with AF-S in the lens name will have autofocus function on a D5x00 or D3x00 body. AF lenses won't autofocus. This is because AF lenses don't have a focus motor, and the D3x00/D5x00 bodies don't have a focus motor, and you need at least one motor to autofocus.  If you upgrade to a D7x00 body, which does have a focus motor, then you can autofocus with both AF and AF-S lenses.
If you are shopping for third-party lenses from Sigma, Tokina, or Tamron, just make sure that you get the version that's Nikon-compatible, since those makers will create the same lens in multiple mounts.  If you're shopping used, you may need to compare a picture of the lens mount with one of the Nikon F mount.
If you go vintage/used, and are looking at lenses that are more than 20 years old, you may want to get some additional advice on older F-mount lenses, which may or may not have electronic communication with the body (non-CPU lenses), and which may not be compatible with higher-end cameras, if you're planning on upgrading in the future (pre-AI lenses).  These are still F-mount lenses, but can be problematic.
A couple other points.
The EF 50mm f/1.8 II is not a zoom lens.  "Zoom" means that the lens has a variable focal length. The EF 50/1.8 II is a "prime" lens--the focal length is fixed.
You are probably looking for the closest Nikon analogs to the Canon EF 50mm f/1.8 II: the AF-S Nikkor 35/1.8G or AF-S Nikkor 50/1.8G. There is the cheaper (older design) AF Nikkor 50/1.8D, but it won't autofocus on a D5200.
Answer: In general, you want to look at the lens mount.  Cameras and lenses both use some standard of connector to ensure compatibility.  In general, if a lens uses the same mount, it should be basically compatible, though some features may not work.  For example, third party lenses may not support automatic adjustments on newer cameras without updates.  Similarly, some older Nikon lenses can't focus on newer camera bodies that lack a focus motor built in to the camera.
The lens you have linked to is an EF lens which is one of two Canon mounts, so it would not be compatible with your Nikon which uses Nikon's F mount system.
Comment: Thanks. So basically I shop for lens with an F mount?
Comment: @Victor - yeah, basically, preferably one with electronic focusing as I don't think that model has a mechanical focus motor, but I'm not a Nikon guy, so I may be wrong on the focus motor part.
Comment: Thanks. By mechanical focus, do you mean manual focus? The camera has both auto and manual focus
Comment: @Victor - no, I mean mechanical focus.  While Canon's EF line has been electronic focus from the start, Nikon's F line had no focus motor in early lenses and instead used a motor in the camera body to focus the lens.  They later switched to electronic motors in the lenses and having the cameras communicate electronically.  Higher end Nikon's still have the motor for controlling the mechanical AF lenses, but some of the newer cheaper bodies do not.  If you put a mechanical focus lens on an electronic only body, then the AF won't work, but you will still be able to manually focus.


Backup-SPFarm or Backup-SPSite to backup a site collection and it's content database

Question: Should I use Backup-SPFarm or Backup-SPSite to backup a site collection with it's content database? Dont both of them backs up with it's content database?
Answer: Backup-SPSite

You can run it only for a site collection but it doesn't offer any backups at the Content Databases level.
If you want to back up multiple site collections then you will have to run it each time.
Backup-SPSite offers more level of granulity and scope which Backup-Farm doesn't offer.

Backup-SPFarm

For backing up all the content Databases, web applications, service application etc. you may use Backup-SPFarm because the scope is beyond any individual site collection.
It can't target the individual site collection within a content database, which makes it different from Backup-SPSite cmdlt.

If you have only single site collection to back up, then go for Back-SPSite
Comment: Thank you Falak. I think the keyword is "but it doesn't offer any backups at the Content Databases level." Now it makes sense why answer was was wrong. Thanks
Comment: Do not fully agree with "doesn't offer any backups at the Content Databases level" since the content is stored in a specific content database and that content will be saved as part of the backup so while yes, the full content database might not be saved if it's shared with other site collections, the relevant part will be. So for me, Backup-SPSite is enough. Cheers


Retrieve first two fields from the first column

Question: I want to convert this file in Linux...
1:a:A:G rs123
1:b:C:T rs456
1:c:G:A,C rs174

To this file...
1:a rs123
1:b rs456
1:c rs174

Would anybody know how to do this?
Thank you in advance!
Comment: can someone please tell why he upvoted this? this does not show any effort of the OP what so ever
Comment: If that's all you want, you can get it with `printf '%s\n' '1:a rs123' '1:b rs456' '1:c rs174'`. If you want a solution that can handle different input, you should describe all the variations that can appear. For example, could you have `1:a:a:G`, `1:A:A:G`, `1:a:A` or `1:c:G:A:C`?
Answer: If all input values are consistent , then just print all columns except those two :
awk -F'[: ]' '{ print $1":"$2"  "$5 }' inputFile

Answer: A few choices:
$ awk -F'[: ]' '{print $1":"$2,$5}' file
1:a rs123
1:b rs456
1:c rs174

This tells awk to use either a space or a : as the field separator and then to print the first field, a :, the second field and the 5th field.
$ sed -E 's/^([^:]*:[^:]*):.* (.*)$/\1 \2/' file
1:a rs123
1:b rs456
1:c rs174

Here, sed captures any non-: ([^:]*) from the beginning of the line (^) until the first : and the next stretch of non-: characters until the second :. Then, we match everything until the final space of the line and capture any characters after it. Finally, the whole line is replaced by the two captured patterns (\1 \2).
$ perl -pe 's/(.+?:.+?):.*\s(\S+)$/$1 $2/' file
1:a rs123
1:b rs456
1:c rs174

This is the same basic idea as the sed approach above but uses non-greedy regex patterns and searches for non-whitespace characters after the last whitespace character on the line.
Answer: Nothing wrong with @terdon solution but just for fun a gawk solution using
awk -F':[^a-z]+' '{print $1, $2}' file1

Composes IFS as a contextual regex which matches any contiguous string starting : followed by a variable length combination of anything except lower case letters [^a-z]+, which just leaves you with the two chunks you want.
Comment: Ha! I had never considered that we could use a negated character class in the FS, nice!
Comment: @terdon It's your fault for grabbing the low hanging fruit. Had to find something creative!
Answer: Apart from all the GNU coreutil solutions it would also work if you open it in vim and type
:%norm 0f:f:vf hd

followed by Enter.
What it does:
: gets you in command mode
% modifier to have norm run on all lines in the file
norm a command that can run on multiple lines and just does as if you typed what ever it is followed by in normal mode.
0 to get to the beginning of the line
f: to go to the next occurence of the colon symbol in the text (i.e. your field seperator. Do this twice to get to the beginning of the 3rd column
v to enter visual mode (because that makes selecting the stuff to delete a whole lot easier :-) )
f˽ (note the space!!) to go to the next occurence of the space (i.e. the other field seperator)
h to go one character to the left (so that we do not delete the space when we do delete our selection afterwards) and finally
d to delete the selected stuff


Linux image backup utility

Question: Can anyone suggest a linux backup utility that can take a copy of the state with the current configuration so I can boot with it or install it on an external/new partition on a different machine?
Answer: I used Deja Dup which is installed in Ubuntu by default.
It's actually a front-end of Duplicity which you can use if you prefer command line approach.
Of course, there are several other solutions so take a look on a list
here

Linux image backup utility


What is the size of the number 65535 in bytes?

Question: As I got to know there are 256 possible combinations to get for 1 byte. If I understand it correctly, it should mean that you can display any number out of numbers 0-255 and this very number would use only 1 byte of your storage on your computer. Displaying a number out of the numbers from 256 to 65535 would however cost you 2 bytes of your storage (if I understand it the right way). However after typing in the number 65535 into a text document and looking up its file size (the "information" about the text doc) I got to see that the used storage for this document was actually "5 bytes". Does anyone know what the reason for this could be?
Comment: It helps if you understand that 256 possible combinations mean that you can encode (represent) 256 different things in one byte (one at a time). It could be numbers from 0 to 255, or numbers -128 to 127, or characters A, B, C, D, ... a, b, c, d, ... and the rest of the ASCII code, etc. Bytes by themselves don't mean anything, you have to interpret them in some way. Your text document doesn't store the conceptual number 65535, it stores a sequence of individual digits, like letters in a word. It's the number 65535 *to you*, but to the text editor its just a sequence of character codes.
Comment: You did not save the number 65535 in the file. You saved the numbers 54 followed by 53 and 53 and then 51 followed by 53. These are five one byte numbers (since each character is a byte)
Comment: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comment: Closed as blatantly off-topic as this is not a software engineering question, it's a "how do computers work" question. Maybe a better SE would be [superuser.com](http://superuser.com)?
Comment: Now, a compiler, for example, can "understand" the text of a program, and figure out that some sequence of characters is meant to represent a specific number that should be stored somewhere in memory, and it will determine the amount of bytes needed based on the rules of the programming language (e.g. the type declaration, as mmathis pointed out in their answer).
Comment: If then the text document were saved as UTF-16BE, its file size would be 10 bytes.
Comment: Computers have different ways of storing stuff. Text documents, with only English text, are stored in a format that uses 1 byte per character. Inside a computer program, the number would typically be stored in a space of 4 bytes (and if the number doesn't fit in 4 bytes - too bad! the extra bits get deleted)
Comment: BTW, in today's world where AI is all the rage, it's easy to forget that computers aren't smart at all - they, in and of themselves, don't understand practically anything. An application, like a text editor, is a bunch of task-specific instructions for this unintelligent machine. Your text editor doesn't know *what* you're typing (what the strings of characters *mean*). E.g., in it doesn't know there are any numbers in "Archeologists discover a 1000 year old artifact", just as it doesn't know what "artifact" or "archeologists" mean. It treats everything the same way, even spaces.
Comment: @BlueRaja-DannyPflughoeft. This is not about "how computers work", it is about "how software works" and thus perfectly fine. The question is also perfectly clear. The reason given for closure is just lazy and borders vandalism.
Comment: It depends! If the number is considered within the fixed known range of 65535 and 65536, a single bit is sufficient to encode it. If it is an arbitrary positive integer, log(65535)/log(2) that is 16 bits i.e. exactly 2 octets are sufficient.If it is a signed integer, you'd need 17 bits at least.
Answer: TL;DR
The key takeaway here is that there is a world of difference between the number 65535 and a piece of text which represents the digits '6', '5', '5', '3' and '5'. It may look the same to you when rendered on a computer screen, but to a computer internally, they are completely unrelated to one another.
The rest of this answer is a lengthy elaboration on what that means and how it is used in everyday computing.

Data has a type. For example, this answer is a text type, known to developers as a string. A number is a different type. There are several number types, based on what it is you're storing (int for integers, uint for positive integers, long for bigger integers, float or double for decimal values, ...).
Why do data types matter? Well, it's sort of similar to why we have file extensions.
Based on the file extension, the file data gets read in a different way. You can easily test this by taking an .mp3 file, changing its extension to .txt, and opening it. You'll see that your OS opens your text editor, not your media player, because it bases its choice on the file extension of the file you're trying to open.
In that text editor, you'll see characters. It's not readable, but as far as your text editor is concerned, this is all valid. You can remove some characters, add some more, and save the file.
If you now change the extension back to .mp3 and play it, you'll notice that the file is damaged. Maybe it's totally broken, maybe it only has a small glitch in it; this depends on what you changed and how you changed it.

Cool trick:
Take a Microsoft Office file (.docx or .xlsx, not the older versions), change its file extension to .zip, and open it. Lo and behold, this is a perfectly working zip archive! Since the advent of the .docx (instead of .doc) and .xlsx (instead of .xls) filetypes, Office has really been storing all of its data using ZIP archiving methods.

Any file is really just a long sequence of binary digits. And how we interpret those digits is at our discretion. ASCII text encoding is one of these interpretations. It uses a character library of 256 characters, which means that it can get away with using a number (0-255) to denote a single character, and this number handily fits into the space of a single byte. So when a text file is opened, the text editor takes the file data, takes the data one byte at a time, interprets that byte as a number (which inherently ranges from 0-255, and then shows the character for that number.
As an aside, I could write my own file data interpretation. For example, I could use a file's data to generate an image which is 1px tall and is as many pixels wide as the file has bits, and generate a black pixel for every 1 and a red pixel for every 0 in the file data. It's a bit of an odd system, but perfectly viable if I choose to make an application that generates these kinds of images.
Or, alternatively, I could store my students' pass/fail on an exam using a simple stream of bits where 1 is pass and 0 is fail, and I know the order of my students based on some other data I've stored somewhere else (not in this file). This is a highly efficient storage mechanism in terms of data size, but it is also very inflexible in terms of storing additional information (e.g. absentees).
Back to ASCII. You can do this exercise by hand using an ASCII table to look up character values. If your file's first byte is 0100 0001, which is 65 in decimal, the text editor will give you an A character.
Following this, you can figure out what 5 letter word I wrote here in ASCII: 0100 0001 0101 0000 0101 0000 0100 1100 0100 0101. If you take each byte, convert it to a number, and look up what character that is, you'll see that the 5 characters are APPLE.
One very important thing to notice in that linked ASCII table is that it doesn't just contain letters (a-z and A-Z), it also contains all digits (0-9).
You'll notice that this answer focuses on text, not numbers. There's a clue in your question:

However after typing in the number 65535 into a text document and looking up its file size (the "information" about the text doc) I got to see that the used storage for this document was actually "5 bytes"

The data you entered was parsed as text, not as a number. You did not store the numerical value of 65535, you stored the individual characters (i.e. text) of 6, 5, 5, 3, and 5. Using the ASCII table, this means that your file contains 0011 0110 0011 0101 0011 0101 0011 0011 0011 0101, which is the same as the APPLE example, but this time using the characters 65535.
Here's an online converter so you can play around with this (you can press "Swap" to switch converting to or from binary).

In programming terms, your variable type matters, because it indicates to the compiler how your data should be stored, and how it should be handled.
int myNumber = 65535;
string myString = "65535";

In the first case, it will store your value numerically. 65535 (decimal) is 1111 1111 1111 1111 in binary. However, int is always 4 bytes, so it gets stored as 0000 0000 0000 0000 1111 1111 1111 1111. Total size: 4 bytes.
In the second case, it will store each individual text character, which we already know from before is 0011 0110 0011 0101 0011 0101 0011 0011 0011 0101. Total size: 5 bytes.
Now here's an interesting curve ball:
int myNumberPlusOne = myNumber + 1;
string myStringPlusOne = myString + 1;

In the first case, because you're dealing with a number, the compiler does numerical addition, and stores the sum (65535 + 1 = 65536) as a new number. myNumberPlusOne is therefore stored as 0000 0000 0000 0001 0000 0000 0000 0000, which is a value one bigger than myNumber. Total size: still 4 bytes.
In the second case, because you're dealing with text, the compiler appends the 1 to the text. Now, you're storing a 6-character string, 655351, which in binary is 0011 0110 0011 0101 0011 0101 0011 0011 0011 0101 0011 0001. Total size: 6 bytes.
Here, you can see why data types matter. We store things differently, and we also treat that data differently. Why? Because it makes sense to us that + on numbers means numerical addition, whereas + on strings means string concatenation (= appending).

To summarize, the key takeaway here is that there is a world of difference between the number 65535 and a piece of text which represents the digits '6', '5', '5', '3' and '5'. It may look the same to you when rendered on a computer screen, but to a computer internally, they are completely unrelated to one another.
Comment: "However, int is always 4 bytes" This is not true, my 16-bit microcontroller begs to differ!
Comment: The validity of `string myStringPlusOne = myString + 1;` also depends on what language/compiler you are using. Some compilers will happily implicitly convert that `1` to a character-type because you are clearly working with a String type and will assume that's what you meant. Others will give you an error because mixing character-types and numeric-types is not allowed. To reinforce your point: they're different data types.
Comment: I understand the drive to correct little imperfections in the answer, but this answer is kept simple specifically because it's addressed at a layman. The finer details do not help explain the core focus and edge cases are unnecessarily distracting to get the main message across. I do agree that my explanation is not 100% correct, but the omissions it makes are done to boil the answer down to the topic at hand and keep it as simple as it reasonably can be.
Comment: To be more precise, ASCII is just one encoding for a specific character set. Nowadays ASCII is used only rarely but it is a subset of UTF8 encoding for Unicode charset.
Comment: @Sulthan: Yep. I only went with ASCII here for simplicity's sake as its shorter set of characters makes it easier to parse when discussing the underlying binary data.
Comment: @GlenYates: Perhaps "`int` is always fixed width on any given machine; assuming a 4-byte `int` it gets stored as ..." (machine isn't quite accurate, you could have different C implementations on the same machine, but a lot closer to correct without making the phrasing too much more verbose.)  Unless we're talking about other languages where `int` *is* fixed-width 4 bytes, which might be the case in this answer because C doesn't have a `uint` type.
Comment: Minor nitpick: ASCII defines 128 values, 0 - 127.
Comment: @Flater submitted an edit to address Mr. Yates edge case, won't be offended if it's rejected though. Great, thorough explanation!
Comment: FWIW I think this is a well-written answer considering the level of expertise indicated in the question, and it was a smart decision to keep the answer simple, even at the expense of getting things right in the edge cases.
Comment: @GlenYates _"However, int is always 4 bytes"_ What I meant by this is that the size of the allocated memory does not change based on how many digits your specific numerical value needs (e.g. 14 needs 4 bits, 126 needs 7 bits, ...). OP's question seems very much rooted in the idea that there is an intelligent decision making about dynamic allocation sizes that minimize data footprint. While ints are not all 4 bytes in every system, their size in a given system is fixed. For the imprecision of not accounting for all possible systems, I refer back to my previous comment (two up from here).
Comment: Thank you for this amazing and interesting answer @Flater! I appreciate the time you spent on this explanation and am very thankful for it!
Answer: There are likely several variables at play here, but 65535 is 5 characters. 1 byte per character = 5 bytes. Text editors don't have a notion of what a number is the same way that your code does, so everything is (at a basic level) stored as a set of characters / a string.
When you write for example, C# code like
int number = 65535;
you're explicitly allocating 4 bytes of memory for that number - even though in this case it could use only 2 bytes. Similarly, you could write
ushort number = 65535;
and then only 2 bytes would be allocated.
But if you write
string number = "65535"; or string otherNumber = "65534"; or string anotherNumber = "95536"; they will all be the same size, and that size has no relation to what the number actually is (with a few exceptions).
When you write things to disk, these can all go out the window, as there are many ways of compressing / optimizing things for storage.
Comment: well, the length of a number presented in decimal does put an upper limit on the value of the number, it can't be bigger than 99999. But you could have 00123 or -4567 in addition to some numbers in the tens of thousands.
Comment: Strings and plain text files are usually encoded in ASCII or Unicode. One can say quite a lot about the size of those. Their sizes are also much more closely related to what the number actually is than the sizes of integral types, given that the number of bytes required to store it is usually a function of the length of the string, which is a function (log) of the number itself. Integral types, on the other hand, are usually a fixed-size regardless of which number you're actually storing in there (obviously assuming it fits, and a bigger integral type will use more space).
Comment: @ilkkachu: If you allow `-` as a character, then you could arguably also allow `9^9^9` which ups the limit dramatically :-) [link](https://www.quora.com/What-is-9-9-9-1) _"The 9th power of 9 is 387420489 (and I verified the result by hand). No one knows the precise number that is represented by 9 to the 387420489 power , but it begins 428124773….and ends ….89. The complete # will contain 369 x 10^6 digits, will use up 500 miles of paper and take years to read"._
Answer: As Thomas Weller noted, you can use less than 2 bytes if you restrict the number of possible expressions that you want to convey.
You could even use as little as one bit if you and your communication partner agree that 0 means I had a delicious scrambled egg for breakfast and 1 means 65535.
The minimum number of bits required to express some information (in a fixed size number of bits) is the base 2 logarithm of the number of possible expressions, see https://en.wikipedia.org/wiki/Entropy_(information_theory). You can always use less efficient encodings, of course, so 5 bytes is a possible size if you want to express the numbers 0..65535 as decimal ASCII digits, but having 5 bytes also gives you the possibility to communicate START, END, Glück, or {°_°}. Using 45 bytes you could express I had a delicious scrambled egg for breakfast and 65535 in a more readable form at the expense of some redundance.
Comment: If the number is known to be in a given range, you can encode it in a single bit (depending on the range) ;-)
Answer: The reason the file contains 5 Bytes of information is because the text (String) '65535' that you typed in is five characters long.
Each of those characters is very common, a digit, and is part of the infamous character set called ASCII.
Each character in ASCII is exactly 1 Byte long. Thus '65535' is 5 Bytes long.
Now if you want to represent the integer 65535 just as a number in memory then technically you would only need 2 Bytes yes. Many programming languages do have a data type specifically for that, typically called something like UInt16 or UShort.
In short, the difference is in storing a number as text (String) vs as an Integer in memory.
Comment: +1 For actually answering the question without delving into number theory etc.
Comment: If you *only* want to represent the number 65535, then you need 0 bits, since you are not actually encoding any information. You know that the value is 65535. If you only want to represent the numbers 65535 and 42 then you need 1 bit. Only if you want to represent all the numbers from 0 to 65535, you need 16 bits. Which still doesn't tell you how many bytes you need, because the size of a byte depends on the architecture. Historically, a byte has been 6, 7, 8, 9, 12, and 18 bits, but even today, there are still modern architectures with 1, 12, 16, 24, and 32 bit bytes.
Comment: Nitpick: ASCII is actually a 7-bit standard, so strictly speaking each ASCII character is not 1 byte long, and for that matter essentially nothing is using true ASCII anymore (in the Western world it's usually either Unicode or an ISO 8859 derivative, while in East Asia it's usually one of Unicode, GB 18030, Shift-JIS, or Big5).
Comment: @AustinHemmelgarn Still each character is 8 Bit long *in memory*. It would be a little awkward, given common circuitry in your CPU and RAM, to store data that takes up specifically only 7 Bits instead of 8.
Answer: A number is a mathematical concept which is not made of bytes. Bits or bytes only come into play when you want to represent (or encode) a number on a computer, and the amount of bits/bytes you need depends on the encoding, which in turn depends on the range of values you want to represent.

If you only ever need to represent a single number, there's no need to encode its value, so the amount of bits necessary is effectively zero.

If you only have a few possible values, you need to enumerate them, and that will cost you log₂(n) bits. For instance, if you only ever need 0 and 65535, you can encode either value with one bit.

If you need a range of numerical values, which is most useful for maths, you can use one of the standard numerical types. The benefit of using the standard types is that you get all the basic math functions for them for free, implemented either directly by the CPU or by the standard library. The smallest of such standard types on a PC for the C language would be uint16_t, which takes two bytes. If you also need negative values, you'll need int32_t, which takes four bytes.

Finally, if you need to be able to represent values besides numbers (e.g. abc), you'll have to go for strings. The leanest standard encoding which can represent digits is ASCII, which technically uses 7-bit characters, but most computers will store those in 8-bit bytes anyway, which brings you to 5 bytes, plus if you want to work with strings of different lengths, you need to encode the length of the string. In some formats, the strings are terminated by a zero byte (for a total of 6), in others, the length itself is encoded as a number.
Comment: Actually, the smallest unsigned arithmetic type in C is `uint_least8_t`.  The smallest that can represent 65535 is `uint_least16_t`.
Comment: @TobySpeight  That is correct in the sense that `uint_least8_t` is required to be present even if an 8 bit type is not available, in which case `uint8_t` won't exist. and `uint_least8_t` will be wider than 8 bits.
Comment: If you only ever need to represent a single number, you could theoretically fit that into effectively 0 bytes, but when/how would that actually be useful? To do anything at all with the number, you'd need to have the number in some conventional numeric data type, which would have a size proportional to the value of the number. This also largely applies to storing a few possible values. The only time I see when one could encode/compress the numbers to those sizes in a useful way would be if you're storing many elements that could only have one of a few values.
Comment: @BernhardBarker "To do anything at all with the number" implies some sort of arithmetic, right? Arithmetic requires a group to operate on, which means you want to be able to represent other values as well. A few possible values could be used to directly define an arithmetic if they include a zero element, e.g. (`0` = 0, `1` = 65535) allows you to do the math with a single bit XOR operation for both `+` and `-`.
Comment: "To do anything at all with the number" refers to arithmetic, sure, but also to outputting the number to anywhere (outside of the closed system that knows the mapping of the numbers). If I didn't already know better, I might've read this answer as suggesting, given a 1-bit variable representing 1 of 2 values, you can get the actual number out of it and use it with other variables over different ranges, which is not generally true. In my experience, encoding a number in this way would not be useful in like 99.9%+ of use cases, and most of the other 0.1% is just a compression problem.
Answer: TL;DR: With typical representations, it can vary from 2 bytes to 14 bytes.
You ask about the size of 65535 in bytes, and that depends on many factors.
A byte is a unit of 8 bits, that's easy and unambiguous. So, equivalently, we can ask about the size in bits. But what is a bit? That's complicated.
Information theory
In information theory, a bit is a unit of information content, and depends on the probability of a given event.
So, if e.g. the expected numbers can either be 0 or 65535, both occurring with the same probability, you get an information content of 1 bit, and an optimal machine representation occupies 1/8 of a byte.
If you expect any number between 0 and 65535 (with equal probabilities), it's 16 bits, and you can put it into two bytes.
If you expect text with five characters length, using printable US English characters (there are 95 different characters), you get 7737809375 possibilities, implying around 33 bits (if all charaters are equally probably).
Computing
In computing, a bit is a place that can be 0 or 1.
Typical data representations in computers come in two flavors: numbers and text.
Numbers
Data are stored as numbers if it's important to do computations.
Numbers in computers are typically represented using the binary system (base-2), with sizes of 1, 2, 4, or 8 bytes. A further distinction is whether you need negative values ("signed" types) or not ("unsigned").
Then

1-byte variables represent numbers between 0 and 255 (unsigned) or -128 to 127 (signed). Your number won't fit here.
2-byte variables represent numbers between 0 and 65535 (unsigned) or -32768 to 32767 (signed). Your number will fit into a 2-byte variable only if you can safely ignore negative values.
4-byte variables represent numbers between 0 and 4294967296 (unsigned) or -2147483648 and 2147483647. Your number will fit here.
8-byte variables represent numbers between 0 and 18446744073709551616 (unsigned) or -9223372036854775808 and 9223372036854775807. Your number will fit here.

So, with number representation, plausible answers for your number are 2 or 4 bytes.
Text
If it's important for you to treat the 65535 as 5 characters that just happen to be decimal digits, you choose a text representation. Then you can

easily access the individual digits, being 6, 5, 5, 3, and 5,
distinguish between 00127 and 127 (important if it's a telephone number, but not if you want to do addition or multiplication),
also have special characters, e.g. 65#35.

Text can be encoded in many ways.

ASCII encodes each character in one byte (or more exactly: 7 bits, leaving the highest bit zero), but only covers the characters from US English. Then you get 5 bytes for the 5 characters.
Various other old encodings also use 1 byte per character (ISO-8859 variants, many Windows code pages). Using all 8 bits of the byte allows for some non-English characters.
Unicode covers "all" characters from "all" scripts all over the world, but needs more than one byte per character. And it comes in various flavors:

UTF-8 is a variable-length encoding. It uses 1 byte for ASCII characters, and more bytes for others. As 65535 consists only of ASCII characters, you get 5 bytes here.
UTF-16 uses two bytes per character most of the time. Only some rare foreign characters don't fit in here and need four bytes each. Here your 65535 occupies 10 bytes. Because of the problem of endianness, UTF-16 comes on two flavors (big endian and little endian), and a byte order mark can be prepended to the text for clarification, accounting for additional two bytes.

A wide-spread convention for text is to add a NUL character to the end, serving as a marker that the text ends here. Depending on the encoding, this can occupy another 1 or 2 bytes.
If you write to a text file, the most plausible encodings are some ISO-8859 variant (or Windows code page) or UTF-8. Both will result in 5 bytes for your number (byte order marks are typically not used, and end of text is determined by the file system, not needing a special end marker).
Answer: What is a byte? Let's assume the modern eight bits.
What is the representation? What other values have to be possible in that representation?
Suppose we assume a pure binary representation which can handle all of the integers from 0 to 65535. In this representation, 65535 is represented by 16 bits: 1111111111111111. This requires two eight-bit bytes.
If the requirement is to have a representation that only handles the two values { 0, 65535 }, or any other choice of two numbers or symbols, we can encode that in as little as one bit: a fraction of a byte.
If we have to represent all integers from -65535 to 65535, using two's complement (or one's complement will need 17 bits, and that will require three bytes.
We can also think about handling the value 65535.0 in the smallest possible floating-point representation we can think of (which still resembles IEEE). The abstract mantissa corresponds to the binary representation and so requires 16 bits, valued 1. However, in floating-point, the leading 1 can be assumed and so it disappears: every nonzero floating-point value is 1.whatever x (base)^exponent: the 1 is always there, and so we don't have to dedicate a bit to it. Thus the mantissa requires only 15 bits. If we do not allow any exponent in our floating-point representation, only a sign bit, then we are back to 16 bits. But that's a "strawman" floating-point. Genuine floating-point should be able to float the point, so we need an exponent field. Not only that, let's make it a requirement that the exponent must actually encode the exponent value that is required, namely 65535 = 1111111111111111b = 1.111111111111111b x (10b)^1111b, as well as every lower exponent down to zero. Moreover, let's make it a requirement that negative exponents must be handled so we can represent small fractional values closer to zero than 1.0: all exponent values from -16 to +15. That requires a five bit exponent. Thus, in total, we need one bit for the sign, five bits for the exponent and fifteen for the mantissa: 21 bits. That fits into three bytes.
The number 65535 requires five bytes if it is represented as decimal t ext, where each of the digits is actually a digit character. In the USASCII code, which is a subset of Unicode, the digits 0 through 9 are represented by the character codes 48 to 57. In plain old seven bit ASCII formats, or 8 bit encodings such as the various ISO-8859-1 ("ISO Latin-1") encodings, these character codes occupy one byte each.
The character string 65535 could easily require more bytes of storage in memory if the string is made up of a character code point type that is wider than a byte. Other representational issues also arise such as meta-data: character strings have a variable length, and so an indication is required of where they end: a length field or null termination. In the C language, which uses null-terminated strings, the literal object "65535" claims at least six bytes of storage (on mainstream platforms): five bytes for the content of the string, plus an additional byte whose value is zero, indicating the end of the string. A wide-string literal, L"65535", whose elements are of wide character type called wchar_t, commonly requires twelve bytes (two-byte wchar_t) or 24 bytes (four-byte, 32-bit wchar_t). (Some specialized systems that still exist today, such as certain DSP chips, do not have a smallest addressable unit that is 8 bits wide. C compilers for those systems have a char type that may be 16 or 32 bits or whatever is the applicable unit.)


convert H264 video to raw YUV format

Question: Is it possible to create a raw YUV video from H264 encoded video using ffmpeg? I want to open the video with matlab and access Luma, Cb and Cr components frame by frame.
Comment: working command : ffmpeg -i input.264 -vcodec rawvideo -pix_fmt yuv420p output.yuv
Answer: Yes you can, you just have to specific the pixel format. To get the whole list of the format:
ffmpeg -pix_fmts | grep -i pixel_format_name

For example if you want to save the 1st video track of an mp4 file as a yuv420p (p means planar) file:
ffmpeg -i video.mp4 -c:v rawvideo -pix_fmt yuv420p out.yuv

Comment: -c:v and -c:a should be ok with recent version of ffmpeg, you may run an old one, consider to update your version if you can :)
Comment: First I got this error:
Unrecognized option 'c:v'

Then, I used "-vcodec rawvideo" instead of "-c:v rawvideo" and it's worked. Thanks!
Comment: @thang if you have keep timestamp + raw video frame, you can follow 2 different way. 1st, combine ffmpeg to decode the raw frame and ffprobe --show_frame (or something like that..) to dump frames information and grep their pts. After that interleave those 2 information source (I think I used a simple python script to read 2 procress stdout and mux them on the output) not that I also often parse an ffmpeg -i filename output to get resolution and frame-rate to build a fully independant and compact format for raw video data like that: W,H,FPS, PTS, FRAME, .... PTS, FRAME ...
Comment: Anyone else get a bunch of multi-colored lines? Also the conversion happens instantly which doesn't seem right to me...?
Comment: @JoshuaF.Rountree You need to specify the dimensions in order to be able to view it (e.g., in VLC): https://stackoverflow.com/a/22313305/2442139
Comment: working command : ffmpeg -i input.264 -vcodec rawvideo -pix_fmt yuv420p output.yuv
Comment: is there a way to store timestamps?

convert H264 video to raw YUV format


Cannot run mongodb v3.0.3 on ubuntu 14.04 32 bit

Question: (I know there are a lot of questions about this on stackoverflow and this site but no one fits my problem.).
I am a new recruit of mongodb. I am trying to install the v3.0.3 on my ubuntu 32 bit following their docs but cant get through it after issuing the install command. Googling a while, I learned that they do not prefer to use 32 bit but has a counterpart, to use the .tgz file I downloaded on their website for 32 bit.
I extracted the mongodb-linux-i686-3.0.3.tgz and place it to a folder on my desktop following their docs and the README inside the extracted folder.
When I issue the command ./mongod inside bin directory to start mongod i got this message
2015-05-14T10:50:47.416+0800 I CONTROL
2015-05-14T10:50:47.416+0800 W CONTROL  32-bit servers don't have    journaling enabled by default. Please use --journal if you want durability.
2015-05-14T10:50:47.416+0800 I CONTROL
2015-05-14T10:50:47.477+0800 I STORAGE  [initandlisten] exception in  initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2015-05-14T10:50:47.477+0800 I CONTROL  [initandlisten] dbexit:  rc: 100

This is my permission inside the extracted folder
drwxr-xr-x 3 repla replace  4096 May 13 14:06 .
drwxrwxrwx 4 replace replace  4096 May 13 14:12 ..
drwxr-xr-x 2 replace replace  4096 May 13 14:06 bin
-rw-r--r-- 1 replace replace 34520 May 13 14:06 GNU-AGPL-3.0
-rw-r--r-- 1 replace replace  1376 May 14 10:22 README
-rw-r--r-- 1 replace replace 22660 May 13 14:06 THIRD-PARTY-NOTICES

How to fix this guys? I am a mysql user and I do not know a thing about this. I really want to try this out because I want to try MEAN.
Thanks in advance.

Seems theres no one online so my immediate fix on this is to install the v2.4 of mongodb..
I followed the answer in this question How can I uninstall MongoDB and reinstall the latest version?
I just want to try mongodb to try MEAN.  If you have knowledge about my question, please post it.
Thanks!
Answer: Looks like the following is a viable workaround:

Create a folder /data/db/ and provide proper write and read access
Start mongo db using mongodb --journal


Get Url Alias in Algolia

Question: I have implemented an Algolia search in my drupal instance and would like to use the node url alias (/some-example-path) rather than node id (/node/{nodeId}). Is there a quick and easy way to do this using the Search API?
Answer: For D7: Under the Configuration -> Search and Metadata -> Search_API and then go to the Algolia Index and Filters tab (path will be like: /admin/config/search/search_api/index/algoliaindex/workflow, where algoliaindex is the machine name of your Algolia index), then under Data Alterations->Enabled data alterations check the URL field box.   This will add a field to your Algolia index called search_api_url.
TIP: If you want to be able to search for text anywhere in the node (not just in indexed fields, you can also check the Complete entity view option.  Under  Processors for Complete entity view use the HTML filter.  Under Processor settings at the bottom of the page, for HTML filter->Fields to run on check Entity HTML output and delete all contents from the Tag boosts field (otherwise it will index the boosts as well and you'll have to change your displayed search index values on the front-end).  This will then add a plain-text version of the node as a field in your index called search_api_viewed that you can display in your search results.
Answer: Using Search API in Drupal 8, you could write a custom processor to create dynamic custom fields which will then be indexed by Algolia, Solr or whatever Search API supports.
Documentation: https://www.drupal.org/docs/8/modules/search-api/developer-documentation/create-custom-fields-using-a-custom-processor
Answer: Use PathAuto module

The Pathauto module automatically generates URL/path aliases for
various kinds of content (nodes, taxonomy terms, users) without
requiring the user to manually specify the path alias. This allows you
to have URL aliases like /category/my-node-title instead of /node/123.
The aliases are based upon a "pattern" system that uses tokens which
the administrator can change.

For learn how work with it read How to Use Pathauto in Drupal 8
Comment: Thank you, I currently have Pathauto setup to allow for these, but the problem I am having is sending the url alias from drupal to algolia for indexing. I do not see an available field for these values to send to algolia. I am using the search api plugin to select the node fields I send.
Comment: @travisbrkr1234 which module you are using to integrate drupal with algolia?
Comment: I am using the Search API module to configure the index (https://www.drupal.org/project/search_api) and (https://www.drupal.org/project/search_api_algolia) to send the fields to algolia.
Comment: I suppose the better question would be: should I be extending the search api module to allow me to index the url aliases? or is there some way I can configure the content types to include a field that is the alias?
Comment: I ended up writing my own interceptor for the indexing service. I iterate through the associated nodes and pull the title from the node, clean it up and append it to a url string.
Answer: I wrote an interceptor for the indexing service. I iterate through the associated nodes and pull the title from the node, clean the title text of any entities/special characters and append it to a "url string".

Get Url Alias in Algolia


How do I log SSH port forwards?

Question: Say I have an SSH server, with port forwarding enabled. It's fairly simple for a user to set up an SSH connection and forward BitTorrent traffic or other illegal or abusive traffic over it. How can I set up logging to record what port forwards users make?
Comment: If you don't trust someone, it would almost certainly be better to simply not give them access to your network.
Comment: For any reasonable level of security, you'll need to make sure the same level of logging is available in all the other programs on your system which might be used to forward traffic - including programs that users write/compile themselves.
Comment: @Zoredache So the answer is don't give anyone access to your network?
Answer: I have used the patch on this web page (slightly altered) http://blog.rootshell.be/2009/03/01/keep-an-eye-on-ssh-forwarding/ to log ssh port forwards.
Answer: I'm asking a question here How can a SSH host process detect which ports have been forwarded by the client (-R not -L) to find a more elegant way to do this same thing.
However, since it's not looking like there is a better way, I do it with lsof:
sudo lsof -email@example.com -Fn -p99999 | grep "^n" | grep -v '\->' | awk -F: '{print $NF}' | sort | uniq
99999 is the PID of the sshd handling the connection you are interested in.
There are a few ways to make use of this snippet. Either have a long-running process that watches for new instances of sshd and then introspects them using the above command, or you prefix all .ssh/authorized_keys entries with a custom command which does this, logs it somewhere, then exec the original intended command (SSH_ORIGINAL_COMMAND or login shell in most cases).
Answer: you might try wireshark. I'm honestly not sure if it will do specifically what you want, but it can certainly determine what users are doing on the network. Spiceworks is another free option
Answer: netstat, ps and some clever cuting & greping. Netstat can give you the Program ID's and ps can give you the user.
user@myhome:~$ ssh email@example.com -R 12345:other.server:22

meanwhile in the other side of the console
email@example.com# netstat -plnt | grep 12345
tcp        0      0 127.0.0.1:12345         0.0.0.0:*               LISTEN     12998/15
tcp6       0      0 ::1:12345               :::*                    LISTEN     12998/15
                                                                                ^ PID!

Of course you won't know the port specified in grep, grep it's here to constraint my output
and
ps -aux | grep 12998 # the PID
user   12998  0.0  0.1   6624  1920 ?        S    07:57   0:00 sshd: user@pts/15

et voila! you know that user "user" is redirecting port 12345 using sshd
script & cron something using this

How do I log SSH port forwards?


Higher graphics card on a laptop with a lower one

Question: Are there any dangers to downloading a Higher graphic card on a laptop with a lower one. I have the geforce940mx (hardware) is possible to download something like the geforce/gtx 1050. Will it cause stuff like overheating or  slow machine?
Comment: You can't download a graphics card.
Answer: Your question seems a bit absurd. You can't download a graphic card. Maybe what you actually mean is download a driver for a graphic card which is better than the one you have installed.
If you have the wrong driver for your graphic card, it simply won't work. You can't magically turn your graphics hardware into a better one by installing different software. If you try, then the best case is that your system loses all 3d capabilities until you install a correct driver. In the worst case, your screen won't work at all and you will have to start Windows in protected mode, uninstall the faulty driver and install a correct one.
Most graphic chip vendors have switched to universal drivers which work with any graphic cards with one of their chips. They do so by auto-detecting which one you have and treating in the most ideal way possible. NVIDIA's Game Ready Driver is one of them. It will work with any NVIDIA graphic card from the past 10 years.
If you want to get more power out of an existing graphic card, then overclocking might be an option. But keep in mind that overclocking will increase power consumption and heat and can cause the graphic card to break earlier than it would usually do.
If you really want more gaming performance, then you would need to replace the video card. Unfortunately most laptops are constructed in a way that replacing the GPU isn't easily possible. They are often soldered right onto the mainboard. The intended upgrade path is buying a whole new laptop. That's why I prefer desktops. With a desktop system, most hardware upgrades just require a screwdriver and 10 minutes of your time.
Answer: First of all, a graphics card is a hardware. You can't download hardware, that's impossible.
If we could download hardware, we wouldn't need home deliveries anymore, since we could download everything instead: groceries, furniture, clothes, new PC parts, etc.
So I'm guessing you're talking about drivers instead.
Drivers are necessary for your OS (Operating System) to properly make use of the hardware installed in your PC. They're like instruction manuals.
Installing a driver for a different graphics card is possible, but meaningless. When your PC starts up, your OS will scan for any hardware installed, will then search for whichever driver matches the hardware's signature, and load only those. As a result, your new driver will never load, because there's no need to.
In theory, you could modify a driver, so it'll load for a different hardware. You should never do that unless you know exactly what you're doing, and if you did know, you wouldn't have asked this question. At worst, you will experience BSODs at startup, meaning you won't be able to start your PC anymore, leaving you with no other choice but to try and fix your mess in Safe Mode, or to simply reinstall the OS, or even buy a new PC altogether.
TL;DR
Only install drivers for hardware that is actually installed in your PC. Everything else is just a waste of your time and storage capacity.


Where are BitRay2 save games stored?

Question: I am trying to migrate my save games to a new laptop, but unfortunately Steam Cloud is not supported. Running a backup of the game through steam and opening this on another computer does not work either.
In the options of BitRay2 there is only the possibility to clear saved data, but not copy it.
Where are the save games located?
Answer: BitRay2 uses the registry to save certain information, including save games.
In HKEY_CURRENT_USER\SOFTWARE\DefaultCompany\BITRAY2 you can find a key named BITRAY2_LevelCount_h41656808. This stores the number of levels unlocked.
Copying the value from the computer which contains your latest progress to the computer where you want to reload your progress does the trick!

Where are BitRay2 save games stored?


rank of quadrics

Question: Consider the quadric $xw-yz$ in $\mathbf{P}^3$ (all over $\mathbf{C}$), and the Klein quadric $x_0 x_5+x_1 x_4+x_2 x_3$ in $\mathbf{P}^5$. I want to determine the rank of these quadrics. For the first I see that this quadric can be written as $s^T A s$ with $s=(x,y,z,w)$ and $A$ having entries $a_{14}=-a_{23}=-a_{32}=a_{41}=1/2$ and all other zero. From this I can conclude, since $\mathrm{rank} \ A=4$, that the first quadric has rank $4$ and similarily that the second one has rank $6$. So is this correct, both the result and the approach? Talking from experience, what would you say is the shortest way to determine the rank of a quadric? (I should note that I am mostly interested in a computational, i.e. linear algebra approach.)
Comment: @Peter: yes ${}$
Comment: What exactly is the "rank of quadric"? The rank of the defining (symmetric) matrix?
Answer: a) The rank of any smooth quadric in $\mathbb P^n(\mathbb C)$ is $n+1$.
b) If  the quadric $Q$ is not smooth, an elementary algorithm due to Gauss (who else?) linearly transforms  its equation to $x_0^2+\ldots +x_r^2=0\quad (r\lt n)$ and its  rank is then $r+1$.
In that case the quadric $Q$ is a generalized cone:
$\bullet$ Its base is the  smooth quadric $Q_0\subset \mathbb P^r(\mathbb C)=\{x_{r+1}=\ldots=x_n=0\}\subset \mathbb P^n(\mathbb C)$ given by the equations $x_{r+1}=\ldots=x_n=x_0^2+\ldots +x_r^2=0$
$\bullet \bullet$  Its generalized vertex is the linear subspace $ \Sigma_{n-r-1}=\{x_{0}=\ldots=x_r=0\}\subset \mathbb P^n(\mathbb C)$.
That linear subspace $ \Sigma_{n-r-1}\cong \mathbb P^{n-r-1}(\mathbb C) $ is exactly the set of singular points of the quadric $Q$ and it  is the union of all the lines joining some point of $Q_0$ to some point of $ \Sigma_{n-r-1}$.
Comment: Smoothness is very easy to check: just verify that the set of partial derivatives $\partial q/\partial x_i\; (i=0,...,n)$ of the homogeneous quadratic form $q$ defining the quadric have no non-trivial zero. This is elementary linear algebra since the partial derivatives are linear forms.
Comment: First of all thank you for your answer. I agree with your first sentence, however I actually want to prove that my quadrics are smooth by computing the rank. Sorry, I should have said that, this is also why I emphasized that I am interested in a computational solution. How would you otherwise prove that these quadrics are smooth?
Comment: I see, I forgot about that this also works for projective varieties. But apart from that, is my own approach valid? It is also rather short
Comment: Yes, your approach is valid.

rank of quadrics


Is there a way to send a task email from sharepoint that gets recognized by outlook?

Question: I see that there is a header MSWorkflowTask, is there any way to set that in an email that is sent via sharepoint designer? I would like to send a customized email that outlook recognizes as a task.
Answer: If it is a regular notification email, probably not, at least not from within SharePoint Designer. You would also have to create and populate several other headers such as X-Sharing-ItemID. It's best to let SharePoint format those for you.
But if you are just interested in emailing tasks to users and if your workflow is creating a task, you can customize the email with a link and ultimately manage it in Outloook. This page describes customizing those notification emails with Designer: http://office.microsoft.com/en-us/sharepoint-designer-help/send-e-mail-in-a-workflow-HA010239042.aspx
The sections you'll want to pay attention to are Include a hyperlink to the current item and Send your own custom task notifications.
A user can respond to those task emails like so:
http://office.microsoft.com/en-us/outlook-help/respond-to-a-task-from-a-sharepoint-site-HA010105444.aspx
Comment: No, I'm asking about how to send an email from sharepoint that will show up as a task from the workflow designer in sharepoint designer. I can send a normal email fine, but there is a special header that the tasks emails have that I would like to add. I would like to send *custom* emails that show up as tasks. Maybe that's not possible.
Comment: Sorry about that. I updated my answer accordingly. If that doesn't help I suggest adding more detail to your question.
Comment: Thank you, that is more what I'm looking for, but in their example they don't use the built-in outlook functionality of letting the user complete the task in outlook. They have a link to Sharepoint. The ones that are automated have a nice feature of letting the user complete the task entirely in Outlook, I was trying to replicate that functionality.


Can satellites travel in clusters?

Question: Last night we saw a large cluster of what looked like exceptionally bright stars that moved, as a group, across the night sky in Lancaster, PA. It was about 9:15 pm, and they moved roughly from SW to NE. There were 25 or 30 of them. They moved as quickly as a satellite I once saw, but were bigger and brighter. They were soundless and did not blink, and the relationships between the lights changed slightly as they moved.
We don't believe in UFOs, but can't we find any explanation via google.
Can that many satellites move as a group?
Comment: @arunvg The question was posted here in 2016. Considering that the first Starlink launch was in 2018 (of just two test satellites), I think it's fair to say that it is likely not  Starlink. However I can see why the mixup occurred, with all of the Starlink questions.
Comment: There are a number of questions like this. The stock answer is "We don't know" No natural phenomenon is exactly as you describe. Not satellites, planes meteors or re-entering space junk.
Comment: Any chance it is the Space X starlink . https://earthsky.org/space/wow-photo-video-spacex-starlink-satellite-train ?
Comment: Hey 2inLancaster, if my answer is sufficient, could you mark this question as answered?  Thanks!
Answer: Yes, they can.  The ships that visit the ISS often orbit near the station for several hours before docking.  Further, there are several satellites that travel in pairs or trios with other satellites.  The nearer the satellites are to earth, or the farther apart they are, the more difficult the task of maintaining spatial relationships between the spacecraft. This is because the spacecraft must be in the same orbital plane to travel together.  The most common configuration is where they are in the exact same orbit, with one satellites a few seconds ahead of the other along the same path.
Answer: We recently had a similar experience while staying in the Massa Lubrense region of southern Italy near Naples around July 10th, 2019. What we saw were about 40 or more satellites orbiting at what appeared to be the same velocity, as a group. There were 4 of us who witnessed this and had never seen anything like it before. They were not airplanes as there were no flashing lights. They appeared to be moving in unison as the relative distance between them did not change. They were moving at the approximate speed of an orbiting satellite (by comparison of ones I have seen before) and did not change direction while we were watching. I started counting and once I reached 40 they became difficult to see so I stopped counting. By the strict sense of the definition, yes - these were UFO's, however I don't think they were piloted by aliens. I do think they were satellites.
Answer: I can't answer your second question. Do you have a video of them? Why do you think they were in orbit? Are balloons a possibility? You say 25 or 30, did you observe them simultaneously or did they blink in and out? How long did you observe them, how far did they travel, and various other questions would need answers to even speculate... Now as far as your first question, the answer is no and yes. A ballistic orbit (not powered) will circle the Earth, and by "circle" I mean the path will be a great circle (which you can look up). This means that no two orbits (at the same altitude) are parallel everywhere. If they seem to be traveling together in parallel now, then their orbits must cross twice for every orbit around the Earth. So IF they were at the same altitude, they would have to be in orbital paths that intersected, so they would have to be staggered so as not to collide. At different altitudes, you can stack any number of satellites above one another. But it's very unlikely that this is what you saw, there's no reason to set up two dozen or more satellites in this type of configuration. Just based on your comments, perhaps what you saw was the break-up of a satellite. 25-30 satellites is an enormous number and the cost would also be extravagant (unless they were mini-satellites).
Comment: James - ok. Li - I went out afterward to take a video, figuring that whatever it was was orbiting the earth and would return. But the two of us didn't see it again.
Comment: Oops- timed out:   James - thanks- so not the breakup of a satellite, space junk, meteors, etc. Li - Two sensible adults saw the lights. I went out afterward to take a video, figuring that whatever it was was orbiting the earth and would return. But I didn't see it again. They moved as a group, did not blink, and were equally bright, suggesting that they were at the same altitude. They were about twice as large as stars.  Very odd.
Answer: As a guess, I'd say you were probably looking at a group of aircraft flying together, possibly helicopters. Usually you can tell aircraft at night because the have red and green lights and anti collision lights that blink, but I have occasionally observed aircraft flying with landing lights on, and could not make out the other lights until they were closer, or they had changed direction, making them stand out.I've never seen a UFO, although I once mistook Venus for one.
Comment: It's quite possibly just one aircraft: a large jet at cruising altitude with all its lights on (landing lights, logo-illumination lights, wingtip lights, etc) can easily be mistaken for a group of UFOs flying in formation.

Can satellites travel in clusters?


Search multiple tables Mysql

Question: I'm working on a advanced search functionality with php and mysql.
The tables are:
blogPost[id, title, description]

water[id, title, description,]

waterSpecie[id, waterId, specieId]

specie[id, name]

user[id, username]

What I want done is this:
The user will be able to search from a text field with a keyword, and the results should only be unique once.
For example:
The user searches for cod then I would like to show all the blogposts that has cod in there titles or description and all the waters that has cods in it and also if a user is nicked cod. But if let's say the blogPost has cod in its title and description I don't want it to show up twice in the results list.
But if only lets say the blogPost table has cod in its title I would only want to show that and nothing else.
I've managed to do it with this sql query: I would now like to add the blogPost table to that query and make it possible to search from it. So if only one table have cod I want to show only the result from that table.
SELECT DISTINCT W.lat, W.lng, W.municipalityId, W.title, W.description
FROM water AS W, specie AS S, waterSpecie AS WS
WHERE S.name LIKE '%$term%' AND W.id = WS.waterId AND S.id = WS.specieId
OR    W.title LIKE '%$term%' AND W.id = WS.waterId AND S.id = WS.specieId;

I hope I've managed to explain my problem and hopefully I could get some help on this issue.
Answer: You might try this:
    Select distinct tablename,id from
(select 'blogpost', as tablename, id, title as searchfield from blogpost
union
select 'blogpost' as tablename, id, description as searchfield from blogpost
union
select 'water' as tablename, id, description as searchfield from water
union
select 'specie' as tablename, id, name as searchfield from specie
union
select 'user' as tablename, id, username as searchfield from user) searcher
where searcher.searchfield='cod'

I don't exactly get what's going on with waterSpecie, so I've left it out.
You should get results something like:
tablename   id
blogpost     5
user        12

And then you can query the database to get the record from blogpost with id=5, and the record from user with id=12.
You'll be able to do this programmatically in your PHP.  And if you add a table that you want to add to the search functionality, you only have to do it by adding a UNION in the query below, rather than making a join and adding another piece to a WHERE clause.
I'm not sure that this would scale to Amazon.com size, so consult somebody better than me before you get that big.
Answer: You will be best served by simplifying your MySQL queries and combining results in your PHP code. The main reason for this in your case is that you want to combine dissimilar results - blog entries if they have the search term and/or waters and other things if they have the search terms.
In pseudo code, I'd do something like this (use a DAO in the real code, of course):
$foundposts = findblogposts($searchterm);
$foundusers = findusers($searchterm);
$foundwaters = findwaters($searchterm);
// etc

if($foundposts){
    print($foundposts);
}
if($founduers){
    print($foundusers);
}
if($foundwaters){
    print($foundwaters);
}
// etc

That way, you can handle the different formatting requirements you probably have to show blog posts correctly, and users correctly, etc.

Search multiple tables Mysql


What are the differences between contextual embeddings of Bidirectional-LSTM and Transformer?

Question: A Transformer, like Roberta, can generate contextual embeddings using the encoder part, similar to a Bidirectional-LSTM that concatenates hidden states. What are the differences between them ? Are there any advantages of Transformer contextual embeddings over Bidirectional-LSTM? Could someone please explain?
Comment: Are you referring to the differences between the contextual embeddings of Bidirectional LSTMs and contextual embeddings of Transformers or to the differences to the architectures themselves?
Comment: @noe, I'm asking about the differences between the contextual embeddings of Bidirectional LSTMs and Transformers. Are the contextual embeddings from Transformers better than those from Bidirectional LSTMs ?
Comment: @noe, I have edited my question to provide more details
Answer: Here are some differences:

Computational complexity: LSTMs have linear complexity $O(n)$, because you need to process input tokens one by one, while transformers have constant $O(1)$ complexity because all tokens are processed at the same time.
Memory: LSTMs have linear memory consumption because you only need to store the last hidden state, while transformers have quadratic memory consumption.
Training task: bidirectional LSTMs are trained on a (causal) language modeling task, while Transformer encoders are usually trained on a masked language modeling task.
Quality of the embeddings: in general, transformer-based embeddings are preferred quality-wise.
Research activity: LSTM's are a much less active area of research and so are LSTM-based embeddings, while transformers have been all the rage since 2017. This means that there are a lot of publicly available pretrained transformer models for embeddings and close to zero LSTM-based models for embeddings.
Comment: _transformer-based embeddings are preferred quality-wise_, but what makes the quality of the embeddings better in the Transformer ?
Comment: The performance in downstream tasks is better. Transformers are completely different from LSTMs, so there is not an identifiable "differential factor", it's just that the Transformer architecture gives better results in general.
Comment: Do you mean transformers, such as Roberta, were pre-trained on a large dataset before we could fine-tune them for downstream tasks? What about bidirectional LSTMs, are they also pre-trained on a large dataset ?
Comment: Yes, transformers such as BERT and RoBERTa are pre-trained and you can fine-tune them for downstream tasks. Bidirectional LSTMs like [ELMo](https://aclanthology.org/N18-1202/) are also pre-trained.
Comment: Is there any paper or article supporting the claim that transformer-based contextual embeddings are preferred in terms of quality over bidirectional-LSTM, since both architectures can output contextual embedding ?
Comment: Yes, check out [this paper](https://aclanthology.org/W19-4302/). However, only a few papers are comparing transformer-based and bidirectional LSTM-based contextual embeddings because, very soon, transformer-based approaches became the norm and LSTM-based ones were no longer attractive.
Answer: transformer tech is evolved version of LSTM/rnn based tech by improving on speed and quality. particularly the tokenization, pre-training method, multi-head attention, longer input size are improved or newer techniques from lstm based models. Tokenization addressed issue of scarceness. multiple attention heads to capture different types of inter-relationships between tokens such as morphological, syntactic, and even deeper semantic. This makes the embedding better in terms of how effectively it represents the semantics of the tokens in the given unique context. training on longer sequences captures very refined differences in meaning than older models.


Runs with debugger but not standalone, using ATSAMD10D13 and Atmel ICE

Question: I made a custom board with 2 ATSAMD10D13AM parts. The are 8k flash/4k sram Cortex-M0 24QFN parts.  When I power the board the IC's start but then freeze (I have LED's blinking that go solid). When I attach the debugger and start debugging, it runs fine. The debugger senses power and does not supply it. The code is modified reference design code for the Xplained Mini, it uses the same part except 16k flash. I am pretty sure I changed the part everywhere. I think maybe the ramp isn't perfect. It is supposed to be 25us or greater from 0 to 2.5V. I will measure it with a scope. Otherwise what could it be?
Comment: (a) Is this a standard JTAG debugger you are attaching, to make things "work"? (b) What is the history of the design e.g. was there a previous working version (in which case, what changed since then) or is this the first actual hardware being tested? (c) Are *both* MCUs definitely "freezing"? (d) Is there any variation (no matter how small) in the time between power-on and freeze, when tested multiple times? (e) Can you supply the schematic? (f) Can you supply a photo of the component side of the populated PCB, showing the MCUs and the place where the debugger is attached (see question (a))?
Comment: Is it possible that when you "start debugging" that the tool chain does some initialization of the target.  And maybe this initialization is omitted from the startup code.
Answer: I haven't seen answers to my earlier questions yet, but as I'm about to go offline, I'll add my hypothesis (which might become more or less likely, depending on the answers to those questions), in case it helps.
I have seen symptoms similar to yours a few times, due to missing or insufficient power decoupling near the MCUs, or an unstable power supply. For either of those cases, the result is unstable power to the MCU(s) in a "normal" configuration (i.e. without a debugger attached). That could explain the "freezing".
JTAG debuggers will often contain a capacitor connected between the target power rail and ground pins. When the debugger is physically attached to the target system, even when the debugger is not actually in-use, it adds that "hidden" internal capacitor across the target system's power rail. Therefore in some cases, if the target is suffering from inadequate power decoupling, or needs extra capacitance due to an unstable power input, then "bingo!" the target system works - just by attaching the debugger :-)
Answer: I had this same problem on an ATSAM4LS2A. Did you check that the watchdog is disabled from the fuses? This was my problem, i didn't have any wtd_reset in my code because i hadn't activated the wtd from the program, but it was on by default.


are these equal: "we got angry" and "we were angered"

Question: Do these phrases have the same meaning?

"we got angry" and "we were angered"
Answer: They are different in several ways.
First, the verb "anger" (and its participle "angered") are rather literary words, not much used in ordinary speech. In speech "angry" is much more common than "angered".
Secondly, the verb "get" to mean "become" is quite colloquial, so its use is inconsistent with the more formal register of "angered". "We got angry" is in an everyday register, but "We were angered" is in a formal one.
Thirdly, the difference in meaning is that "We were angered/angry" refers to a state we were in, whereas "We got angry" refers to a process of becoming angry.
Dwili's answer assumes that "we were angered" is not a state (using the adjective "angered") but a passive meaning "something angered us". This is possible, but I think it is even less likely than the stative meaning.
Answer: These phrases both can mean that we developed a feeling of anger if used in the right contexts. However, there could be subtle differences in meaning as well.
If 'we were angered' is written in a sentence with the passive voice it means that we became angry.

We were angered by the tone of his voice.

This sentence also means that we became angry.

We got angry at the tone of his voice.

However, the difference is that in the first case there is an outside agent causing the anger and in the second case we are the agent of the anger grammatically.
The word 'angered' can also be used as an adjective without an outside agent making the sentence passive, which gives the sentence a slightly different meaning. In this case, 'angered' is a steady state. It talks about a feeling that was not changing rather than one that was developing in the moment.

We were angered all day due to the weather.


What is the btc.to address shortening algorithm?

Question: How does the btc.to address shortening algorithm work? Is is a deterministic algorithm, that is, it can be reproduced on other websites with the same results, or are the results specific to the website and the order in which the addresses were inputted?
Comment: @RoryAlsop: I'd say it's pretty Bitcoin specific since it is a way to shorten _Bitcoin_ addresses, not a general service for web addresses or so. Do you agree?
Comment: @RoryAlsop I believe this question is on-topic, as it deals with a website specific to Bitcoins. Whether their algorithm relies on Bitcoin-related data or not is (at least to me), unknown, thus only by answering this question we can know if any further topics related to btc.co would be on, or off topic.
Comment: this might actually be more appropriate on StackOverflow, as it isn't actually a bitcoin specific piece (cf twitter's t.co, and stackexchange's own shortened URL's)
Comment: that makes sense - I was thinking it was the more general case.
Answer: The results are specific to the website and the order in which the addresses were input.
This can be easily determined by experiment. I took a random address from BE and it gave me http://btc.to/2z7. I took another address and it gave me http://btc.to/2z8.
So clearly, it stores all given addresses in a database, and the URL is the address ID encoded in base 36 (experiment also shows that it's case insensitive).
Also, it only accepts valid Bitcoin addresses.
More generally, it's impossible for any algorithm to take an arbitrary long, high-entropy string and give a short string which can be uniquely mapped back to the input.
Comment: Firstbits makes use of the fact that the address already appears in the block chain, which means that it is not high-entropy (or that it is not arbitrary, depending on how you look at it).
Comment: As for the last part, you can still create an algorithm that shortens some of those high-entropy strings, especially if you have some additional information about them (like FirstBits did).


How to run GTK+ in ubuntu?

Question: How to run GTK+ in ubuntu. When I enter gtk+ in the terminal then it doesn't open.
Neither I found any application as GTK. It doesn't run in the terminal.
Comment: I would get started using `zenity`. You can search this site for examples.
Answer: GTK+ is toolkit  or framework to provide user interface support. Like awt, swing or JavaFX in java.
And as mentioned on their website https://www.gtk.org/

GTK+ is cross-platform and boasts an easy to use API, speeding up your development time. Take a look at the screenshots to see a number of platforms GTK+ will run.

you can use Glade builder to build the interface for your app.
Some of the Desktop Environments like Cinnamon, Mate, Gnome use GTK framework and already have it. Installing from source can cause conflicts with your system and may crash it.

How to run GTK+ in ubuntu?


Why are Ash and his friends fooled by team rocket again and again?

Question: I have seen so many episodes of Pokemon. Many episodes have Team Rocket trying to steal Ash's Pokemon by disguising themselves, or with other predicable methods. Still, they are easily recognizable as Team Rocket every time. Why are Ash and his friends fooled every time, when Team Rocket's actions should be predictable by now?
Comment: The practical reason is "it's a children's show".
Answer: It's not that Ash and co. are constantly fooled by Team Rocket again and again, but rather that Team Rocket has a specific role in the show. In order to keep Team Rocket in the show, they have to have a purpose for each episode, and thus have been constantly after Ash's Pikachu since the original few episodes. To us, it seems that Ash is "dumb" or oblivious to Team Rocket's schemes, but in all reality it is due to the writing staff trying to keep them in the show (you have to remember that Pokemon is considered to be a children's show).
I found from here one reason for why Team Rocket still appears in Pokemon:

Because they are popular comic relief characters, and if they were ever to get rid of them, a boatload of rocket shipping fangirls would freak out and hate Nintendo and stop buying games and watching shows, therefore bankrupting the company. How else would they manage to make those episodes last 22 minutes without wasting our time with another predictable plot to capture Pikachu?

At this point, Team Rocket has become a staple of the Pokemon universe, and it would feel empty without them. There are other Pokemon watchers who feel similarly to you, as stated here:

The comic relief they provide is a necessary part of the show, but I'm quite certain they could think of better ways of working it in.  Not quite the same as how you feel about strangling them, but my brother has actually started cheering them on because he wants them to actually win for once so that they aren't completely irrelevant.  Plus it would be fun to see Ash totally lose it when Pikachu is gone for days on end ;)  The thing that really bugs me though is how they have no concept of how you're supposed to pull off crimes anyway.  I can think of several instances off the top of my head where if they'd kept their traps shut (no pun intended) without constantly going off into their motto that they might actually have succeeded.  They also think that as soon as they've got a net around something that it's theirs.  Team Rocket is always shocked when the Pokémon fight back.  Finally, who the **** travels in a hot-air balloon when you're trying to be inconspicuous?!
Comment: @ardaozkal Well, they do got a character like that: Gary Oak. It's not every few hundred episodes, but he does show up every once in a while.
Comment: They shoulda have made it the bleach way. Create a character only to show it every few hundred eps.
Comment: @Nzall you have a point :)
Answer: One way to understand this is that the disguises are made obvious for the viewers, so that we are always aware that it is Team Rocket. From an in-universe perspective, the disguises must be fairly effective, because they always fool everyone.
From TV tropes:

The external reason for the flimsy disguise may be that the creators
want to signal the presence of a disguise to the audience before the
other characters catch on (a sort of Reverse Whodunnit).

Another point to consider is that this is a cartoon. In the real world, it doesn't take much alteration to one's appearance to make it hard for other people to identify you. But in a cartoon, where detail is lower, it's a lot easier to pick out characters so long as the alterations are minor and their features are prominent enough (such as having giant purple or red hair). If we consider Ash and friends seeing things more like we see them in the real world, and less like the cartoon world we see them in, then this makes a bit more sense (Jesse's hair is still pretty distinctive, though).
Some sources on how easy it can be to fool people with simple disguises:
https://www.bbc.com/future/article/20121207-do-disguises-fool-surveillance
https://www.wikihow.com/Disguise-Yourself
https://gizmodo.com/its-surprisingly-easy-to-trick-people-with-a-disguise-1832767214
https://psycnet.apa.org/doiLanding?doi=10.1037%2Fxap0000213  (scholarly article mentioned by above gizmodo article, access required)


Is "no-index" necessary with extensive, white-labeled syndication?

Question: For the purposes of this discussion, consider the following scenario:
You have written a fair amount of quality, unpublished content that third-party websites wish to license from you and white-label on their own sites (i.e. you are ghostwriting for these third parties).  In other words, there will be no attribution or links referring to your name, email address, or website at all; it will appear to readers and search engines as if the article were written by the third party instead of by you.
Consider that 10,000 of these third-party sites were created independently, without any association to each other (they are absolutely NOT part of a blog farm network).  From your collection of 100 articles, you plan to license the white-label publishing right of each article to 100 of these sites (again, on a per-article basis).  So, while each of your 100 articles will be published 100 times, it's fair to assume that no site will host all 100 articles.  The most any one site will host is 30 articles.
Now for the question: Given this scenario, and that your intent is not to game search engines at all (but rather to provide quality content on established websites), do you need to include "no-index" meta tags on the pages that display your content?
Clearly, you wouldn't want your customers to receive the wrath of the Google Duplicate Content Penalty.  However, at the same time, if they can benefit from any Google juice deriving from your content, then that would be a nice benefit.
I suppose a more concise question may be, "Would this behavior cause Google to penalize the third-party websites?  Or, would Google simply choose one of the sites as hosting the "best" version of the content on a per-article basis?"
Answer: If the same article appears on 100 sites then that is duplicate content. There's no denying that. But there is no "Duplicate Content Penalty", or at least probably not what you are thinking.
Where duplicate content occurs, Google will usually return only one instance of the article. It could be the first one they detected (assumed to be the 'original') or it could be whichever page they deem most important (e.g. has more links to it).
Search engines would not penalise the site as a whole, that one page would just not rank well in searches. So there is no real need to prevent indexing of those pages. And there is no reason for you to enforce anything like this - it should be obvious to your clients that the content will not be original to their site, and thus the onus is on them whether they wish to prevent indexing. (You could of course make recommendations, but as detailed above, this isn't necessary.)