Which characters are allowed in a bash alias

Question: I recently added
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'

to my bash_aliases file. Playing around with this, I noticed that while aliasing .. was allowed, aliasing . was not. What other punctuation characters are allowed in bash aliases?
Comment: What version of `bash` are you using? I can alias `.` just fine. However, `.` is already defined as a command name in the POSIX specification, so you probably should not shadow it with an alias.
Answer: Bash aliases definitely can't contain these characters: space  , tab \t, newline \n, /, \, $, `, =, |, &, ;, (, ), <, >, ' and ".
The Bash Reference Manual says:

The characters /, $, `, = and any of the shell metacharacters or quoting characters listed above may not appear in an alias name.

"Shell metacharacters" are defined as

A character that, when unquoted, separates words. A metacharacter is a space, tab, newline, or one of the following characters: |, &, ;, (, ), <, or >.

"Quoting characters" aren't explicitly listed but they are the backslash \ and the single ' and double " quotes.
Bash checks alias names in legal_alias_name() which is implemented here: 1, 2, 3. Looking through the output of mksyntax.c (a C program that generates another C program) on my system, shellbreak() will return true for these 10 characters: \t\n &();<>|, shellxquote() for these 4: "'\`, and shellexp() for $, finally legal_alias_name() also checks for /.
However, there are other limitations from 1) how Bash tokenizes the alias expression that you would have to write to define the alias and 2) how it will tokenize a command that starts with your alias. Namely, for 1), = can't appear in an alias name, probably because alias foo=bar=baz would be parsed as foo = bar=baz, not foo=bar = baz. For 2), from my experiments, you can define an alias with !, the history expansion character, but if you try to use it, you'll get a command not found error, unless the ! is at the end of the command. There's probably other characters, the safest bet is to stick to numbers, letters and the underscore.
Comment: For completeness: I use `!` in many of my "dangerous" commands (like force push `gpf!` or interactive rebase `gri!`), but only as the final character. Not sure if they work in other locations in the alias name. Came to this thread looking to see how else I might use `!` :)
Comment: @Xunnamius `alias "abc!"=echo` works but `alias "a!bc"=echo` and `alias "a\!bc"=echo` and `alias "!abc"=echo` don't.
Answer: It's always been safer to use functions instead:
function .. { cd '..'; }
function ... { cd '../..'; }
function .... { cd '../../..'; }

Or for a conservative preference:
..() { cd '..'; }
...() { cd '../..'; }
....() { cd '../../..'; }

What is safer about doing it this way?

Aliases affect first-class syntax (if, case, etc.) and its commands are specified using quotes. It's like having to use eval unnecessarily. Using functions on the other is straightforward and you know exactly how the arguments are expanded. TL;DR aliases are a hack. It's like using a #define statement in C when you can simply define a function. It's something beginners would love to compose.
If anyone would want to define default arguments to a command, you can use command to make the function call the external command to avoid recursion. That's the right way to do it. E.g. function grep { command grep --color=auto "$@"; }
Comment: what is safer about doing it this way?
Answer: According to the following environment variables names can only contain

uppercase letters, digits, and the '_' (underscore) from the
characters defined in Portable Character Set and do not begin with a
digit. Other characters may be permitted by an implementation;
applications shall tolerate the presence of such names.

But variables are not really the same the same of alias names.
In practice a -(dash) should be added to the list because it is a defacto standard in debian(apt-get).  In addition _~@#%^., all work and ><'"|=()`/?[]+!. don't.  In addition you have to worry about $PATH and characters like :.  It appears space and linebreaks could work if they are properly escaped or quoted like so "a b".
Comment: The GNU [manual for bash](https://www.gnu.org/software/bash/manual/html_node/Aliases.html) says "The characters `/`, `$`, `\``, `=` and any of the shell metacharacters or quoting characters listed above may not appear in an alias name." so this answer (which says `/` and `$` are okay) is wrong.
Comment: I tried to use a `/` in my alias name but it didn't work.
Answer: https://www.gnu.org/software/bash/manual/html_node/Aliases.html
I wouldn't name an alias .. in linux . is a special name for the current director and .. is for the parent directory. there could be some obscure process that could be screwed up by aliasing .. for cd
Comment: The problems you describe are the same whether you define `..` as an alias or a function, but neither would be invoked if `..` were used as the argument to a command. Since `.bashrc` is only invoked for interactive shells, there's no worry that you will change the behavior of any shell script, especially system scripts (as long as you don't mess with `/etc/bashrc`, since they scripts will run as `root`, not a user account).
Comment: `..` is just a (special) directory name, so syntactically it's no different than something like `foobar`.
Comment: ah ok i see what you mean
Comment: im aware, and normally it wouldnt matter, but if you put it in bashrc, and some system tries to execute it and instead cd's to it, then it will be weird, which is why as konsolebox said, functions are safer


Why is least count error like this?

Question: For a measurement of 4.6 (between 4.6 and 4.7 ) with a least count of 0.1 we write the measurement as 4.6 ± 0.1 . Why can't we write it as 4.65 ± 0.05. My guess is this gives a false sense of resolution of the instrument. I would like a nice explanation. 6 is uncertain here.
Answer: Yes! You are right. When your instrument has a resolution of $0.1$, How come you able to measure up to two-digit after the decimal point.
It's like, You have measured in millimeter with centimeter stick.
Answer: The reason is that, since your instrument only measures in steps of $0.1$ of some unit (say, millimeters), any measurement could be off by less than that amount without your instrument being able to correctly capture it, leading to an error. Since $\pm \, 0.1\, $mm is the largest possible range of this kind of error, that is what you should report.

Why is least count error like this?


Display monitor without light

