A terminal-only (No window manager) terminal emulator that supports all characters

Question: I am setting up Satnogs monitor, which needs a lot of unusual (unicode) symbols to show a world map with symbols. In order to get them, I was using a fork of yaft. On my raspberry pi, I could simply open this from a terminal, it would switch to a yaft non gui terminal, and then I could run it. However, I am setting it up on another raspberry pi and symbols are not working. Instead of trying to find the underlying issue I want to just use another terminal that works (konsole works on my main machine but that requires installing all of KDE). Are there any I can start from the command line and use without a window manager, and that support all symbols?
Comment: I'd say that this had already been asked and answered at https://unix.stackexchange.com/a/177209/5132 and https://unix.stackexchange.com/a/196102/5132 five years ago, were it not that the proper question is _How do I expand the fonts in yaft?_.
Comment: There are two components to make this work: a terminal emulator capable of displaying unicode and a font supporting the glyphs. All [nerdfonts](https://www.nerdfonts.com/) should work. My personal choice is the [tewi](https://github.com/lucy/tewi-font) font. The yaft fork uses this font by default. So you don't have to generate it yourself. Make sure you're actually using the fork on your new RPi.
Answer: While not exactly what you're asking for, you could run a simple window manager like i3 then fullscreen a terminal emulator like st or xterm. This saves you installing an entire desktop environment and will be nice and light weight.
You can configure i3 to start a terminal in full screen or use dmenu to launch a program.
Comment: You don't need a WM just to run XTerm in full screen size. Just run `xterm -geometry 800x600` or whatever your display resolution is. But anyway, the OP is about the choice of a terminal, not WM.
Answer: I've actually tried satnogs-monitor on Xubuntu, and XTerm does support all the symbols required to show a decent image. So just make sure you have xterm command available, and try running it like xterm -geometry WIDTHxHEIGHT, where WIDTH and HEIGHT are your screen resolution dimensions. From the window that appears, run satnogs-monitor as you would usually do.
Here's the command I tried when testing fully DE-less X11 session on Xubuntu 19.04 in QEMU (after having stopped the lightdm service):
startx /usr/bin/xterm -geometry 1024x768

Typing satnogs-monitor -s 175 in the terminal here gives me the following result:

You'll just have to set it up to have black background and white foreground instead of the default colors. Namely, I have put the following into ~/.Xdefaults:
xterm*background: black
xterm*foreground: white

Now the result is
Comment: "terminal only" and "non gui" do imply that the questioner is somewhat averse to using X as a whole.  But maybe xe is not.
Comment: @JdeBP yeah that might be true. But in this case the question should be edited to specify the missing details. The mentioning of Konsole though implies that X-based solution is not really undesired.
Comment: I ended up just installing Kubuntu, but I'll try this. Thanks.


Where in the story do the non story missions fit?

Question: In Zombies, Run there are several modes in addition to the normal story. Namely these are:

Airdrop
Supply
Race

How do these fit in the story (or does it even matter)?
I read that Airdrop missions should be played during the first half of season two and race missions between missions 13 and 14 of season one. Does this mean all race missions in ascending order (even the second set)? What about the other types?
Is there some kind of overview including all missions? Or will the missions just occur on the main (home) screen where the I can select the next normal mission?
Answer: The official Zombies, Run web blog states that the race missions for Abel and New Canton take place chronologically "just before the finale" of season one, though I've seen multiple sites saying the chronological order places them between Patient 29 and Virtuous Circle. And now that training missions and Zombies, Run! 5K have been released, you may want to run those before Season One.
As each Race mission in order seems to contain references to the next race mission, I would suggest running them in order (if you have the endurance or desire to run them). If you don't, you can read the transcripts on the Wiki or turn off the GPS and just listen to them, as though another runner assumed your number in your place. Canon is what we make of it, after all. Each set of race missions is meant to be run in ascending order, with the second set immediately following the first.
Supposedly, the Supply missions are interspersed throughout Season One and the Airdrop missions are peppered throughout Season Two as shown on this post. There doesn't seem to be any sort of in-app overview listing all the missions. On my app's mission page they are split by category, with Story missions being shown separately from Airdrop, Race, and Supply missions. The 'next mission' feature only cycles through the Story missions, and only if you have them downloaded. Otherwise, the app will switch to Radio mode.


what is web to lead and web to case in Salesforce?

Question: I was going through visual workflow in Salesforce I found Web to Lead and web to Case Here's link. Can anyone please explain What is Web to Lead and Web to Case in Salesforce ? I got only got very vague  understanding of these cause I am new to Salesforce. What is Lead and Case here refers to? What is Use case of these two ? I tried to understand Lead but it wasn't explained very clearly here's link.
Answer: Both Web to Lead and Web to Case generate basic HTML to pass onto your website developer that would pass queries straight into Salesforce.
Web to Lead is normally Sale driven, e.g. someone interested in a product or receiving a call back from a Sales person.
Web to Case is normally Customer Service driven, e.g. My product doesn't work help me please.
Both are basic enquiry forms. You have a daily limit of how many can be created - this is to prevent spammers taking over. A word on that, mask the org id on the web page - as this is all they need to spam using the POST function.
One thing I found is that web 2 lead create failures (e.g. not passing a validation rule) email a system administrator, web 2 case does not.
Both offer a quick and basic way to get a public facing page up to get data straight into Salesforce and use the automation that it can provide.
Comment: What does lead refer to in Web2Lead?Can you please explian what is lead in Salesforce?
Comment: In a pure salesforce definition a lead is someone who has expressed an interest in something of yours but hasn't yet been qualified/turned into opportunity.
Answer: Lead is a prospect for an opportunity. I will explain with an example, say I am a salesperson met a customer and understood his requirements. With the conversation I can figure out whether he is interested to purchase the product. If yes, then if he is interested to purchase product with my organisation. If any of the answers are positive then this is positive lead, means it can turn to opportunity.
Comment: What does this answer have to do with `Web To Lead` or `Web To Case`?


Make Buffer List take focus?

Question: How can I make it so that when I press C-xC-b to access the Buffer List that that buffer automatically takes focus instead of having to switch to it manually with C-xo? I can't find a variable that customizes this.
Comment: This is purely editorial, but I have never understood how having the list come up un-focused is supposed to be useful. So yeah, good question.
Answer: You can replace the command list-buffers which is run with C-x C-b to a function that does what you want.  In this case buffer-menu-other-window opens the buffers list in another window with focus. Adding the following snippet to your init file should remap C-x C-b to the new function.
 (define-key global-map [remap list-buffers] 'buffer-menu-other-window)

Here global-map represents the keymap where C-x C-b is bound to a command, list-buffers the original command and buffer-menu-other-window the new command.
Comment: Or `buffer-menu`, if you don't want to use another window.
Comment: Kudos for using remapping over global-set-key.
Comment: @metaturso You can remap with `global-set-key` as well: `(global-set-key [remap list-buffers] #'buffer-menu-other-window)`. `global-set-key` is merely a thin wrapper around `define-key`.
Answer: An alternative is to switch to ibuffer, which does not share this problem.
ibuffer is part of GNU Emacs, so on recent versions of Emacs you should just need to add
(global-set-key (kbd "C-x C-b") 'ibuffer)

to your init file.
Comment: This is what I do as well, but the wording of your answer makes it seem like it is more than just a matter of preference.
Comment: It certainly does.
Answer: Here's what I use:
(add-to-list 'display-buffer-alist
             '((derived-mode . Buffer-menu-mode)
               (display-buffer-reuse-mode-window display-buffer-same-window)))

As mentioned by others, switching to ibuffer is also an option.

Make Buffer List take focus?


Add firewall exception

Question: I'm working on a server/client TCP communication and it works fine, altough I can't make an application to add the software to the Windows firewall exception. I did found a sample, but it didn't worked.
My code:
<code>Imports NetFwTypeLib
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim appType As Type = Type.GetTypeFromProgID("HnetCfg.FwAuthorizedApplication")
        Dim app As INetFwAuthorizedApplication
        app = DirectCast(Activator.CreateInstance(appType), INetFwAuthorizedApplication)

        ' Set the application properties
        app.Name = "My App"
        app.ProcessImageFileName = "c:\users\klein\documents\visual studio 2012\projects\tcp_server\tcp_server\bin\debug\tcp_server.exe"
        app.Enabled = True

        ' Get the firewall manager, so we can get the list of authorized apps
        Dim fwMgrType As Type = Type.GetTypeFromProgID("HnetCfg.FwMgr")
        Dim fwMgr As INetFwMgr
        fwMgr = DirectCast(Activator.CreateInstance(fwMgrType), INetFwMgr)

        ' Get the list of authorized applications from the Firewall Manager, so we can add our app to that list
        Dim apps As INetFwAuthorizedApplications
        apps = fwMgr.LocalPolicy.CurrentProfile.AuthorizedApplications
        apps.Add(app)
    End Sub
End Class
</code>
The code runs perfectly, no exception detected. Yet, the program is not listed after the form is loaded.
Thank you.
Answer: Look at this:
Programatically Add Exceptions to a Windows Firewall Using C#
Comment: The instructions are for `SQLServer`, it would be better if you could provide code that shows OP how it works for server/client TCP.
Comment: Thank you, but I managed to make it work, the problem was that the program had to be ran as administrator.

Add firewall exception


What are the speeds of the windshield wipers on an A320?

Question: In the Airbus A320, the overhead panel wiper selector knob has three settings: Off, Slow and Fast. At what speed do the wipers operate in Slow and Fast mode?
Comment: To confirm, you are not asking about airspeed, but about the angular speed of the wiper blades themselves?  I doubt this information is published anywhere...
Answer: The A320's manual doesn't say—it doesn't have to as what is adjusted is the tension. Assuming you're asking out of curiosity and a general answer / other jet-liners would do:
It's measured in sweeps/strokes (or cycles) per minute – a cycle is two sweeps/strokes. Generally it's 250 sweeps per minute, and the slow mode is 2/3 of that (that's how the typical control system is designed).
This perfectly matches the numbers for the Boeing 737 (b737.org.uk) and Airbus A380 (technical training manual). Given the similarity between the 737 and A380, it should be similar if not exact. The optional intermittent option adds a delay between cycles.


Calculate limit of integral sequence

Question: Hi i need to calculate limit of integral sequence:
$$\lim_{n\rightarrow\infty}\frac{1}{n}\int_{1}^{\infty}\frac{dx}{x^2\cdot\ln{(1+\frac{x}{n})}}=\lim_{n\rightarrow\infty}\int_{1}^{\infty}\frac{dx}{x^2\cdot n\cdot\ln{(1+\frac{x}{n})}}=\int_{1}^{\infty}\frac{dx}{x^2\cdot e^x}$$ and it's true if i can use monotone convergence theorem. Everything seem fine but i am not sure about monotonicity of $f_n$. I thinks it's decreasing and according to statement it should be otherwise. And taking negative doesn't seem right at all.
And another one.
$$\lim_{n\rightarrow\infty}\int_{0}^{n}(1+\frac{x}{n})^{n+1}\cdot e^{-2x}=\int_{0}^{\infty}e^{-x}$$ and here i am not sure about the $\infty$ in integral.
I am hopeless newbie so i will be glad for thorough explanation.
Comment: You have computed the wrong limit. You could a) use the dominated convergence theorem, or b) use a variant of the monotonone convergence theorem; you have $f_n \geqslant f_{n+1} \geqslant 0$, that suffices to interchange limit and integral, since $f_1$ is integrable. You could also look at $g_n = f_1 - f_n$ and apply the MCT to that.
Answer: If you are not familiar with dominated convergence and such things, you could use the inequality
$$
\frac{y}{1+y}<\ln(1+y)<y
$$
which yields
$$
\int_1^{+\infty}\frac{1}{x^3}\,dx<\frac{1}{n}\int_1^{+\infty}\frac{1}{x^2\ln(1+x/n)}\,dx<\int_1^{+\infty}\frac{1}{x^3}+\frac{1}{n}\frac{1}{x^2}\,dx.
$$
Calculate the integrals and use the squeeze theorem, and you will see that the limit is $1/2$.
Answer: Change variables in your first integral $x/n=t$, yielding
$$
\lim_{n\to\infty}\frac{1}{n}\frac{n}{n^2}\int_{1/n}^\infty \frac{dt}{t^2\ln(1+t)}=\lim_{n\to\infty}\frac{1}{n^2}\int_{1/n}^\infty \frac{dt}{t^2\ln(1+t)}\ .
$$
Then use L'Hopital and compute
$$
\lim_{n\to\infty}\frac{\partial_n \int_{1/n}^\infty \frac{dt}{t^2\ln(1+t)}}{2n}\ ,
$$
whose numerator can be evaluated using the fundamental theorem of calculus
$$
\partial_n \int_{1/n}^\infty \frac{dt}{t^2\ln(1+t)}=\frac{1}{n^2}\frac{1}{(1/n)^2\ln (1+1/n)}\ .
$$
Eventually, your limit is equivalent to computing
$$
\lim_{n\to\infty}\frac{1}{2n\ln(1+1/n)}=1/2\ .
$$
Answer: Note that, for $x\ge1$,
$$
\lim_{n\to\infty}\frac{1}{x^2}\frac{1}{n \ln(1+x/n)}=\frac{1}{x^2}\frac{1}{\ln(e^x)}=\frac{1}{x^3}.
$$
Furthermore such an integrand is controlled as follows
$$
\frac{1}{x^2}\frac{1}{n \ln(1+x/n)}\le \frac{1}{x^2}\frac{1}{n \ln(1+1/n)}
$$
and since $\lim[n\ln(1+1/n)]=1$, there will be a constant $C$ such that
$$
\frac{1}{x^2}\frac{1}{n \ln(1+x/n)}\le\frac{C}{x^2};
$$
in fact, it can be shown that $(1+1/n)^n$ is monotone and increasing, so that $C=1/\ln2$ is fine, by the monotonicity of the logarithm. Since the integrand has a ''guardian'' $C/x^2$ (an estimate from above) which is summable,
$$
\int_{1}^{+\infty}\frac{C}{x^2}=C,
$$
we can apply Lebesgue's dominated convergence theorem and take the limit $n\to\infty$ inside the integral sign:
$$
\lim_{n\to\infty}\int_{1}^{+\infty}\frac{1}{x^2n\ln(1+x/n)}dx=
\int_{1}^{+\infty}\lim_{n\to\infty}\frac{1}{x^2n\ln(1+x/n)}dx=\int_0^{+\infty}\frac{1}{x^3}dx=1/2.
$$
Similarly, you can work out the second example.
Comment: @vanHohenheim The $C$-estimate is fine, since $(1+x/n)^n\to e^x$ from below. The last step is also correct because the integral of a positive function on a larger domain is always bigger than its integral on a smaller one! Note that you can always think of $\int_0^nf(x)dx$ as $\int_0^{+\infty}\chi_{[0,n]}(x)f(x)dx$, where $\chi$ is the characteristic function, so all in all there is nothing exoteric in sending $n\to\infty$ in the integration bound.
Comment: Alright i get it know. Thanks for solid and detailed explanation.  $$\int_{0}^{n}(1+\frac{x}{n})^{n+1}\cdot e^{-2x}dx=\int_{0}^{n}(1+\frac{x}{n})^{n}\cdot (1+\frac{x}{n})\cdot e^{-2x}dx\le\int_{0}^{n}C\cdot e^{-x}dx\le\int_{0}^{\infty}C\cdot e^{-x}dx$$ as exponential function is monotone and increasing it should be true. Bo unlike the previous $C$ may be arbitrary big(we take $x$ as fixed value?) or my esestimation is wrong. And what about $n$ in integral? I can freely go with it to infinity?

Calculate limit of integral sequence


How fast can the base-bumping function in Goodstein's theorem grow?

Question: In the usual presentation of Goodstein's theorem, the base is bumped up by the "add 1" function. Does the theorem still hold when we replace this function by a fast-growing one (e.g. Ackermann or busy beaver)? How far can we push this? For example, let's define $g_0(n)$ to be the number of Goodstein iterations needed to reach 0 when we start with base 2 and seed $n$ (so that $g_0(0)$ = 0). Then we can build a hierarchy of functions by defining $g_{k+1}(n)$ as the number of Goodstein iterations needed to reach 0 with seed $n$ and base-bumping function $g_k$ ($k$ = 0, 1, ...), continuing through the ordinals by diagonalization at each limit ordinal. Surely it's got to break down when we go past $\varepsilon_0$, if not long before that!
Answer: As long as your fast-growing "base-bumping" function still takes every natural number to a natural number (instead of, say, an infinite ordinal)--and the busy beavers do--the Goodstein iterations are still upper-bounded by the strictly-decreasing sequence of ordinals in "base" $\omega$, which must be of finite length as a decreasing sequence in a well-ordered set.
Comment: @Tracy: Thank you for your compendious answer, from which I conclude that defining $g_\kappa$ as in the question is unproblematic as long as $\kappa$-induction is permissible, at least for countable ordinals $\kappa$.
Answer: First, let me say that this is a really great question.
It seems to me that any increasing base-bumping function would give the
same Goodstein result that you eventually hit $0$. That is, I claim that for any increasing
sequence of bases $b_1$, $b_2$ and so on, if we define the
Goodstein sequence by starting with any number $a_1$, and
then if $a_n$ is defined, we write it in complete base
$b_n$, replace all instances of $b_n$ with $b_{n+1}$,
subtract $1$, and call the answer $a_{n+1}$. The theorem
would be that at some point $n$ in the construction, we
have $a_n=0$.
The proof of the original theorem proceeded by associating
any number $a$ in complete base $b$ with the countable
ordinal obtained by replacing all instances of $b$ with the
ordinal $\omega$ and interpreting the resulting expression
in ordinal arithmetic. They key fact is that the ordinal
associated with $a$ in base $b$ is strictly larger than the
ordinal associated in base $b+1$ with the number obtained
by replacing all $b$'s with $b+1$'s and subtracting $1$.
If we replace $b$ with some larger $b'$ and
do the same thing, then it appears that this key fact still goes
through, since it was proved by observing what happens when the subtract-$1$ part causes a complex term to be broken up with coefficients below the new base. Thus, the newly associated ordinals would still
be descending, so they must hit $0$, but this happens only
if the numbers themselves hit $0$.
Comment: If I remember correctly, Goodstein proved the theorem for an arbitrary base-bumping function.  The reason people often present just the case of "add 1 to the base" is that already this relatively weak case is unprovable by finite combinatorial methods.  (By "finite combinatorial methods" I mean ZFC with the axiom of infinity replaced by its negation; this theory is known to be equivalent, via coding, to Peano arithmetic.)
Comment: You can't allow an arbitrary base-bumping sequence. For example, if your bases are 2, 4, 2, 4, ... and you start with $a=2$, then the Goodstein sequence will be periodic 2, 3, 2, 3,..., and never hit 0. The Goodstein proof uses that the bases are non-decreasing when it shows that the associated ordinals descend, because you need to know that none of the old coefficients (below the base) are  absorbed into the new (smaller) base.
Comment: @Joel: Thank you for the encouragement. That Goodstein's theorem (GT) holds for *any* base-bumping function gives it awesome power. (I don't think that the function has to be increasing---not that it makes much difference.) Thus it seems that we have $2^\aleph_0$ base-bumpers to choose from, each corresponding to a particular version of GT.
Comment: @Joel: Thanks for the correction. I think I'll refrain from off-the-cuff remarks (and attempts at LaTeX) in comments in future.
Answer: Dear all,
let me give the following remark:
"Goodstein actually employed arbitrary increasing base-bumping functions. He showed that the convergence of all such is equivalent to transfinite induction below ϵ0."
This statement has to be taken with care when it comes to weakly increasing base bumping
functions. When we reach functions in the neighboorhood of log* then the Goodsteinprocess
becomes provable in PRA.
But when we take a fixed iterate of log then of course termination of Goodstein
sequences is equivalent to the 1 consistency
of PA.
If the base bumping function growth faster than H_epsilon_0 then Goodstein
can of course yield more than the 1 consistency of PA.
Best,
Andreas
Answer: Goodstein actually employed arbitrary increasing base-bumping functions. He showed that the convergence of all such is equivalent to transfinite induction below $\epsilon_0$. This is illustrated somewhat more graphically by the Hercules vs. Hydra game. See the references from my old post [1] of 1995 which helped serve to popularize these topics on (use)net. Curiously that post received far more feedback than any of my other posts - from popular science writers to researchers, teachers and students.
[1] Bill Dubuque, sci.math, Dec 11, 1995. Goedel's theorem: about anything in real world?
http://email@example.com
Comment: An anonymous user has pointed out that your link yields a 404, and that you should use groups.google.com instead of google.com.
Comment: @Scott: Thanks. Such links used to work ok before recent changes.


