Let $(X, d)$ be a compact metric space, and $f: X \to X $ is a map such that $d (f(x), f(y)) < d(x, y)$ where $x \neq y$. Show that there exists a point such that $f(x) = x$.  My idea is to make compact sets where any finite intersection is non-empty and then use the fact that an infinite intersection will also not be empty to show existence. I don't want to use continuity as that has not been covered in my notes yet.  Thus take $A_n = \{x \in X:d(f^{n-1}(x), f^n(x)) < a \}$, where $f^n$ is $f$ iterated $n$ times. Since $A_n \subset X$, they are compact and any finite intersection is non-empty. Thus an infinite intersection is also non-empty.   Since $a$ was arbitrary and distances are always positive, I can create a series of non-empty $A_n$'s between $0$ and $a$ no matter how small $a$ is. Thus there exists a point where $f(x) = x$.  How do I know that you can always find points with distance less than any $a$? Because $X$ is compact, it is bounded and so there is a maximum distance between any 2 points. So start there, iterate $f$ once and now you have points with distance less than $a$. Repeat as needed.  I feel like it's missing some rigor though, or at least could use some clean-up or an extra piece that I've overlooked.

A contractive mapping on $M$ is a function $f$ from the metric space $(M,d)$ into itself satisfying $$d(f(x),f(y))<d(x,y)$$ whenever $x,y\in M$ with $x\ne y$. Prove that if $f$ is a contractive mapping on a compact metric space $M$, there exists a unique point $x\in M$ with $f(x)=x$.   Consider the function $g(x)=d(f(x),x)$. Note that   \begin{align*}d(f(x),x)-d(f(y),y)&\leq (d(x,y)+d(y,f(x))-(d(y,f(x)-d(f(x),f(y)) \\ &=d(x,y)+d(f(x),f(y)) \\ &<2d(x,y)  \end{align*}  And similarly for $d(f(y),y)-d(f(x),x)$, so we have $|d(f(x),x)-d(f(y),y)|<2d(x,y)$. This means $g(x)$ is continuous.  So $g(x)$ is a real-valued continuous function on a compact space, so must be bounded and has a minimum $c$, i.e. there exists $x_0$ such that $d(f(x_0),x_0)$ equals the minimum $c$. What then?


I have a text like:  This patch requires:  Patch 1.10-1 Patch 1.11-2  Notes:   I want to extract   Patch 1.10-1 Patch 1.11-2   with the following regex:  This patch requires\:[\r\n](.*)[\r\n]Notes\:   But nothing is matched.  Why ?

For example, this regex  (.*)<FooBar>   will match:  abcde<FooBar>   But how do I get it to match across multiple lines?  abcde fghij<FooBar>


Is the data received from XSensor normal? I'm using an NVIdia    Here are the details of my laptop:

I have a Samsung series 5 my temperature is around 77-80°c when i am playing, and 48-54 on normal use it laptop don't have a month and I am not sure if it is normal.  Intel® Core™ i5-3210M CPU @ 2.50GHz × 4     8 GB of RAM     Nvidia optimus 650M (I am using Bumblebee)     Ubuntu 12.04


About a year ago, in a distressed state, I posted a question on Interpersonal Stack Exchange which I would rather delete. (I know that was a while ago, but I want to remove all traces of the situation from the internet.) The post was downvoted, closed, and is probably not of use to anyone else since it was regarding a very unique and specific situation. My account was suspended when I tried to delete the question through editing, and I tried explaining the situation to the mods. I even proposed an alternative edit that would not invalidate the answers but which would remove the identifying details and make the post less embarrassing. I then received the following reply: "Okay, let me be very clear one last time: Editing the post like you've tried or are proposing is not an option. There are others outlined in that help center article." The only other option I see under their help page is to ask that the post be dissociated from my account. However, dissociating the post from my account (or even deleting my account) would not make me less identifiable (especially to anyone familiar with the situation), and it would only permanently embed the post into stack exchange. Also, their own rules permit editing to generalize a question and remove identifying information. I feel they're deliberately antagonizing me, as is evident by their rude reply, plus any reasonable person would allow the post to be removed or at least edited given the circumstances. Is there anyone to report this to and/or any way to appeal their decision?

One or more of the following things happened to me on a Stack Exchange site:   My post(s) were wrongly deleted or locked by a moderator A moderator posted a wrong comment on one of my posts I was suspended, but did not do anything wrong I asked a meta question, but the question was closed and/or deleted A moderator discredited me in public ...   I think a moderator has abused their power, but I feel powerless against them.  What recourse do I have now? What can I do when I feel that a moderator has abused their power, and has been repeatedly unfair in their dealings with me?


this question concerns only the INDEFINITE article, I don't care for the definite article or 'of' forms here.  In the following construction  a friend's book a boy's toy a guy's car   Question: do you still write the indefinite article if the noun following the possessive noun is plural?  a friend's book >> a friend's books / ø friend's books? a boy's toy >> a boy's toys / ø boy's toys? a guy's car >> a guy's cars / ø guy's cars?   If the 'a/an' article is removed, why?   Thanks.   P.S if anyone could cite a link to this particular topic, that would be be great.

Is there a definite rule about the use of articles with the possessive nouns in the plural? One rule says that the article in such a phrase modifies the possessive noun. So, it is correct to say "Peter's book' (not 'the Peter's book") because we do not say 'the Peter'. According to the same rule it's possible to say 'a cat's whiskers' because the article belongs to the word 'cat', not 'whiskers'.   But I've come across the following examples: 'a women's magazine'; 'a wolves' den'; 'a girls' school' and I realize that the article does not belong to the possessive noun any more.  It modifies the 'head'-word like in all ordinary noun phrases as 'an interesting magazine' or 'a prestigious school'. My head is broken, please, help!


This script   \documentclass{article} \usepackage{lipsum} \begin{document} \lipsum[1-5] \lipsum[6][1-2] \end{document}   produces the output    How can I avoid starting page 2 with such a scanty number of words, lines?

How do I prevent a line from appearing by itself:  Orphan: at the bottom of the page, or Widow: at the top of the page?


I have two sentences in my personal statement which I am not sure about.  Additionally, it will expose me to multiple cultures which will enhance my patient interaction and networking skills, and allow me to become an effective leader. Also, I would like to establish a research center that will conduct research on different aspects of clinical pharmacy which will improve the healthcare system in my country and make Egypt a leader in healthcare services.  I am not sure if I am using “which” and “that” right or not and whether to put comma before which or just leave it like that.

When is it appropriate to use that as opposed to which with relative clauses?


I followed  procedure to reset the lost sudo password from the root prompt. Unfortunately, a password is requested to access the root prompt.  Am I missing some obvious step or is it not the right procedure? I am running Lubuntu on a Virtual Machine (W10 Host).

I need to reset my password. I have followed these steps:    However, then I go to "root" or "netroot" recovery options, it tells me:  Give root password for maintenance (or type Control-D to continue)   Clearly, I do not know the root password. If I type CTRL+D, I return to the list of options. From  I read:  Under chapter 'The Other Way':  4. Highlight the line that begins kernel and press 'e' to edit`   But in the grub configuration file I have no line that starts with kernel. Only:  setparams 'Ubuntu...' recordfail set gxfpayload... insmod part_msdos insmod ext2 set root=... search --no-floppy... linux /boot/vmlinuz-2.6.38... initrd /boot/initrd.img-2.6....   Those are all lines in my GRUB. Which line should I edit? Or is there another way to reset my password?


I've been recently having a discussion on how to compute the genus of a pair of pants, namely the figure:    After some research, we stumbled across this webpage:    in which they find the genus of a three-holed sphere (i.e. a pair of pants) to be 2. However, the wikipedia article says it has genus 0.    For us, therefore, a satisfactory answer remains elusive. Our questions will then be: what are we missing? what is the right answer, if there is any (we hope so) ? What's the correct way to compute the genus of a pair of pants?  Thanks in advance!

Are genus necessarily toral -- as shown in the illustration on  what about a tube, does it qualify for having genus 1? What about ? Does this have genus 1 or 2?  Thanks.


I have a scenario where, whenever a user logs into a CENTOS machine via SSH, I need to have the following commands run:  ssh-agent bash ssh-add  [This other thread explains why I am using those commands:   ]  I have tried putting those into .bashrc, but then when I log in via Putty, it seems like the log in hangs.  I have also tried putting the two commands in a shell script, and then running the shell script manually after logging in, but that is not working (it looks like only the "ssh-agent bash" is run).  So is it possible to get those 2 commands to be run when the user logs in?  And if so, how can I do that?  Thanks, Jim

I want to communicate between several computers on my network (static Ethernet), through SSH. In order to do that I need to run ssh-add every time I log in on a specific machine, how can I do it so that it's set up once and it doesn't ask me for the passphrase every time I log in or reboot my machine?  I know that there is a way that you should add some lines to the bash_profile file, but I still need to type the password every time I reboot/log in to a specific machine.  if [ -z "$SSH_AUTH_SOCK" ] ; then     eval `ssh-agent -s`     ssh-add fi


We know that at point A and B there is same voltage.Then why electron moves from one point to the another one?

In an ideal circuit, How can there be a current b/w points a & b, when there is no potential difference and thus no electric field between a & b? If there is no current, then where does current across the resistor come from, because that means no charge is coming from the battery (?).


I have been using a evaluation version of Sever 2012 Standard for the last few months and want to now buy the retail version.  Is there a way to retain the same copy of Windows, but turn it into a Retail version without having to reinstall Windows? I've read before that it's not as easy as it sounds, and I have tried it once before but it wouldn't accept the key (same version and all).  If I have to build a new VM with the licensed copy of Windows, what is the easiest way to copy AD over? Create AD as a domain controller and then run dcpromo on the old machine?  Any advice appreciated!

This is a  about Licensing.    Questions on licensing are off-topic on Server Fault.  If your question has been closed as a duplicate of this question, then this is because we want to help you understand why licence questions are off topic rather than just telling you "it just is". In all likelihood, this question will not address your question directly, it was not meant to.    I have a question regarding software licensing. Can the Server Fault community please help with the following:   How many licenses do I need? Is this licensing configuration valid? What CALs do I need to be properly licensed? Can I run this product in a virtual environment? Can I downgrade this product to an earlier version? Am I entitled to feature X with license Y?


Say you have a level 1 character (so a proficiency bonus of +2) and that character is proficient in ranged martial weapons and they have a dexterity of 16 (+3). If they attack using a longbow then they add 5 to their attack roll. But for damage do they add 5 or do damage rolls just include the ability modifier of +3?

Me and my friends are pretty new to D&D and are likely getting the majority of the rules wrong. I believe I understand AC: an AC of 16 means you must roll a die (+modifier) of 16 or greater to deal damage, and anything over that AC is taken as hitpoint damage?  What I was wondering was, at level 1, I believe I have a d10 halberd and a +4 strength modifier. However, the guards we're fighting have an AC of 16, making it completely impossible to even get past their AC. So we played it as if we could group attack, i.e. add up all our attack scores then remove whatever was excess of the AC from HP. Pretty sure we're playing some rules wrong, could anybody shed some light on the subject?  Not sure which version of D&D I'm using. It's the free pdf version released in August:   I have read the armour class section of the rulebook. Is it perhaps that first you roll a d20 (+modififers) to see if you beat armour class, then you do a damage roll?


I need to show that  $$\binom{p^{\alpha}-1}{k} = (-1)^k\pmod{p}$$  for $0 \leq k \leq p^{\alpha}-1$. Not really sure how to start going about this... how should I transform the term on the left? Thanks.

This is a problem out of the text Introduction to the Theory of Numbers by Niven, Zuckerman, and Montogmery and I am having quite a bit of trouble with it.  I tried to prove it directly, but that didn't work.  The question is:     Let $p$ be a prime and $\alpha$ a positive integer.   Show that $\binom{p^{\alpha}-1}k \equiv (-1)^k \pmod p$ for $ 0 \leq k \leq p^\alpha -1$.   If relevant, I did prove that ${{p^{\alpha}}\choose k} \equiv 0 \pmod p$ for $ 0 < k < p^\alpha $ but I can't seem to incorporate it.


I want to encrypt my phone to protect sensitive information. But I do not want to enter a password every time I pick up my phone. That seriously hampers the usability. Particularly because the password must be of sufficient complexity for the encryption to be secure.  What I want is a boot time only password.  Most thieves switch off the phone after stealing it. Or remove the battery to change the SIM (so it won't get tracked). When he starts it again it'll be locked. There is a risk that he may mail my sensitive information to himself before switching off the phone but that is a risk I'm willing to live with.  How do I encrypt my phone with only a boot time password?

I recently enabled encryption on my Nexus S running Android 4.1.1. I'm aware of all the benefits and drawbacks, and device encryption is definitely something I want. It's currently working fine.  However, one small caveat I overlooked is that encryption requires a password or PIN lock screen. I assumed (somewhat foolishly) that I'd be able to change back to the lock screen of my choice once the encryption process was complete. I like using a pattern lock, because I can set it to not display any visual cues, which makes shoulder-surfing a lot more difficult. It's also quick and easy to enter a relatively complex code.  The password I used to encrypt the device was intentionally long and complex, making it something I certainly don't want to be entering every time I want to check my messages. I don't want to change it to something shorter, because increased security was the whole point of doing this in the first place.  Is there a way I can go back to using a pattern lock screen? I understand that encryption is irreversible, and I don't really want to remove it. I just want my old lock screen back.  EDIT: I notice that changing the code for my lock screen also changes the key used to decrypt the device, which I assume is why you're not allowed to use a different type of lock screen. I very specifically do not want to be using the same code to encrypt the storage as I'm using to unlock the screen. That seems like a terrible idea, and I can't believe it's really the way Android does it.


I'm adjusting an archive page to only show products where a certain ACF meta field has a specific value but its not straight forward as the meta value is a nested array so I'm struggling to check if the value is in there. I've commented what get_post_meta(get_the_id(), 'sub_categories'); pulls through, I've tried just the value as in Oil Lubricated tried %Oil Lubricated% etc but no joy. See below query code. E.g ...  $meta_query, array(     'key'=> 'sub_categories',     'value'=> '', // Array ( [0] => Array ( [0] => Variable Speed Frequency Controller [1] => Oil Lubricated ) )     'compare'=>'LIKE' // = / exists / like  ); $wp_query->set('meta_query',$meta_query);  ...  Any help would be greatly appreciated. Cheers

I'm working on a project in which I'm creating a custom post type and custom data entered via meta boxes associated with my custom post type. For whatever reason I decided to code the meta boxes in such a way that the inputs in each metabox are part of an array. For instance, I'm storing longitude and latitude:
      Latitude:
      <input type="text" id="latitude" name="coordinates[latitude]" class="full-width" value="" />

          Longitude:
      <input type="text" id="longitude" name="coordinates[longitude]" class="full-width" value="" />
   For whatever reason, I liked the idea of having a singular postmeta entry for each metabox. On the save_post hook, I save the data like so:  update_post_meta($post_id, '_coordinates', $_POST['coordinates']);   I did this because I have three metaboxes and I like just having 3 postmeta values for each post; however, I've now realized a potential issue with this. I may want to use WP_Query to only pull out certain posts based these meta values. For instance, I may want to get all posts that have latitude values above 50. If I had this data in the database individually, perhaps using the key latitude, I would do something like:  $args = array(     'post_type' => 'my-post-type',     'meta_query' => array(         array(             'key' => 'latitude',             'value' => '50',             'compare' => '>'         )     )  ); $query = new WP_Query( $args );   Since I have the latitude as part of the _coordinates postmeta, this would not work.  So, my question is, is there a way to utilize meta_query to query a serialized array like I have in this scenario?


Disclaimer: I am extremely new to this and have no proper knowledge of this subject at all, this is just an idea that I had which I want to properly understand. I don't have any knowledge of necessary equations, proper terminology, etc.  In Sci-Fi movies that involve travelling at  almost the speed of light, there is sometimes a plot where it involves a character travelling  almost at the speed of light for a few minutes or hours, and when they return to earth, they discover that a very long period of time has passed. I know these are Sci-Fi movies, but obviously, this part is not made up.  Now, take this scenario for example. A person aboard some sort of spaceship is travelling close to the speed of light. They travel for a small period of time, maybe a few minutes. For this person, time is moving slower than for a person that is standing still. When this person was to stop, he would find that a long time had passed for everyone else.  Hypothetically,  If someone was to look at this person travelling  almost at the speed of light, wouldn't they see him travelling much slower than the speed of light? Because if time if passing slower to him, wouldn't he be moving in... slow motion...?   So if it took him a few minutes to travel a very large distance, wouldn't the observer, for whom the time is passing slower, have time to observe the passage of the person moving at the speed of light?  What I don't understand is in this case, it would mean that to the observer, the person is not travelling  almost at the speed of light, but much slower. But to the person travelling  almost at the speed of light... well, they're travelling  almost at the speed of light.  Any help with this is appreciated. If someone can help me, please try to explain the answer in simple terms. If I have gotten one key idea of this wrong, please don't hesitate to correct me.    Edit: I'm not just asking about the time dilation, I'm also asking about the velocity from different POV's.

The paradox in the  is that the situation appears symmetrical so each twin should think the other has aged less, which is of course impossible.  There are a thousand explanations out there for why this doesn't happen, but they all end up saying something vague like it's because one twin is accelerating or you need general relativity to understand it.  Please will someone give a simple and definitive explanation for why both twins agree on which twin is younger when they meet for the second time?


\documentclass[a4paper]{article} \usepackage[margin=0.5in]{geometry} \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \usepackage{graphicx} \usepackage[colorinlistoftodos]{todonotes} \usepackage{colortbl} \usepackage{etoolbox} \usepackage{hhline}  %--------------------------------------------------------% %   BEGIN DOCUMENT %--------------------------------------------------------%  \begin{document} \begin{table}[] \centering \caption{Fruits!}\tabularnewline \label{my-label} \begin{tabular}{|c|c|c|c|c|}\hline \multicolumn{5}{|c|}{\textbf{Fruits}}                                                                                \\ \hline      & \multicolumn{2}{c|}{Billy}                          & \multicolumn{2}{c|}{Jean}                     \\ \hline Rank & Item                                             & Weight & Item                                      & Weight \\ \hline \rowcolor[gray]{.9} 1    & Apples.         & 0.331  & Oranges.  & 0.423  \\ 2    & Bananas.        & 0.170  & Strawberries. & 0.423  \\ \end{tabular} \end{table} %--------------------------------------------------------% %   END DOCUMENT %--------------------------------------------------------%  \end{document}   I'm using \rowcolor to color in certain rows of my table, but I notice that this causes some of the vertical borders to be covered. I've tried using the package hhline but it doesn't seem to help.

I'm using the xcolor package to colour the top row in a table. This is displayed properly using PDF viewers such as Preview or Skim (Mac). But using Adobe Reader 10.1.3 (either Windows or Mac) doesn't display the table line properly.   But removing the colouring for the table fixes it. Here is the example that works as expected:  \begin{table} \caption{Table showing Feature 5's Functional Tests} \hspace*{-0.5in} \begin{tabular}[h!]{|p{0.6cm}|p{4cm}|p{5cm}|p{4cm}|p{1.5cm}|} \hline {\bf Test ID } & {\bf Task } & {\bf Expected} & {\bf Actual} & {\bf Outcome} \\ \hline    5.1 & Something &  Something & Something &  Success \\ \hline    5.2 & Something &  Something & Something &  Success \\ \hline    5.3 & Something &  Something & Something &  Success \\ \hline    5.4 & Something &  Something & Something &  Success \\ \hline \end{tabular}  \end{table}   And here is the example with a coloured row:  \begin{table} \caption{Table showing Feature 5's Functional Tests} \hspace*{-0.5in} \begin{tabular}[h!]{|p{0.6cm}|p{4cm}|p{5cm}|p{4cm}|p{1.5cm}|} \hline \rowcolor{gray!25} {\bf Test ID } & {\bf Task } & {\bf Expected} & {\bf Actual} & {\bf Outcome} \\ \hline    5.1 & Something &  Something & Something &  Success \\ \hline    5.2 & Something &  Something & Something &  Success \\ \hline    5.3 & Something &  Something & Something &  Success \\ \hline    5.4 & Something &  Something & Something &  Success \\ \hline \end{tabular}  \end{table}   Removing the \rowcolor{} command replacing it with \cellcolor{} creates the same view. Any idea how to fix this?  I've tried printing it out of Adobe and the lines print fine, but as this will be read on as a soft copy it's pretty important. .  Any idea how to fix this?


How does one show that Derived Algebra is nilpotent implies the lie algebra is solvable.  My attempt: Let $L$ be such a Lie-algebra then $[L,L]$ is nilpotent so it is solvable. So $[L,L]^{(n)}=0$ for some $n$. What can I do after this?

The Wikipedia  page lists the following property as a notion equivalent to solvability: $\mathfrak{g}$ is solvable iff the first derived algebra $[\mathfrak{g},\,\mathfrak{g}]$ is nilpotent.  I can't see this at all and it does sound dodgy: solvability and nilpotency different by "only one rung" in the derived series. Is this correct (I suspect I'm missing something trivial- I can't seem to find anything relevant in Knapp "Lie Groups: Beyond an Introduction" (mine is reprint of the first edition))? If not universally correct, is it correct with further assumptions about the field which $\mathfrak{g}$ is a vector space over? (For example, a field of characteristic nought, algebraically closed, ...). Can someone either give a proof, a counterexample or a reference to one?   I'd also like to put a reference on the Wikipedia page quotation, or clearly have it stricken from the page if incorrect.


Everything I am talking about here takes place in the Newtonian mechanics, but it is also interesting to discuss everything in the context of special theory of relativity, quantum-mechanics or even QFT. We say that the mass is something that measures the resistance to acceleration. In practice, in order to get the body to accelerate, we need to apply force. But want to define the force, we say that the 1N of force measures the needed force in order to accelerate the 1kg body with the acceleration $1 \frac{m}{s^2}$. Thus we completed the loop - in order to define the acceleration, we need the force and in order to define the force we need the acceleration. Does that mean that we need to define the mass and force simultaneously? If you think about it, the concept of mass, historically speaking, was very intuitive and known in the ancient times and they could also measure it (using balance scale for example). Force on the other hand, even though very intuitive did not have any way to be measured in the ancient times. Only after the Newton's second law $F =  ma$ we finally get the formula that permits us to measure the force (and maybe even define it quantitatively? ). Going back to my question, I want to find out if we can define the mass and the force before introducing the Newton's second law?

If you consider  as laws, then there must be independent definitions of  and  but I don't think there's such definitions.  If you consider them as definitions, then why are they still called laws?


As far as I know quantum physics and General relativity theory get along. So Why do some people claim that quantum physics and General relativity theory will never get along?  Mathematically, What is contradiction between quantum physics and General relativity theory?

It is well known that quantum mechanics and (general) relativity do not fit well. I am wondering whether it is possible to make a list of contradictions or problems between them?  E.g. relativity theory uses a space-time continuum, while quantum theory uses discrete states.  I am not merely looking for a solution or rebuttal of such opposites, more for a survey of the field out of interest.


Need to validate an input using Regular expression   It should accept only digit Min and max should be dynamic   Thanks for your help in advance  My code is  min=3, max=10   MyRegex is   /^(\d{min, max})$/

I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it.  However, I can't figure out how to pass a variable in to a regex.  I can do this already which will replace all the instances of "B" with "A".  "ABABAB".replace(/B/g, "A");   But I want to do something like this:  String.prototype.replaceAll = function(replaceThis, withThis) {     this.replace(/replaceThis/g, withThis); };   But obviously this will only replace the text "replaceThis"...so how do I pass this variable in to my regex string?


Is it true that, if $G$ is a group such that $Aut(G)$ is trivial, then $G$ is of order at most $2$? Thanks in advance.

Well, this is an exercise problem from Herstein which sounds difficult:   How does one prove that if $|G|>2$, then $G$ has non-trivial automorphism?   The only thing I know which connects a group with its automorphism is the theorem, $$G/Z(G) \cong \mathcal{I}(G)$$ where $\mathcal{I}(G)$ denotes the Inner- Automorphism group of $G$. So for a group with $Z(G)=(e)$, we can conclude that it has a non-trivial automorphism, but what about groups with center?


I have a trouble. I hope someone can do it.     How to prove that   $\left\{a + b\sqrt{2} + c\sqrt{3} + d\sqrt{6} \mid (a,b,c,d)\in \mathbb{Q}^4\right\}$ is a field?   I can't prove the existence of multiplicative inverse. Thanks.

Why must $\mathbb{Q}[\sqrt{2}, \sqrt{3}]$ -- the set of all polynomials in $\sqrt{2}$ and $\sqrt{3}$ with rational coefficients  -- contain multiplicative inverses?   I have gathered that every element of $\mathbb{Q}[\sqrt{2}, \sqrt{3}]$ takes form $a + b\sqrt{2} + c\sqrt{3} + d\sqrt{2}\sqrt{3}$ for some $a,b,c,d \in \mathbb{Q}$, and I have shown that $\mathbb{Q}[\sqrt{2}]$ and $\mathbb{Q}[\sqrt{3}]$ are both fields, but it's not clear to me why this allows for general multiplicative inverses to exist in $\mathbb{Q}[\sqrt{2}, \sqrt{3}]$.


Imagine I have an HTML5 web game where the user can get points by doing certain activities. The game can be played offline, so there's not necessarily a live internet connection (note: this makes this question other than existing questions). Game state will then be synchronized at a later moment.  How can the frontend tell the server that the user has indeed gained those points without giving the user the ability to cheat? E.g. by doing a REST call with a multitude of his points? How can the server tell the difference between a real call and a fake call?  What I can think of is to send not the points, but e.g. all the moves of the game, and then the server recomputes the game and calculates the gained points? But that is quite hard, and the game must be deterministic in order to give the client and server the exact same result from the moves.  Does anybody know how existing games implement this? Or how it could theoretically be done?

On backend I am using java. I have a game in HTML5; when user completes it I sends an Ajax call to save the score to database. Now, someone can easily use tools like Fiddler and firebug to modify this ajax request and send a much better score to the server. How do I make sure that user cannot manipulate scores !


I am trying to justify the formula:  $${\rm det} (M) = e^{{\rm Tr}\;log M} $$  for any square matrix M.  My idea is that it is easy to check for diagonal matrices and since det, Tr, and log are continuous functions and the set of diagonal matrices is dense in the set of matrices it must be true for any matrix.  Is that enough?

Prove $$\det(e^A) = e^{\operatorname{tr}(A)}$$ for all matrices $A \in \mathbb{C}_{n×n}$.


I'm applying growth curve modelling and am interested in modelling a three-way interaction between predictors A x B x C. From what I remember a condition for modelling three-way interactions in regression analyses is to model all underlying related interactions as well (so AxB, AxC, and BxC in order to be allowed to model AxBxC). Can anyone confirm this (preferably providing a source) or am I confusing things and I could happily model higher-order interactions without including those lower order interactions of less interest?

I am actually reviewing a manuscript where the authors compare 5-6 logit regression models with AIC. However, some of the models have interaction terms without including the individual covariate terms. Does it ever make sense to do this?  For example (not specific to logit models):  M1: Y = X1 + X2 + X1*X2 M2: Y = X1 + X2 M3: Y = X1 + X1*X2 (missing X2) M4: Y = X2 + X1*X2 (missing X1) M5: Y = X1*X2 (missing X1 & X2)   I've always been under the impression that if you have the interaction term X1*X2 you also need X1 + X2. Therefore, models 1 and 2 would be fine but models 3-5 would be problematic (even if AIC is lower). Is this correct? Is it a rule or more of a guideline? Does anyone have a good reference that explains the reasoning behind this? I just want to make sure I don't miscommunicate anything important in the review.  Thanks for any thoughts, Dan


I have a finite space of 'data' (rows) that is fairly large (3 billion) and I want to check how many 'Positives' there are in this data set. However, checking the data is time consuming from a computational standpoint. If I have reason to believe that the data is i.i.d and each row has an equal likelihood of being a 'Positive' how can I calculate the sample size required to get a reasonable estimate on the TOTAL NUMBER (not just proportion in a Binomial Distribution) of 'Positives' in the data?  Things I have tried / other caveats:   I have looked into Binomial sample size calculation, but I'm not sure how this extends to the case where I am just looking for counts. I am guessing that when I multiply the estimated probability by the 3 billion, that it will distort the confidence intervals as it adds more variance. I have looked into doing a Poisson sample size calculation but can't find many resources online that I can understand. Do I have to assume that data is i.i.d in the distribution of 'Positives'? Intuitively I can understand why it wouldn't matter, since a large enough sample would factor in an aggregate probability of success.

I'm trying to determine n, the sample size.  We have $N=580$ and we want to estimate population proportion, $p$, at a 95%-CI and a margin of error of $0.10$, then I get   $$n=Npq / (N-1)D + pq$$  where $D= B^2 / 4$ to be about $n=86$.  But what if instead we keep that same margin of error at $0.10$ and now only want a 90%-CI, if we use the same formula don't we get the same $n$?   Am I using the formula wrong here?


To construct the half-normal probability plot, plot the absolute values in a certain statistical diagnostic (residual, leverage, Cook distance and others) versus $z_i$ where:  $\displaystyle z_{i}  = \Phi^{-1} \left(\frac{k + n - \frac{1}{8}}{2n +\frac{1}{2}}\right)$   $\therefore$ Applied Linear Statistical Models, (Kutner,Nachtsheim,Neter & Li, 2005) Fifth Edition, Pag 596  or  $\displaystyle z_{i} = \Phi^{-1} \left(\frac{k + n + \frac{1}{2}}{2n +\frac{9}{8}}\right)$  $\therefore$ Generalized Linear Models, (P. McCullagh & J.A. Nelder, 1989) Second Edition,  Pag 407  where  $\Phi$ is the cumulative distribution function of the standard normal distribution.  $k$ is the  $k$-th ordered absolute residual   $n$ is the sample size  I could not locate the mathematical justification for the difference of the $z_i$, and more importantly I don't have any intuition about where it comes from.      Any help? Could you please guide me?


I have seen that  has an "Offline mode", which is described in .  However, it shocked me as I thought that perhaps it was storing my data online, which would be a security concern.  Is Clipit safe to use?  How could I check that it wasn't communicating with an outside source?

The version of the Clipit applet in 14.04's repos has an "offline mode" option. It is not really clear what it does, as Clipit seems to lack support for any Pastebin site. Any ideas?


I am creating a KeyEvent for my Main class, what I want the event to do is when the UP key is pressed, it will return n as false, and when the DOWN key is pressed, it will return n as true.  package main;  import java.awt.event.KeyEvent;  public class IsStopped {      public static boolean main(String[] args, KeyEvent e) {         boolean n = false;          int key = e.getKeyCode();         if (key == KeyEvent.VK_UP) {             return n = false;         }          if (key == KeyEvent.VK_DOWN) {             return n = true;          }         return n;     } }   I want to use n for my Main class. Like this inside a loop:  if(main.IsStopped.main(args, null) == false) { break;   This is what returns once I run my Main class:     Exception in thread "main" java.lang.NullPointerException   at main.IsStopped.main(IsStopped.java:12)   at main.Main.main(Main.java:27)   How would I define e?

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I am trying to compile a document of talks I have texed. Currently I am putting each talk in a section, put them in a separate file, and include all of them in a main document. Is it possible for me to "tag" each section so that I can compile a document that shows only talks with a specific tag easily? Thanks.

Is it possible to tag sections of your .tex file so that you can make text appear or not?  I have a long document and would like to be able to comment a certain section in each chapter, and produce two different pdfs, one with the comments, and one without.  I read . Is it possible to make this appear if I redefined the comment tag? How is this done?  (On suggestion, migrated this question from StackOverflow: )


I am writing a grant application for a post-doctoral fellowship, and I need to provide a publication list. In the list of papers published in peer-reviewed journals, I wonder if I should include the following information:   Impact factors of the journal? Number of citations the paper actually raised?   One of the papers raised a pretty large number of citations (several hundreds) despite being published in a low IF, so I wonder how to carry this information...

Some people, in their CV or publication list, add bibliometric information to each entry. I've typically seen:   mention the impact factor of each journal number of citations of each paper mention the acceptance rate of each conference   I'm not sure it is very helpful: people from your field will surely know the journals/conferences, while people from outside your field might be more interested in a “macro” view and not go into the minute details of your publications.  Moreover, I'm not sure I like the tone it conveys: it feels like bragging (this is typically done by people who are proud of these indicators), and a bit over-the-top to me. Finally, it's well accepted by now that things like the journal impact factor are a poor measure of individual papers' merits.  So: is it accepted practice to do it? does it improve the CV? or does it risk alienating the reader?


I would like to know, How HttpSession works on Load balancer? How Load balancer knows for the particular request need to send the respective Web Server?  Here's what I would guess:  1. load-balancer works based on user's region like county, state.  2. load-balancer works based on user IP address range  3. load-balancer works based on Cookies management.

I was researching different load balancing algorithms for HTTP and I just found 3.   Random, Round Robin and Weighted Round Robin.   Are there any other options?  Thanks  Paul


Prove that every finite integral domain R is a field.   I am given the following hint: For an element $r\neq 0 $ decide if the function $f : R \to R $ defined by $f(s)=rs $ is injective and/or surjective.   My question is about the hint.   Firstly i am assuming they mean that $ r, s \in R $ ?   If $f$ is an injective function that would seem to imply that $f$ is simply a permutation all the elements in $R$? if $f$ is injective or surjective then it is a bijection.  lastly what does this map have to do with anything? shouldn't it be $f:R \to F $ where $F$ is a field with that many elements then show that $f$ is a homomorphism and a bijection so $R$ (our integral domain) would be isomorphic to $F$ which is the field?

I'm reading Galois Theory by Steven H. Weintraub (second edition), and finding that I'm at least somewhat short on the prerequisites. However the following proof looks wrong to me - am I misunderstanding something, or is it actually an incorrect proof?  Lemma 2.2.3. Let $F$ be a field and $R$ an integral domain that is a finite-dimensional $F$-vector space. Then $R$ is a field. Proof. We need to show that any nonzero $r \in R$ has an inverse. Consider $\{1, r, r^2, \cdots\}$. This is an infinite set of elements of $R$, and by hypothesis $R$ is finite dimensional as an $F$-vector space, so this set is linearly dependent. Hence $\sum_{i=0}^n{c_i r^i} = 0$ for some $n$ and some $c_i \in F$ not all zero.  It then goes on to show, given the above, that we can derive an inverse for $r$. However, if I consider examples like $r = 2 \in Q[\sqrt{2}]$, $r = \sqrt{2} \in Q[\sqrt{2}]$ or $r = 2 \in Q[X]/{<X^2>}$, the set $\{1, r, r^2, ...\}$ doesn't look linearly dependent to me. I do believe the lemma is true (and might even be able to prove it), but this does not look like a correct proof to me. Am I missing something? [Edit] Well yes, I am. Somehow I had managed to discount the possibility of any $c_i$ being negative, despite repeatedly looking at each fragment of the quoted text in an attempt to find what I might be misunderstanding.


When I was writing out a degree title, I recall the "rule"     "a" comes before a consonant    "an" comes before a vowel   but then I naturally used to say that "I have an MSc degree" just for ease of pronunciation.   as M is a consonant, I thought this violates the "rule" but "an" is apparently the appropriate indefinite article for "MSc".   Why do I use "an" and not "a" ahead of a degree title as above?

In the following example, is it appropriate to use a or an as the indefinite article, and why?     He ate __ green apple.   I know that in the case of just "apple", it would be "an apple," but I've heard conflicting answers for "green apple," where the noun is separated from the article by an adjective.  Also, which is more appropriate in this case:     He ate  __ enormous Pop-Tart.


When defining javascript objects that behave like classes that have state and functions that manipulate that state is it better to define functions when defining the object like so:   function MyNewClass(){    //State    this.value = ""    this.otherValue = ""    //Functions    this.someFunction = function(){       //Some logic here    } }   Or it it better practice to define functions on the prototype of the object such as:   function MyNewClass (){    //state    this.value = ""    this.otherValue = "" }  MyNewClass.prototype.someFunction = function(){   //Some logic here }   Are there any advantages to defining object functions on the prototype?  Thanks!

What's the difference between  var A = function () {     this.x = function () {         //do something     }; };   and  var A = function () { }; A.prototype.x = function () {     //do something };


I installed 19.10 on Lenovo G550 but no wireless icon and on settings Bluetooth is not active. I did: sudo nano /etc/modprobe.d/blacklist.conf  blacklist Lenovo-G550 But to no avail  lspci -nnk | grep -iA3 net; lsusb; rfkill list 04:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4312 802.11b/g LP-PHY [14e4:4315] (rev 01)     Subsystem: Broadcom Inc. and subsidiaries BCM4312 802.11b/g LP-PHY [14e4:04b5]     Kernel driver in use: b43-pci-bridge     Kernel modules: ssb 07:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet controller [10ec:8136] (rev 02)     Subsystem: Lenovo RTL810xE PCI Express Fast Ethernet controller [17aa:392e]     Kernel driver in use: r8169     Kernel modules: r8169 Bus 002 Device 004: ID 090c:37b1 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Lenovo EasyCamera Bus 002 Device 006: ID 059f:0c41 LaCie, Ltd LaCie Hard Drive USB Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 008 Device 002: ID 1bcf:0535 Sunplus Innovation Technology Inc. 2.4GHz 2way RF Mouse Receiver Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 002: ID 1a2c:0b23 China Resource Semico Co., Ltd USB Keyboard Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 0: ideapad_wlan: Wireless LAN     Soft blocked: no     Hard blocked: no   Any help please TIA Kemal

I'm having serious problems installing the Broadcom drivers for Ubuntu. It worked perfectly on my previous version, but now, it is impossible.   What are the steps to install Broadcom wireless drivers for a BCM43xx card?  I'm a user with no advance knowledge in Linux, so I would need clear explanations on how to make, compile, etc.    lspci -vnn | grep Network showed:   Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller [14e4:432b]      iwconfig showed:  lo        no wireless extensions. eth0      no wireless extensions.   NOTE: Answer below is updated every time new information is added and confirmed working.


I have this array: const myArray: [{phone: ""}, {message: ""}]  I want to destructure this array and obtain something like this: const result = {phone: "", message: ""}  But I can't find a way.

I need to be able to merge two (very simple) JavaScript objects at runtime.  For example I'd like to:  var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' }  obj1.merge(obj2);  //obj1 now has three properties: food, car, and animal   Does anyone have a script for this or know of a built in way to do this?  I do not need recursion, and I do not need to merge functions, just methods on flat objects.


What is the difference between web application and website in asp.net? and if it have a difference which best from all sides?

When I start a new ASP.NET project in Visual Studio, I can create an ASP.NET Web Application or I can create an ASP.NET Web Site.  What is the difference between ASP.NET Web Application and ASP.NET Web Site? Why would I choose one over other?  Is the answer different based on which version of Visual Studio I am using?


I can run these commands to show the "Section" of certain packages  $ apt-cache show bash | grep Section Section: shells  $ apt-cache show procps | grep Section Section: admin   I would like a command to list all packages in a certain section. Here is what I have tried  $ dpkg --list shells dpkg-query: no packages found matching shells

In Synaptic, one can list packages by section. For example, in the image below all packages of the "Amateur Radio (universe)" section are listed.  How can I get such a list (edit: with package description) at the command line?  I need a raw list; a terminal application like aptitude will not do.


When trying to convert to GPT, I get this error:  PS C:\WINDOWS\system32> mbr2gpt /validate /disk:0 /allowfullos MBR2GPT: Attempting to validate disk 0 MBR2GPT: Retrieving layout of disk MBR2GPT: Validating layout, disk sector size is: 512 bytes Disk layout validation failed for disk 0   Here's diskpart info:  PS C:\WINDOWS\system32> diskpart  Microsoft DiskPart version 10.0.17134.1  Copyright (C) Microsoft Corporation. On computer: DESKTOP-74HKFD4  DISKPART> list disk    Disk ###  Status         Size     Free     Dyn  Gpt   --------  -------------  -------  -------  ---  ---   Disk 0    Online         2794 GB      0 B  DISKPART> sel disk 0  Disk 0 is now the selected disk.  DISKPART> list part    Partition ###  Type              Size     Offset   -------------  ----------------  -------  -------   Partition 1    Primary            500 MB  1024 KB   Partition 2    Primary            519 GB   501 MB   Partition 3    Recovery           885 MB   520 GB   Partition 4    Primary           1525 GB   521 GB   And here's a picture of disk management:    I've tried shrinking the storage by a few GB in case it was the issue, but no luck. I'm kinda out of ideas. Maybe the recovery partition counts as a primary partition and thus I go over the 3 primary maximum? It shouldn't, but that's the only idea I have left.

I want to upgrade my disk from MBR to GPT, and I tried using Windows' MBR2GPT.EXE tool to do the job. I used Windows' DISKPART tool to identify the disk I want to convert. However, this happened:  C:\WINDOWS\system32>MBR2GPT.EXE /convert /disk:0 /allowfullos  MBR2GPT will now attempt to convert disk 0. If conversion is successful the disk can only be booted in GPT mode. These changes cannot be undone!  MBR2GPT: Attempting to convert disk 0 MBR2GPT: Retrieving layout of disk MBR2GPT: Validating layout, disk sector size is: 512 bytes Disk layout validation failed for disk 0 MBR2GPT: Conversion failed   and the conversion failed. Using Diskpart again, I get the following output:  DISKPART> list disk    Disk ###  Status         Size     Free     Dyn  Gpt   --------  -------------  -------  -------  ---  --- * Disk 0    Online          465 GB      0 B   Disk 1    Online         3841 MB   960 KB  DISKPART> select disk 0  Disk 0 is now the selected disk.  DISKPART> list partition    Partition ###  Type              Size     Offset   -------------  ----------------  -------  -------   Partition 1    Primary            100 MB  1024 KB   Partition 2    Primary            464 GB   101 MB   Partition 3    Recovery           813 MB   464 GB   Partition 4    Recovery           511 MB   465 GB   Looking at the partitions on disk 0, there are 2 primary partitions and 2 hidden ones, I read  that the partitions might have something to do with the conversion failing, so I believe this is the culprit. If anyone could offer help converting my disk, that would be greatly appreciated.


How many solutions (using only nonnegative integers) are there to the equation   $$x_1+ x_2 + x_3 + x_4 + x_5 = 31\;?$$

How to use the  method?  Say I want to find number of combinations I can get with $x_1+x_2+x_3+x_4=22$,  where $x_i\in\mathbb{N}$.  Is this the correct time to apply the method?  This is being repurposed in an effort to cut down on duplicates, see here:     and here:


I have been using json_encode, url_encode and many other functions suffixed with encode in php. However, I have never seen real use case or atleast learn from anywhere what base64_encode does. Inspecting its output,I realize that it uses Character set [A_Za-z0-9] to encode data.  //sample output  TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=    So the question is. What does base64_encode aim to solve when we already have a myriad of text encoding functions.

I've heard people talking about "base 64 encoding" here and there.  What is it used for?


I am reading a linear algebra book and I don't understand some part of it. The chapter is about diagonalization of linear operators.I state what is exactly in the book:    Let $T$ be a diagonizable linear operator and let $c_1,...,c_k$ be the distinct characteristic values of $T$. Then it is easy to see that the minimal polynomial fot $T$ is the polynomial $$p=(x-c_1)...(x-c_k).$$ If $\alpha$ is a characteristic vector, then one of the operators $T-c_1I,...,T-c_kI$ sends $\alpha$ into $0$. Therefore $$(T-c_1I)...(T-c_kI)\alpha=0$$ for every characteristic vector $\alpha$.  Please explain why the last claim is true i.e. $(T-c_1I)...(T-c_kI)\alpha=0$ for every characteristic vector $\alpha$.  ---------------------------------------EDIT-------------------------------------  I got my answer. My answer is the duplicate of  and the answer is the commutativity of the operators (T-c_kI).

There proof given in my textbook is as follows:  Let T be a diagonalisable linear operator and let $c_1, ..., c_k$ be the distinct eigenvalues of T. Then it is easy to see that the minimal polynomial for T is the polynomial  $$ p = (x-c_1)...(x-c_k)$$  If $\alpha$ is an eigenvector, then one of the operators $T-c_1I,...,T-c_kI$ sends $\alpha$ into 0. Therefore  $$ (T-c_1 I)...(T-c_kI)\alpha = 0$$  for every eigenvector $\alpha$. There is a basis for the underlying space which consists of eigenvectors of T and hence  $$ p(T) = (T -c_1I)...(T-c_kI) = 0$$  I cannot understand this proof at all. I understand that one of the operators $T-c_1I,...,T-c_kI$ sends $\alpha$ into 0, but I can't see why we we multiply them together, it still works. And I also don't understand why there is a basis for the underlying space. Can someone kindly explain to me please. Thanks


I just created an empty WPF app in VS 2015.  It has  public partial class MainWindow : Window {     public MainWindow()     {         InitializeComponent();         var mainWindowHandle = new WindowInteropHelper(this).Handle;     } }   But mainWindowHandle  is 0 always.  Is it OK? Should it be > 0 ?

I have the following class declared:  public partial class MainWindow : Window   And I need to get the actual handle of the window once the window has one. How can I do that and where should I put the query function.  What I tried so far was:  IntPtr hwnd = new WindowInteropHelper(this).Handle;   But the handle I get back is 0, which might be because it was planted in OnInitialized - maybe the window is not ready yet at that stage. And, yes - it is connected via WPF, thank you for pointing it out!  Thanks


I know that 20.04.1 is available to download but my settings are to update "for long-term support versions" and I am currently using 18.04 LTS and I don't get an update. My understanding is that it will be available for updating when all the bugs are ironed out. Is there any way that I can fond out what is delaying the update. It seems an inordinately long delay compared to the time it took for the 16.04 LTS to be updated to 18.04

I want to use do-release-upgrade to upgrade from 18.04 to 20.04, but I can't do that do-release-upgrade Checking for a new Ubuntu release There is no development version of an LTS available.  It seems that  is used, and it still points to 18.04. Do you know when (or how?) can I upgrade to 20.04?


In my project.. I needed to make multiuser enviroment. So I declared INTERACT_ACROSS_USERS_FULL permission.  Then I also found INTERACT_ACROSS_USERS permission. INTERACT_ACROSS_USERS_FULL and INTERACT_ACROSS_USERS, what is the difference?  what is INTERACT_ACROSS_USERS_FULL permission?

When installing an application, the application lists permissions that it needs to perform its  functions.    I am creating this list of the the system defined permissions and a description of what they mean. It is a community wiki so if new permissions are added in the future they can be added to this list.


Is there even a relativistic mass or just relativistic momentum? How does one reason to prefer one over another? What is the problem with saying a hot gas will have more mass/inertia to it?

I'm reading Nano: The Essentials by T. Pradeep and I came upon this statement in the section explaining the basics of scanning electron microscopy.     However, the equation breaks down when the electron velocity approaches the speed of light as mass increases. At such velocities, one needs to do relativistic correction to the mass so that it becomes[...]   We all know about the famous theory of relativity, but I couldn't quite grasp the "why" of its concepts yet. This might shed new light on what I already know about time slowing down for me if I move faster.  Why does the (relativistic) mass of an object increase when its speed approaches that of light?


I was playing with extension functions and tried to do binarySearch function on lists. And I realized that there is an extension function already that is builtin in Kotlin. However, it is very slow: -  public fun <T: Comparable<T>> List<T?>.binarySearch(element: T?, fromIndex: Int = 0, toIndex: Int = size): Int {      rangeCheck(size, fromIndex, toIndex)       var low = fromIndex      var high = toIndex - 1       while (low <= high) {          val mid = (low + high).ushr(1) // safe from overflows          val midVal = get(mid)          val cmp = compareValues(midVal, element)           if (cmp < 0)              low = mid + 1          else if (cmp > 0)              high = mid - 1          else              return mid // key found      }      return -(low + 1)  // key not found }   I have edited the function and removed the function call (compareValues) and the replacement function is way faster   test_buildin_binary_search         8s35m test_binary_search           584ms   ^based on my test I will attach it down.  the new one: -  fun rangeCheck(size: Int, fromIndex: Int, toIndex: Int) {     when {         fromIndex > toIndex -> throw IllegalArgumentException("fromIndex ($fromIndex) is greater than toIndex ($toIndex).")         fromIndex < 0 -> throw IndexOutOfBoundsException("fromIndex ($fromIndex) is less than zero.")         toIndex > size -> throw IndexOutOfBoundsException("toIndex ($toIndex) is greater than size ($size).")     } }  fun <T : Comparable<T>> binarySearch(list: List<T?>, element: T?, fromIndex: Int = 0, toIndex: Int = list.size): Int {     rangeCheck(list.size, fromIndex, toIndex)      var low = fromIndex     var high = toIndex - 1      while (low <= high) {         val mid = (low + high).ushr(1) // safe from overflows         val midVal = list.get(mid)         val cmp = element?.compareTo(midVal as T) as Int          if (cmp < 0)             low = mid + 1         else if (cmp > 0)             high = mid - 1         else             return mid // key found     }     return -(low + 1)  // key not found }   It is not an extension function so far. But I believe that the inside function call is the reason of making it slow.  Q1. why compareValues is not an inline function? maybe due to design decisions? where it is not always a good idea to inline it?  Q2. Is there a keyword that gives the programmer the freedom to inline function "f1" for example where f1 is not inline function?  I mean why there is no keyword like "inlineit" and it is used as: -   fun f1() {     println("something")  }   fun main() {      inlineit f1() // line 1      f1() // line 2  }   Where in this case f1() will be inlined only when we use the keyword inlineit in front of its name, in above code f1() in line 1 is inlined but in line 2 is not.  The junit test: -  class BinarySearchTests() {     private val max = 10_000_000     private val times = 10_000_000     private val largNumbers = (0..max).toList()     private val r = Random(System.currentTimeMillis())      @Test     fun test_binary_search() {         var found = false          repeat(times) {             val item = r.nextInt(max)              val r = binarySearch(largNumbers, item)              if (r != null) found = true         }          assert(found)     }       @Test     fun test_buildin_binary_search() {         var found = false          repeat(times) {             val item = r.nextInt(max)              val r = largNumbers.binarySearch(item)              if (r != -1) found = true         }          assert(found)     }  }   Thank you

How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related:


My server has been steady at about 2-3%, but today the CPU usage has raised to about 25%  When I run top in command line this is what I see.. user is still low about 1.3% and the same with system about 1.2% but then I look at wa.. 16.1% !?  What is wa and why is it suddenly so high?!

As much as I have read about iowait, it is still mystery to me.  I know it's the time spent by the CPU waiting for a IO operations to complete, but what kind of IO operations precisely? What I am also not sure, is why it so important? Can't the CPU just do something else while the IO operation completes, and then get back to processing data?  Also what are the right tools to diagnose what process(es) did exactly wait for IO.  And what are the ways to minimize IO wait time?


I need to make an integral that looks like this:  or on a real world example like this:  in LaTeX? I couldn't find any special integral symbols in latex except \oint. Is there a way to do this?

Is there in LaTeX a symbol or a macro for the average integral with a horizontal slash? I know about \strokedint, but I'd prefer the dash to be horizontal.


I am making a registration page and I used sha1() to encrypt my passwords upon registration. I check my tables and the passwords are encrypted but when I try logging in, the password is considered invalid. I was wondering if someone could check the login code for it? I am aware that sha1() is unsuitable for password encryption but I haven't learnt better encryption methods yet and this is considered enough for our assignment.  Registration code:  <?php if (!empty($_POST) && !empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['email'])) {     $username = strip_tags($_POST['username']);   $password = strip_tags($_POST['password']);   $email = strip_tags($_POST['email']);   $username = mysqli_real_escape_string($db, $username);   $password = mysqli_real_escape_string($db, $password);   $email = mysqli_real_escape_string($db, $email);   $passwordhash = sha1($_POST["password"]);    $query = "SELECT COUNT(*) AS count FROM login_details WHERE Username = '".$username."'";   $result = $db->query($query);   $data = $result->fetch_assoc();    if ($data['count'] > 0) {      echo "
Username taken!
";    } else {      $query = "INSERT INTO login_details (Username, Password, Email) VALUES ('".$username."','".$passwordhash."','".$email."')";      $result = $db->query($query);      $query = "INSERT INTO authors (Name) VALUES ('".$username."')";     $result = $db->query($query);      $query = "INSERT INTO `login_profile` (`user_id`, `author_id`) SELECT `login_details`.`id`, `authors`.`id` FROM `login_details`, `authors` WHERE `login_details`.`Username` = '".$username."' AND `authors`.`Name` = '".$username."'";      $result = $db->query($query);      if ($result) {       echo "
User registered!
";     } else {         echo "SQL Error: " . $db->error;     }   } }     ?>  Thank you!

It is currently said that MD5 is partially unsafe. Taking this into consideration, I'd like to know which mechanism to use for password protection.  This question,   suggests that hashing multiple times may be a good idea, whereas  suggests using salt.  I'm using PHP. I want a safe and fast password encryption system. Hashing a password a million times may be safer, but also slower. How to achieve a good balance between speed and safety? Also, I'd prefer the result to have a constant number of characters.   The hashing mechanism must be available in PHP It must be safe It can use salt (in this case, are all salts equally good? Is there any way to generate good salts?)   Also, should I store two fields in the database (one using MD5 and another one using SHA, for example)? Would it make it safer or unsafer?  In case I wasn't clear enough, I want to know which hashing function(s) to use and how to pick a good salt in order to have a safe and fast password protection mechanism.  Related questions that don't quite cover my question:


I am a new hire at a large private company that is undergoing some rapid growth.  I hope to stay with this company for at least the next few years.  At my hire, I was offered stock options equivalent to one year's salary--fully vested after five years--and the first batch of those is now available for purchase.  Please forgive any incorrect vocabulary or lack of pertinent details, but that brings me to my question:  I am fairly financially illiterate.  I have looked up what "stock options" and "vesting" and so forth mean, and I more or less understand it, but I have no idea whether it's a good idea or not.  I understand there are no guarantees with the stock market, but I'm wondering if anyone can tell me things I should consider when making this decision.  My company is growing and I believe the stock is currently increasing in value.  Our company is very large and I believe in its business model, which seems poised to do very well.  I suppose we're technically a startup, but we have 8000 employees and locations across the world.  Not sure which of this is pertinent but:   I am married, and we have a combined income of approximately 200K. We live in the US We have the majority of our $450K mortgage outstanding (we've owned our home for just two years). We have approximately 35K in credit card debt which we are rapidly paying down. We have about 100K in student loan debt (mostly my husband's) which we know we will be paying down for quite a while.

Background: I am currently employed by a start-up that, so far, is doing really well. As part of my contract, I have stock options that will come available on a typical vesting schedule. A quarter of my options are set to vest later this year. Also, the company is not public yet, and it may be several years before it is public / I could sell my shares of the company.  My question is, is there any reason I should exercise them as soon as they vest? As far as I know they don't expire as long as I work at my company (if I leave for any reason, then I only have 3 months to exercise).  I don't foresee leaving any-time soon, and if I did, I would have 3 months to make a final decision.  Is there any disadvantage to just letting the option stay an option for a while?


Can the standard LaTeX “Book” class adjust to the paper size and structure of a Novel sized book?  It would be smaller than the standard dimensions that LaTeX seem to be setup for.  The LyX dialog box for adding a custom paper size keeps the [ok] button grayed out after I’ve made my adjustments.  Would that requires another package to support customization, or does it require an adjustment in the settings of MikeTeX first?     I’d like to customize the standard paper sizes used in Novels, for instance those that fit nicely on a bookshelf with other novels, something small but not tiny.  ()  The “12mo” paper size would be perfect; it’s an American Library Association standard size, also known as "Duodecimo" 17.5-20 cm (5” x 7-3/8”).  Is the standard LaTeX using Book Class capable enough for typesetting a novel in final form typesetting a page that would fit on those dimensions, even if I have to use 8.5 X 11 and trim it, with all the proper pieces (front matter, main matter, back matter) of a commonly published novel?     I’m not thinking of a submittal to an editor, and not a submittal to a publishing house that converts submittals using their own system, but rather something that could be used for direct printing from pdf?  LyX or another LaTeX front end seems like the perfect solution for a Fiction project if the default packages are all that’s necessary.  I suppose if it can handle a scientific textbook with tables, formula and diagrams, then it’s more than capable enough.  That’s why I’m thinking that I could just use the Standard LaTeX Book class and create a template to fill in on LyX, and all the text would be typeset with precision, all in its proper spot, with the excellent word spacing and justification controls that LaTeX excels at, since a Novel is the simplest type of book, page after page of the same font and formatting.  But I'd use the KOMA Book (scrbook) class or Memoir if necessary.  Also, I’ll probably just use InkScape, Scribus or Gimp for the front and back cover graphics and skip text altogether there.    The scenes would not be numbered like "2.4.2.1".  A Novel usually has the following layout:   Front Cover (use a graphics program: Scribus, InkScape or GIMP) Front Matter Table of Contents Dedication Prologue Main Matter (Parts, Chapters, Scenes, and insets for monologues or poem) Epilogue Back Matter Back Cover (use a graphics program: Scribus, InkScape or GIMP)

I am a casual TeX user. Mostly I have used it to type up some reports/homeworks for class in my graduate engineering work. In the past I have used document type "article". And then kept all the defaults.  I need to self publish something online. At the highest level I would like to know: How do you setup a TeX document to self publish a book online?  Some more low level questions:   Is there a document type for "book" and what is its name? I am looking at Amazon Createspace. : filetype=pdf, trim size, margins (gutter and outside margins). All of these various trim size, margins gutter/outside can be adjusted in the Tex document?   Has anyone seen any good TeX templates for Amazon Createspace? If you could demonstrate how to tweak a specific "book" document type that would be very helpful also.    Other than the above questions, please feel free to offer any other sort of help since I am completely new to this process (advice, links to good tutorials, links to wikibooks).


urllib2.urlopen("http://www.someURL.com/pageTracker.html").read();   The code above will return the source HTML at .   What do I need to do to actually return the rendered HTML that you see when you visit google.com? I essentially trying to 'execute' a URL to trigger a view, not retrieve the HTML.  To clarify a few things:   I'm not actually concerned about the visual output of the page I'm concerned about the page rendering as it would inside of a proper browser so that I can track a Google Analytics goal via the JavaScript on that page.

Is there any python module for rendering a HTML page with javascript and get back a DOM object?  I want to parse a page which generates almost all of its content using javascript.


The ESG funds are becoming more and more popular. (ESG = Environmental, Social and Governance). But I am wondering if it makes sense for stock funds?  If you buy a stock fund, the only consequence is that you become a player on the stock market, but your money will not transfered to any "bad" company in the stock fund. So why should I care about the portfolio of the fund?  Clearly, if you buy a fund that includes corporate bonds, then you finance companies, i.e. you could finance, e.g.,  weapons or child labor. In this case ESG funds are very useful.  But for pure stock funds, what is the point with ESG?  Edit: This question is very similar to the question "if buying a stock means to support the company". However, one difference is, e.g., that if you buy a fund you can not participate at a annual general meeting and you are not a legal shareholder of the companies. So with a stock fund you are only a speculator but with a stock you are also a owner. So it could be a reasonable and responsible strategy to select stock funds according to risk/profit and to select bonds (or other assets that directly support the company) by ESG criteria. In this way one could transfer money from non-ESG companies to ESG-companies.  Edit2: All funds I have are ESG funds. But I was wondering if this has any positive impact. This is why I asked this question. So please don't downgrade my question to tell me that I am irresponsible or ignorant. This is not the case.

I ask this question in the context of investing in "ethical" companies, as someone I know wants to do in order to support them. My understanding is that when you buy stock, you're just exchanging ownership of the company, and not actually helping the company by giving them money (unless it's an IPO or new stock has been issued).  In what ways directly (if any) or indirectly, do you help a company by buying into them?


I updated my HP computer from 18 to 20.04.  Google Chrome crashes, I have no sound.  I have read thru many of the questions and tried the given solutions.  When I try command line nothing seems to work.  Someone suggested reinstalling from disk.  I downloaded and unetbootlin but because I cant do anything command line I cant create a bootable disk.  So is there somewhere I can buy a disk?

I need to upgrade my existing Ubuntu system, and I also want to install Ubuntu on a new laptop.  I would like to have an installation CD or DVD to do both of these.  Where exactly I can order or request an Ubuntu installation CD/DVD/USB?


Currently, the Frequently Asked Questions list on the Meta homepage looks like this:        But the very first question on that list isn't tagged with  at all!        Is this a bug, or can questions without the special tag appear in that list?

Ding!  Hello, new feature!  I just noticed a new "Frequently Asked" section on the main page.  I'm guessing it's a test of a new feature, like the recent .  Seems cool so far.  But what is it populated with?  Common dupes?  Topics the viewing user asks about a lot?  Topics the viewing user searches for a lot?  For what it's worth, I'm getting a link to the  tag underneath it.


A month ago, I saw US$500 round trip flights from Dallas to Shanghai. Now I can't seem to get anything less than $750, no matter what time of the year pick. I am searching Expedia, and Travelocity.  I am going to wander around China to immerse myself in the language, for a month, as a continuation of my Mandarin language studies - so I am not fussy about what time I go. I just want to lower my costs.  Do you have any tips for me? How can I get the cheapest flight to China?

Several airline and trip planning sites will allow you to check "I am flexible with my dates" or a similar option.  Is there any way to also search more broadly for location?  For example, if you wanted to leave from YYZ or YKF and arrive at any airport in California, can a search for such flights be done somehow?  I ask because when I plan plane trips, I want the lowest price.  I'm OK with leaving a day or two later if I save $200 (same with the return trip).  There are 3 airports within 80 km of me, I'll leave from the one with the cheapest flight. And I'm also OK with changing the trip to spend time exploring San Francisco instead of lying on the beach near San Diego, and that sort of thing.  Normally this would take dozens of searches, but I'd like to see it all at once.


I want to open the URL in the same window I'm actually using the lightning component inside vf page so I can't use "Navigate To Url" as it only works in one.app container. It’s supported in Lightning Experience and Salesforce1 only. that's the reason I'm using Window.open is there is a way I can open the URL in the same window the way we can do this using "Navigate to URL". handleOpenNewWindowWithRecordId : function(component, event, helper){     console.log('called');    window.open("/006/o"); }  and if i use window.open("/006/o","_self"); if just refresh the component and open the url there only

Actually I am using lightning components with a visualforce page, because this is the only way to override standard button (using VF) today. The problem is that, i need to redirect my user to the new record page on a certain action, but :  $A.get("e.force:navigateToURL")   and   $A.get("e.force:createRecord");   Is not working. Because as stated in the doc :  "This event is handled by the one.app container. It’s supported in Lightning Experience and Salesforce1 only."  But the worst part is that even if I am in lightning experience, but the fact that i'm using a VF, it is considering me out of lightning.   But for such cases, what salesforce has to provide for navigation ? Is there no method I can use for this redirection ?


A fair die is rolled until the first time 6 appears. What is the probability that an even number of rolls is needed? With this knowledge, how many times would you expect to roll the die before all six sides appeared at least once?

What is the average number of times it would it take to roll a fair 6-sided die and get all numbers on the die?  The order in which the numbers appear does not matter.  I had this questions explained to me by a professor (not math professor), but it was not clear in the explanation.  We were given the answer $(1-(\frac56)^n)^6 = .5$ or $n = 12.152$  Can someone please explain this to me, possibly with a link to a general topic?


Recently, I have found this problem:     Prove that for every positive integer $n$, the equation: $$\frac{1}{\beta_1}+\frac{1}{\beta_2}+\cdots+\frac{1}{\beta_n}=1$$   has a finite number of solutions in positive integers $\beta_1,\beta_2,\cdots,\beta_n$.   I am trying to prove this proposition by induction: I have already shown that for $n=1$ and $n=2$ there is only one solution, but how can I go on?

This is a homework problem.  I tried proving this by means of induction. Verifying the case $n=1$ is easy, the only solution to $\frac{1}{x_1} = 1 $ is $x_1 = 1$, therefore there is only one, and thus a finite number of solutions. I am having some difficulties with proving that the case of $N+1$ follows from the $N$'th case (for some $N \in \mathbb{Z}_{>0}$), assuming that the sum only has a finite amount of solutions in $\mathbb{Z}_{>0}$ (our induction hypothesis). Can you help me with this?   I am equally interested in any other way to prove that the given sum has only a finite number of solutions, whether it can be done by means of induction or not.  Thanks in advance!


P/S:This is not duplicate, I already have an answer myself which map to the answer in the duplicated solution, what I need is the shortest expression that is possible.   l=[set()]*passwordLen l[0].add(1) print l   will give result  [set([1]), set([1]), set([1]), set([1]), set([1]), set([1])]   but I need  [set([1]), set(), set(), set(), set(), set()]   what is the shortest expression to create list of sets that could achieve this?  what I could think of is  l=[set() for _ in xrange(passwordLen)] l[0].add(1) print l

I needed to create a list of lists in Python, so I typed the following: my_list = [[1] * 4] * 3  The list looked like this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]    Then I changed one of the innermost values: my_list[0][0] = 5  Now my list looks like this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]]    which is not what I wanted or expected. Can someone please explain what's going on, and how to get around it?


I am using this code to call a REST API inside my same domain           HttpResponse res = new HttpResponse();         Http http = new Http();          req.setEndpoint('https://chaarvim-dev-ed.my.salesforce.com/services/data/v48.0/composite/tree/Account/');         req.setMethod('POST');                 req.setCompressed(false);         req.setBody(strRequest);         req.setHeader('Content-Type', 'application/json');         req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());           try {             res = http.send(req);                  } catch(System.CalloutException e) {             System.debug('Callout error: '+ e);         }   But i am getting   [{"message":"This session is not valid for use with the REST API","errorCode":"INVALID_SESSION_ID"}]  Any Suggestions please.

I wrote my own apex class with the following code:  @AuraEnabled     public static String getSessionId(){         return UserInfo.getSessionId();     }   This code works when I import it into my Lightning component. I retrieves a session id but it is invalid. If i try to do the same thing inside an apex page it works perfectly and it gives me a working session id. How can I retrieve a working session id?


I am using Windows8 and now I am trying to install Ubuntu alongside my Windows8 .My professor has warned that i might lose all my data in the hard disk.Will I lose the data ?

Is it really safe to choose the "Install Ubuntu alongside Windows" option from the Ubuntu installation program?  I never used that option, instead I used other tools such as partition magic or windows 7's disk tool to resize my partitions.  Since I'm going to install Ubuntu across a lot windows (XP, Vista and 7) machines. It would not be nice to damage those Windows partitions.  What is your experience? Can I use this feature without concerns?


The coefficient of $x^9$ in the expansion of $(1+x)(1+x^2)(1+x^3)...(1+x^{100})$.  I tried the following concept, how to sum 9 using 1-9 only without repetition.  1:9, 2:1+8,3:7+2, 4: 6+3, 5: 5+4,  6:1+2+6 ,7:1+3+5, 8:2+3+4  The answer is 8.  How will it be solved using Binomial theorem.

This question had come in jee advanced 2015. Give a hint to solve it.


I was reading a fantasy novel and I came across this piece of dialogue:     Don’t you know what a Conquest Knight is?   And the main character replied by nodding his head.   But this confused me because the question could be asking if he does know, to which he nods his head, or it could be asking if he does not know, to which he nods his head.  Well from reading the story I can tell you that at this point in time the character does not know. And because he nods his head the question must be asking if he does not know.  But, left as is, it could be interpreted one of two ways:     "Do you not know what a conquest knight is?"      "Do you know what a conquest knight is?"   Basically, I am asking if the contraction don't is used improperly in the sentence or if the contraction itself has always been that ambiguous.

I faced a problem to answer a negative question, for example, when someone asks you:      Don't you have any money?   It's a yes/no question but how should one answer the question without ambiguity?  When you answer "yes", does it mean "yes, I don't have any money"? or the other way "Yes, I do have money"? the questioner may think you are agreeing to the negative, that yes, you do not have any money.  I know it's better to answer with "on the contrary" but is it possible to answer yes or no?


I am trying to make an app. Where if the userId has a specific value then it goes to another activity else it goes to the onCreate method. But every time I execute it, it goes to one way.  For example, my database status has value NotGiven, So for not given value, it goes to another activity. But every time it goes to another activity for any other word also.  Database pic:    "tooltip"  Below I gave my code:  @Override protected void onStart() {      firebaseUser= FirebaseAuth.getInstance().getCurrentUser();      if (firebaseUser!= null){          final String userID = firebaseUser.getUid();          final String binum1="NotGiven";         String null1="";          referenceChecking = FirebaseDatabase.getInstance().getReference("Riders").child(userID);           referenceChecking.addListenerForSingleValueEvent(new ValueEventListener() {             @Override             public void onDataChange(@NonNull DataSnapshot dataSnapshot) {                  Rider rider=dataSnapshot.getValue(Rider.class);                 String binum=rider.getStatus().toString().trim();                  Toast.makeText(getApplicationContext(),""+binum,Toast.LENGTH_LONG).show();                  if (binum !=binum1){                      startActivity(new Intent(getApplicationContext(),UnderConstruction.class));                     finish();                  }              }              @Override             public void onCancelled(@NonNull DatabaseError databaseError) {              }         });            super.onStart(); } }

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


When I pass this static method a linked list from main and remove the duplicates, the list remains un-changed. I assume this is because of some weird pass by value problem...Anyone know why?  public class LinkedListHelper{  public static <T> void eliminateDuplicates(LinkedList<T> list) {     LinkedList<T> temp = new LinkedList<>();     temp.add(list.peekFirst()); //initialize this list with first element        ListIterator<T> itr1 = list.listIterator();     ListIterator<T> itr2 = temp.listIterator();      while(itr1.hasNext())     {         T element = itr1.next();         boolean found = false;          while(itr2.hasNext() && !found)         {             T current = itr2.next();                         if(element == current)                 found = true;                            }          if(!found)             temp.add(element);          itr2 = temp.listIterator();     }      list = temp; //Why does this not work????  }   }

I always thought Java uses pass-by-reference. However, I've seen a couple of blog posts (for example, ) that claim that it isn't (the blog post says that Java uses pass-by-value). I don't think I understand the distinction they're making. What is the explanation?


addresses the question of whether petrification effects are blocked by the Antimagic Field spell. But it does not seem to address the gaze itself—particularly the Petrifying Gaze of a Medusa.  A Beholder's ray is clearly blocked as a magical beam, but what about the gaze of a Medusa? Is the gaze of a Medusa magical or non-magical? Alternatively, if not the gaze itself, what about the effect of the gaze? Is the effect of the gaze considered magical and blocked by an Antimagic Field?  The  for Petrifying Gaze does not state either way whether the effect is magical.

Often confusion arises when the  spell is used, an  is worn, or the 's anti-magic ray is employed, whether a given character's ability will still function.   The spell does give you some guidelines on how to adjudicate the effects of the loss of magic but says very little about how to determine what is affected.  In short, how do I tell if an ability is magical?


/sdcard -> /storage/sdcard0 /storage/sdcard0 -> /storage/emulated/legacy /storage/emulated/legacy -> /storage/emulated/0   Based on the above, if all the locations point to the same virtual storage, what's the point in having separate storage locations for each different user?   If /storage/emulated/0,1,2,3,etc. all point to /storage/sdcard0, and saving files in any storage location make it appear in all other locations, how is it possible to have user designated storage if all information is the same for all users?  Or is it not supposed to be designed this way...that every user's storage should be the exact same, but if that were the case, then why does having multiple folders with different numbers for multiple users exist? Am I missing something here? Am I missing some key piece of information? Why allocate folders for a specific user if they all point to the same location and contain the same exact information?

From what I guess, internal storage is available by every user. If emulated storage is a storage location, made for a specific user, are files created in /storage/emulated/0 supposed to appear in /storage/sdcard0? I assume no, because files that are user created should show up in emulated only, otherwise files created by the user would be available for all other users to see.


I was under the impression that both the sudo password and the password that I use to login to Ubuntu are the same. But it happened that after logging into the system, tying the password in terminal followed by su, it raises Authentication failure ! error. Aren't they the same ?

I am having problems with the su command. I know my password and I am typing it correctly but su indicates authentication failure.  So I checked on the internet and then went into recovery mode and changed my username's password to what I was entering before.  Even now entering the same password on su gives me authentication failure.  Please suggest what am I doing wrong??


I am seeking an exact mathematical definition of a stochastic time-series variable.  Suppose we have a filtered probability space $(\Omega,(F_t)_{t\geq0},P)$.  Then, a stochastic process is a collection of random variables indexed by time $X:[0,\infty)\times\Omega\rightarrow\mathbb{R}$.  So, I think when one loosely speaks of a time-series variable that is stochastic, it is simple the stochastic process defined above.  (1) Is this correct?  (2) When we talk about economic variables such as GDP and unemployment, do we also implicitly assume these variables are adapted (i.e. $X_t$ is $F_t$-measurable for all $t\in[0,\infty))$? In other words, is it required for a stochastic time-series to be adapted?

A stochastic process is a process that evolves over time, so is it really a fancier way of saying "time series"?


E/AndroidRuntime: FATAL EXCEPTION: main     Process: com.example.projectfinalzar, PID: 23628     java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.projectfinalzar/com.example.projectfinalzar.order}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3311)         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3460)         at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)         at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)         at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2047)         at android.os.Handler.dispatchMessage(Handler.java:107)         at android.os.Looper.loop(Looper.java:224)         at android.app.ActivityThread.main(ActivityThread.java:7590)         at java.lang.reflect.Method.invoke(Native Method)         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)      Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference         at com.example.projectfinalzar.order.onCreate(order.java:136)         at android.app.Activity.performCreate(Activity.java:7893)         at android.app.Activity.performCreate(Activity.java:7880)         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3286)         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3460)          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2047)          at android.os.Handler.dispatchMessage(Handler.java:107)          at android.os.Looper.loop(Looper.java:224)          at android.app.ActivityThread.main(ActivityThread.java:7590)          at java.lang.reflect.Method.invoke(Native Method)          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)  I/Process: Sending signal. PID: 23628 SIG: 9 Disconnected from the target VM, address: 'localhost:54409', transport: 'socket'

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I'm trying to run a service when the system starts up by following   I have a script named service.  To make it run on startup, I ran   sudo update-rc.d service enable   and then rebooted using sudo reboot and it works.  I'm curious as to whether I need to add a respawn line or not since it is used in this article. In my case it works even I do not add that line.      Add a respawn line for this service at the bottom of the /etc/inittab   file. Here's a generic example:  /etc/inittab  id:2345:respawn:/bin/sh /path/to/application/startup    My Ubuntu version : 14.04

How can I run scripts automatically when Ubuntu starts up so I don't have to run them manually after startup?


I met a problem when practicing high order function.  Function "repeated" and "repeated2"  are of the same propose.  However,  "repeated2" works and returns 8, while "repeated" fails: (this confused me a lot why variable'l' cannot be tracked, but variable 'n' seems work well)  def repeated(f, l):     def h(x):         while l:             x=f(x)             l=l-1         return x     return h  def repeated2(f, n):     def h(x):         k = 0         while k < n:             x, k = f(x), k + 1         return x     return h  result2=repeated2(lambda x:x+1,5)(3) result=repeated(lambda x:x+1,5)(3)    Traceback (most recent call last):   File "error_code.py", line 18, in <module>     result=repeated(lambda x:x+1,5)(3)   File "error_code.py", line 3, in h     while l: UnboundLocalError: local variable 'l' referenced before assignment

The following code works as expected in both Python 2.5 and 3.0:  a, b, c = (1, 2, 3)  print(a, b, c)  def test():     print(a)     print(b)     print(c)    # (A)     #c+=1       # (B) test()   However, when I uncomment line (B), I get an UnboundLocalError: 'c' not assigned at line (A). The values of a and b are printed correctly. This has me completely baffled for two reasons:   Why is there a runtime error thrown at line (A) because of a later statement on line (B)? Why are variables a and b printed as expected, while c raises an error?   The only explanation I can come up with is that a local variable c is created by the assignment c+=1, which takes precedent over the "global" variable c even before the local variable is created. Of course, it doesn't make sense for a variable to "steal" scope before it exists.  Could someone please explain this behavior?


I am familiar with java but new to python and I wanted to know whether this piece of code is same as the main method in java if __name__ == '__main__'. Do all the python class need this code to execute. what if I did not have this code in my .py file. Will it throw any error message

Given the following code, what does the if __name__ == "__main__": do?  # Threading example import time, thread  def myfunction(string, sleeptime, lock, *args):     while True:         lock.acquire()         time.sleep(sleeptime)         lock.release()         time.sleep(sleeptime)  if __name__ == "__main__":     lock = thread.allocate_lock()     thread.start_new_thread(myfunction, ("Thread #: 1", 2, lock))     thread.start_new_thread(myfunction, ("Thread #: 2", 2, lock))


I create a vector of uint_8t* sometimes with 3, 4 or 5 bytes but when I make the sizeof my array, I always get 4. How can I solve this?   After creating my array I want to get the length of it.  Example:   uint_8t* u8;  u8[0]=...; u8[1]=...;    sizeof(u8)=4 instead of 2.  sizeof(uint8_t) is 1, I Alo triedsizeof(u8)/sizeof(u8[0])` and I get 4

For example: sizeof(char*) returns 4.  As does int*, long long*, everything that I've tried.  Are there any exceptions to this?


It seems that when I cancel a edit of my answer the subject of the question changes to undefined.  Steps I did:   Open a question where I have answered:  (question subject is "Add Values to Existing Entry in Dictionary") Click on edit for my answer (Clicking edit on question does not show this bug for me) After the edit screen is opened - click on cancel See "Undefined" question subject:     I was trying this in Chrome 28, Windows 7SP1.

Recently, the titles to some questions have been displaying as "undefined":    "undefined" is replaced with the question's true title upon refreshing the page. Is this a bug?


I have this code:  class Doh:     ctr = 0;     def __init__(self):         self.my_num = self.ctr         self.ctr += 1 d1 = Doh() d2 = Doh() print(f"d1: {d1.my_num}") print(f"d2: {d2.my_num}")   I run it expecting d1 and d2 to have different values for self.my_num but they both come out 0:  d1: 0 d2: 0   So clearly I don't get how class variables work with +=.  What am I doing wrong?

Is it possible to have static class variables or methods in Python? What syntax is required to do this?