Question: I am looking for monitor, which can not emit light - something like old Nokia's display, only bigger. I need it to have a backlight, which could be toggled - just like mentioned old phone display. How are these monitors called? I would need 4-10 inch size monitor.
Answer: Depending on the requirements of your particular application, you may find that an e-ink monitor will suit your purpose. E-ink displays are slow to update, which means that video and animated images will blur/smear. E-ink devices such as the Amazon Kindle require external illumination, although some now include internal (reflective) illumination.
Amazon has a number of small (13") monitors that use e-ink technology. The selected monitor has a touch screen and also built-in illumination (with on/off switch) but there are others listed without those features. I used "e-ink computer monitor" as the search terms to locate these devices.

Image via linked page.
Additionally, one can find Arduino and Raspberry Pi accessory devices which use e-ink technology. Sized much smaller than 13", they are also limited in providing moving images.
I use an older Kindle Reader without internal illumination options. It is larger than your desired limit, but newer models are closer to your requirements. There is no feature to allow external input, but it is referenced as an example that the size you seek is likely to be found.

Display monitor without light


Why is the coinbase bitcoin withdrawal fee 10 times cheaper than my usual P2P Exodus transaction?

Question: Do you know why the Coinbase bitcoin withdrawal fee is 10 times cheaper than my usual P2P Exodus transaction? Are they use the Lighting Network? How is it possible? For example, the Binance withdrawal fee is also in the range of a usual transaction.
Answer: Most of the exchanges will charge a bigger fee, they are business and they need to make money, one way to make money in exchanges is by charging expensive fees.
Coinbase really has a cheap fee, it is because they decided to have this, maybe to attract more customers with their cheap fees, they can do that because when you are using the Bitcoin Core client, you can create a transaction to the network paying a cheap fee.
Comment: I downvoted, as I think this answer is confusing. If Coinbase is charging less than the network feerate to their customers, it simply means they're eating the cost. Using Bitcoin Core doesn't allow you to pay below market rate any more than other software.
Comment: What I meant is using Bitcoin core you can create transactions paying the native fee and therefore that is much cheaper than the amount most exchanges use to charge. Coinbase fees are very similar to the amount of fee you use to pay using Bitcoin Core, therefore I think they do something like that, but as you said, they also may be eating the cost.


Meaning of cross with Jesus on both sides

Question: I have a necklace that is a cross charm with Jesus Christ on the cross but on both sides. What's the meaning of this symbol?
Comment: can you include a picture?
Comment: I expressed some concern at this being "a charm" because some non-Christian religions also use the cross symbol but in a way that opposes the Christian view of the cross of Jesus Christ. Even some groups claiming to be Christian are so superstitious, they treat the cross symbol as if it could be a charm, to protect or help them. But the cross should point to the person of the risen Christ, in whom alone Christians trust.
Comment: Welcome to Ch.se, Julee.  For Anne - in jewelry making, the word charm refers to a [small ornament on a necklace or bracelet](https://www.merriam-webster.com/dictionary/charm)
Comment: @Dan Fefferman  No doubt that applies in the world of jewellery-making, but I was thinking in terms of spiritual understanding!
Comment: In the world of jewelry - if it hangs on a necklace it's called a pendant. If on a bracelet they're called a charm.
Answer:
A double-sided crucifix has the same religious significance as a single-sided one. It is an artistic device that enables the image of Jesus to been seen from two sides. This is particularly useful in the case of a necklace, where the jewelry may rotate toward the skin, so that the face of crucifix would not be seen otherwise. This tradition is also used for altar pieces, as in the above photo, so that viewers will see the image of Jesus whether they look from the front or the rear of the crucifix.
For those who are worried about the word "charm," I'm sure the OP does not mean this in the sense of a magical device but as simply "a small ornament worn on a bracelet or chain".
Answer: Your word description is insufficient to convey what this bit of jewellery looks like. You refer to it as "a charm" which is a bit alarming, as it indicates something of superstitious value. However, if you read in the Bible book of Mark, chapter 16 verses 27 and 28, you will note that two other crosses were on each side of Jesus' cross. The men on those crosses were called thieves, and one was on Jesus' right, and the other on his left. Jesus was in the middle.
Could this be what you are referring to? Without a photograph of the piece of jewellery, we really need a much more detailed verbal description, so if you could add more, that would be helpful.
Comment: "charm" may also have completely innocent meaning; although this case seems more atypical. I remember girls having "charm bracelets" which had small trinkets shaped like various symbols that were important to them. The trinkets were known as charms
Comment: I originally thought of "side" as you do (referring to the thieves) no doubt influenced by the Gospel description until Dan produces a picture that OP meant "backside".


Windows Tablet Event - disable Hold Through gesture

Question: I've been trying to implement a long-press feature on a Tablet PC (Windows 7).
The problem is I don't get the MouseDown event when touching the tablet (touch and wait).
I do get a MouseDown event only after I move my finger (dragging).
And when I pick it up after a while, only then do I get both down and up events at the same time.
I have found out that this problem is happening due to the "Hold-through" gesture, mentioned here:
http://msdn.microsoft.com/en-us/library/ms703320%28VS.85%29.aspx
I want to disable this gesture, the same way they do it with press and hold:
hxxp:...microsoft.com/en-us/library/bb969148%28VS.85%29.aspx
I have implemented the press and hold gesture disable successfully, but nowhere could I find how to disable the Hold Through gesture.
Maybe it is done the same way but with different constant.
I would really appreciate your help on this.
Thank you,
BJoe
Answer: I came up with this solution:
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
     if (msg == 716) //Tablet touched
     {
              //Tablets on first touch send this instead of mouse down
              /Handle message/
     }
     return IntPtr.Zero;
}


Extract subtitles from movie

Question: Some movies I download legally, contain embededd subtitles. I would like ego extract them as text files(.srt, .sub, etc) in order to view the movie on a samsung tv, which needs separate files for both movie and subtitles. I tried with VLC bout found no way to extract them, do you know about any other way? Preferably for OSX.
Comment: Don't have much idea about video formats but I guess the only way you can extract the subtitles is if the  video is in a container format along with the subtitles. I might be totally off track but you could try googling along these lines.
Comment: You of course realize that *some* subtitles are burned-in, e.g. they are part of the picture and there is no way to extract them? Are you sure this is not your case?
Comment: Yes, i know that
Comment: Guess this is for you if you want commandline :-)
[Superb answer in thread ***Extracting Subtitles from mkv file***](https://superuser.com/a/1649627/1514761)
Answer: If you have the command line ffmpeg installed you can use:
<code>ffmpeg -hide_banner -i Movie.mkv -map 0:s:0 subs.srt
</code>
Mapping depends on the subtitle track you want. if its the second one then use:
<code>-map 0:s:1
</code>
Works with mp4 too.
Comment: You may need to strip XML tags from the output file. At least I had to.
Answer: If your video happens to be in mp4 format then for example MP4Box can be used to demux (extract) the different types of streams (video, audio, subtitles) from it.
This works only if subtitles are not actually "burned" on the video image (easy test - can you turn them off in your player? If yes then all should be well).
Comment: I have used MP4box via a GUI, both of which are Windows only. A quick look at the command line documentation [here](http://gpac.wp.institut-telecom.fr/mp4box/mp4box-documentation/) shows that possibly -srt command line option should do the trick _"-srt TrackID : dumps text track to SRT format."_ Do find out the TrackID the _"-info : prints some file information. File can be an IsoMedia file or any file supported by MP4Box for import."_ would be my first guess.
Answer: For mp4 files I use MyMp4BoxGui from http://www.videohelp.com/tools/My-MP4Box-GUI. This is a Windows tool which will separate the different tracks in an MP4 file including subtitle tracks, if present.

Launch MyMp4BoxGui.
Click Demux tab.
Click "Open" button and select mp4 file.

Will show video, audio file and "timed text" (subtitles) if present.

Click checkbox for timed text item.
Click "Demux" button.

Will process mp4 file to .srt in mp4 file directory.

Unfortunately, many video files (esp. DVDs) store subtitles as bitimages. Extracting these as text for a .srt file requires an OCR process. Google SubRip for one solution.
If you're dealing with a video which is a movie, you might be better off not trying to extract subtitles from your video files. Instead go to a site like http://subscene.com/ and download a srt file in the desired language for your video. If there is more than one subtitle file, you'll have to try them until you find one that best syncs with your file. Or use a program like Subtitle_edit, to tweak the sub file.
Answer: On the other hand if your subtitles (or anyone else's who happens to read your question from now on for that matter =) are hardcoded i.e., embedded in your video file, which is often the case with AVI files for instance. It's also possible to extract them but you will need to proceed with OCR (Optical Character Recognition). SubRip for instance, there are others. The extraction that way takes much more time, because of the numerous computations involved by OCR (several filters must be applied to extract any "useful information", timecodes, ... then it's simple OCR as each frame may be processed as a picture) and the results depend of your video (are the subtitles outlined ? how readable/legible is the font used to display them ? are they displayed directly on the video or is there some stationary background ? ...)
Answer: I've tried XMedia Recode and it worked great for a .mkv file. I assume it can handle "soft subtitles" in many other formats as well. It is currently only available for Windows however.
Steps: (for version 126.96.36.199 64bit)

Click on "Open File" or go to "File > Open File..." on the menu bar and select the video from which you want to extract the subtitles. Alternatively you can drag and drop the video.
Under the "Format" tab, select "SubRip subtitle" as the format type from the drop-down.
Make sure the file you added is selected in the application window, then go to the "Subtitle" tab. Select the file in the "Source" box and click the right-pointing arrow button to take it to the "Output" box.
Click on "Add to queue" from the toolbar or use "Edit > Add to queue". Under the "Queue" tab, you can double-click on the job to change the destination folder and filename.
Finally, click "Encode" or "File > Encode" and the subtitles will be extracted in no time.

(I learnt about the software from this Reddit).

Extract subtitles from movie


what formula describes the convex hull of two circles (i.e. two circles connected by tangent lines)?

Question: I'm investigating the following problem.
Imagine a circle at the origin with radius r. The circle moves upward with speed s and its radius simultaneously increases by a length of b per time unit. That is, at time t=0, the circle is at the origin with radius r. At time t=n, the circle is at (0, sn) with radius r+bn. As the circle moves and expands, it sweeps a shape. What is the formula for the shape swept by the circle in a given amount of time N?
It occurs to me that there are two cases. First, when s <= b, the motion of the circle is overshadowed by the expansion, and the final shape ends up being a circle at (0, sN) with radius r+bN.

But when s > b, the expansion can't keep up with the motion, and it sweeps a shape through space. It appears to me that the exact shape is that of both circles connected by line segments tangent to both, like two pulleys with a belt.

This related question says that it's called the convex hull of two circles. The questioner wants to know how to determine whether a point is within the convex hull. I could also like to know how, but I'd like to have a formula rather than an algorithm. I imagine there must be a formula that describes this shape, but unfortunately, I've been unable to derive one myself. :-/  It would be great if one formula handled both cases, but I'd be happy to have just the formula for case two.
I'd also be satisfied with a formula to determine the distance from the origin to the outer edge of the shape at a given angle. In fact, that is the main thing I would hope to calculate from the formula, in addition to using the formula to plot it.
Does anybody know? Thank you.
Comment: If you say the center at $t=0$ is the origin, then a point $(x,y)$ is in one of the circle's if and only if there exists a $t\in[0,N]$ such that $$x^2+(y-st)^2\le(r+xt)^2.$$ This can be rewritten as $(\text{quadratic in }t)\ge0$. You can find the interval(s) on $\mathbb{R}$ where this inequality holds using standard techniques and then check if one of them intersects $[0,N]$. The test for intersection can itself be written as an inequality in $N,x,y,s,$ and $r$ determined by the roots of the quadratic.
Comment: Thanks, that looks promising. I will investigate after I get some sleep. In the question, I made a poor choice of variable name, using x for the increase (e.g. r + x*t) although it's unrelated to the x coordinate. I've renamed that to b. Am I correct that only the second x in your equation should be renamed to b, while the first x refers to the x coordinate?
Comment: I didn't even notice that slip up! Yes your understanding of the formula is correct.
Comment: Hmm. Producing the (quadratic in t) >= 0 is easy enough. But it seems like the roots of the quadratic depend on both x and y. Then, finding the intervals where the inequality holds seems hard because it's not a 2d curve with a set of zero crossing points, but a 3d surface whose zero crossings are themselves curves (ellipses?). Getting the correct set of zero crossings also seems dependent on t being bounded. I'm probably just stating the obvious here, but I seem to have gotten stuck. I'll keep thinking about it, though, and hope I have some insight... :-)
Comment: It's a quadratic *in t*, there are only at most two roots. Remember $x,y,s,b$ are fixed.
Answer: The phrase you want to research in general is "envelope of a family of curves". An envelope is a curve that's tangent to each member of the family at some point; in this case, it's the "border" of the shape swept out by your circles (though if your family doesn't extend indefinitely in both directions, you'll want to add circular caps at the top and the bottom).
It happens (as you suspect) that the envelope of your family consists of straight lines, and basic geometry should be able to prove this. However, it could easily have been the case that a more elaborate border curve arises, so I'll talk through your envelope as in this Wikipedia article. Note that the process involves taking "partial derivatives", so is technically an aspect of multi-variate calculus, although knowledge of basic single-variate calculus will do.
First, to reduce the number of parameters involved, let's say that the center moves as speed exactly $1$, and that radius increases at rate $k$. (Effectively, I'm just re-scaling your time parameter and setting $k := b/s$.) Note that, because you have discussed the case of the more-rapidly-increasing radius, we may assume $|k| < 1$.)
Now, at time $t$, the center of your circle is at $(0,t)$, and the radius is $r+kt$, so that
$$x^2 + (y-t)^2 = ( r + k t )^2$$
We define $F$ (so that the above is equivalent to $F = 0$) as
$$F := x^2 + (y-t)^2 - ( r + k t )^2$$
The equation of the envelope arises from setting $F$ and $\partial F/\partial t$ (the partial derivative of $F$ with respect to $t$) simultaneously equal to zero. We already know $F$. The partial derivative we seek is simply the derivative where we treat $x$ and $y$ as if they were constants (just as we do with $k$ and $r$).
$$\frac{\partial F}{\partial t}= 2 ( y - t )(-1) - 2 ( r + k t )(k) = 2 \left( t ( 1 - k^2 ) - ( y + k r ) \right)$$
Solving $\partial F/\partial t = 0$ for $t$ (and recalling $|k|<1$) ...
$$t = \frac{y+kr}{1-k^2}$$
... and substituting into $F = 0$ ...
$$x^2 + \left(y-\frac{y+kr}{1-k^2}\right)^2 - \left( r + k \frac{y+kr}{1-k^2} \right)^2 = 0$$
... yields ...
$$\left( 1 - k^2 \right) \left( x^2 \left( 1 - k^2 \right) - \left(yk+r\right)^2 \right) = 0$$
$$\implies x^2 \left( 1 - k^2 \right) = \left(yk+r\right)^2$$
$$\implies x \sqrt{ 1 - k^2 } = \pm \left(yk+r\right)$$
$$\implies x \sqrt{ 1 - k^2 } \mp y k = \pm r$$
... vindicating your suspicion that the border of the swept area consists of lines.
Specifically, when $k = 0$ (the circle's radius doesn't change as the its center climbs higher), we have a pair of vertical lines at distance $r$ from the $x$-axis:
$$x = \pm r$$
When $k \ne 0$, we have the lines with slope-intercept form
$$y = \pm \frac{\sqrt{1-k^2}}{k} x - \frac{r}{k}$$
The lines cross at $(0,-\frac{r}{k})$, where the circle (at time $t=-r/k$) collapses to a point.
All that said, you are now back to your question of finding an equation for the convex hull of your circles. I'll need to come back to this.
Comment: This is very interesting nonetheless. :-)
Answer: I will use the notation of @Day and consider only the right half of the hull ($x \ge 0$).

We have
$$\cos \alpha = k, \;\;\; \sin \alpha = \sqrt{1 - k^2}, \;\;\; y_0 = r/k$$
So, the equation of the tangent is
$$y(x) = x \sin \alpha / \cos \alpha -y_0 $$
as was already derived by @Day. The hull is composed of the fragment $AB$ of the initial small circle, then the line segment $BC$ on the tangent and finally the fragment $CD$ of the moving growing circle. The hull can be described by the distance $R(\phi), -\pi/4 \le \phi \le \pi/4$ from the origin to the hull. Points inside the hull have Euclidean distance from the origin less or equal $R(\phi)$. Now, it is possible to derive implicit equations for $R(\phi)$ depending on the value of $\phi$ with respect to the angles given by $A, B, C, D$. I was not able to derive simple explicit formulae.
However, it possible to obtain explicit formulae for $x(y)$. The y-coordinates of the points are
$$A_y = -r \;\;|\;\; B_y = -r sin \alpha \;\;|\;\; C_y = t - (r + kt) k \;\;|\;\; D_y = t + r + kt$$
The hull is characterized by:
$$x(y) = \sqrt{r^2 - y^2} \mbox{   for   }  A_y \le y \le B_y $$
$$x(y) = (ky + r) / \sqrt{1 - k^2} \mbox{   for   } B_y \le y \le C_y $$
$$x(y) = \sqrt{(r + kt)^2 - (y-t)^2} \mbox{   for   }  C_y \le y \le D_y $$
The left half of the hull is obtained by a simple reflection on the y-axis.
Answer: It may help you to have a more physical or alternate approach to think about this problem or the method of characteristics
also see here too which is used to gain intuition for fluid like or wave like settings (e.g. a boat emitting a wake, a supersonic plane emitting shock waves, cars entering or leaving a traffic jam).
The idea is to plot $x$ (horizontal) vs $t$ (time). First you plot the trajectory of your boat.  Then at each position the boat emit waves that travel to the right and left on the plot at the sound/wave speed. To find the area at time $t$ intersected you draw a horizontal line across the plot.  Your two situations (where the area you want is a circle and where it is not a circle) correspond to your sound or wave source (the boat) traveling below or above the sound or wave speed.  The analogy being that information is emitted at the sound speed and that gives you your circles. I find that these simple plots really help you think about where you get information when.


What does "Please enter a username matching the regular expression configured via the NAME_REGEX[_SYSTEM]" mean?

Question: I am a research assistant in a neuroscience lab completely new to programming. I'm just trying to make a username in the ubuntu system I downloaded to run an MRI analysis program for someone else. And I don't even understand what this basic command means. I know regex means "regular expression" but can someone please tell me what an acceptable entry would be if I want my username to be "Icymoguls," or at least point me to a tutorial? I learned about /,~, cd, and ls in an intro video but don't know anything else. Thank you
Comment: [adduser - "Failed to create user" due to regular expression error - Ask Ubuntu](https://askubuntu.com/questions/232742/failed-to-create-user-due-to-regular-expression-error)
Answer: The regex error you are seeing is basically saying that the username you tried to set does not meet the "rules" your system has set for what characters can be in usernames. By default, Ubuntu does not allow capital letters in usernames. The username you provided, "Icymoguls," has a capital letter at the beginning and therefore Ubuntu will not accept it.
Ubuntu only accepts usernames based on the following rules:

Must start with a lowercase letter
May only contain lowercase letters, underscore (_), and dash (-)
May optionally end with a dollar sign ($)

A regular expression is merely a string that shows what is and what is not allowed in another string. When creating a new user, Ubuntu checks potential usernames against its builtin regular expression for usernames (which is ^[a-z][-a-z0-9_]*\$ in case you were curious!).
Comment: Any idea why the Ubuntu devs set up the regex to reject uppercase letters?
Answer: I think that instead of ^[a-z][-a-z0-9_]*\$, the regex should be ^[a-z][-a-z0-9_]*\$?$. The trailing $ is optional and the regex should match the entire string.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: It seems that there is a reason behind this limitation.
If you try to run systemd service for scripts, it can be starting as root and not as a user. It's caused by systemd not recognize user with dot (domain.com user name for example) as valid user and runs service as root instead. Still this can be fixed already on systemd side, but still has a risk.
Also having dots in the user name creates some issues with scripts using chown, which still accepts dots as separator between user name and group name. If chown still accepts dots, there will be scripts using this notation, which will break if a user name contains a dot.
Still you can edit /etc/adduser.conf and amend the regex or use straight command useradd, but then you are responsible to create home -m flag and supply skelleton -k SKEL_DIR and do all the groups manually.


Norm and Weak Topologies agree?

Question: so my professor mentioned that when a normed space is finite dimensional the norm and weak topologies agree. To show the topologies agree it should be enough to show that they have the same convergent nets. I can see how if a net $x_\alpha\rightarrow x$ in the norm topology then it converges in the weak topology. Namely, for arbitrary $f\in X^*$ we know by continuity that $f(x_\alpha)\rightarrow f(x)$, which means $x_\alpha\rightharpoonup x$. However, I can't see the other way. Would anyone have some intuition as to why convergence in the weak topology implies convergence in the norm topology? I'm assuming that this direction is where the finite dimension of our space comes in to play. Thanks in advanced.
Answer: We can identify our space $X$ with $\mathbb{R}^n$, with the norm topology being the usual Euclidean topology on $\mathbb{R}^n$ (since all norms on a finite-dimensional space are equivalent).  Now if $x_\alpha\to x$ weakly, then $f_i(x_\alpha)\to f_i(x)$ where $f_i:\mathbb{R}^n\to\mathbb{R}$ is the $i$th coordinate functional.  But that just means that $x_\alpha$ converges to $x$ on each coordinate, which implies $x_\alpha$ converges to $x$ in the Euclidean topology.  Thus $x_\alpha\to x$ in the norm topology.
More generally, a finite-dimensional vector space only admits one topological vector space structure (i.e., only one Hausdorff topology such that addition and scalar multiplication are continuous).  This is a bit more complicated to prove; see this answer for instance
Comment: So this proof fails in the infinite dimensional case as we can't identify our space with $\mathbb{R}^n$, correct?
Comment: Yes, that's correct.
Answer: Another way to do this is to just go back to the definitions. Let $\epsilon>0,$ and $x_0\in X$. It suffices to  show that any open ball $B(x_0,\epsilon)$ is weakly open. We may use $\|\cdot\|_{\infty}$ as our norm.  And since translation is a homeomorphism, we may take $x_0=0$. Choose a basis $(e_i)^n_{i=1}$ for $X$. Then, $x=\sum^n_{i=1} x_ie_i$ for each $x\in X$ and for each $1\le i\le n,$  we have the functionals $e_i^*:X\to \mathbb C:x\mapsto x_i.$
Then, $B_{\epsilon }=\left \{ x:\left \| x\right \|<\epsilon  \right \}=\left \{ x:\forall\  1\le i\le n,\ |x_i|<\epsilon \right \},\ $ which is nothing more than the weakly open set $\left \{ x:\forall\  1\le i\le n,\ |e_i^*(x)|<\epsilon \right \}.$
Comment: I think you have shown that every open ball in the norm contains a weakly open set. Which shows that the weak topology is finer than the norm topology. Wouldn't you have to show now that every weakly open set also includes an open ball?

Norm and Weak Topologies agree?


MS Project VBA - Iterate by display row number

Question: I have a problem using for loop in this MS Project VBA Macro:

Sub Check_Change_Article()
    Dim ProjTasks As Tasks
    Dim ProjTask As Task
    Dim Art As String
    Dim ArtOld As String
    Set ProjTasks = ActiveProject.Tasks
    ArtOld = " "
    For Each ProjTask In ProjTasks
    If Not (ProjTask Is Nothing) Then
        Art =ProjTask.Text22
        If (Art != ArtOld) Then
            ProjTask.Text4 = "CHANGE"
        End If
        ArtOld = Art
    End If
    Next ProjTask
End Sub

Project Example

Case 1: Sheet when task is open:
VBA Row #     TaskID     Text22    Text4
1               1        PNL50R    CHANGE
2               2        PNL50R
3               3        JPL50Y    CHANGE

Case 2:  User can filter, group or order tasks (note change in row number)
VBA Row #     TaskID     Text22    Text4
1               3        PNL50R    CHANGE
2               1        PNL50R    CHANGE
3               2        JPL50Y

I read this discussion:
ms project VBA associate task with row
Using ActiveSelection.Tasks instead of ActiveProject.Tasks I see that for loop iterates follow VBA Rows.
Is it possible to set for a loop to iterate by VBA Row Number, without using ActiveSelection (if it's possible, I wouldn't force the user to select rows)?
Thanks in advance,
Giuseppe
Answer: You can use Application.SelectSheet (so that the user does not have to manually select the tasks). Then you can loop through the ActiveSelection.Tasks collection. When done you can use Application.SelectBeginning to select only the first task.


Mistaken For Wings?

Question: What feature could more feasible evolve in a humanoid race, related to humans or not, that could be mistaken at first glance and/or conflated into by word of mouth exaggerating things, wings?
Comment: This needs to be narrowed a bit.  Pretty much anything can evolve in a humanoid race given enough time, and by including "humans or not" you've made all answers equal in value which means getting closed as "primarily opinion-based."  Are we dealing with humanoids or not?  What's the context of the question?  Wearing a cape would be an equally valid answer right now (because we evolved to wear clothes).
Comment: Are these faux wings part of the arm, as with a bat, or are they separate appendages entirely, as with an angel?
Comment: I was thinking more towards the latter, but if you have ideas for the former, go for it, I'm  intrigued by your suggestion.
Comment: This question asked what other possible uses dragon wings might have.  Obviously body parts that look like wings could have those possible uses. https://worldbuilding.stackexchange.com/questions/105919/alternate-uses-for-dragon-wings/105925#105925
Answer: Hair?

https://www.youtube.com/watch?v=DqUrKTb4ZH0
It is long.  It can appear massive.  It is attached.  It moves with the wind.  You can whip it back and forth.
Hair wings are apparently an anime trope.
Comment: Some people have suggested black and white colobus monkeys use their long back hair to sorta slow their descents.
Answer: Loose underarm skin.  I know we're supposed to give more detailed answers on this forum, but I think that link really speaks for itself as a complete reply to your query.
Comment: I regret clicking the link, ooh, made me think of the scene from family guy with stewie after the steriods
Comment: Haha oh yeah, the Rocky and Bullwinkle bit?

https://lh3.googleusercontent.com/9FwvQXIWlkXrCYmrxbivpXStfihiWF-BNBgec-F_lnId7V512svjrsszwh3M8-MosJw4IvubQDWmrenj1HgrrHKJYXzZ60NAbBQujoYxq2wMMyNCrzM-pEQCZaTQ5IljYhMh1g
Answer: Graham Hancock, crank pseudo-historian and writer of crap "history", had a theory that the concept of winged angels arose from an advanced people in Mesopotamia (who were totally not Atlanteans) that wore capes made from feathers which the other, more primitive, locals mistook for wings. The supposed totally-not-Atlanteans disappeared when their totally-not-Atlantis homeland was destroyed in a natural disaster.
Answer: Literally anything. Hair, clothes , skin, muscles...
It all depends on where the mistake comes from, there are countless historical examples of a murderer or even entire race of people, being labelled as baby eating red eyes claw handed evil people. it all depends on time and sitution
If it is mistaken at first glance but the then corrected very quickly, then hair clothes or skin/muscle, or even actualy wings (you said humanoid not human),
At that point it would be down to setting, just witnessing them move in a bird like manner, which the human brain would register:
bird like manner, flappy arm movements, lage amount of hair/skin on the arms, = must be wings
However, if it is seen once or twice and then they are an enemy that are rarely seen in person, then there is no limit ro how quickly or far removed that species' windely know description could become.
unfortunately It is almost always down to the person perceiving something incorrectly, then what they are perceiving.
Answer: Some body part to regulate body temperature by dissipating heat might have a winglike shape.
For example:
https://en.wikipedia.org/wiki/Elephant#/media/File:African_Bush_Elephant.jpg1
So if this humanoid species evolved from a group of animals that often overheated it might have some sort of wingish looking heat radiators on the back.
Answer: Perhaps they managed to make primitive wingsuits? That could easily be mistaken for wings.
Comment: A good answer explains how your idea meets the OP's needs.  In this case, the OP is looking for an evolved condition.  To build on your idea, they might have evolved skin between arms and legs like flying squirrels, too thin to be used for such a purpose because they're actually heat radiators because the humanoids don't have sweat glands nor long tongues like dogs.  Do you see how that makes an answer for the OP?
Comment: care to expand a little bit on this idea?
Answer: Possibly the children have wings and can fly, and as they grow heavier and can now longer fly, the wings morph into heat exchange organs but still look somewhat like wings.
The average adult human supposedly weighs about 62 kilograms or 133 pounds.
That is much larger than the largest flying birds today. The largest flying birds, like the Great Bustard and the Kori Bustard, can weigh up to 21 kilograms or 46 pounds.  A Mute Swan weighed 23 kilograms or 51 pounds, though it might have been too fat to fly.
Thus really young human children would be light enough to fly - if they were built like birds - while older children and adults would not be.
An intelligent species could have adults significantly smaller than the typical adult human.  Thus their children would be lighter still.
Adult specimens of Homo floresienses  living on the island of Flores about 100,000 to 60,000 years ago have heights of 1.06 to 1.09 meters, or 3 feet 6 inches to 3 feet 7 inches.  The weight of one adult has been estimated at 25 kilograms or 55 pounds.
Thus adults of that semi or fully intelligent species would have been a little too heavy to fly even if they were built like birds and had wings, while children would have been small and light enough to fly for most of their childhood.  So we can picture an intelligent species where the children weigh 10 or 20 pounds and can fly while the adults are heavier and are grounded.
But, on the other hand the heaviest known extinct flying birds and reptiles were larger and heaver than any known birds at the present time.
The extinct Argentavis magnificens, the largest flying bird, weighed an estimated 70 to 72 kilograms, or 154 to 159 pounds. The largest extinct flying reptiles weighed an estimated 200 to 250 kilograms or 440 to 550 pounds.
Thus there could possibly be an intelligent species where the children were built like prehistoric flying reptiles and could fly until they reached body weights of 500 pounds or more, but then had to live on the ground or in the water as larger adults.  Their wings, now useless for flight might shirk in size but still be used to get rid of excess body heat and be used for display in interpersonal relations.
If humans only met the adults of a species somewhere between Homo floresienses and Quetzalcoatlus northropi in size, the adults' former wings might resemble wings enough for humans to think they were wings and to imagine that the adults could fly.
Answer:
Some kind of dorsal decoration or mate attraction thingy kinda like peacocks or a spinosaurus (there is a debate whether Spinosaurus used his Sail as a temeprature regulator or to attract mates, but that's not the point), but twofold.
If you accepted (semi-)aquatic lifestyle, two dorsal fins could look like wings.
As has been suggested before, heat regulating organs.

Mistaken For Wings?


How do you gain heist-specific favors?

Question: On certain heists, you can gain and use heist-specific favors in the ready up screen. For example, on Road Rage, you can place an alternate loot pickup that's active immediately. How do you gain heist specific favors?
Answer: They're gained randomly after completing a heist. You can get a heist-specific favor for any heist within the same category (e.g. Legacy Heists will currently only drop favors for Turbid Station or Cook Off).
Comment: You are right. Favours can be heist specific, but don't need to be and can be found or purchased. What ever you find or what is on offer in the shop can change and is not set in a certain order.
Comment: @MattixA1 This is 100% wrong with respect to heist-specific favors, and I'm honestly a little baffled since gage's shop never changes.
Answer: Heist favours in PayDay 3 can be purchased or found during the quiet phase during heists.
I have found this guide on Game Rant (Find the guide under this link) regarding PayDay3 favours.
Especially this excerpt might help you:

Players need to flip to the vendors' tab in the main menu to purchase items. Favors can be found all the way at the bottom of the weapon dealer Gage's shop inventory. They will be right underneath the weapon stickers. Favors only cost $10,000 and are well worth the small investment. Check back between each heist for different items. Be on the lookout for unique items like QR codes that will make certain heists easier.
Comment: The QR code bit doesn't have anything to do with favors. Additionally the question is about heist-specific favors, the ones bought in Gage's shop are generic and can be used on any heist.
Comment: This is 100% wrong with respect to heist-specific favors.

How do you gain heist-specific favors?


How can I send messages to clients without polling?

Question: Every example for GAE Chats uses some kind of polling.  However, if my GAE app holds a list of clients (in the datastore if necessary), perhaps I could avoid polling by sending a message to all these clients.  How can I achieve this?
Answer: If you are talking about HTTP, the short answer is that GAE does not currently support it.  What I think you are asking about is sometimes called BOSH.  Once WebSockets become more widespread, they will be an excellent solution for this problem.
In the mean time you might want to look at XMPP.  Using XMPP you can avoid polling.  Google has announced a Channel API (yet to be released) which will basically give you the same features as websockets.
Answer: You've probably seen some chat room examples...
Since you just want to send a message to users on your datastore (Tip: the IMProperty is great to store such data), it's just a matter of directly sending the message:
from google.appengine.api import xmpp
# `destination` is a list of JIDS
# `message` is a normal unicode string
xmpp.send_message(destination, message)

You can find a great tutorial on using XMPP by Nick Johnson here
Comment: so when i integrate the chat into my application i could send messages to the users using xmpp and jids like: whatever@upserip:userport. Then my app sends my message as a http request. correct? can i traverse NAT like that?
Comment: @Laures now you got me confused. From what I understand, what you're looking for is actually on Robert's anwer, not mine. I'll be upvoting his answer.
Comment: ok...now i'm confused. I want to recieve information from clients and distribute recieved data to all clients. i want to do this without polling. when the channel api is out this should be simple, but why is it imposible now? (maybe i should have mentioned that this is my first gae or network related project)
Comment: It is not impossible now.  You could potentially use XMPP in combination with some thing like Strophe (http://code.stanziq.com/strophe/) to achieve what you want to.  What you are looking for is actually detailed in my response to your question.
Answer: Note that you can now use the App Engine Channel API for this: http://code.google.com/appengine/docs/python/channel/
You can create a channel for a given client using:
channel.create_channel(client_id)

Then when you want to update that client, send a message:
channel.send_message(client_id, message)

Basically each client will get a persistent connection that you can push messages over.


Why axis2 generated proxy does not have any ServiceLocator class

Question: I am new to Web Services. I have to use the crm web services to perform some task from my java application. I am using Eclipse Galileo on Tomcat Application server. I have downloaded the WSDL from CRM web site and generated the Proxies through Axis2 WSDL2Java command.
Now I don't know how to use Axis2 generated proxy classes in my java app as the class structure is different from the Axis1.X generated classes. How to set up the connections(Endpoint and ports) is the point where I got stuck.
Please Help me out.
Answer: There should be a constructor that will take a string representing the endpoint on whatever generated class that extends org.apache.axis2.client.Stub


Is it a sin to not give money (sadaqah) everytime we are asked in the streets?

Question: Salam,
Are we supposed to give money to every person asking in the streets ?
I decided to give a certain amount every Month, but this amount is not enough Big to give everyday to people.. but I Can give more.. it's a weird question.
Answer: There is no Hadith or Ayat indicating this would be a sin.
However, if you are able to give more amount of money to the people asking then there are more good deeds for you. But even if you have the money (but still got many days left to get your salary) and you decide not to give more money as you said that you already do it then there is no sin in that and no such verse is there to prove that is a sin.
Answer: No it is not a sin.
Allah doesn't burden a soul more than it can bear.

Narrated `Aisha:
Allah's Messenger (ﷺ) said, "Do good deeds properly, sincerely and
moderately and know that your deeds will not make you enter Paradise,
and that the most beloved deed to Allah is the most regular and
constant even if it were little."
Sahih Bukhari 6464

Just do your due diligence and give sadaqah as per your capacity to those who are in real need or poor. As Asan mentioned in his answer, your parents, your relatives, the orphans and those classified as "miskeen" should be given preference.
Try to avoid those who made begging for money a business.
Answer: This is not a weird question. It is a good question.
First of all the quran does mention those that have a known right for the needy i.e. it is referring to the people who set aside a known amount for the needy and gives such people glad tidings (70:24-5).
Your ansewer is in surah Baqara, it goes:
They ask thee what they should spend (in charity). Say: Whatever ye spend that is good is for parents and kindred and orphans and those in want and for wayfarers. And whatever ye do that is good―Allah knoweth it well. (215)
......
......
......
.....................................................They ask thee how much they are to spend; say: "What is beyond your needs." Thus doth Allah make clear to you His Signs: in order that ye may consider.― (219)


How can I improve my quran recitation?

Question: as salaamu alaikum, any advice on reading the Quran faster? I can read but I read really slow and I sound dumb. the only time I have a good recitation is when i memorize the surah any advice? jazakallah khair for your help
Answer: Learn Arabic. Become fluent.
It may sound dismissive, but seriously that's all there is to it; if you don't know the language you're always going to be stuck working out every word letter by letter, syllable by syllable, and that's always going to slow you down.
It's equivalent to trying to read English (assuming that's your first language) phonetically, letter-by-letter, instead of just looking at a word and instantly recognizing it and how it's pronounced. Not to mention how your brain does a lot of heavy lifting predicting what the rest of the sentence is going to be based entirely on context of what you've read so far, which requires understanding what you've read so far, so you often already know what the next word is going to be before you've even looked at it. That's just how reading works.
Or, let me put it another way: If you're not already fluent in Arabic, stop worrying about reading slow and sounding dumb. Nobody is perfect when they're starting out, and if you're worried about stuff like that now you're never going to improve. Just stick with it and you'll get less dumb-soundy and more fast over time.
Comment: okay I understand thanks.

How can I improve my quran recitation?


Why do fabric skin constructions not show up much in larger single engine piston aircraft?

Question: I noticed that many ultra-lights use fabric skin but are not seen much in GA aircraft, especially compared to carbon fiber? Many skin makers advertise that it can handle that sort of weight. Is this due to difficulty manufacturing, weight, smoothness of surface, strength of material or other factors?
Comment: are you asking about fabric covering? The expression "stretched skin" does not exist and sounds as if you confused it with "stressed skin", something that is very common in GA aircraft.
Comment: Very few aircraft have only a single piston!
Comment: @PeterKämpf Thanks! You are right. I just updated the question
Comment: Not that I have an answer anyway, but it seems to me that you need to be a bit more specific. The term GA covers many types of planes, some of them really quite heavy, powerful and fast in a context of fabric-covered planes. Your local CEO hotshot on his/her Citation or Gulfstream, for instance, is flying under general aviation rules. So what do you include in your category of "larger" GA planes?
Comment: @Monolo Thanks! Clarified it
Comment: Fixed it. Although this was way more fun when the headline was in its original form.
Answer: This answer assumes that "GA" means "little piston planes."
Aluminum (or non-fabric) aircraft tend to "hold up" better against the elements.  I would not store a Stinson 108 outdoors but would not think twice about storing a 172 (or Cirrus) on an open air tiedown.  The fabric covering requires a great deal of care compared to the metal (or composite) skin of most GA planes.
Fabric planes must be re-covered every few decades, more frequently if neglected.  This is a non-trivial operation with a price tag to match.  This typically involves reconditioning the now-exposed structure which adds significant cost.  Re-covering and painting a Cub (small plane), for example, can cost an owner tens of thousands of dollars. Stripping, treating, and painting a "metalized" Cessna 120 (similar to a Cub) is a much easier, faster, and cheaper task.
Another consideration is the availability of aluminum.  Aluminum was declared a strategic material in WW2 and, as a result, a great deal of energy was allocated to increase production.  With the war over and the infrastructure in place to produce a lot of aluminum cheaply, why adhere to an antiquated manufacturing process requiring a painstaking level of detail when lower skilled labor can use cheap aluminum to mass produce high quality planes?
In short, fabric planes typically require more care and attention than their stressed skin cousins.  They also require somewhat specialized and skilled labor to build and maintain.  This generally translates into higher costs for everyone involved.
I'm sure there are technical reasons for the shift away from fabric but I'll let Peter (or another technical expert) comment on those.
Comment: How small is a little piston? Sorry, I'll get mi coat...
Answer: This should be understood as a supplement to @acpilot's excellent answer. All his points are valid and correct, and I just want to add a few more.
Fabric covering is easy to build and hard to maintain. In the early days, when engines were heavy and less powerful, a wooden airframe with fabric covering was the fastest, lightest and easiest way to get airborne with the skill set of a carpenter. Later, welded steel tubing became popular especially for fuselages because it makes it easy to introduce big loads locally. Again, fabric covering was the easiest to give the truss an aerodynamic shape. Maintenance was hardly considered, given that the lifetime of early aircraft was a few years at best and a more likely few minutes only.
With better engines, wing loading and speed increased. Now the weight disadvantage of a plywood or even metal skin diminished, and with the increased experience of both designers and operators, aircraft enjoyed a much longer life. Only now the disadvantage of fabric covering showed up, but it was still kept even in WW II airplanes (the fuselages of the Hawker Hurricane and the Vickers Wellington were fabric-covered), especially in the control surfaces so their balancing mass could be kept low. With the danger of flutter at high speed, fabric covering became unacceptable for the main structural members of fast aircraft: Only the torsional stiffness imparted by a plywood or metal skin made fast flight possible.
Low wing loading designs like gliders and motor gliders kept their fabric covering even longer, and some modern ultralight / microlight designs still use it today. Glider designers would probably still use it were it not for the much better surface quality possible with composites. Being fair-weather aircraft, gliders are less affected by the obvious disadvantages of fabric covering.
Comment: Thanks for the answer! Would have accepted them both if it was possible
Comment: Another point for the use of fabric with ultralights is that many of them are portable.  At the extreme, think of your typical hang glider, which is broken down, rolled up, and carried home on a roof rack.  Can't really do that with a metal skin :-)


How to use Overlay layer in Grease Pencil to show drawing only over desired background

Question: to create blinking eye effect.
Answer: Here the basic typical setting -

we have three layers here,

set the top layer to ("blue square" in this example) Object data > layers> Blend = Overlay.
toggle the Clamp option for the layer below (in the layer rubric or next to the Opacity option)

you can see that the red circle is visible only on top of the green oval, but not on the blue background.
note that the red color changed, due to color mixing, you may adjust it.

Now I used this setting to set a blinkable eye:

I used the former setting, and -

I placed layers to not be effected, above the overly
I placed the 'pupil' layer under the overlay, but above the 'eye.white", and toggled the Clamp option.

Now when I scale the eye.white shape vertically, I get the blinking eye effect.
It can be animated too.
Note that now layers partly covered under the overlay (like 'neck') would not be covered as regularly, it is a bit of a problem, you may separate it into to two different objects.


How can I get my Facebook posts translated from English to another language?

Question: How can I have integrated translation of Facebook posts from English to another language in my browser? I have seen that in some cases, Facebook adds a "Translate" link, but not in my non-English account.
Answer: Facebook auto-translates comments in some circumstances, see http://www.geek.com/articles/news/facebook-starts-experimenting-with-comment-translations-2011095/ . What language are you hoping to translate to?
The other option is to use a browser plugin such as Google Translate for Chrome: https://chrome.google.com/webstore/detail/google-translate/aapbdbdomjkkjkaonfhkkikfgjllcleb?hl=en . Most browsers have plugins that include extensions to quickly highlight text and translate.
Answer: You can try Babylon translation. It allows you to translate quickly from many different languages and to post. It also has an app for your phone so you can it do while you're mobile.
Answer: Facebook provides various language and language translation settings, one of which may do what you required. To access them, open Facebook's settings by clicking the downwards pointing triangle to the right of the top nagivation bar, then click "Settings" then click the "Language" tab.


Where is the reply button in Google gmail (Chromebook)

Question: You'd think that in an email application the "reply" button would not only be visible but would stand out. I cannot find it in Google gmail on my Chromebook.
Answer: Scroll down to the end of the message. That's where you will find the Reply and Forward buttons.
Answer: As an alternative to the existing answer, one can press R to start writing a response. This avoid the potentially tedious scrolling down to the end of the thread.


How to use .svg files in a webpage?

Question: I want to know how can one actually use a .svg file In a web page?
Answer: See svgweb quickstart and the svgweb project homepage for something that works in all browsers including IE (requires flash plugin).
There are many ways to include an existing svg file:

<object data="your.svg"/>

<embed src="your.svg"/>

...

Comment: My favorite is not in this list, just open your svg in a text editor and put its content inline into your html document, this will allow you to apply filters to it and style the svg image with css.
Comment: @chrisweb That works with `` too. See "Using SVG as an " at http://css-tricks.com/using-svg/.
Comment: @chrisweb How does that work with a background image?
Comment: Keep in mind that if you don't include it directly in your content document (like crisweb suggests) you might have something similar to FOUC with your svg making it look like it gets reloaded every time you switch a page. Important for header logos and the like.
Comment: does any of these methods support changing of svg icon fill color property also?
Comment: @Erik Dahlström, how to display svg image correctly when we have uploaded our svg file to server and then using .
Comment: @Ahmadmnzr verify that the server transmits the svg with the correct svg media type, 'image/svg+xml'
Answer: If all you want to do is to place an SVG image such as a logo or static diagram, you just need to be careful to provide a fallback for older versions of Internet Explorer (i.e. versions 8 and earlier).
The best and simplest method I've found is to use a .png or .jpg for your fallback, placed using a normal img tag. You then wrap the img tag in an object tag, using the data attribute to place the SVG.
<object data="/path-to/your-svg-image.svg" type="image/svg+xml">

</object>

The img fallback is only loaded and used if the browser doesn't understand SVG.
Comment: alternatively move the fallback into the CSS itself
Answer: I recommend putting the svg inline into your document (html5 technique). Just open your SVG file, copy the SVG tag and everything insideof it and then paste it into your html document.

        <svg></svg>

It has the advantage that this allows you to use css to style it, like changing the fill color or applying filters to it like blur. Another advantage is that you save one http request for fetching the svg file if it is inside of your document.
If you want for example to change its position using css, then you have to put the css inside of a style attribute. Styles that are in an external css file will not get applied in most browser as this is a security restriction. For example:
<svg id="mySVG" style="position: absolute; top: 200px; left: 200px;"></svg>

This technique is supported by all browsers except IE8 and below as well as the android 2.3 browser and below.
Read the chapter inline SVG for further details:

css-tricks.com Using SVG
developer.mozilla.org SVG In HTML Introduction

If you dont want to put it inline in your page then the best alternative seems to be the object tag and avoid using the embed tag.
Read this for further details about object vs embed vs img tag:

How to Add Scalable Vector Graphics to Your Web Page
Comment: Do you know of a way to automate this? Rather than copying from the SVG file and pasting into your HTML, is there a grunt plugin or something that can inject it into your page?
Comment: nope sorry never heard of such a plugin, but maybe it exists
Answer: http://www.w3schools.com/svg/svg_inhtml.asp
The best example:
<embed src="rect.svg" width="300" height="100"
type="image/svg+xml"
pluginspage="http://www.adobe.com/svg/viewer/install/" />

Comment: Note that code-zoop's solution (RaphaelJS) "removes the plugin dependency" by not actually using SVG at all on IE.  If you're looking specifically to display an "svg file", that is probably not going to help you.  For SVG + all major browsers, IE users will need a plugin.
Comment: Thanks,
but whats the 'pluginspage' all about?
can't catchup with that one?
Comment: would this actually show the svg image on any browser?

Thanks?
Comment: pluginspage tells the browser where to get a plugin if it can't display SVG files natively (e.g. Internet Explorer).
Comment: so the image would not be visiable If the user doesn't download the plugin?
Comment: It would be visible to Firefox, Chrome and Safari users but Internet Explorer users will need to have to plugin installed. If that's a problem then code-zoop's solution does some fancy work to remove the plugin dependency.
Answer: Caspar's approach is the proper one.   However, I would move the fallback to the CSS, since you probably want to apply some styles to the svg file itself...
<object data="/path-to/your-svg-image.svg" type="image/svg+xml"  class="logo"> </object>

CSS
.no-svg .logo {
  width: 99px;
  height: 99px;
  background-image: url(/path-to/your-png-image.png);
}`

Answer: Raphaël—JavaScript Library. Nice javascript library that is using svg, and gives you a large range of effects!
Also supports most browsers, including IE
Comment: that JS library url is broken btw
Comment: I added the answer 8 years ago. But Hey, here you have the link to the github repo https://github.com/DmitryBaranovskiy/raphael
Answer: I'd like to agree with the answer from "code-zoop". Although this technically doesn't answer your question, it might also be a solution: enter the relevant data straight into the HTML. Either directly as an svg element, or by using Raphaël-JS.
From w3c-schools:

SVG is all suported in In Firefox, Internet Explorer 9, Google Chrome,
  Opera, and Safari you can

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <circle cx="100" cy="50" r="40" stroke="black"
  stroke-width="2" fill="red"/>
</svg>

(end of quote)
And to think even more outside the box, depending on how you want to use it, you can also put your 1-color graphics in a webfont. (see for example iconmoon.io )

How to use .svg files in a webpage?


impersonation in asp.net

Question: My understanding was that if asp.net application wants to write file to file server, it needs to use impersonation. I use the support.microsoft.com/kb/306158#4  "Impersonate a Specific User in Code" to do it. But it didn't work. The GetLastError() was giving error code 1326 "Logon failure: unknown user name or bad password." ( as per msdn.microsoft.com/en-us/library/ms681385) Then, the only way it worked was I've to create user (My computer > manage > local user and groups > user) with same user name and password as the file server folder. Now, even if I removed the impersonation code, it still works. So, I'm confused. Why do we need impersonation? I'm using XP and windows 2008 server.
Answer: You don't need to use impersonation in order for ASP.NET to write files to the local server.  You simply need to make sure that the identity that ASP.NET is using has permission to write to the location you're trying to write to.

impersonation in asp.net


Do polymerized cooking oils release free radicals

Question: I am seasoning a carbon steel wok and from what I understand it basically involves heating cooking oil on it until it gets to the smoke point and then forms a polymerized layer that makes it like a non stick pan.  I have also heard that as oil gets heated close to and past the smoke point it breaks down releasing free radicals and other unhealthy compounds.  My question is that when the heated oil polymerizes do these compounds get permanently locked up in the polymer or will they eventually get into the food cooked in the pan?
Answer: I read several articles in the topic in the past 5 hours, and I have a different conclusion than the other answerer.
My experience that the TG polymer layer on the surface of your wok is far from being stable. Every time you use it, smaller or bigger particles of the polymer can end up in your food. Some of them are even visible, that's why I stopped using a wok a long time ago. If you want to use a seasoned wok no matter what, then do the seasoning with an oil high in polyunsaturated fatty acids (e.g. flax seed oil), so the polymer will be somewhat more stable, because of the additional bonds, but there is no guarantee that it won't break down in time. Don't use these heat sensitive oils for cooking, they are good only for seasoning or for cold salads.
High polymers can be absorbed depending on whether the enzymes of the digestive tract can handle them. For example starch is a high polymer of glucose and amylases can easily hydrolize it, while cellulose is a different high polymer of glucose, which we don't have the enzymes to digest. As of TG polymers, they contain mostly fatty acid monomers, dimers and trimers. So the polimerization is far from being complete, you won't get long fatty acid polymers by cutting down the glycerols with a lipase. According to the articles I read, lipases can hydrolize around 10-50% of the polymers (they are inhibited by them at some degree), so the resulting dimers, trimers, oxidized monomers, cyclic monomers, etc. created in the seasoning process, can be absorbed. It is hard to find studies about their health effect, but they are not considered healthy.
Comment: Any cook can tell you, that seasoning a pan is not a permanent, but ongoing affair.  High heat, acidic food and mechanical damage can and does occur, which is why you need to season your pan on a regular basis. So it is clear, that some of this stuff ends up in your food, no way around that.
Answer: If you use fresh cooking oil containing unsaturated fats (like olive or canola oil) to season your pan, it will thermally polymerize to form a stable layer that gives the cooking surface its nonstick properties. Note that a saturated fat like coconut oil, lard, or ghee will not work very well or at all for this, since it does not have any double bonds to undergo polymerization. The radical formation you are concerned about results over time from air oxidation of unsaturated fats to form peroxides--these in turn break down to give aldehydes and acids that cause the bad flavor of rancid fat, and have adverse health effects. (Not a problem for coconut oil.) Heating fresh oil in a pan to create a nonstick coating may result in some air oxidation in addition to polymer formation, but I think it is not a big cause for concern. High polymers are generally nontoxic because the body does not absorb them.
Comment: I am not sure I understand your answer. I am pretty sure, that heating oil above its smoke point is pretty bad for your health and as far as I know this is exactly what produces trans fats, please correct me if I am wrong.
Comment: @user1721135 No this is not how trans fats are created. And, since the point of seasoning a pan is to create a semi-permanent coating not to cook food, the concerns are irrelevant if the treated pan is washed before you cook with it.
Answer: Based on inf3rno's answer, this is from "Deep Frying Chemistry, Nutrition, and Practical Applications" by Michael Erickson

Digestibility of oxidized fatty acid monomers was considerably high,
averaging 76.6%. Among polymeric fatty acids, nonpolar dimers had the
lowest digestibility (10.9% on average),whereas oxidized dimers and
polymers possessed higher apparent absorbability than expected,
ranging from 22.7-49.6% (96).

Basically, the question around all safe cookware questions is, "is a coating of X on the surface" considered safe. In stainless steel it would be chromium oxide. Nonstick coatings are manmade thermoplastic polymers. Glass is silicon dioxide. There seems to be a blind consideration of "cast iron" as safe yet it is quite difficult to figure out what the coating actually is, so this question of asking if it releases free radicals makes a lot of sense.
Comment: While this is interesting, I don't see how it actually answers the question.
Comment: My train of thought was not explained well. Since inf3rno stated that "dimers, trimers, oxidized monomers, cyclic monomers" are created, I wanted to quantify how well they are absorbed. I agree that they are not healthy.
Comment: I don't have enough points to comment on the above post.


Feeling sound; frequency and volume

Question: How loud and "low" must a sound be in order for one to feel some physical sensation in response? I've read that below certain frequencies humans can be expected to "feel" sounds in their chests, and I assume amplitude plays into this as well, but at what point, specifically, does this normally occur?
Answer: Having played electric bass guitar for 48 years, I can offer some rule-of-thumb guidance here.
You can begin to "feel" the sound from a bass guitar amplifier at about the 100 watt RMS level, assuming good coupling between the speakers (2 x JBL D140F) and the air, if you are about one foot from the speaker cones, and playing the lowest note (fundamental E). Farther away than that, the bass will still be deafeningly loud (to normal ears) but you won't feel the bass.
At the 1000 watt RMS level and assuming 18" drivers and a detuned, extra low string (fundamental B) you can feel the bass notes several feet away.
The human body is supposed to have subsonic resonances in the ~10Hz range but to excite them at any significant range (say, tens of feet) requires a lot more than 1000 watts of radiated power.
Note than since 746 watts = 1 horsepower, we're talking very, very loud!

Feeling sound; frequency and volume


When to use candies in let's go pikachu

Question: I'm curious, does it matter when you use a species specific candy? Say, would it be best to wait till my pokemon is lvl 100 then use the 200 candies to achieve max stats? Or is there no penalty and you can use them whenever without consequence?
Answer: Candies always give you +1 to the associated stat (Or +1 to all stats for species candies.)  Apparently the candies increase the "Awakening value" for each stat, and the cap is 200 for each of the six stats (They're independent so you can get up to +200 points in every one.)
To actually answer your question, no, it doesn't matter. The stat boost for candies will be the same at level 1 as level 100.
You can get a more info for this here.
Comment: Wouldn't this actually depend on the goals of the player? If the player is expecting to level their pokemon to max, then waiting until level 100 would be the most optimal way since Pokemon have a chance of gaining awakening values when leveling up. Thus, you should need less candies at level 100 compared to level 1.
Comment: You could maybe save 16 candies if you're extremely lucky with level up AVs, but the end result is the same regardless if you jam them full of candy at level 1 or 100.
Answer: It doesn't matter
You can use the candies whenever you want, from my own experience I can say is encouraged to use them at lower levels so your Pokemons get stronger, there is no penalty from having a low-level Pokemon with +200 in each stat, because the game is oriented to younger and/or newer Pokemon players, so this mechanic was implemented to help you out when you feel your party is weak or you want them to be super strong.
In YouTube and forums you can find people talking about beating master trainers with low-leveled Pokemon with the use of candies.
This is for in-game play-through, in case you are talking about online play is somewhat different, because there are two modes to play, Normal and Anything goes, if you plan to only play Normal, all your Pokemon will be at Lv.50 with no AV (values added by the candeis), but if you want to play in anything goes, make sure your Pokemon are at Lv.100 and have +200 stats because they will battle at the level they are.

When to use candies in let's go pikachu


Relicensing software under GPLv2+ without all contributors

Question: I have software licensed under GPLv2, which I would like to relicense under GPLv2+.  Unfortunately, I an unable to contact some of the contributors.  Can I proceed, or am I stuck?
Comment: I have an answer to this as a project just went through this and wrote it up, but let's see what develops.
Answer: Since licensing can only be done by the copyright holder, you generally need individual permission from each copyright holder to change the license of their code. (If the project is being re-licensed to the GPL from a compatible license, then no re-licensing from the copyright holder is necessary; however, versions 2 and 3 of the GPL are not compatible with one another.)
Ways around this are:

Remove or replace all code written by the unreachable contributors.

Have contributors assign copyright to a person or legal entity that controls the project, so that there is exactly one copyright holder. (This is a preventive measure. If you have not done this already, it's too late when you cannot track down a contributor.)

But if you can't do either of those things, what do you do?
Historically, re-licensing of software without explicit approval from all contributors has been done before, under the advice of legal professionals. However, the legal mechanics of it are unclear and have never been tested in court. The two prominent examples appear to be:

Mozilla relicensed from the MPL to a triple-licensed MPL/GPL/LGPL scheme

The Dolphin emulator relicensed from GPLv2 to GPLv2+.

The Dolphin project produced a report about the process, but it lacks any specifics about how the legal mechanics of the switch work. They say (emphasis mine):

Out of all [200 contributors], we managed to contact all or take care of the code of all but 10 of those developers. Considering that many of those accounts are now dead and the people seemingly vanished from the Internet, finding the rest is akin to squeezing blood out of a stone.
That's when research provided us some much needed relief when it seemed as though relicensing was an impossibility. In 2003, Free Software lawyers consulted for Mozilla's relicensing project and stated that relicensing with the permission of just 95% of contributors was fine, as long as there were no objections in the remaining 5%.
[...]
[...] Instead of simply asking all of our active developers and relicensing, we made a very strong effort to get a hold of every single developer. Despite this, it simply wasn't feasible to make contact with every single person who worked on Dolphin.
[...] We definitely would love to hear support from those that we were unable to contact, and if there are any concerns we will gladly address them in a prompt fashion.

That posts links to a post from Ciaran O'Riordan:

Someone who works with many lawyers on free software copyright issues later told me that it is not necessary to get permission from 100% of the copyright holders. It would suffice if there was permission from the copyright holders of 95% of the source code and no objections from the holders of the other 5%. This, I'm told, is how Mozilla was able to relicense to the GPL in 2003 despite years of community contributions.

There is no information available about why Mozilla's lawyers believed it was acceptable to re-license without each copyright holder's permission. It's also unclear if any factors apply to Mozilla specifically that might apply less strongly to anyone else in a similar situation.
In sum, we know only that:

You need the permission of every contributing copyright holder to re-license a work

Mozilla's lawyers believed (for unspecified reasons) it would be acceptable for Mozilla to make a good-faith effort to contract all contributors and then re-license, even if 5% of the contributors were unreachable (and none of the contributors disapproved).
Comment: That's exactly what I was going to write.  I wish we could get Mozilla's lawyers on here.
Answer: As far as I know, you are stuck unless you can somehow track the pieces of code written by every single developer, and remove those written by those you can't reach.
For obvious reasons, this is seldom doable.


iPhone App: implementation of Drag and drop images in UIView

Question: In my iPhone App I want to implemented functionality as shown  below

user can pick a shape(an image) from one view and put in other view
How can I achieve this?
Comment: [http://stackoverflow.com/questions/17678735/adding-drag-and-drop-component-to-ios-app/31963306#31963306](http://stackoverflow.com/questions/17678735/adding-drag-and-drop-component-to-ios-app/31963306#31963306) You can try this link enjoy coding :)
Answer: Easiest way is to use a UIPanGestureRecognizer. That will give you messages when the view is moved and when it is dropped. When it is moved, update its center. When it is dropped, check if its position is within the bounds of the view you want to drop in. (You might need to convert coordinates to the target view's coordinate system.) If it is, do the appropriate action.
Answer: Try below link drag and drop image around the screen
also try this
Comment: hi, your first link is dead. for future references, can you post the contents of the link in your comment. SO is meant to be a one stop shop and shouldn't link to potentially dead links
Comment: Link 1 cached: https://web.archive.org/web/20081022074350/www.icodeblog.com/2008/10/20/iphone-programming-tutorial-using-uitouch-to-drag-an-image-around-the-screen/
Answer: You can refer to the previous post which will definitely help you to achieve this functionality...

Basic Drag and Drop in iOS
Building drag and drop interface on iphone
iPhone drag/drop

For all of above link, You have to keep in mind that You need to first get TouchesBegin event for any Control and then you have to get the TouchesMoved event for same control.
In TouchesMoved event, you just have to get the center point (CGPoint) of the Control. And when you release the control will be set at that CGPoint. If this creates problem then you can take that CGPoint in variable and set that Point in TouchesEnded event.
For your case, i think you must have to maintain the Hierarchy of the Views...Else while dragging you view may not be visible...
FOR MORE CODING PART :
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

        NSLog(@"%f,%f", self.center.x, self.center.y);
        CGPoint newLoc = CGPointZero;

        newLoc = [self.mainView convertPoint:[[touches anyObject] locationInView:self.superview] toView:self.superview];
        float newX = newLoc.x + self.superview.frame.origin.x + (self.frame.size.width /2) + [[touches anyObject] locationInView:self].x ;
        float newY = newLoc.y - (((UIScrollView *)self.superview).contentOffset.y *2) ;
        NSLog(@"content offset %f", ((UIScrollView *)self.superview).contentOffset.y);

        self.scrollParent.scrollEnabled = NO;
        NSLog(@"%f,%f", self.center.x, self.center.y);

        newLoc = CGPointMake(newX, newY);
        [self.superview touchesCancelled:touches withEvent:event];
        [self removeFromSuperview];
        NSLog(@"%f,%f", self.center.x, self.center.y);

        self.center = CGPointMake(newLoc.x, newLoc.y);
        [self.mainView addSubview:self];
        NSLog(@"%f,%f", self.center.x, self.center.y);

        [self.mainView bringSubviewToFront:self];
        isInScrollview = NO;
}

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

    [UIView beginAnimations:@"stalk" context:nil];
    [UIView setAnimationDuration:.001];
    [UIView setAnimationBeginsFromCurrentState:YES];

    UITouch *touch = [touches anyObject];

    self.center = [touch locationInView: self.superview];

    [UIView commitAnimations];
    if ((self.center.x + (self.frame.size.width / 2)) > 150 && hasExitedDrawer && !self.scrollParent.dragging ) {
        self.scrollParent.scrollEnabled = NO;

        [self.delegate moveItemsDownFromIndex: ((self.center.y + (self.scrollParent.contentOffset.y)) / 44) + 1 ];
        //NSLog(@"%i", ((self.center.y + (self.scrollParent.contentOffset.y *2)) / 44) + 1);
    }

    if (self.center.x + (self.frame.size.width / 2) < 150) {

        hasExitedDrawer = YES;

    }

}

-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    if ((self.center.x + (self.frame.size.width / 2)) > 150 && hasExitedDrawer && !self.scrollParent.dragging ) {
        CGPoint newLoc = CGPointZero;

        newLoc = [self.scrollParent convertPoint:[[touches anyObject] locationInView:self.superview] toView:self.superview];
        float newY = newLoc.y + (self.scrollParent.contentOffset.y *2);

        [self.scrollParent insertSubview:self atIndex:((self.center.y + (self.scrollParent.contentOffset.y)) / 44) ];
        self.frame = CGRectMake(0, newY, self.frame.size.width, self.frame.size.height);
        isInScrollview = YES;
        hasExitedDrawer = NO;
    }
}

This code may cantains some irrelevant but gives you more idea...
Answer: You can use below open source libraries:

Library 1 OBDragDrop
Library 2 AJWDraggableDroppable
Library 3 iOS-DragAndDrop
Library 4 ios-drag-and-drop
Answer: Adding drag and drop component to iOS app the Question
i thing you are going to Build a feature like Add to cart in Most of the Shopping Apps like Amazon, Flip kart and etc..
Answer: Three step solution
1) u'll have to implement/listen for touch events
2) implement dragging and touch events
3) and then manage movetosuperview method.
Comment: Source code for how to drag and drop with snap to area http://stackoverflow.com/a/9233102/1537178


Big problems with AD gpo

Question: I have a problem with a gpo on AD.
Well, I have a domain root where I have only one domain policy. In the policy there is a permission on "log on as service" and two 2 groups added.
Down the root I have 1 OU and some other leaf OU as user,groups,computers and servers.
Under servers I have al my servers. Then the servers have just one gpo that is the domain policy.
The servers have applied the domain gpo as it should be. But there is one that have only one group under the "log on as service" policy.
If I run gpo result it show me that the server should have just one group and it look that it apply the policy correctly. But for my logic it should have two groups... what's happening ?
Comment: Where does the resultant set of policy show that setting as coming from?
Comment: Do you have any SCECLI errors in your event log?  Perhaps with an error 0x534?  See: http://support.microsoft.com/kb/324383
Comment: ok, it should be resolved. I dont know why the kaspersky antivirus would have blocked the gpo apply.
Answer: Kaspersky blocks gpo application. Do not know why.

Big problems with AD gpo


trasnsaction not confirmed forever at polygon mumbai

Question: since a few weeks, I tried deploy contract on polygon mumbai by hardhat. but transcaction not confirmed for a while then timed out. so I set higher gas, gasprice, and time out limit. but nothing changed.
I also tried on remix then contract deployed but It takes 380 confirmation at just one contract.
plz give me some advice.
Comment: @thefett thanks for your answer. I raised gasprcie to 50gwei, it worked!
Comment: whats your address?  Do you get a failing txn or nothing at all?  And no idea what good gas should be on Mumbai, but it might be higher (I know some networks have a 30gwe min)
Answer: Polygon (and mumbai) apparently have a min gas fee now:  https://thedefiant.io/polygon-transaction-fee-hike
Raise it up and you should be good