Why an Anonymous class can't implement multiple interfaces directly? Simply because of syntax or there is another reason?

Question: In there an internal issue why java anonymous classes cannot implement and subclass at the same time? Or is it just because the syntax?
Answer:
In there an internal issue why java anonymous classes cannot implement and subclass at the same time?

I believe it is 99% due to syntactical reasons. Type parameters even support intersection types (<T extends InterfaceX & InterfaceY>) so I don't think such feature would introduce any contradictions or complications.
An expression like new (InterfaceX & InterfaceY)() { ... } could for instance be compiled into something like
interface InterfaceXandY extends InterfaceX, InterfaceY {}
... new InterfaceXandY() { ... }

The reason no such feature has been added is most likely because it's a rare use case for which there is a simple workaround.

On a somewhat related note. You can let a lambda implement for instance Serializable by doing
Runnable r = (Runnable & Serializable)() -> System.out.println("Serializable!");

See How to serialize a lambda?
Comment: Great answer +1. Totally agree that if there is a very trivial work-around present, why make a fundamental change in the language and introduce a cumbersome syntax of two static types.
Answer: solely syntax, so called anonymous classes are 100% normal classes. you can possibly achieve a funky results by using java.lang.reflect.Proxy and InvocationHandler, would be the dirtiest way to do it.
Simpler ways include declaring the class in the method and just adding 'implements',
Answer: Anonymous classes are provided as a way to quickly and succinctly build a "one off" class. Your question suggests that you are attempting to use your anon class in multiple ways (at least one interface, and one extends).  In this case, it would be more readable and more maintainable if you promote that anon class to a full class.
This would also stave off unexpected side effects by better managing your classes' encapsulation.
Answer: Found a hack around this
create a interface at the bottom of your file witch extends all the interfaces you want to implements then create an anonymous class of which implements this.
Comment: I don't know that I would call this a hack
Answer: According to James Gossling:

Closures were left out of Java initially more because of time
  pressures than anything else. In the early days of Java the lack of
  closures was pretty painful, and so inner classes were born: an
  uncomfortable compromise that attempted to avoid a number of hard
  issues. But as is normal in so many design issues, the simplifications
  didn't really solve any problems, they just moved them.

Interesting, now that lambda expressions and closures are being added to Java, and this time instrumented with something different than inner classes, we could define an object on the fly composed by more than one interface, provided that the second one is marker interface.
interface Bar {
   default String getName() { return "Bar"; }
}

Object o = (Comparable<Integer> & Bar) (x,y) -> x > y ? x : y;
Bar b = (Bar) o;
System.out.println(b.getName()); //Bar

This compiles and runs perfectly in my latest build of the JDK 8 (March 12, 2013). So, it would look like they have been giving more thought this time to this problem.


Where can I find good resources for learning Robotic Process Automation (RPA)?

Question: I'm looking for tutorials for learning RPA. I did a lot of google search but couldn't find anything thats useful. Please suggest me some useful tutorials or certifications from where I can learn RPA.
Comment: Did you tried Google?
Answer: A software 'robot' is a software application that replicates the actions of a human being interacting with the user interface of a computer system. For example, the execution of data entry into a SAP system - or indeed a full end-to-end business process - would be a typical activity for a software robot. The software robot operates on the user interface (UI) in the same way that a human would; this is a significant departure from traditional forms of IT integration which have historically been based on Application Programming Interfaces (or APIs) - that is to say, machine-to-machine forms of communication based on data layers which operate at an architectural layer beneath the UI... says Wikipedia.
...in other words, RPA is nothing else than a marketing term for web automation and macro recorder software. The term is mostly used by vendors of (usually expensive) automation software that targets the enterprise market. A related term is BPO - Business Process Automation.
But with regards to software, from web testing/web automation software like Selenium or Kantu to desktop automation software like AHK or Sikuli - these are all Robotic process automation (RPA) tools. So anyone that knows how to use AHK is also an RPA expert.
So if you want to learn the technical side of RPA, learn one or more of these automation tools. For the business side, some MBA related literature can be interesting.
Comment: Years of working in selenium, and now looking at RPA (UIPath, Automation Anywhere).  It's .... a different approach.  Having to relearn really. Can see some overlap, but it's less about testing, and more about replacing a business process.


Usage of AppDomain in C#

Question: What is the most important use of AppDomains in C#?
Comment: Please read my blog for standard application of runtime loading of DLLs and cross-communication using AppDomain. https://blog.vcillusion.co.in/sending-events-through-application-domain-boundary/
Answer: The single most important use is that your code has to have one - i.e. everything you write  in C# executes in an AppDomain. That is quite important ;-p
If you mean additional app-domains:
When using plugins and other untrusted code, it allows you both isolation, and the ability to unload them (you can't unload assemblies - only entire app-domains).
I'm using it currently to load dynamically generated dlls, so that I can unload them.
They also allow you to set different configuration files, trust levels, etc - but have associated costs of complexity and remoting.
MSDN has a section on app-domains, here.
Answer: I can't tell you what the most important use is, since that depends on the situation.
AppDomains are useful for sandboxing parts of your application. You can load extensions in an AppDomain and unload them again - something you cannot otherwise do. You can assign specific rights to AppDomains. Per default objects in different AppDomains cannot access each other.
AppDomains can be viewed as lightweight processes as they give you many of the same features. However, unlike a Process new AppDomains do not have their own thread per default. You have to manage AppDomains and threads yourself.
Also, AppDomains all share the same managed heap. This is usually not a problem, but it may have surprising effects as some instances like strings are shared among AppDomains. For regular use this is not an issue, but if you use strings for locking, threads in different AppDomain can affect each other.
Comment: Nice note about strings.
Comment: "AppDomains all share the same managed heap." does that means they also share static classes or static methods ?
Comment: @Mathematics it just means they all have their heap in the same managed heap created by the CLR. Each AppDomain doesn't share its managed heap with any other or else they would cross refer instances which is not allowed and data exchange between 2 AppDomains is only copy-by-value
Answer: In general, it's not so daily coding practice to use AppDomains, this could be considered something as an advanced concept.. but, starting from this simple thing, it's important to better understand concepts behind the word "AppDomain".
In terms of architecture, and taking it simple as possible, an AppDomain is an isolation container even in terms of memory addressing, inside it all the assemblies needed by an application are loaded and executed, even if this concept is more complicated to explain in details (I hope it's not about yor question to going so deeper).
Starting from there, the AppDomain class first of all is used to obtain access to the application related executing application domain, this could be done via the Singleton property implementation AppDomain.CurrentDomain. In this way it's possible to:

obtain access the loaded assemblies;
obtain access to the appdomain-shared data slots;
intems marshalling, in terms of unwrapping created instances from loaded assemblies in created domains.

Then, the AppDomain class is used to:

create more "domains" in the same process;
executing assemblies in the process;
manage the appdomain's loading/unloading process.

It could be useful to take a view of the code of the new Microsoft framework (not yet released) MEF (Managed Extesibility Framework) which is truly based on concepts like AppDomains creations and unload, dynamically loaded assemblies.
As a simple example of things and examples of what you can do with AppDomains, I can share this link.
I hope I answered your question.
Answer: A C# AppDomain is a logically isolated container inside which .NET code run. When you run any .NET code it always runs in a default appdomain.
Do watch this 30 minutes youtube video What is C# AppDomain ? which explains AppDomain in more detail.

But let me still try to explain in more detail. Lets say you get a third party DLL and you want to use it in your application. But you also suspect that the third party can have some malicious code so you would like to run the third party DLL in a constrained environment. Like you do not want the third party to access your c: drive or delete files and so on.
So you can create two AppDomains one which is for the third party and one for your own C# classes. For the third party appdomain you will apply security constraint that it can not access c: drive and for your C# DLLs you will have a unrestricted app domain.
Answer: Please read my blog for standard application of runtime loading of DLLs and cross-communication using AppDomain. https://blog.vcillusion.co.in/sending-events-through-application-domain-boundary/

Runtime Loading and unloading of DLLs: I worked on a project where DLLs are loaded at runtime by the user, and during program execution, the methods are executed using Reflection and unloaded during the program run.
Securing my Main Execution Program: We are loading the DLL dynamically so any exception that occurred in that dynamically loaded DLL didn't affect my main AppDomain. In case of corruption scenarios, we have the option of efficiently unloading and loading the DLL again.
Cross-AppDomain Communication: We can dynamically load any two DLLs at runtime in different AppDomain and make them communicate with each other.

Usage of AppDomain in C#


Manager editing timesheets after submission

Question: My manager is editing timesheets after we submit them. He's modifying something that often takes off 30 minutes to 1 hour. Is there any good way to approach this without seeming greedy and/or a troublemaker?
Comment: Are you keeping a copy of the timesheet that you submit to him for your own records? If you aren't, **start**.
Comment: The purpose of the timesheets can change the answer. 1)  Are those timesheets used for your pay calculations? 2) Are those timesheets used for customer invoicing?
Comment: Is the issue that he is simply rounding to the nearest hour? It may be part of the contract with the client to round to the nearest (cieling) hour.
Comment: Related/Duplicate:  http://workplace.stackexchange.com/questions/9742/how-to-deal-with-mis-represented-timesheet
Comment: @SeanDuggan, this is an internal control accounting matter and you need to read up on why this is fraud and why well-mananged companies do not allow this practice.
Comment: Strong suggestion: Ask the HR department this question.
Comment: It could be a duplicate but the answers to that question do not seem terribly helpful in this case or any case other than the OP's of that question. This is a more general question and already has  better general answers and that question linked here.
Comment: @HLGEM It is only fraud if the time-sheets are being used to defraud someone, if they are being used for pay, yes it is fraud. However if it is simply an internal record for company internal cross charging not so much.
Comment: When working on a salary at some places and I clock in at, say, 7:56AM, then clock out at, say, 5:44PM because I was finishing some task; I have found that my time sheets still just show 8.5 hours (a half hour lunch being accounted for) - that they are essentially limited to a maximum of 8.5 hours. I always assumed this was for internal accounting and that it applied to all salaried employees. If you are paid hourly or are salaried with overtime or for any other reason your pay hinges on hours worked, I would say this is a serious issue.
Comment: Are the hours cut on long days? In Germany we have a law preventing workers to do more than 10 hours a day. If someone happened to work longer than those 10 hours the hours were cut and he didn't get paid.
Comment: I think that quarter hour increments are pretty common. As an hourly office employee, I was asked to make entries that aligned on quarter hour times, without adding time worked. In other words, I aim to arrive a few minutes before a quarter hour, and leave on or a few minutes after. Our timesheets total the time for us. But if you boss is "correcting" your times according to this, it would be better to simply inform you of the rule so you can follow it properly.
Answer: Changing timesheets is a BIG red flag. It is called fraud and is illegal in most places. Worse, if you don't keep copies of what you submitted, you can get caught up in this yourself if the fraud is discovered and you could go to jail.
I used to work for an audit agency and that several of the people we sent to jail had committed timesheet fraud.
Legitimate companies send a timesheet back to the employee if the manager thinks it is an error. This is an accounting internal control to prevent fraud which often includes not giving the supervisor the access to change electronic timesheets unless approved by another senior manager (for emergency cases). If your company does not do this, then you need to get another job as quickly as possible to not get caught up in a legal mess. A company that will commit timesheet fraud will do other unethical and illegal things. This is not a place that you want to continue working in.
The only time it is legitimate for a supervisor to change a timesheet of an employee is when the employee is unable to do so due to something like sickness or injury. Any other time he is committing fraud. Either he is denying you pay that you are entitled to or he is getting more pay for someone (usually with a kickback) or he is overcharging the customer or he is undercharging to avoid the appearance of overrunning the budget or he is charging one project what was a cost to another project because the second project budget was out of money (this is fraud to whoever was paying for the first project). All of these are serious legal issues and much more serious if you have a government contract because they will often audit timesheets.
The first thing you need to do is protect yourself. Save a copy of every timesheet as it is submitted and before he changes anything. Keep those copies off-site.
If he is changing timesheets to reduce the amount you are paid, then you may need to contact a labor lawyer. Personally, I would keep the records and then do this after I have another job.
You can certainly ask him casually if there is a problem with your timesheets because you noticed they were being changed. However, I would not be confrontational unless you are ready to be let go. If you feel you are being shorted on pay, it is your right to ask why. But you might consult with a lawyer first just to make sure that how you do it bolsters your case and doesn't make it worse.
To address the question in the comments:
There is legal fraud and just plain fraud. If the intent is to deceive and make things look good when they are not, then it is fraud even if it is not legally prosecutable. And even if it was only internal it could still be legal fraud if someone benefits (such as by getting a bonus they would not get if the time was properly accounted for, one of the most common reasons for this type of thing) at company expense.
It is bad for the company no matter what. It messes up the ability to properly estimate future tasks based on past history and it makes some people suffer because they go over the hours on their project but can't say that the reason why is that the 500 hours that were improperly charged to the project were really on some other project. (Hint - if you can't say why those hours are there in a meeting, then what you are doing is wrong.)
For instance, take project A which has run out of funds and so the last 500 hours on project A to finish it up are moved to project B which is just getting started. Later project B runs out of hours and there is a big meeting to determine why. Can you say in that meeting that 500 of the hours shouldn't count against project B because they really were for Project A? If you can't, the behavior is fraudulent.
Would the project manager even know that the hours were there if the orginal PM who moved the hours left before the time project B is finished? Is it fair for the new PM to get punished for something that was not his fault but was fraudulent behavior on the part of the first PM who took his big completion bonus on project A and then left?  Did senior management even know the hours were moved? Are they under the impression that Project A was within budget? Was the request to change the hours in writing? If it wasn't, then the intent is almost certainly not only fraudulent but trying to make sure that someone else is blamed if the fraud is discovered. Of course, if the request is in writing and someone benefits finaincially who shouldn't as a result, then the fraud is much easier to prove in court.
There are genuine reasons why smart companies do not allow supervisors to change timesheets even when things are just internal.
Comment: Are you certain that it makes no difference what (if anything) the timesheets are used for by the company? I have worked for companies that kept timesheets for reasons of internal budgeting but did not (normally) use them to bill clients. Ofc there's still the issue of whether the employee is being shorted on credited hours, so this doesn't look good however you slice it. I guess my questions is: is a timesheet privileged in law regardless of what the information on it is used for, or is it just that the only plausible *benefit* of altering timesheets is to a criminal fraud?
Answer: You can bring it up by mentioning that you've noticed that he's making changes to your timesheets. Ask him what his reasoning is for making these changes - perhaps he thinks they are corrections for inaccurate entries.
If he's changing your entries because he thinks they are incorrect (and they aren't incorrect), tell him that you believe the entries are accurate, and ask him why he thinks they are inaccurate, and more importantly, how you two can each more clearly track your time so that you both have the same understanding of hours worked.
If he's changing them because he thinks they are incorrect, and is able to explain to you why your entries are incorrect, then you need to discuss ways for you to more accurately keep track of your hours worked.
If the hours you've entered are correct, but he is changing them for some other reason (such as a limit on how much time you should spend on a particular task), then you've got a bit of a problem. Your previous timesheets don't accurately reflect the hours you really worked (do these changes affect your pay? If so, you'll need to discuss this because you've done work and not been paid for it). Ask him for clearer guidance going forward on his expectations for your timesheet so that you can accurately and honestly record your time worked without him making changes to it.
Answer: I have experienced something like this, but it has only been within a contract scenario. There are two ways this may be done.
One- the original time sheet is unmodified, but the company submits a company generated time sheet according to the contract and files your original time sheet with the company time sheet with the billing and any notations as to why there is a change.
Two- the change is make on the time sheet where the original entry can still be read. Also notations are made on the original time sheet.
Is this legal? Yes. Sometimes. Depending.
Some contracts have billing requirements that may mean rounding down time to the nearest quarter or something similar- or that time billed will not exceed a certain amount for a particular period. Where this becomes legal is, when in a contract scenario, a contract employee is notified of the billing schedule and time policies for the particular contract and that the contract employee agrees to work within and accept these policies as a condition of employment.
In the cases where I have seen this, I have not seen more than 15 minutes per day lost or not more than an hour per week. In these cases, the contract company should be keeping a close eye on hours worked on a daily or near daily basis. I know of one company who attempted to contact each contract employee each day to get an estimated number of hours per day and inform the employee of any billing time issues as a result.
In another scenario, the time sheets are not necessarily modified except for rounding, but the time you can work would be less for the next period if you exceed the allowed number of billing hours for the current period. This can be a period of one week, two weeks, or one month.
Under this scenario, it is legal to change a time sheet. As long as valid justifications are made according to the contract to the customer and the employee and the original accounting is preserved to check the validity of the change.
Please note: This was in the U.S. There may be similar scenarios in other countries and the laws may vary.
Comment: I am not a lawyer, but in the states where I have checked "and that the contract employee agrees to work within and accept these policies as a condition of employment" is NOT legal. A company policy cannot override the legal requirement to pay employees for all hours worked. A company can control costs and maintain compliance with a contract by sending employees home when the hit their maximum hours and/or terminating employees who repeatedly work extra hours without authorization, but not by failing to pay for time actually worked.
Comment: You are missing the point being that there is a limit to the amount of hours that can be worked and that the contract employee agrees to this as a condition of employment. That is *not* illegal. It is then the contract employees responsibility to remain within the time period allotted unless an exception is made. Companies can absolutely control the number of hours an employee works and contract employees work under a 1099 as a sub-contractor therefore are not a W2 employee. Everything I said is *not opinion*. It is business as I had conducted as a sub-contractor for nearly 30 years.
Answer: If this is part of a US Government contract, that would be illegal modification of government records. This would probably tend to be true for government contracts in other parts of the world. Under the presumption it's B2B, one suspects your project is in trouble and your manager is trying to keep the project afloat as long as possible.  If it's an IT contract, it's probably underbid so badly it will blow it's budget regardless.
Edit: US Federal Government Hours Recordkeeping
Edit: Employee Time Tracking Laws in Texas
I've added links that deal with government contracting and laws in Texas (where I'm from). I suspect these rules are common not only in the US but other countries. This should be researched for the jurisdiction you're in.  In both of the above examples, the only people that can alter timesheets are the employees, and those records are to be signed and dated by both the employee and the manager, and retained for several years.
Depending on what country you're in, if this is altering your pay, you could
complain to the agency that handles worker/employer issues.  Your manager might be following instructions from someone farther up in the hierarchy, in such circumstances your manager isn't in control of the situation.
Can you edit the post to expand on these possibilities?


Why does the graph of compressibility factor(z) vs pressure increase after reaching the minimum?

Question: I understand why it decreases for most of the gases but i cannot understand why it increases after reaching a certain minimum.
Answer: After a certain amount of pressure, the molecules start repelling each other and this leads to a rise in compressibility factor.
At high pressures, the van der Wall constant $b$ which represents the finite volume occupied by the gas molecules plays a greater role than the van der Wall constant $a$ which represents the attractive forces between the gas molecules.


Is $(^{1/2}) = \Omega(^{\sin(n)})$?

Question: As $-1 <\sin(n) < 1$, So $n^{\sin(n)}$ is bounded, but square root of $n$ tends to infinity. Is my logic correct? But from the other perspective, $1/n \leq n^{\sin(n)} \leq n$. I am confused.
Comment: The zero function is in $O(n^{1/2})$, but not in $\Omega(n^{\sin(n)})$.
Comment: Both $\sqrt{n} \leqslant n^{\sin n}$ and $n^{\sin n} \leqslant \sqrt{n}$ are asymptotically wrong.
Answer: First, let's unpack this. We say that $O(\sqrt{n}) = \Omega(n^{\sin n})$ if any function $f(n)$ which satisfies $f(n) = O(\sqrt{n})$ also satisfies $f(n) = \Omega(n^{\sin n})$.
In particular, if $O(\sqrt{n}) = \Omega(n^{\sin n})$ then $\sqrt{n} = \Omega(n^{\sin n})$. If $\sqrt{n} = \Omega(n^{\sin n})$ then according to the definition, there exist $C,N>0$ such that $\sqrt{n} \geq Cn^{\sin n}$ for all $n \geq N$. Let us assume that this is the case.
In what follows, I assume that the argument in $\sin n$ is measured in radians.
Since $2\pi$ is irrational, the sequence $n \bmod 2\pi$ is equidistributed in $[0,2\pi)$. In particular, there are infinitely many $n$ such that $n \bmod 2\pi \in (0.4\pi,0.6\pi)$, and so $\sin n \geq 0.95$. For each such $n \geq N$, we have
$$ \sqrt{n} \geq Cn^{\sin n} \geq Cn^{0.95} \Longrightarrow n \leq C^{1/0.45}.$$
Since there are infinitely many $n$ such that $\sin n \geq 0.95$, we can find one such $n$ which exceeds both $N$ and $C^{1/0.45}$, and so reach a contradiction. This shows that $\sqrt{n}$ is not $\Omega(n^{\sin n})$.

Is $(^{1/2}) = \Omega(^{\sin(n)})$?


Is it possible for Data to eventually gain emotions without a chip?

Question: It is my personal opinion that the more the Android learns human knowledge, the more human he becomes. The very yearning to be so is human in its own right. If I understand, the emotion chip causes malfunctions but I think observation naturally could give him some kind of emotional function. I haven't yet seen where he's got said chip but it seems like the more he learns, the more human he is. I still have yet to see In Theory as well but apparently, he gained a relationship with a hologram in some way and on Data's Day, he clearly believes he would be married someday AND even said he understands love and friendship. I can't see how it'd impossible to gain a relationship with someone even without emotions - he does have a conscience and morale. I am needing more interesting research for a fanfiction I'm writing.
Comment: I don't know what to do about this question, looks really opinion-based... But it will be usefull to you if you watch 4x25 where Data does get into relationship.
Comment: I think there's sufficient info about Data to answer this.
Comment: "I can't see how it'd impossible to gain a relationship with someone even without emotions - he does have a conscience and morale."  You **really** need to watch more episodes with Data before concluding he has no conscience or morale without his emotion chip.
Comment: More pertinently, whether or not he could develop the ability to at least simulate emotions, it was his belief in Star Trek: Generations that he had reached an impasse in his development without it.  Whether or not **this** is true is up for debate.
Answer: I'm going to say no. Firstly, it's explicitly stated in several of the scripts that emotionality will always be beyond Data, even in situations where he can clearly identify that an emotional response would be appropriate, for example in TNG: The Offspring where his daughter dies:

DATA : What do you feel, Lal?
LAL : I... love... you... Father.
And Data just stares at her... unable to say it back.
DATA : I wish I could feel it with you.
LAL : I... will... feel... it... for... both... of... us.
...
PICARD : The crew grieves for your loss, Mister Data.
Data studies the sad faces of his "family", never has, never will
  entirely understand "grieving".

and in Star Trek Generations, Data himself gives us a pretty good indication that without the chip, he's reached the end of the road as far as his growth (as a person) is concerned.
(n.b. I've quoted from the novelisation for ease of reading but the script is essentially the same.

"I thought you were afraid it would overload your neural net." "That
  is true," Data replied. "However, I believe my growth as an artificial
  life-form has reached an impasse. For thirty-four years I have
  endeavored to become more 'human'- to grow beyond my original
  programming.   And yet I am still unable to grasp such a basic concept
  as humor."
He turned back toward the crystalline case. "This emotion
  chip may be the only answer." Geordi leaned forward to dubiously study
  the chip, then sighed. At worst, it could cause some annoying
  complications, but no permanent damage. And what right did he have to
  deny his friend such an experience?
Comment: @Zibbobz - Per my comment below (on cde's answer), it's not that he can't sense when emotion would be appropriate, it's that in the absence of genuine emotion, he's unwilling to fake it. On those occasions that he tries, it's very 'forced' and he seems to find it quite unpleasant
Comment: It's a false premise: dunking Crusher was hilarious.
Comment: I feel it's important to remember, though I cannot find any citation to support it, that Data's personal growth hasn't reached an impasse because of difficulty, but because of a **hard limit** on what he can experience.  His programming has gotten very good at simulating and replicating emotional reactions, but spontaneity and the understanding of uncontrolled emotions  elude him because he **cannot** experience them, even if he can run simulations of how he should react in certain situations.
Comment: Exactly.  He recognizes it, he can even force it when he wants, but it's not something that 'comes naturally' to him, and he recognizes this.
Comment: Well, with one exception:  He appears to experience genuine emotion right at the end of 1x23, after Tasha's funeral service, but does not recognize it for what it is
Answer: I think Data would be able to develop responses that were perhaps rudimentary feelings.  It started by imitation, but there were times where you can tell from his reactions that the "imitation" had some sincerity.
My best evidence:  "The Most Toys".  It's probably the most emotional you ever saw him before the chip, and so much more satisfying as character development.  He became angry and was going to kill Fajo.  I argue this because he recognized it as an emotional response.  Had it been a logical decision to protect future victims, Data would have reported it honestly.
Answer: Yes it is possible.  First, from everything we have seen in Trek,  anything is possible.  Probability is the problem. Second,  what is emotion other than learned behavior brought on by observed contextual clues of your surroundings, i.e. social and evolutionary programming. Data is capable of learning on a mental level,  not just rote memorization.
That said, Data and his creator both know there are natural technical limitations to Data,  that cannot be overcome by sheer willpower. Hence the chip. Note that Lore did not have those limitations in place, him being the reason for Data's limitations,  and nor did Data's mother. And possibly neither did his Daughter.
Comment: His lack of emotional response is down to his essential truthfulness. He spurns emotionality even in situations where an emotional response would be easy to fake.
Answer: I think the best evidence we have of this comes from my Soong in TNG 'Brothers':

Basic emotions. Simple feelings, Data. Your feelings. I've imagined how hard it's been for you, living amongst beings so moved by emotion.

The fact that Soong knows Data doesn't have emotions suggests he knows Data couldn't develop emotions without some alteration.  So, I'd say that Data couldn't possibly develop emotions without some external input.
Answer: Yes, as we saw briefly in the episode Deja Q. At the very end, Q gives Data a brief gift of laughter. How did he do this? All powerful trickster god, who knows? But it would seem to hint that the possibility is there. However, as a practical measure, convincing an all-powerful trickster god to give you emotions is...probably not a practical solution. So in terms of personal evolution, no. In terms of perhaps altering some of his code or whatever, probably. No reason the code of a chip can't be integrated into the system. But the danger there, of course, is that nobody but Soong is competent to do such a thing- and look how well that turned out with Lor.


Can I mix 4gb RAM with 2gb RAM in my Precision T1700?

Question: I have a question that is probably somewhere I can't find, but anyways wanted to ask can I mix (Hynix 2gb 2rx8 PC3 - 10600U - 9 - 10 - B0 HMT125U6BFR8C - H9 NO AA - C 1003) with (DDRIII1333 4GB CL9 MDCB334G28-9E02   1144)My PC Precision T1700, here's the link:https://www.dell.com/support/article/en-uk/sln290792/precision-t1700-desktop-workstation-hardware-specifications?lang=en
Comment: http://www.crucial.com
Comment: Kudos on sorting your question out. As you can see, you've now garnered a sensible response.
Answer: Both memory sticks you've referenced are DDR3 (same generation) 1333MHz (same frequency) sticks, neither with ECC. In theory, this should work, yes. See SU 'Related' questions to learn more info about potential conflicts (for example, this one).
Ideally, you can use matching size (e.g. 2x 4GB) rather than mixing. It may make some difference to put the 4GB stick in slot 0 and the 2GB stick in slot 2 (leaving slots 1 & 3 empty). Refer to your computer manual for more info.


How do I detect a hit by a swung held object?

Question: I have an XR Grab Interactable wrench and the grab is working fine, as is movement. I'd like to use it to smash some chains, so I figured that I could use an OnCollisionEnter on the chains, and check against the tag. Except... it doesn't seem to actually register a collision at all unless I drop the wrench. What's the best way to detect a hit on a swing? And would it be possible to require a certain amount of speed of movement to trigger the collision?
Answer: The way I would do this is to cache the position and rotation of the wrench at the end of each Update or FixedUpdate (depending on when your wrench moves). At the start of the next step, calculate the position of the end of the wrench in its previous and current orientations, then check a capsule of space encompassing those two points, to see if it intersects your chain.
This will catch a collision at the start/end of the interval, as well as any object the end "skipped over" in between, approximating the swing as a straight-line movement.
You can repeat this check for points along the handle of the wrench too, to make sure you don't miss a chain when you over-reach with the tip.
You can also break this into sub-steps to better approximate the wrench's arc, if you find players are swinging it so fast that it swings through a significant fraction of the circle in a single step.
Lastly, you can estimate the impact velocity using the point's travel divided by the timestep.
Here's some example code that does this:
public class SwingDetector {

   [System.Serializable]
   public struct CheckPoint {
       public Vector3 localPosition;
       public float radius;
   }

   public LayerMask whatToHit;
   public CheckPoint[] points;

   Vector3 _oldPosition;
   Quaternion _oldOrientation;

   public bool CheckHit(float deltaTime, out RaycastaHit hit, out Vector3 velocity) {
       hit = default;
       velocity = default;
       bool hitSomething = false;

       foreach(var point in points) {
           Vector3 before = _oldPosition + _oldOrientation * point.localPosition;
           Vector3 after = transform.TransformPoint(point.localPosition);

           Vector3 travel = after - before;

           float distance = travel.magnitude;

           if(Physics.SphereCast(before, point.radius, travel, out hit, distance, whatToHit)) {
               velocity = travel / deltaTime;
               hitSomething = true;
               break;
           }
       }
       transform.GetPositionAndRotation(out _oldPosition, out _oldOrientation);

       return hitSomething;
   }
}

Answer: Ultimately, I wound up using a Trigger check instead of Collision. It works, although I did not bother with implementing the velocity check.
private void OnTriggerEnter(Collider other)
{
    GameObject obj = other.gameObject;

    if (obj.CompareTag("SmashTool"))
    {
        // Since the chains can only be smashed if both locks have been removed
        if (_locks <= 0)
        {
            gameObject.GetComponent<MeshCollider>().enabled = false;
            gameObject.GetComponent<MeshRenderer>().enabled = false;
            Destroy(gameObject, 5f); // Leaving enough time for the sound file

            _audioSource.Play();

            _doorAnimator.SetTrigger("OpenDoor");
        }
        else
        {
            // Play sound?
            // Give hint?
        }
    }
}


Colon or semicolon?

Question: We need help with colons and semicolons - and we need the definitive answer here, with examples.
Here is my example:
There is hardly any reason to be happy in the DPRK: the people are the most repressed, the most isolated and the poorest people in the world.
Is the use of the colon acceptable or should I use a semicolon?
My English teacher is confused - and I as a student even more.
We've consulted a number of authorities, and they are somewhat contradictory:
http://www.grammarbook.com/punctuation/semicolons.asp
http://www.bristol.ac.uk/arts/exercises/grammar/grammar_tutorial/page_05.htm
The matter is: In my example "hardly any reason to be happy in the DPRK" I used a colon because according to the grammar book in certain circumstances we can use a colon: when the second sentence is an explanation of the first.  (Can I use a colon after 'colon' in this  sentence, when the second sentence is an explanation of the first.)  :-)
Is there an easy way to sort this out? :-)
I think this  is all the fault of the grammar books!
I appreciate your help and I would like to thank you in advance.
Massimo
Answer: Both of your colons are correctly placed.
I will, as I have before, refer to the Guide to Punctuation by Larry Trask (University of Sussex).
Basically, what you read in your grammar book is correct. In this case, the colon precedes an explanation of what is before the colon. That is one of the times when the use of a colon is correct.

Colon or semicolon?


Chocolatey cannot install Microsoft Teams

Question: I can perform other installations with Choco but not MS-Teams. It fails with this error even though I did the installation in elevated mode. What can I do about it?
Comment: Did you try to check any available logs as to what it's trying to access that fails? Maybe the path is just to long?
Answer: Problems with package installations are best handled by reaching out directly to the maintainer of the package.  They are the ones who are best able to help with these sorts of problems.
You can reach out them via the package page:
https://chocolatey.org/packages/microsoft-teams
And then click on the "Contact Maintainers' link.
For what it is worth, I just attempted the installation of this package on a local testing environment (which is the same as that used by the automatic package verifier that is ran on chocolatey.org) and the package installed without any problems.
Seems like this could be something local to your environment that is causing problems.  As suggested in comments, it would be good to see the output log from the installation attempt.


SharpSVN list of users

Question: Is there any way to get list of all users who have access to a SVN project with SharpSVN?
A user may not add/edit any file, yet, but he has access to that project.
Answer: No. Whoever has access is determined by the server and there is no way to retrieve this for any specific server. On the server side you might look in the config files to see who has access, but this could be something like 'anybody on this active directory domain'.

SharpSVN list of users


Do I have to do blood on ice to buy hjerim?

Question: I did the Dark Brotherhood quest where you kill Nilsine Shatter-Shield and Alain Dufont, so since Nilsine is dead, I can't do Blood on the Ice.  Do I need to do that quest to buy a house, or can I just do the Falkreath liberation quest?
Answer: According to UESP's article on Hjerim, you don't need to complete Blood on the Ice before purchasing the house. Just proceed with the civil war until the Jarl of Windhelm offers you a chance to purchase the house.
However, you should still be able to complete Blood on the Ice after killing Nilsine. From UESP's article on Blood on the Ice:

If you've killed Nilsine in order to get a bonus reward in the quest Mourning Never Comes, Tova will be dead inside her house, and you will need to pick the lock of her house in order to get the key to Hjerim.

UESP also says that if you don't start Blood on the Ice before purchasing Hjerim, the quest will start the first time you enter the house.
Comment: ...but UNLESS you join the Stormcloaks the answer is yes: you have to complete Blood on the Ice to buy Hjerim. BTW, Blood on the Ice is so buggy even the authors of USLEEP pretty much gave up trying to fix it.


Can i import my Diablo 3 demo character into the full console version?

Question: The demo appears to have a save and make progress. Can this save be imported into the full version? What about vice versa (can I play a save from the full version within the demo)?
Answer: Yes, if you play a character in the demo and buy the full game, this will be transferred across.
Blizzard FAQ on the matter.
Comment: I just booted up the full game version on the 360 and nothing happens with my demo data, there is no import message or anything. The characters are not on my main character selection screen as well. There is also no option to "force" import from a menu. There is also no way to ask Blizzard through their help system since they always redirect you to Microsoft or Sony. Also my stash in-game has none of my items from the demo as well. Trying to get a hold of blizzard. About this since I hate calling Microsoft.


Can I take multiple cars into Mexico from the U.S.?

Question: I've taken my car into Mexico multiple times from the United States, on a Tourist visa.  Is it possible to take more than one car registered to me at the same time (obviously with a second driver)?
Comment: @Gagravarr: I'm guessing you never left the free-trade zone (first ~25km inside the border), then... if you had, you would have been stopped and had your car inspected, and probably been turned back.  Or at least that's how they do it now. I wasn't driving into Mexico 5 years ago, so maybe they were more relaxed then.
Comment: Yes, they require proof of vehicle ownership when entering the country. And if it's not registered to you, you must have a signed letter from the owner indicating that you are authorized to take the vehicle into Mexico (or so I understand--I've never actually tried doing that). And their rules have become much more strict in the last few months... so I want to be doubly sure before I drive _two_ cars 800 miles just to find out I can only take one into the country. :)
Comment: Do they actually check who the car is registered to? Even if they do, I'd assume unless it's reported stolen, it should be ok...
Comment: The only time I've driven to Mexico, we didn't slow below 20mph as we crossed the border, let alone stop and be asked any questions! (This was about 5 years ago though). Coming back was a very different story though, I think we queued for about 2 hours to get back into the states..
Answer: From the US Consulate:

Tourists to Mexico wishing to travel beyond the border zone with their
  car must obtain a temporary import permit or risk having their car
  confiscated by Mexican customs officials.
To acquire a permit, one must submit evidence of citizenship, title
  for the car, a car registration certificate and a driver's license to
  a Banjercito branch located at a Mexican Customs office at the port of
  entry, and pay a processing fee.
Mexican law also requires the posting of a bond at a Banjercito office
  to guarantee the departure of the car from Mexico within a time period
  determined at the time of the application. For this purpose, American
  Express, Visa or MasterCard credit card holders will be asked to
  provide credit card information; others will need to make a cash
  deposit of between $200 and $400, depending on the age of the car.
  Please do not forget to ask for your receipt from Banjército.
In order to recover this bond or avoid credit card charges, travelers
  must return to any Mexican Customs office immediately prior to
  departing Mexico. Disregard any advice, official or unofficial, that
  vehicle permits can be obtained at checkpoints in the interior of
  Mexico. Avoid individuals outside vehicle permit offices offering to
  obtain the permits without waiting in line.
If the proper permit cannot be obtained at the Banjercito branch at
  the port of entry, do not proceed to the interior where travelers may
  be incarcerated, fined and/or have their vehicle seized at
  immigration/customs checkpoints.

So it sounds really like as long as you have the ownership papers and registration, it doesn't matter how many cars in your convoy :D
Answer: To add to Mark Mayo's Answer.
There is no limit on the number of cars. If you don't own the car you need a letter from who does. IE if the car is leased you need a letter from the leasing company; If the Bank still owns the car, you need a letter from the bank; etc. The letter needs to say you are authorized to take the vehicle into Mexico. Since you, (the owner), would be with them it should be easier, but you may still want to write the letter for them to keep in the car.
I would refer to Mark's quotation for requirements and add, If you don't have a tourist permit you can not pass checkpoints. The tourist permits can not be obtained at checkpoints. You also need to insure vehicles.
This information comes from Instant Mexico Auto Insurance, they insure vehicles for groups of people involved in international off road racing, and pit stop crews are often driving cars that all belong to the Motor-sporting company.
Answer: You can only enter Mexico with 2 motor vehicles that are in your name.  Additional vehicles must be in another persons name and that person must be present.  This is what we've found when entering last December (2019) with a motorhome pulling a car with a Vespa scooter on a hitch carrier.  I'm online now looking to see if there's a work around as I want to enter this December with the same vehicles but my wife is no longer here to sign for the car as she did before.


Graduated Style Renderer not displaying for joined csv to shp

Question: I have joined a csv file (via the add spreadsheet layer plugin) and the field types have saved correctly (i.e. they are "real" types, see attached image), and yet the graduated style renderer option is not available. I have several numeric fields showing percentages and total numbers that I would like to display as graduated classes. Any advice? Ideas on why the graduated style option is not showing? See image of current style window. I am using QGIS version 2.18.23
Answer: You are selecting Single symbol which is the default style when you click on Layer Properties -> Style. You need to change the Single symbol to Graduated:

Then, under Column, select the field that you need to show its graduated color. If you still couldn't see the numerical field under Column, then save your CSV file as a shapefile and try again the same steps using the shapefile.


Multicore CPU energy requirement and load balancing

Question: I am interested in load balancing for multicore CPU systems. If you use 1 CPU with multiple cores, is it more energy efficient to balance the load on several cores, or try to fill up single cores and leave others idle.
The basic assumption is that the amount of work being done in both cases is exactly the same, in the same time. So, is it more efficient to use 4 cores in the same CPU with 25% load each or 1 core with 100% load.
I would assume 1 core with 100% load should be more efficient, but as I might be wrong, I was looking for serious answers about this problem (no guesses).
Comment: +1 Really interesting question! Here are some links http://www.tomshardware.com/reviews/truth-pc-power-consumption,1707.html http://www.tomshardware.com/reviews/intel-cpu-power-consumption,1750.html however they don't really address your question. I have C2D T8100 and one of these days I'm going to do some testing to see which type of load makes more heat.
Comment: 4 cores at 25% is definitely going to spread the heat out better than 1 core at 100%.
Comment: If the amount of work is constant across the use-cases, piling up all the load on the same core is going to make it perform lower -- effectively taking more time and thrashing. You might loose the instantaneous energy savings when the same work requires longer time to complete. (+1, thought provoking question)
Comment: @Brian agreed that using more cores spreads the heat out, but does it generate the same amount of heat in total?
Comment: AMD has announced CPUs that will be able to power down unused cores, allowin to run the active cores at higher clock speed
Comment: Even if there is some power saving utility, I think you can't turn off the unused cores completely. So, if you still have some power consumption for idle cores, it somehow would seem logical to assume that 4 cores at 25% power consumption would be more efficient than 1 core at 100% and 3 at 1%, but I'm unsure if 25% load on CPU cores translates to 25% power usage.
Comment: I am a bit confused regarding the heat. Theoretically, wouldn't a CPU basically run at the same temperature regardless of the number of cores doing th work?  Also, what are the real advantages here? Are we talking savings at the consumer level, or only at a level where savings can scale up such as in a data center.
Comment: In terms of heat, a CPU dissipates almost all of its energy as heat.  (Also, heat and temperature are different things, but that's a different discussion).  Basically, the more power a CPU uses, the more heat it generates and the higher its temperature.  New, more efficient processors use less energy and therefore produce less heat because they can partially depower unused cores.
Answer: IMO this question is simply unanswerable in the general case.
On my desk I have one of these new-fangled Core i7-980x 6-core TurboBoost enabled CPUs.  If you load up a single core on this machine, it will boost the clock speed of that core, thereby increasing the power consumption of the CPU, so that will make for a huge difference.  This CPU as well as other, more modern CPUs can partially de-power inactive cores, increasing the power savings.  That's not as true on older CPU models.
Keep in mind that the work that you have to do with one core will necessarily be different than the work you do with multiple cores.  If it's the case that you can spread the load out onto multiple cores, you'll find that a lot of extra time will be spent on the single core performing expensive context switches, and your performance will suffer.
Anyway, the problem has too many variables to really answer.  One could go on and on about the different types of loads, and anyone who tries to benchmark to get an answer will end up (probably inadvertently) making apples-to-oranges comparisons which don't apply in other use cases.
Oh, and one more thing.  Most people will probably quote efficiency in terms of power.  You don't want to fall into that trap.  Since the time to process the loads will necessarily be different depending on how the loads are balanced, you must integrate the result over time to find the net amount of energy used to complete the jobs in order to arrive at a credible result.
Comment: LOL How could you tell?  Hokie Engineering, baby!
Comment: Takes one to know one.  Go Mizzou
Comment: Oh wait.  I was wrong.  There is one man who could run some benchmarks and give us an answer in the general case: http://gizmodo.com/5598885/a-humble-russian-man-presents-his-cpu-collection
Answer: I did some tests today using this computer (Intel C2D T8100) and using optimized SETI@Home applications from lunatics installer 0.36. I used M$ Joulmeter to calculate power consumption. I measured consumption tree times. First, I let BOINC take 100% cores and 100% CPU time and let it run for one hour. Processor was consuming 20W and CPU time graphs from task manager were flat at 100%. Average power consumption of my computer was 45.05W and rising and at the moment I stopped test power consumption was 46.18W.
In second test, I set BOINC to take 50% of available cores and 100% of CPU time and let it run for one hour. CPU power consumption varied between 12W and 13W. Average consumption was 42.72W and rising. At the moment I stopped the test, consumption was 44W. In order to make CPU time graph for targeted core be flatline, I set affinity of program to one core and priority to high. The graph for other core showed somewhat higher than normal CPU time use.
For the third test I set BOINC to use 100% of available cores and 50% of CPU time. Power consumption varied in large jumps between 5W and 17W. Average power consumption after one hour of testing was 39.96W and falling. CPU time graphs looled like <code>/\/\/\/\/\/\/\/\/\/\/\/\/\</code>. Spikes were expected because of the size of time units used by BOINC.
So I believe that it is more efficient to use two cores running at half load than to run one core at full load.
And yes, I know that for a proper study much more samples are needed, but at the time I don't have enough computers or time to do proper statistics.
Comment: Now it would be nice to find an equivalent to the Joulemeter for other operating systems, then I could test some of the equipment I got...
Comment: Here's something for GNU/Linux laptops http://www.thinkwiki.org/wiki/How_to_measure_power_consumption
Comment: Here's another interesting link:www.lesswatts.org/ and another one http://www.susegeek.com/general/powertop-free-opensource-linux-tool-to-measure-power-usage/ and another one http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=/liaai/energymgmt/liaaienergymgmt.htm Apparently people don't believe ACPI readings and are convinced that external meters are necessary, so few of those links discuss how to use external meters. I'm not 1337 enough with other operating systems to be able to provide any help.
Comment: Thanks. The problem with external meters is that they measure all power consumption, not only processing power. While whole power consumption would be important too (e.g. algorithms extensively use hard drives). If ACPI readings don't seem to be trustable, You'd have to use external readings for Windows Computers as well to be able to compare them :-/
Comment: But still ACPI readings are better than no readings, right? Also, using tests which impact CPU the most, we can establish base power consumption and see how much it increases with load. This way we can know that most of the consumption change was from CPU load. I might do some more testing later with a voltmeter and amperemeter. It'd be really interesting to see how ACPI measurements and real instrument measurements compare. Too bad such comparison cannot be generalized.
Answer: The answer to your question is twofold: If you are running highly vectorizable, parallel code, then balancing the load over multiple cores is always more efficient. The cores will run at lower loads releasing less heat than a single core that is pushed to it's limit. On the other hand, if your code is not parallelizable, then running it on multiple cores is less efficient because of the number of cache misses that will occur due to dependencies across the code. This might still generate less heat, but it will definitely take longer to complete your task compared to running it on a single core.
Comment: But if you have non-parallelizable code, how are you going to run in on more than one core?
Comment: In your opinion, 4 cores pused to 25% together generate less heat (and produces more energy loss) than 1 core pushed to 100%.
Comment: @AndrejaKo If there are multiple processes or threads, it's easy to spread them out across cores.
Answer: Your question as asked has too many unknowns.  Are you asking about time efficiency or energy efficiency?  Non parallel code or parallel code?  Single job or average desktop multi-tasking? If you've got an energy bill over $1000 / month for your computers then it MIGHT be worth a worry or two.  Otherwise you can't save enough to make the problem worth solving.  Fun to talk about - but if you've got a serious problem the best answer is : try some different things and see what works.


Owner of init and xterm

Question: I don't understand what is owner of process. Owner of bash is me.
Then who is owner of init and xterm? I searched on google but I can't find.
Comment: How about taking a look and see for yourself? ( ps, top, etc )
Answer: Processes normally have a user and group id they run at, processes that are started with root permission (user id 0), can change the id they are running with (e.g. your webserver can run as user www-data).
During startup initial user id is 0, for something that is started by a logged in user it is (in most cases) the id of the user.
So you do not really own those processes, they run with your id, and that allows you to kill them etc. The ids of a process also determine what directories can be accessed and which files changed/created.
Answer: Processes have lineages just like people. So in the same way people have parents, so do processes. If you look at the output of ps you can see who owns a particular process.
$ ps -eaf | head -10
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Dec07 ?        00:00:07 /usr/lib/systemd/systemd --system --deserialize 24
root         2     0  0 Dec07 ?        00:00:00 [kthreadd]
root         3     2  0 Dec07 ?        00:00:03 [ksoftirqd/0]
root         5     2  0 Dec07 ?        00:00:00 [kworker/0:0H]
root         7     2  0 Dec07 ?        00:00:00 [kworker/u:0H]
root         8     2  0 Dec07 ?        00:00:06 [migration/0]
root         9     2  0 Dec07 ?        00:00:00 [rcu_bh]
root        10     2  0 Dec07 ?        00:00:56 [rcu_sched]
root        11     2  0 Dec07 ?        00:00:00 [watchdog/0]

The 1st column is the user that owns the process. The 2nd column is the process ID (PID) assigned to that process. And the 3rd column is the parent process ID (PPID). This PPID is what chains a process to a previous process, so in effect the PPID is the parent process ID for a particular process.
These are examples of processes that are other users (besides root) that have PPID's of processes owned by user root.
Examples
Owned by user avahi:
avahi      511     1  0 Dec07 ?        00:00:00 avahi-daemon: running [greeneggs.local]

Owned by user dbus:
dbus       512     1  0 Dec07 ?        00:00:22 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation

Here we can see where a process started by a process owned by root eventually spans a process owned by my username saml.
root      1266   547  0 Dec07 ?        00:00:00 gdm-session-worker [pam/gdm-password]
saml      1277  1266  0 Dec07 ?        00:00:03 gnome-session

Notice that gnome-session's PPID is 1277.
Lastly you can use slightly different switches to ps to see a visual tree of lineage.
$ ps -auxf
root       530  0.0  0.0 296804  1824 ?        Ssl  Dec07   0:00 /usr/sbin/gdm
root       547  0.0  0.0 380436  2208 ?        Sl   Dec07   0:00  \_ /usr/libexec/gdm-simple-slave --display-id /org/gnome/Dis
root       584  4.0  0.5 297980 40816 tty1     Ss+  Dec07  86:37      \_ /usr/bin/Xorg :0 -background none -verbose -auth /run
root      1266  0.0  0.0 516956  3160 ?        Sl   Dec07   0:00      \_ gdm-session-worker [pam/gdm-password]
saml      1277  0.0  0.0 714828  6336 ?        Ssl  Dec07   0:03          \_ gnome-session

Answer: Each process runs as a particular user. (It's called "user", not "owner".) The user determines the processes's rights. In particular, if a process is running as the user sumi, then whenever that process tries to access a file, the "user" permissions on that file apply (first rwx group of the ls -l output, first digit of the octal mode).
A number of things are restricted to processes running as the same user, such as sending signals (killing) and obtaining debugging information.
All the processes that you interact with directly — shell, terminal emulator, browser, etc. — run as your user.
The user that a process is running as is unrelated to the user who owns the disk file containing the program. Most programs are installed system-wide and owned by root, but when the program is executed, the process runs as the user who started it.
The init process, like other core system processes, runs as the system user, root. The root user has more rights than other users.
(This is to get you started. I've simplified several aspects of process users, privileges and file access rights.)

Owner of init and xterm


How do you install software directly into a SD image?

Question: So I'm using this SD Card image for my raspberry pi downloaded from Ubiquity Robotics. It has ROS preinstalled and runs Ubuntu OS. The problem is I'm missing a few dependencies missing and because of those missing dependencies I can't seem to install libraries from the internet. So if someone could walk me through on the process of installing dependencies directly onto the SD Card image, that would be great. Thank you.
Answer: You can mount the partitions -- there are probably two (Raspbian), possibly more but not less -- in a Pi SD card image pretty much the same way you would1 mount the partitions on a card created from such an image.
How can I mount a Raspberry Pi Linux distro image?
Any changes you make while the image partitions are so mounted are real, meaning if you unmount it and mount it again later they will still be so, and if you create a card using that image, they will be part of that too.
The OS that's in the image is obviously not running (exactly the same as if you put a Pi SD card in another computer), so you can't use the distro package manager2, but this may not be necessary on what your dependencies are and how you intended to install them.
As per the footnote, chroot is likely to be an important tool here, and that will require another Pi or other similar ARM system to do the work on.  To summarize:

If the changes you want to make do not require you to run software from inside the image (such as a package manager), then you can work on the mounted image directly.
If you do need to run software that's inside the image, use chroot on another ARM based linux system (such as a Pi).

Maybe "you could" makes more sense than "you would" there.
As far as I know, that is. But IMO it should be possible, presuming you can run the same package manager (PM) software (eg. apt) on the host system -- it just requires explicit capabilities in the PM, presuming all the PM does is unpack an archive, copy files, and apply changes to text files or databases that are architecture agnostic.
I doubt that has been implemented though, which means your best bet is to do the whole thing using another Pi (and USB SD card adapter) with chroot.
https://en.wikipedia.org/wiki/Chroot
In case that was a bit confusing, you can only use chroot this way on a system that has the same ISA as the software in the image, which is ARMv6.  Most normal computers are not that, they are x86 or x86-64.
Answer: You can loop mount the image file on a linux system (including the Pi itself).
This lets you examine and modify the image.
I use the following script (not mine - sourced from https://raspberrypi.org/forums/viewtopic.php?p=1528736).
This works with Raspbian, and should work with any normal image with 2 partitions.
It could be modified for any image by determining the offsets of the partition within the image.

image-mount mounts a standard 'raw' image file to allow it to be read or written as if it were a device.  Usage is:

image-mount imagefile mountpoint [W95|Linux]

where W95 mounts the BOOT partition and Linux mounts the ROOT partition.  If neither is specified, Linux is assumed.

#!/bin/bash

errexit()
{
  echo ""
  echo "$1"
  echo ""
  exit 1
}

usage()
{
  errexit "Usage: $0 imagefile mountpoint [W95|Linux]"
}

if [ $(id -u) -ne 0 ]; then
  errexit "$0 must be run as root user"
fi

IMG="$1"
MNT="$2"
PART="$3"

if [[ "${IMG}" = "" || "${MNT}" = "" ]]; then
  usage
fi

if [ ! -f "${IMG}" ]; then
  errexit "${IMG} not found"
fi

if [ ! -d "${MNT}" ]; then
  errexit "${MNT} is not a directory"
fi

if [ "${PART}" = "" ]; then
  PART="type=83"
else
  PART="$(tr [A-Z] [a-z] <<< "${PART}")"
  if [ "${PART}" = "w95" ];then
    PART="type=c"
  elif [ "${PART}" = "linux" ];then
    PART="type=83"
  else
    usage
  fi
fi

echo ""
echo -n "Mount ${IMG} on ${MNT} (y/n)? "
while read -r -n 1 -s answer; do
  if [[ "${answer}" = [yYnN] ]]; then
    echo "${answer}"
    if [[ "${answer}" = [yY] ]]; then
      break
    else
      errexit "Aborted"
    fi
  fi
done
echo ""

INFO="$(sfdisk -d "${IMG}")"
START=$(grep "${PART}" <<< "${INFO}" | sed -n 's|^.*start=\s\+\([0-9]\+\).*$|\1|p')
SIZE=$(grep "${PART}" <<< "${INFO}" | sed -n 's|^.*size=\s\+\([0-9]\+\).*$|\1|p')
LOOP="$(losetup -f --show -o $((${START} * 512)) --sizelimit $((${SIZE} * 512)) "${IMG}")"
if [ $? -ne 0 ]; then
  errexit "Unable to create loop device"
fi
if [ "${PART}" = "type=c" ]; then
  dosfsck "${LOOP}"
else
  FS_TYPE=$(blkid "${LOOP}" | sed -n 's|^.*TYPE="\(\S\+\)".*|\1|p')
  if [ "${FS_TYPE}" = "f2fs" ]; then
    fsck.f2fs "${LOOP}"
  else
    fsck.ext4 -f "${LOOP}"
  fi
fi
if [ $? -ne 0 ]; then
  losetup -d "${LOOP}"
  errexit "Filesystem appears corrupted"
fi
mount "${LOOP}" ${MNT}
echo ""
echo "${IMG} mounted on ${MNT}"
echo ""
echo "When done, run:"
echo "umount ${MNT}"
echo "losetup -d ${LOOP}"
echo ""


Need to run Qbasic in Windows 7

Question: Is it possible to emulate Windows XP in Windows 7? I would like to run Qbasic programs on my Windows 7 laptop.
Answer: Rather than load a whole windows VM could also try DOSBox, it's been reported to run QBasic fine.
I don't know what you're running in QBasic of course but I'd be interested to know whether you could build it with Microsoft Small Basic
Answer: Yes. Microsoft distributes Windows XP Mode for Windows 7 Professional, Enterprise and Ultimate editions. It's free and you can get it here.
Answer: The QB64 IDE is QB compatible and is free at www.qb64.net and will compile 32-bit applications written in QB. It also supports Microsoft libraries and can cross-platform to Linux and MacOSx.

Need to run Qbasic in Windows 7


Can I configure Google Play to see App Reviews in several languages?

Question: By default Google Play is configured to display reviews only in my native language (not english). But there are a lot of reviews in other languages, especially in english and I want to see them also. As a workaround I can change language to english but it is not perfect solution. Can I see reviews both in my native language and in english?
Answer: If You browse Play store via a web browser, then you can add <code>&hl=en</code> at the end of the URL and it may show English comments.
Comment: Perfectly simple & working!
Comment: Worked for me with `&hl=hu` also (for Hungarian)
Comment: This should be the main answer and the script option should be the secondary answer for advanced and motivated users.
Comment: Not working for this page: https://play.google.com/store/apps/details?id=jp.kingsoft.officekey&hl=en or this page: https://play.google.com/store/apps/details?id=com.magazin.weekly&hl=en
Comment: Did work for me. @Firelord maybe these apps didn't have english reviews?
Answer: Not with the regular Playstore app, AFAIK. If you want to do so using an app, you might want to take a look at Market Comments Reader. From within the web browser, AndroidPIT allows to show comments of all languages at once, i.e. without selecting each language separately.
Update: note that both, the app and the AndroidPIT site section, are dead by now. For a work-around you could use my UserScript GooglePlaySwitchLang in a web browser (like Firefox) via an Addon like Greasemonkey (see the Greasyfor main page for a list of options for your favorite browser). The script injects links to easily toggle between languages – currently German and English, but you easily can adjust it to any language combination you need.


Relation between adjoint operators/dual operators

Question: I'm a bit confused about adjoint operators. Let $T:X \to Y$ be a linear isomorphism between Hilbert spaces.  Then is it true that $(Tx,y)_Y = (x,T^*y)$ exists (does $T^*:Y \to X$ always exist)? What if these Hilbert spaces are part of Hilbert triples? Then what is the deal with the operator $T':Y^* \to X^*$?
Answer: If you have a linear operator $T : X \to Y$ between the Hilbert spaces $X$ and $Y$, you have to distinguish between to notions of the dual operator.

The Hilbert space adjoint: Define $T^* : Y \to X$ by $( T^*(y), x)_X = (y, T x)_Y$. Note that $x \mapsto (y, Tx)_Y$ is a linear functional on $X$ and, hence, can be identified with an element in $X$.
The "usual" adjoint: Define $T^* : Y' \to X'$ by $\langle T^*(y^*), x \rangle_{X',X} = \langle y^*, T x\rangle_{Y',Y}$. Note that $x \mapsto \langle y^*,Tx \rangle_{Y',Y}$ is a bounded linear functional on $X$, hence an element of $X'$.

Here, $(\cdot,\cdot)_X$ refers to the scalar product in $X$, whereas $\langle \cdot, \cdot \rangle_{X',X}$ refers to the duality product between $X'$ and $X$.
Of course, both adjoints are linked via the Riesz isomorphisms of $X$ and $Y$.
Comment: For 2. you have $x \mapsto \langle y,Tx \rangle_{X',X}$ but both arguments here are in $Y$ so this would read $x \mapsto \langle y,Tx \rangle_{Y,Y}$ which doesn't make sense.
Comment: @eurocoder: Thank you for spotting this typo.


Is unbeatable game state possible?

Question: I managed to get through the first days at relative ease. After several attempts, I can't earn enough money on the day I'm at to feed and medicate my family.
Is a stalemate situation possible?
Comment: I'm not sure if it's possible to enter such a state, but in case you didn't know, I wanted to point out that you can continue from earlier days as well. If your game was saved after day 10 and you feel like you can't survive day 11, you can select day 9 or 8 and continue from there.
Comment: It sounds like you're asking if the state your game is in is possible to be in, which is confusing. Can you try to rephrase your question?
Comment: I think it would be better, if you'd just describe the situation you're in. I can't tell for certain, if there's a theoretical possibility for an unwinnable position. On one hand, the money you get depends on how fast you process people. On the other hand, you can be in a situation where everything has just gone wrong.
Comment: @MatthiasFischer: I'll edit my question to clarify.
Answer: First of all, it is entirely possible to play the game without making any mistakes. See this video (I didn't watch it, but it claims to be a perfect playthrough).
As Matthias noted in a comment, you are not expected to be able to always play from the latest day and get further. There are some situations where because of a past action, you will be arrested, or your family will die, or some other ending. You are encouraged to continue from a previous day or begin a new game and attempt to reach a different ending.
Comment: If you're interested in the endings, check the [wiki](http://papersplease.wikia.com/wiki/Endings) (spoilers, of course).
Comment: Can you tell about situations that result in game over?
Comment: @user598527 No, that's outside the scope of the question, and basically constitutes spoiling the entire game (every ending is game over).
Answer: It is entirely practical for a skilled player to correctly process 15 applicants in a day (or 17 and 2 citations), earning the 75 credits required to feed 5 family members and rent a class 5 apartment.
Though this is an interesting question- is a softlock possible? For purposes of the question, this means a setup which will always end in ending 1 or 2.
Days with scripted attacks end after a specified number of migrants. So is it possible for there not to be enough, with zero savings and a single, very sick son?
If the inspector is in a class 8 apartment, he only needs 30 credits- 25 for rent and 5 to treat his son. No terrorist event allows fewer than six applicants. Additionally, the inspector can get 20 credits for shooting a terrorist.
If the inspector is in a better apartment, moving back to class 8 will become available earning 75 credits.
Comment: @BryanAllaire 20 credit sharpshooter bonus.
Comment: Ah, that's right. It would have to be on day 2, 6, or 12, before you have the key. Days 6 and 12 each allow you to process 10, and day 2 is closer, only allowing you to process 7, but rent is only 20 and you can't set up sick family members in time anyway. I'd say it's impossible then.
Comment: Downgrade is guaranteed if you have under 20 credits in savings. See this post: https://gaming.stackexchange.com/questions/383610/how-does-papers-please-decide-when-to-offer-better-apartments/404184#404184
Comment: Day 28 has the earliest scripted attack, after the 6th entrant. You still have enough time to process a 7th if you're fast, and you might have to just take a guess, but it's possible. So you earn 35 credits that day. Rent costs 25, so you have 10 credits available. Very sick family members need two out of the three heat, food, and medicine to stay alive another day. With TWO very sick family members, paying for food/heat each costs 10 and medicine for one of them is 5, forcing you to spend at least 15 credits to keep one of them alive. Softlock.
Comment: @BryanAllaire I do want to double check if the downgrade is guaranteed but redoing the maths it doesn't seem to matter. Your worst case scenario gives you 55 credits (7 entrants, 20 sharpshooter).

Is unbeatable game state possible?