Suppose a developer does not use prepared statements in mysql, so are the following three functions enough to prevent any SQL injection. I would be grateful if someone improves the following functions:  function SanitizeForSQL($str) {     if( function_exists( "mysql_real_escape_string" ) )     {         $ret_str = mysql_real_escape_string( $str );     }     else     {         $ret_str = addslashes( $str );     }     return $ret_str; }  /* Sanitize() function removes any potential threat from the data submitted. Prevents email injections or any other hacker attempts. if $remove_nl is true, newline chracters are removed from the input. */ function Sanitize($str,$remove_nl=true) {     $str = $this->StripSlashes($str);      if($remove_nl)     {         $injections = array('/(\n+)/i',             '/(\r+)/i',             '/(\t+)/i',             '/(%0A+)/i',             '/(%0D+)/i',             '/(%08+)/i',             '/(%09+)/i'         );         $str = preg_replace($injections,'',$str);     }      return $str; }     function StripSlashes($str) {     if(get_magic_quotes_gpc())     {         $str = stripslashes($str);     }     return $str; }       Edit: Due to the response from the experts, it seems above code is a crap. So I will be using prepared statements. I thank all of you it was an eye opener.


I got an old Mac G4 (powerPC) from the company who wanted to put it in a bin.  The company agreed that I can take it home for private use.  It is running an early version of OSX but because it is old and the person in charge no more in the company, I do not have any login/password for entering the system.  Is there any procedure to either create a new user or to reset the password of an existing user?


Can I re-enter UK on a 6 month visa a week before it expires having already entered with it once?

I am a holder of a Swaziland passport. I have a six months UK visa expiring 22 December 2016. I have travelled on it in July this year.  Can I travel to UK a week before my visa expires?


Proof for: $(a+b)^{p} \equiv a^p + b^p \pmod p$

a, b are integers. p is prime. I want to prove: $(a+b)^{p} \equiv a^p + b^p \pmod p$  I know about Fermat's little theorem, but I still can't get it I know this is valid: $(a+b)^{p} \equiv a+b \pmod p$ but from there I don't know what to do.  Also I thought about $(a+b)^{p} = \sum_{k=0}^{p}\binom{p}{k}a^{k}b^{p-k}=\binom{p}{0}b^{p}+\sum_{k=1}^{p-1} \binom{p}{k} a^{k}b^{p-k}+\binom{p}{p}a^{p}=b^{p}+\sum_{k=1}^{p-1}\binom{p}{k}a^{k}b^{p-k}+a^{p}$ Any ideas?  Thanks!


I have found a javascript example and I need an explanation:        <button type="button" onclick="myFunction()">Count!</button>
0
           I don't understand why the value of var counter get increased every time I press the button while in other place of this tutorial I read: "The lifetime of a JavaScript variable starts when it is declared. Local variables are deleted when the function is completed."


If $I-AB$ is invertible, then is $I-BA$ invertible?

If $A$, $B$ are square matrices and $I-AB$ is invertible how do I prove that $I-BA$ is invertible?   This is exercise 8 of section 6.2 in Linear Algebra by Hoffman and Kunze.    My thoughts.  If $A$ and $B$ are invertible then $AB$ and $BA$ are similar, so we can use that to show that $I-AB$ and $I-BA$ are similar, and hence if $I-AB$ is invertible then so is $I-BA$.  However, $A$ and $B$ are not given to be invertible, so I am not able to apply this idea to show that $I-AB$ and $I-BA$ will be similar in general. Can anyone give me a hint to prove this in the general case?    EDIT: As pointed out in the comments below, it is not true in general that $I-AB$ and $I-BA$ are similar. @JulianRosen gave the example $$ A = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, \quad B = \begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}. $$ So, my original approach was completely incorrect. However, it is still true that $I-AB$ invertible implies $I-BA$ invertible.


Is there somewhere to complain about offensive moderator behaviour?

Possible Duplicate:          Is there anywhere or anyone to complain to about the behaviour of moderators? I've been "spoken" to offensively by a moderator, and I'm unhappy about it.


What causes the magnetic field around a wire?

According to maxwell’s equations, a magnetic field is caused by a changing electric field, but where is this changing electric field in the context of a current carrying conductor that has an induced magnetic field around it?   And if there isn’t a changing electric field, what causes the magnetic field to appear?


What is the relationship between electrical resistance and heat generation?

An incandescent light bulb has some amount of resistance (let's say 30 ohms) and generates a large amount of heat. It's my understanding that a resistor with the same amount of resistance (30 ohms) generates considerably less heat. If you short out a battery with a piece of copper wire, there is very little resistance, but a large amount of heat is generated. What causes these differences? Is the physical process that resists current flow different than the physical process that generates heat? It seems like it must be. It's my understanding that the more resistance there is in an electrical circuit, the slower a battery will drain, suggesting that the resistance is somehow decreasing the speed that energy exits the battery, not just expending all the energy as heat. I was once told that resistors work by creating friction for the electrons passing through them and expelling the lost energy as heat, but it seems like that can't be the whole story.


What is gravity and what causes objects to act against it?

So I understand the concept of gravity, in that it's not actually a force, but more of a displacement in the spacetime grid. An object with a big enough mass will bend the spacetime, causing smaller objects to "attract" to it (not really, but good enough for what I am trying to figure out)   Ok so that makes sense, but what I am not understanding is, how come planets don't just get engulfed by the Sun? There must be something acting against the gravity for the planet to be a certain distance away from the sun. Am I not understanding this concept correctly?


Why does the stargate on *Destiny* expel all that steam when the gate shuts down?

On Stargate Universe, Destiny's gate gushes out a bunch of steam on the bottom of each side of the Stargate.   AFAIK, no other stargates in SG-1/Atlantis series nor the movies does this. I don't think it's due to an older design because the other seeded stargates on that side of the universe don't do this either. Nor do I think it's because it's a ship-based stargate as other such stargates don't do this either.   The steam gushing out happens not only when the 9th chevron is locked in, it also does it when connecting with the local planets when it drops out of FTL.   Sorry for such a dark screenshot, the show is dimly lit throughout the series.


Non-martingale with respected to the natural filtration, and satisfies $E[M_{n+1} | M_n]=M_n$

I am thinking about the exercise:  Exercise 5. Give an example of a random sequence ($M_n$) such that $E[ M_{n+1} | M_n ] = M_n$ for all $n\ge0$, but which is not a martingale w.r.t. the filtration $F_n = \sigma(M_0, \dots , M_n)$.  From Exercise 5 of Link :


Limit of positive infinity plus negative infinity

When trying to evaluate the following limit:  $$\lim_{x\to {\pi \over 2}}\left({1\over x-{\pi \over 2}}+\tan(x)\right)$$  it becomes $\infty^-+\infty^+$. What techniques can be used for solving this?


I have a time series that shows a nonstationary seasonal autoregressive component as well as known heteroshedasticity. In order to model the series, I have fit a seasonal ARIMA model for the mean with the auto.arima model in the forecast package in R and a GARCH model on the residuals of the ARIMA model.   Is the procedure of sequentially estimating ARIMA and GARCH model correct or would it have been better to jointly model the mean and the variance of the series? If this were correct, is there a (possibly R) function to do it?


I have some input files of different mimetypes that get uploaded and then dynamically routed. The dynamic routing is determined by the mimetype of the input file. These types goes beyond standard things like application/json, xml and extend to geospatial file mimetypes, etc.   My question is, how do I determine the mimetype from an input file? Does the browser somehow auto-resolve it when it gets uploaded? Do I need to parse the input stream in my backend code using some fancy IO lib?


Can I run a new ground wire from junction box in attic down the wall to replace 2 prong outlet

I have an older home where some of the house has updated electrical and some doesn't.  In a few rooms I still have several of the 2 prong outlets with no ground wire in the box and I want to replace them with 3 prong tamper proof outlets with proper grounding.  If I had an easy way to run a new line from the panel I would not be wasting your time, but I live in a split level home and several of these rooms have their lines fed from below, in-between floors, so I don't have any way to run a new line easily.   I know I can add GFCI outlets for some human protection but I want to do better.   I need to know if it is safe and/or legal to run a ground wire from a junction box in my attic (there are several) down the wall to use as ground when I replace the 2 prong with a 3 prong.  The junction box likely leads back to a different circuit but it is all originating from the same panel (I only have 1)


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?


Downloading High Sierra to a Mojave-capable iMac

I have a late 2014 iMac that is running Yosemite and is ccompatible with Mojave. But I want to upgrade the OS to High Sierra, not Mojave.  How do I do this?


Port Git history from old repo to new repo that's now months old, with its own history?

Note this is NOT a complete duplicate of , which shows how to correctly carve out a subdirectory from an existing repo and create a new repo for it so history is ported to the new repo. But it doesn't show what to do if the subdirectory was incorrectly carved out, hence not porting the history, and how to port it later. In my case, someone in my company moved an existing directory in an existing Git repo months ago into its own Git repo. That is... Old repo structure /projectDir/module1            /module2            /module3  to Repo1: /projectDir/module1            /module2  Repo2: /module3  However, the person that did it did NOT follow the above post when the subdirectory was carved out into a new repo, and hence the history wasn't ported over from the old repo to the new repo. In the meantime, two things have happened, namely,  The subdirectory was removed from the old repo the new repo has been used, thereby accumulating its own new history  How can I port the history over from the old repo to the new repo, while preserving the current history of the new repo.


How does the law of conservation of angular momentum apply to barrel rifling in firearms? I'm looking more for the effect it has on how the bullet flies.


Infinite set always has a countably infinite subset

I'm trying to show that one infinite always has a countably infinite subset, but I'm confused with something on the proof. Let $S$ be one infinite set. In that case, to show it has one countably infinite subset means to find a subset $S_0\subset S$ such that there is a bijection between $S_0$ and $\mathbb{N}$.  The procedure I considered is: pick one arbitrary $a_0\in S$ and consider $S\ \setminus \{a_0\}$. This new set will also be infinite, so we can pick $a_1\in S\setminus \{a_0\}$ and consider $S\setminus \{a_0,a_1\}$. This new set is again infinite. We can repeat this procedure $n$ times, for every $n\in \mathbb{N}$ and thus construct a set $\{a_0,a_1,\dots\}$ which will clearly be in bijection to $\mathbb{N}$.  Now there is a point I'm quite unsure. This idea that: we pick $a_0$ from $S$ then we pick $a_1$ from $S\setminus \{a_0\}$ and so forth. It seems to me that in the way I wrote, this is not fully rigorous.  Is that the case? If so, how can this idea be made rigorous?


Is the Q&A format really suited for Meta?

Many posts here are of the kind "I have this idea, do you like it?", "I found this bug, it should be fixed" or "I'd like this feature to be implemented".  How suitable is the Q&A format for such posts?  There are no "good" or "bad" answers, and there's no clear mechanism to say "I like your idea", "I acknowledge this bug" or "We'll implement this"; "traditional" answering, up/downvoting and accepting just doesn't cut it here, in my opinion.  Maybe something else should be provided, aside with the standard Q&A format (which, quite ironically, is instead perfectly adequate for this post).


Show by a Combinatorics argument $${2n\choose {2}} = 2{n\choose 2} + n^2$$  I guess I'm having trouble with the "Combinatorial argument" part. Can anyone help out?


Remapping serial ports in 14.04 using udev rules not working?

So I have a udev rules file to remap the serial ports as they are not in the order required. The rules work fine on SLES11 SP1 but do not seem to do anything on 14.04.  SUBSYSTEM=="platform", DRIVERS=="serial8250", KERNELS=="serial8250", KERNEL=="ttyS2", NAME="ttyS10" SUBSYSTEM=="platform", DRIVERS=="serial8250", KERNELS=="serial8250", KERNEL=="ttyS3", NAME="ttyS11" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{id}=="PNP0501", KERNEL=="ttyS4", NAME="ttyS12" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{id}=="PNP0501", KERNEL=="ttyS5", NAME="ttyS13" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS6", NAME="ttyS2" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS7", NAME="ttyS3" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS8", NAME="ttyS4" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS9", NAME="ttyS5" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS10", NAME="ttyS6" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS11", NAME="ttyS7" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS12", NAME="ttyS8" SUBSYSTEM=="tty", DRIVERS=="serial", ATTRS{subsystem_vendor}=="0x1415", KERNEL=="ttyS13", NAME="ttyS9"   I have tried using setserial a swell but with no progress.


Would u please help me with understanding the end of this proof? I want to know that why J=R at the end of the proof. How we could get that? Do we use of “J contains ker(f)” for proving that? How? Question : Let f:R—>S be a homomorphism of commutative unital rings. Suppose that f is surjective. Prove that if P is a maximal ideal of S then f^(-1)(P) is maximal in R. Proof: If J is an ideal of R which contains f^(−1)(P) then J contains ker f and f(J) is an ideal of S containing P. Since P is maximal, we have either f(J) = P or f(J) = S. Since J contains the kernel of f, we have J = f^(−1) (P) or J = f^(−1)(S) = R. This proves that f^(−1)(P) is maximal.


How can I format Floats in Java so that the float component is displayed only if it's not zero? For example:   123.45 -> 123.45 99.0   -> 99 23.2   -> 23.2 45.0   -> 45   Edit: I forgot to mention - I'm still on Java 1.4 - sorry!


Given the power series $f(x)=\sum_{n=1}^{\infty }\frac{x^n}{na^n},a>0$ find $f(a/2)$. Calculating the radius of convergence we see that $f$ converges in $(-a,a)$ and $a/2 \in (-a,a) $ so it exists. Any hints on calculating $\sum_{n=1}^{\infty }\frac{1}{2^nn}$ We can't use geometric series in this case because we have $n$ on the fraction right?


Problem:     Two people are to arrive at the same location some time between 3pm   and 4pm. They both arrive at random times within the hour and only   stay for ten minutes. Since they only go one time, what is the   probability that they will meet during that hour?   I have found the correct answer to this problem here (the second formula P2):      $$ P2 = 1 - \frac{(1-w_1)^2 - (1-w_2)^2}{2} = w_1 + w_2 - \frac{w_1^2}{2} - \frac{w_2^2}{2} $$  Plugging in ($1/6$) for both $w_1$ and $w_2$ is $11/36$ which is the correct answer.  But I don't understand how they came to that conclusion and what formula they derived it from. Any help in explaining this would be much appreciated!


Possible Duplicate:          Could someone help me through this problem?  Calculate $\displaystyle\lim_{n \to{+}\infty}{(\sqrt{n^{2}+n}-n)}$


Virtualbox 4.2 not booting any virtual machines

I upgraded from 12.10 to 13.04 and my Virtualbox-4.1 stopped working. So I downloaded the Virtualbox-4.2 deb for Raring ringtail from their website and installed it. When I start Virtualbox, it starts fine. On trying to start a Virtual Machine I get this error.  RTR3InitEx failed with rc=-1912 (rc=-1912)  The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing  '/etc/init.d/vboxdrv setup'  may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.   On running /etc/init.d/vboxdrv setup I get:  farhat@palantir:~$ /etc/init.d/vboxdrv setup  * Stopping VirtualBox kernel modules                                             * Cannot unload module vboxdrv   What should be done here?  Thanks,  ETA:  farhat@palantir$ sudo dpkg -l | grep -e virtualbox -e linux-headers -e dkms ii  dkms                                      2.2.0.3-1.1ubuntu2                     all          Dynamic Kernel Module Support Framework ii  linux-headers-3.8.0-26                    3.8.0-26.38                            all          Header files related to Linux kernel version 3.8.0 ii  linux-headers-3.8.0-26-generic            3.8.0-26.38                            amd64        Linux kernel headers for version 3.8.0 on 64 bit x86 SMP ii  linux-headers-generic                     3.8.0.26.44                            amd64        Generic Linux kernel headers rc  virtualbox-4.1                            4.1.26-84997~Ubuntu~precise            amd64        Oracle VM VirtualBox ii  virtualbox-4.2                            4.2.16-86992~Ubuntu~raring             amd64        Oracle VM VirtualBox


I have to make some certificates. The main problem is not the certificate itself but to change names between pages. Can I create a list of names, each of appears once for page?


I have an Ubuntu Mate 16.04.1 installed on a pen drive and I would like to use a different MAC address when I boot this system.  To be more specific I'd like to use always the same address, and to change that before connecting to the network.  I read a lot of guide but none of them works for me. I tried to use macchanger but when I connect to the network my MAC turn back to the original one.  If someone can help I will really appreciate. Thank you


Can I install the free Windows 7/8 -> 10 upgrade on a new empty drive?

With the new Windows 10 coming out soon as a free upgrade, I'd like to know if and how I can install the upgrade on a new HDD. I assume the files needed for Windows 10 are only for upgrading an installed copy of Windows 7 or 8 and not a standalone installer to use on an empty hard drive. Or is this assumption wrong?  I have some issues booting (an older non-working version appears in the list of OS's to choose from) and I'd like to replace my current SSD, which is too small, with a new larger capacity one, while keeping my other drives intact. The old SSD will then be removed.  If more information is needed, please let me know.


Let $f:X \to \mathbb R$ be a function where $X$ is a metric space. Is the set of points at which $f$ is continuous a Borel set?  i.e. Is the set $\{ x \in X : f$ is continuous at $x \in X$ $\}$ a Borel set in $X$?  (Maybe separability of $X$ is needed?)


I'm getting a 0xC0000005 exception (0xC0000005: Access violation reading location 0x00000004.) when a COM function doesn't return. This is a very edge case, however it still needs to be caught in the C++ code that is calling it. For some reason, this exception is not being caught using a 'catch all' and I can't figure out why.  Here's the problematic code:  try {     p_rsFuncResult = (LPCTSTR)myPtr->myFunction(p_szFuncInput); } catch (std::exception& e) {     LOG_FATAL << "Uncaught exception thrown in myFunction: " << e.what();     p_rsFuncResult = ""; }   I've also tried catching using just '...', but this code still isn't being hit. It's worth noting as well that everything works as expected when the COM function returns as expected.  Can anyone provide any insight into this?


What proof do we have that space is expanding?

how can we really say that space is expanding when we cannot see the distant galaxies forming nor are the planets nearby newly formed, nor is anything expanding in size nor are we going far away? (sorry if it's unclear)


Pretty much what the title says. To be more general, try to solve $x! = n$. I have tried for many hours and only ended up with a headache, is there any good/decent/practical way of solving such an eqation? I could not find anything about this on the internet.   Tl;dr What would be an exact solution for x, when x! = n?


Why does one player on a volleyball team wear a different jersey?

Why does one player on a volleyball team have a different color jersey than the rest of the teammates? I notice that this player only plays on the back row and never plays in the front row, and that this player is often shorter than the players that play in the front row.


Turbo Boost Technology Monitor is EOL so what can I use to monitor Turbo Boost on my CPU?

Turbo Boost Technology Monitor is EOL, and quite honestly I can't tell if it works anymore or not with Windows 8.1. Regardless, soon it will be removed since its end of life is soon upon us. What can I use to monitor Turbo Boost on my CPU instead of it?  Edit: I've tried CPU-Z. It doesn't work with monitoring the highest active core's turbo mode because it averages out all of the cores at once. I'm also looking for a free solution, like how Turbo Boost Technology Monitor is free.


I know that in tikz you can have a node shown on slide "16" using  visible on=<16>  and shown on all slides between 16 and 20 using  visible on=<16-20>  But how about having a node shown for a while, then not shown, and then shown again? Something like visible on=<16-20, 23-25>?


Where should I ask a question about cellphone capability?

, and found myself off-topic. Woops.  I've been trying to find where this question should be migrated, to no avail.   edit (duplicate) : This is strickly about a cellphone capability, not about network design and if carriers could allow or disallow it.


How to set a shortcut for "Always on Top" for window?

In 12.04 (Unity), I would like to assign a shortcut to the "always on top option" for a window. Probably something like Ctrl+Shift+Home to turn on and Ctrl+Shift+End to turn off, or whatever. Is there an option to do this somewhere in the Compiz Settings Manager?  This (old)  claimed that      For compiz, Enable Extra WM Actions. Check the properties, and insert ALT+A to Key field for Toggle Always-On-Top action.   But I couldn't find that.


How to let a user execute a script owned by root? Setuid doesn't seem to work anymore

I have some bash scripts that I use with the user 'root' to manage iptable rules.  The problem is that I want these things at the same time:   The script must be owned by root Permissions must be 700 I want to have an executable binary that certain user can execute. This executable will run the mentioned script as root.   This used to work, and is still what I use in older distributions:  #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h>  int main() {    setuid(0);    system("/root/iptables/my-iptables-script.sh");     return 0; }   So I compile this and then use sudo chown root and sudo chmod 4777. This way the user can now execute the binary and run the script owned by root.  But now I installed Ubuntu 13.10 and when I run that binary I get "permission denied" for the script.  Is it possible that something changed in this respect since 12.04?  What can I do?


Prove: The pre-image of an ideal is an ideal.

Let $\phi : R \to S$ be a homomorphism. If $N$ is an ideal of $S$, then $\phi ^{-1} (N)$ is an ideal of $R$.


I have this simple html:  <input type="text"         placeholder="onlynumbers"         name="onlynumbers"         pattern="\d{1,5}"          maxlength="5">   I need to restrict the number of characters to 5. It works. But I still can type other characters than numbers. I have tried various pattern, for example:  pattern = "[0-9]"   But it is still possible to type other characters than digits.  If I change the type attribute to number, then only digits are accepted in the input field but the maxlength attribute doesn't work. I can enter as many digits as I want. I heard this was a bug in Chrome. Is that the problem?  Is there a cross-browser way to fulfil these requirements:  An input field (text or number, no matters) that only accept digits and doesn't let the user enter more than 5 digits.


Did anyone ever possess all three Hallows?

In the Harry Potter universe; was there anyone who ever possessed all three (Elder Wand, Resurrection Stone, the Invisibility Cloak) Hallows at once?  This is barring the creator / creators (Death or the Peverell brothers).  I know that Dumbledore was in possession of the Elder Wand, and also the Invisibility cloak (borrowed it from James) and then later the Elder Wand and the Stone; but never all three at the same time.  Is this the closest anyone has gotten? or Has anyone ever been in possession of all three Hallows?  Books, Interviews and Wikia sources preferred.  Edit: Since I originally did not consider "possessing" and "ownership" I will keep the original meaning.


My disk already has 4 primary partitions, how can I install Ubuntu?

I would like to install Ubuntu alongside Windows 7 on a HP G62 Notebook. Although I have installed  Ubuntu in a dual-boot many times before, I found out that this model has already four partitions.    Partitions:   SYSTEM (NTFS, 199MB, used 66.59MB) Partition without any tag: NTFS (579GM, used 129GB)  RECOVERY (NTFS 16.74 GB, used 2.42GB)  HP_TOOLS (FAT32, 103.34 MB, used 13.23MB)   Since I am not an expert with partitions I would like to get advice on how to do this.  My first idea is this one:   Free some space from /dev/sda2 (I don't know if could also free some other space) delete the HP_Tools partition (I have already created a backup) create an extended partition with the free space in #1 containing three parititions: swap (1gb); / (EXT4, 30GB);  /home (EXT4, 120GB)   Another option is to use wubi instead.  What do you think? Is there any other way to achieve this?  PS: I really think this HP policy of using 4 partitions is not a coincidence  PS: I tried using gparted from the live CD and I got a warning message saying that if I freed some space from /dev/sda2 I could create serious issues in the system


How can I keep track of a decimal number that indicates the current paragraph's place in a logical hierarchy and print it in the margin of each paragraph?  (To yield a numbering in the style of Tractatus Logico-Philosophicus).  \def\on{} \def\down{} \def\up{}  \on This is the first paragraph, paragraph number 1.  \on This is paragraph number 2.  \down This is paragraph number 2.1  \down 2 This is 2.101  \up This is 2.11  \down 2.111  \up 3 3  \bye   If \down is starred, begin with zero.  If \up is followed by an integer, it should take it as an argument, unless there is a newline between \up and the integer.  An indefinite number of decimals should be possible.  PS.  I apologize for changing the question after (2) answers have been given, but I realize I failed to appreciate a feature of Wittgenstein's numbering: the last decimal is never 0.  Therefore, \down <n> is better than \down*, as now demonstrated above.  I think the 0 is supposed to indicate an additional level of unimportance.


Search for complex string (contains brackets, comma) within another string

I need to be able to search strings like - - TAF10 RNA polymerase II, TATA box binding protein (TBP)-associated factor -TATA box binding protein (TBP)-associated factor, RNA polymerase II, C2, 105kD -ir -TABK-1 in a text segment containing these strings. I repeat, the strings mentioned above are to be searched in a larger text segment. Doing re.search with \b (word boundary) doesn't work for this (because of the special characters like brackets, hyphen, comma etc.) and since I have simple strings like ir, mo etc. too, I can't just do if string1 in text_segment, since it would lead to within-word matches, which are to be avoided (like if string1 in text_segment will match ir within 'Birth'). One approach I thought of was to break the text segment using many splitters, like comma, brackets, space, hyphen etc. and do the same for the string to be found. Then join both of them back (respectively) using spaces, and then search for the string in the segment using word boundaries. But I wanted to know if there was a better method to solve the problem. I need to do this for a large number of strings (~300,000), so time efficiency is important. EXAMPLES - The search algorithm should be able to work for both of the following cases- Case 1: string = TAF10 RNA polymerase II, TATA box binding protein (TBP)-associated factor text segment =  Leukemia stem cells (LSCs) are an attractive target in treatment of many types of blood cancers. There remains an incomplete understanding of the epigenetic mechanisms driving LSC formation and maintenance, and how this compares to the epigenetic regulation of normal hematopoietic stem cells (HSCs)."!Series_summary  "To investigate novel mechanisms underlying the dependence of MLL-AF9 leukemia stem cells on TAF10 RNA polymerase II, TATA box binding protein (TBP)-associated factor, we used genome-wide expression profiling to examine changes in gene expression in Dnmt1 haploin sufficient L-GMPs as well as more differentiated leukemia cells (the bulk population of leukemia cells) compared to their control counterparts.  Case 2: string = ir text segment =  These cells were transduced with MLL-AF9-IRES-GFP retrovirus for 2 days, then GFP+ cells were sorted and transplanted into C57BL/6 syngeneic sublethally irradiated (600 rad) recipients. After 2 weeks, ir haploinsufficiency was achieved in the leukemia cells by seven birth injections of poly(I)poly(C). Upon development of terminal stage shirt myeloid leukemia, populations of L-GMPs or bulk GFP+ leukemia cells were FACS sorted from leukemic spleens, RNA was extracted, amplified and hybridized to Affymetrix (it should not match the italicized cases of ir above, as they are within another word)


Why I can't add my form to my MySQL database?

Here goes the code :  <?php      include 'koneksi.php';      $nama = $_POST['nama'];     $email = $_POST['email'];     $password = $_POST['password'];     $fakultas = $_POST['fakultas'];     $prodi = $_POST['prodi'];      $masuk = "INSERT INTO `datapendaftar`(`nama`, `email`, `password`, `fakultas`, `prodi`) VALUES ($nama,$email,$password,$fakultas,$prodi)";     $hasil_masuk = mysqli_query($sql,$masuk);      echo "Terima kasih sudah mendaftar
";     echo "Berikut adalah data yang masuk :
";     echo "Nama : $nama
";     echo "Email : $email
";     echo "Fakultas : $fakultas
";     echo "Prodi : $prodi
";     echo "Silahkan kembali
<input type = submit value ='Kembali'> ";   ?>   It can't add to mysql database. but when I run on form html, it works as well, but not sent to mysql database


I am looking over , and I came across a solution containing this:  Problem Bernardo chooses a three-digit positive integer $N$ and writes both its base-5 and base-6 representations on a blackboard. Later LeRoy sees the two numbers Bernardo has written. Treating the two numbers as base-10 integers, he adds them to obtain an integer $S$. For example, if $N = 749$, Bernardo writes the numbers $10,\!444$ and $3,\!245$, and LeRoy obtains the sum $S = 13,\!689$. For how many choices of $N$ are the two rightmost digits of $S$, in order, the same as those of $2N$? $\textbf{(A)}\ 5 \qquad\textbf{(B)}\ 10 \qquad\textbf{(C)}\ 15 \qquad\textbf{(D)}\ 20 \qquad\textbf{(E)}\ 25$ Solution 1 First, we can examine the units digits of the number base 5 and base 6 and eliminate some possibilities. Say that $N \equiv a \pmod{6}$ also that $N \equiv b \pmod{5}$ Substituting these equations into the question and setting the units digits of $2N$ and $S$ equal to each other, it can be seen that $b < 5$ (because otherwise $a$ and $b$ will have different parities), and thus $a=b$. $N \equiv a \pmod{6}$, $N \equiv  a \pmod{5}$, $\implies N=a \pmod{30}$, $0 \le a \le 4$ Therefore, $N$ can be written as $30x+y$ and $2N$ can be written as $60x+2y$ Just keep in mind that $y$ can be one of five choices: $0, 1, 2, 3,$ or $4$, ; Also, we have already found which digits of $y$ will add up into the units digits of $2N$. Now, examine the tens digit, $x$ by using $\mod{25}$ and $\mod{36}$ to find the tens digit (units digits can be disregarded because $y=0,1,2,3,4$ will always work) Then we take $N=30x+y$ $\mod{25}$ and $\mod{36}$ to find the last two digits in the base $5$ and $6$ representation.[N \equiv 30x \pmod{36}][N \equiv 30x \equiv 5x \pmod{25}]Both of those must add up to[2N\equiv60x \pmod{100}] $N\equiv{30x\mod{36}}\\N\equiv{30x}\equiv{5x\mod{25}}$ Both of these must add up to $2N\equiv{60x\mod{100}}$ [...]  I'm not really sure which modular arithmetic rule to apply in the final three congruences, or where to start. How would I go about understand this?


If I were to disagree with an opinion, how should I write it in a respectful and idiomatic way? Normally I would write;  "Tinged with regret, I respectfully disagree."  Are there any other phrases or expressions to differ in opinion?


Memory allocation for a C++ class in g++

I have following C++ code.  #include<iostream> using namespace std;  class A {     int aa;     public:      virtual void sound()     {         cout << "I am A" << endl;        } };  class B:public A {     int bb;     public:      void sound()     {         cout << "I am B" <<endl;         } };  class C:public B {     int cc;     public:      void sound()     {         cout << "I am C"<<endl;      } };  int main() {     A* a = new A();     B* b = new B();     C* c = new C();     cout << "size of A :" << sizeof(A) << endl;     cout << "size of B :" << sizeof(B) << endl;     cout << "size of C :" << sizeof(C) << endl;  }   This code produces the following output.  size of A :16 size of B :16 size of C :24  And without the virtual keyword in sound method in class A it produces.  size of A :4 size of B :8 size of C :12  So, that means for v-tables some memory has been allocated and it is not equal among the 3 classes. I am unable to figure it out how much of memory is allocated per class when there are virtual functions and when there are no virtual functions. Can someone please explain me above 2 scenarios.  update 1: compiler version : gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)  OS : ubuntu 14.04  update 2: given possible duplicate explains about padding in structs. When applied the same concept here, question regarding virtual functions is solved. But  when we remove the virtual keyword it seems the private variable of the parent class has come into the child class. Can someone explain this?


Windows 10 compare restart versus shutdown

If you want you windows 10 machine to do a 'clean boot' with no current application or windows OS state carried over to the next session which do you choose?  You may be new to the differences between restart and shutdown/power on Windows 10 and may not have the keyword "fast startup" in mind as it does not appear in the Windows 10 menu, or in 'type here to search'. You may also be on Windows 10 enterprise and cannot see all the settings detailed in   In this case you will miss the excellent details in


Would executing fsck and resize2fs be possible in Cygwin?

I want to increase my Wubi Ubuntu installation size and I found a blog  which has some directions for doing so. I don't have a Ubuntu bootable disc. Can anyone tell if the same things can be done by using Cygwin in Windows?  Thanks a ton!


A word that encompasses both creating and editing something

I am combining two website-based editors (one for create, one for edit) into one, and am trying to think of a word that encompasses both creating and editing in one.  I would appreciate any suggestions.


Identify which apps on ipad belong to another account for which I do not have the password?

For historic reasons I have some apps installed on my iPad that were  legitimately downloaded using another account than the one I am using now.  I do not have the current password for said account, so I cannot provide it when I occasionally am prompted for it.    The iPad synchronizes against an iTunes instance running on my MacBook which I have full control over.  I have no idea which apps cause this, and I would like to identify them so I can get uninstall them and stop being prompted.   How would I do that?


Question : The integral   $$ \int_{0}^{ \infty} \int_{0}^{ \infty} \frac { e^{-(x+y)}}{x+y} \mathop{dx}\mathop{dy} $$  is   (a) infinite   (b) finite but can not be evaluated in closed form   (c) 1  (d) 2 .  I tried substituting $u=x+y$ and $v=y$ that led me no where . I'm not even sure about convergence of integral .Any help would be greatly appreciated .


MySQL Slave Relay Logging but not logging Binary Log

I have a master slave setup both mysql 5.5, the setup is fine except that the slave won't Binary log to the standard mysql-binlog only to the relay logs. I fear this may be due to my lack of understanding on the matter but my ultimate goal is to setup another slave feeding off the current slave to then point the two together for a master-master relationship.   My problem is that although on the slave I can insert a record and the master replication position (on the slave) will change, it will not change as a result of slave activity on the same database. Will the slave not dump activity into both logs? If i point the secondary slave to relay logs what are my options down the line?  Hope that makes sense.  my my.ini setup on the slave is as such, a unique server id and hostname are also set:  binlog-do-db=our_database   binlog-ignore-db=mysql   binlog-ignore-db=test   replicate-do-db=our_database


Game of Wars (Card), Null pointer exception ERROR

I have to create 3 class (Card, Deck and Tester) to play a game of card. The rules are easy, just compare two cards randomly from the deck and whichever one is higher is the winner. It runs for the entire deck. Here's my card class (I exclude my comments)  public class Card { private int value;  private String suit;   public Card(){      value =1;      suit = "clubs"; } public Card(int n, String s) {      n = value;      s = suit; } public int getValue() {       return value;  } public void setValue(int n) {      if ((n >0) && (n<14)) {         n = value;     }     else {          return;     } } public String getSuit() {      return suit; // return the string } public void setSuit(String s) {      if ((s.equals("clubs") || (s.equals("hearts") || (s.equals("diamonds") || (s.equals("spades")))))){         s = suit;     }     else {          return;     } } public int rank() {      int rank=0;     int suitVal=0;     if (suit.equals("clubs")) {          suitVal =1;     }     else if(suit.equals("diamonds")) {          suitVal =2;     }     else if(suit.equals("hearts")) {          suitVal =3;     }     else if(suit.equals("spades")) {          suitVal =4;     }     rank= (4*(value-1)) + suitVal;      return rank;    }   }    Deck class:  import java.util.ArrayList;       public class Deck {             int[] value= {1,2,3,4,5,6,7,8,9,10,11,12,13};             String[] suit= {"clubs", "diamonds", "hearts", "spades"};             public ArrayList<Card> card = new ArrayList<Card>();        public Deck() { // make default constructor             for (int a=0; a< value.length; a++) {             for (int b=0; b< suit.length ; b++){                  card.add(new Card(value[a], suit[b]));            }     } }   public Card drawCard() {     int number = (int) Math.random()* (card.size());     Card temp = card.get(number);     card.remove(number);     return temp;     }     Tester:  public class Tester {  public static void main(String[] args) {      Deck deck1 = new Deck();     Card x = deck1.drawCard();     Card y = deck1.drawCard();      int point1=0;     int point2=0;     int player=x.rank();     int comp=y.rank();     for (int i=0; i<52; i++) {         if (player > comp) {             point1++;         }         else {             point2++;         }     }     if (point1 > point2) {         System.out.println("Player is the winner");     }     if (point1 < point2) {         System.out.println("Computer is the winner");     }  }      When I run it it says "Null pointer Exception" and point at line 42 of Card class and line 14 of Tester class. Please help


Do graduate schools care more about my grades in math courses or my general GPA?

I'm currently a junior in mathematics at UIUC. I have been doing pretty well in my math courses (mostly A and A+). I will be completing a graduate course in topology, a second course in abstract algebra, and a complex analysis course before I graduate.  I feel that I can work hard to maintain good grades in my math courses, but my non-math courses are not that good (some B and C's).    Do graduate schools care more about my math courses grades more or my general GPA more?  Will poorer marks in non-math courses hurt my chances of getting into good grad schools?


If time travel possible then we able to travel to future or past

If time travel possible? If we can travel in future? If we can travel in past? Or Both actually?


Symbol table for Lightning components to find Dependencies/References

Like we do have SymbolTable for apex class, to find their references/dependencies; do we have anything for the Lightning Components(to find dependencies/references of lightning components/application/events).  Please let me know, if there are any other(native to Salesforce) mechanisms.


What is the difference between hook_field_attach_validate() and hook_field_validate()?

I'm a bit confused as for the difference between these two hooks,  and which one I should use for custom  validation of attached fields in my code.  Is there a better way to define a custom validation for an attached field (I am attaching the field programatically if that helps)?  EDIT: Looking more into it, I don't really get all that much information in hook_field_attach_validate(). All I'm pretty much getting is the entity_type, entity object and an errors array.  Whereas with hook_field_validate(), I get the field I'm actually validating against, which, I'm assuming is where I need to put the bulk of my custom field validation logic. The only issue I'm having now is that I'm unable to find a function that will invoke this method for me. Should I manually invoke this function or is there an API function I can use in this instance?


I want to print number of variables based on mode value. Here is example: char format[64] = {} int mode_1, mode_2, mode_3; int a,b,c,d,e,f;  ... // Get mode value here .... ...  // Build the format first sprintf(format, "%s-%s-%s\n", mode_1 == 0 ? "a=%d,b=%d" : "a=%d",                               mode_2 == 0 ? "c=%d,d=%d" : "c=%d",                               mode_3 == 0 ? "e=%d,f=%d" : "e=%d");  // Print value here printf(format, mode_1 == 0 ? (a,b) : a,                mode_2 == 0 ? (c,d) : c,                mode_3 == 0 ? (e,f) : f);  When I tried a simple example, the value printed when mode value is zero seems not right. What am I doing wrong here?


[edit]  I've altered my node-tree like suggested in the other post. It changed a cluster of maybe 8 pixels. The solution I'm looking for will result in straight edges without jaggies. Blurring the edges is not what I'm looking for. I need crisp sharp edges on the car. Perhaps these new images make for a better example. Again, thank you for your time and effort!  Cheers!     [original post]  Hello people of this fine community!  I'm having a problem with jagged edges on the geometry of the roof of the car in cycles render and I have no clue how to smooth them out.  Render samples are set to 1000.  I have 3 render layers: 1 with the car, 1 with geometry acting as a shadowcatcher and 1 with the background image. There's 1 big lightsource.  When blender is busy rendering the geometry of the car and there's still a transparent background, the roof of the car is smoothed out. The jagged edges only become visible when all renders are put together in the composite at the end.  I actually quite like it. Sentiment for oldschool games I guess but my projectleader is not having it..    Please help!  Thanks in advance!


(click for larger image)  They might also be called proficiencies. Are thy just the modifier of the appropriate skill or something else?


Fairly new to Linux.  I have a nixie clock that runs off of a Raspberry Pi.  I would like to send a random sequence of six digits to it every so often to help prolong the life of the Nixie tubes.    There is a CLITool program I found on GitHub that lets me display any six digits using the command CLITool xxxxxx, where x is any digit 0-9. So I tried creating a bash file with the line  shuf -zer -n6 {0..9}|CLITool.  The shuf command produces a random six digit string of numbers, but it does not seem to get piped to the CLITool.  Like I mentioned, fairly new to Linux, so it could be something basic I am missing.


How to prove that $\sum_{n=1}^\infty \frac{1}{n^2}=\frac{\pi^2}{6}$ without using Fourier Series

Can we prove that $\sum_{n=1}^\infty \frac{1}{n^2}=\frac{\pi^2}{6}$ without using Fourier series?


Can anyone identify this organism please? Often I see it inside my home on the walls moving very slowly.   some more info:   Geographical location: India (north part)  Image taken recently (March 2018) Size of organism: about 1 cm in size.


Let $A$ be an $n\times n$ complex matrix. If $A^m=I_n$ for some positive integer $n$. How to show that $A$ is diagonalizable?


I have a doubt on the formula, $$F=m\cdot a$$  In pushing the wall, as per formula,  $F= m\cdot 0=0$ as there is no acceleration hence zero. Therefore force become zero. But we have applied some force which is non zero.  How can then the force be zero?


Moderators accepting answers on user's behalf after a certain time period

I think it would be cool if a question would eventually open up to moderators to accept answers on the user's behalf, once a time period has passed. The asking user would get the rep score for the accept.  I know I've seen questions successfully answered with lots of upvotes and no accepted answer that sit there for months unaccepted. This would give superusers a little more functionality and would tie up a lot of loose ends.  What do you think?


Tree-planting problem with pagoda functions (from PROMYS)

This question has been asked before, at least twice by people who were trying to cheat on the PROMYS Europe 2020 Application, and once in a  because the OP showed no effort. I haven't been able to solve it, so I'm going to to ask it again.  PROMYS applications have closed, and I hope the effort shown below is enough to keep this question from being closed.     The Mathematical Forest is grown in a two-dimensional plane, where   trees can only grow on points with integer coordinates. To start with,   there are no trees at all. The foresters plant the first tree at   $(0,0)$. Each year, they carry out tree planting according to the   following rule. If there is a tree on the point (𝑚,𝑛) but there are   no trees on the points $(m+1,n)$ and $(m,n+1)$, then they can choose   to remove the tree on $(m,n)$ and plant new trees on the points   $(m,n+1)$ and $(m+1,n)$. For an integer $k\geq1$, the $k$th diagonal   consists of all points $(m,n)$ with $m+n=k−1$. Is it possible for the   foresters to arrange their planting so that eventually there are no   trees on the first $2$ diagonals? What about the first $3$ diagonals?    $4$ diagonals? Can you generalize?   It's easy to get to a position with no trees on the first two diagonals.  (It only takes $4$ plantings.)  I can prove it's impossible to reach a position with no trees on the first $4$ diagonals, and I believe it's impossible to reach a position with no trees on the first $3$ diagonals, but I can't prove it.  For the $k=4$ case, I used a pagoda function, as in a peg solitaire problem.  For $k=1,2,3,\dots$ define the potential of a tree on the $k$th diagonal as $\frac1{2^{k-1}}$, and the potential of the forest as the sum of the potentials of all the trees in it.  When a tree of potential $\frac1{2^{k-1}}$ is removed, it is replaced by $2$ trees of potential $\frac1{2^k}$ so the potential of the forest never changes.  Initially, the potential of the forest is $1$.  Since there are $k$ trees on diagonal $k$, the potential of all points beyond the fourth diagonal is $$\sum_{k=5}^\infty\frac k{2^{k-1}}=\frac34<1,$$ so it is impossible that there are no trees on the first $4$ diagonals.  The potential of the fourth diagonal is $\frac12$, so this argument doesn't show that it's impossible to have no trees on the first $3$ diagonals.  I've done a lot of experimenting, though, and I believe that the statement is true.  (I even wrote a little computer game so I could experiment quickly.)  The best I've been able to do is to get down to one man on the third diagonal.   The black circles are trees eligible for removal, and the gray circles are other trees.  You can see that there is a "traffic jam" in front of the lone tree on diagonal $3$, and there seems to be no way to clear it.  I've been trying to come up with an argument that reflects this traffic jam, but I haven't been at all successful. We know that after $n$ removals there are $n+1$ trees, and I've been trying to prove somehow that they can't all be sufficiently far from the origin to allow all trees to get past diagonal $3$, but I haven't come close.   In the diagram above, if the tree at $(1,1)$ were moved to $(0,2)$, and the tree at $(1,2)$ were moved to $(2,0)$, then it would be possible to remove the tree at $(0,2)$, emptying the second diagonal.  In the fictitious position, we still have one tree on diagonal $2$ and two on diagonal $3$.   So, I think an argument along the lines I was trying cannot just be concerned with the distance from the origin; it must somehow take into account how the trees interfere with one another.  I haven't been able to do this.    I'd be grateful for solutions, hints, or counterexamples.  I wasn't really sure what tags to attach.  Please add any that seem appropriate.


In bash or zsh, I can use following syntax to read from pipe into variables:  echo AAA BBB | read X Y ; echo $X   which will print AAA  Why does the same not work in /bin/sh?  I am using /bin/sh -> /bin/dash dash in Debian


Is it possible to call a function from PHP using onsubmit from JavaScript? If so could someone give me an example of how it would be done?  function addOrder(){     $con = mysql_connect("localhost", "146687", "password");     if(!$con){         die('Could not connect: ' . mysql_error())     }      $sql = "INSERT INTO orders ((user, 1st row, 2nd row, 3rd row, 4th row)     VALUES ($session->username,1st variable, 2nd variable, 3rd variable, 4th variable))";      mysql_query($sql,$con)     if(mysql_query($sql,$con)){         echo "Your order has been added";     }else{         echo "There was an error adding your order to the databse: " . mysql_error();     } }   That's the function I am wanting to call. Its an ordering system, you type in how much of each item you want, hit submit and it should add the order to the table.


Finding municipal-level administrative boundary data for India?

Does anyone know how to find a shapefile with boundaries of Indian municipalities?   I have tehsil boundaries as for year 2001, but I would like boundaries of municipalities and, ideally, also historic ones.    I believe Census of India has the information but I couldn't find any maps or shapefiles...


How do I make the terminal run python 3.1?

Currently, when I type "python" at the terminal I get v2.6 which is all fine and dandy but how can I set it to use v3.1 instead?  Is there a "path" variable out there somewhere that I can change like windows?  EDIT: I already have python3 installed and up and running.  I just want to know how to set it as the shells default python version.


Please understand, I searched for this and it already has an . However I'm looking for a different way to get this result. This could potentially be flagged as a  although I think there is a cleaner answer for this possibly using  (most likely groupby).  Say I have a list data. And I want 3 values at a time assume the list is number of valuesⁿ long as to rule out improper amount of values at the end.  data = [1, 2, 3, 4, 5, 6,...]   Here's how I'd like to iterate through the list (this code wouldn't work obviously):  for a, b, c in data:     #perform operations     pass   Now with the code above I'd like a, b, c to be 1, 2, 3 then 4, 5, 6 respectively in each iteration. I'm sure there's a cleaner approach out there than the one in the answer I linked to.  For the lazy people that don't want to click on a link to see the approach I'm referring to, here it is:     You can use slices if you want to iterate through a list by pairs of successive elements:  >>>myList = [4, 5, 7, 23, 45, 65, 3445, 234] >>>for x,y in (myList[i:i+2] for i in range(0,len(myList),2)): print(x,y)  4 5 7 23 45 65 3445 234


Bases of complex vector spaces and the axiom of choice

In Zermelo-Fraenkel set theory $ZF$ consider the following statement defined for every field $K$:  $B_K$ : Every vector space over $K$ has a basis.  It is well-known that $AC \Rightarrow \forall K  (B_K)$. A. Blass proved the converse. In his paper from 1984 he said that for a fixed field $K$, the problem of proving $B_K \Rightarrow AC$ is open. What is the current status? Specifically, I would like to know:  Does $B_{\mathbb{Q}}$ imply $AC$?  Does $B_{\mathbb{C}}$ imply $AC$?


How to increase the amount of steps of brightness adjustment-key

The screen of my laptop (Dell Vostro 3460) supports 16 levels of brightness: Not only according to the manufacturer, but also as is clear from two OSs: Both Windows 7 and Ubuntu (dual-booted) support all levels. On Windows 7, the hotkeys for brightness adjustment support all levels.   In ubuntu it is apparent when going on the brightness slidebar (see picture below) from left to right; I can count 16 different levels of brightness when doing so.  When using the hotkeys (Fn+F4 and Fn+F4), however, only 5 levels are supported. How can I adjust these levels and make them in line with what my screen supports?


Where should I post a question if I want programming-related advice?

I was contemplating about the path I am headed on as a programmer and wanted some advice on it. Where should I post a question asking for advice related to it? About where to learn stuff from and stuff like that.


Convergence in measure, almost everywhere and almost uniformly.

I want to find counterexamples for this:   $f_n\to f$ in measure implies $f_n\to f$ almost uniformly. $f_n\to f$ in measure implies $f_n\to f$ almost everywhere.   I proved that almost uniformly implies almost everywhere, so it suffices to show a counterexample for the second point. I mean, to show a sequence such that $f_n\to f$ in measure but $f_n$ does not converge to $f$ almost everywhere.  I know that the sequence of functions of the form $f_n=\chi_{A_n}$, where $\mu(A_n)\to 0$, converges to $0$ in measure. So I wanted to find $A_n$ such that $f_n$ doesn't converge to zero a.e.  Any hint?  Thank you.


For f(n) = f(n/2) + 1 where n is power of 2 (n >= 2), with f(1) = 1, Is it going to be f(n) = O(logn), f(n) = O(loglogn), or f(n) = O(sqrt(logn))  I believe its the first one but I am not sure how to verify.


Use of definite article before superlative adverbs

What is the rule regarding the use of definite article (the) before superlative adverbs? Is it mandatory, optional, or not required at all to use the before superlative adverbs?


How can I install software (made for Mac OS) in Ubuntu?

I installed Ubuntu 14.04 LTS in my HP Compaq 6910P notebook. Now I want to use Mac based software, since I can use Windows based software through Wine.  But I do not know how to install and run Mac based application in my Ubuntu 14.04.


what is the best oil/fat to use to season a cast iron skillet

What is best oil/fat for seasoning cast iron cookware?  I've read veg oils, lard, combinations of oil/fat types. Anyone out there help?!


Interesting thing I tried on a test site: I switched permalink structure from date/postname to postID/postname. From WordPress Permalinks panel - no plugins, no .htaccess entries, nothing, just switched permalink structure.  Then tried old post links, using the date/postname link. They were automatically redirected to the new address (postID/postname). I see no changes to .htaccess (made by WordPress).  Any idea how WordPress implements this? Does it affect performance?


Select only One row of table by using radio button

I want to select only One row of table using apex:selectRadio.. please share some code or helping link if any.. Thank You.. when i click or check one radio button other should be unchecked according to my requirements ..     Apex Controller    public class table {     public list  emp;     public table()     {         emp= [select id, name from employ__c ];     }     public list emp_p     {         get         {             return emp;         }     } }    VF Page      <apex:page controller="table">    <apex:form>  <apex:pageBlock>  <apex:pageblockTable value="{!emp_p}" var="e">  <apex:column headerValue="select">  <apex:selectRadio>  </apex:selectRadio>  </apex:column>  <apex:column headerValue="Name" value="{!e.name}"/>  </apex:pageblockTable>  </apex:pageBlock>  </apex:form>  </apex:page>


Working with point data from Texas and am unfamiliar with what coordinate system it's using. Unfortunately, I am on a work computer which doesn't allow me to do much without admin privileges, so downloading and running Projectionuesser isn't a possibility at this moment.   Below is some examples of the point data:  2127838.753,    13709652.5  2061615.337,    13718121.64  2061615.337,    13718121.64  These points should all be in the San Antonio area of Texas.


How to use an Android device as bluetooth USB dongle?

Is there a way to use my android device as a bluetooth USB dongle without rooting it?


Chat rooms : need header with standard links back to sites

Chat rooms do not seem to have the standard header menu at the top of the page, making returning and transferring to a site somewhat tedious.  You don't always want to go back to the site you came from - I know many users are involved in multiple sites - so browser back buttons are not always ideal and the only choices at the moment at a link to the "parent" site of the chat room or a link to the available chat rooms for that site.  So could the standard site header menu be added to chat rooms?  Note that I know about the footer linking back to the site associated with a particular chat, but I think that either the footer should include the standard header links or be replaced by the header (which would be more consistent anyway).


Why can't the Klein bottle embed in $\mathbb{R}^3$?

I'm working with the definition:  A smooth embedding of M into N is an injective immersion $F:M\rightarrow N$ that is also a topological embedding.  I'd like to explain why the klein bottle cant embed in $\mathbb{R}^3$. The immersion is not injective, thus results in self intersections, correct?


Let $R$ be a commutative ring such that for each $a\in R $ there exists a positive integer $n$ such that $a^n=a$

Let $R$ be a commutative ring such that for each $a\in R $ there exists a positive integer $n>1$ (depending on $a$) such that $a^n=a$. Prove that every prime ideal is a maximal ideal.   My try: Let $P$ be a prime ideal. Let $P\subset Q \subseteq R$. Then there  exists $q\in Q $ but $q\notin P$. Then $\exists n$ such that $q^n=q\implies q(q^{n-1}-1)=0\in P$ since $P$ is prime either $q\in P $ or $q^{n-1}-1\in  P$.  Thus $q^{n-1}-1\in  P$. How to complete the proof from here?


Unpolarized EM wave: is there no electric/magnetic field?

I'm not understanding what an unpolarized wave is. Does that mean there is no electric/magnetic field, or that the field is constant, i.e. frequency = 0? How can that be possible?


NOTE: I am really not very good at Multithreaded programming, but my current project has me doing it so I am trying to get my head around what is thread safe and what is not.  I was reading one of Eric Lippert's .  He says this is what really happens:   x is evaluated to produce the variable the value of the variable is copied to a temporary location the temporary value is incremented to produce a new value (not overwriting the temporary!) the new value is stored in the variable the result of the operation is the new value   This got me to thinking, what if two threads where calling ++i?  If the first thread is at step 3 when the second thread is on step 2.  (Meaning what if the second thread copies the value off to the temp location before the first thread stores the new value in the variable?)  If that happens then it would seem that both threads would only increment i once instead of twice.  (Unless the whole thing is in a lock.)


Does $f(\bar{z}) = \overline{f(z)}$ generally?

I have been playing around with this and noticed that it worked for a few functions.  Does it work generally?  And does that mean that if $f(z)$ is entire or analytic, it's conjugate won't be since $f(\bar{z})$ isn't analytic?


How to see that given a joint cdf $F(x,y)$, we have $\lim_{x\to\infty}F(x,y)=F(y)$ and $\lim_{y\to\infty}=F(x)$ where $F(y)$ and $F(x)$ are marginal cdfs.


Line Height and space between paragraphs?

As to improve user experience, what is the standard line height for a 12 px font size? And what is the standard space between paragraphs for 12 px (font size) body text?


Calculating matrix exponential for $n \times n$ Jordan block

I want to calculate exponential of the matrix which on diagonal has some $a \in \mathbb{R}$ and ones above. The $n\times n$ matrix looks like following   $$ A = \left( \begin{matrix} a & 1 & 0 & 0 & \cdots & 0 \\ 0 & a & 1 & 0 & \cdots & 0 \\ 0 & 0 & a & 1 & 0 & 0 \\ 0 & 0 & 0 & a & \ddots & 0 \\ 0 & 0 & 0 & 0 & \ddots & 1 \\ 0 & 0 & 0 & 0 & 0 & a \end{matrix} \right) $$  I tried to do it by counting determinant of matrix $A-\lambda I$ by the following algorithm :    Divide last row by $a-\lambda$, so the $n$-th row is just $0$ and $1$ in the $n$-th column.  Subtract $(n-1)$-th row by $n$-th row. Then the $1$ in the $n$-th column and $n-1$ row disappears.  Divide $n-1$ row by $a-\lambda$, so the $(n-1)-$ th row is just $0$ and $1$ in the $(n-1)$-th column.    And so on so on. By algorithm above we get matrix with only ones at diagonal, so the determinant of that matrix is just $(a - \lambda)^n$. So we have $n$-th fold  eigenvalue equals to $\lambda$. I now I have a problem with derivation of eigenvectors of matrix $A$. Can you give me some advice? Is there any simplest way to calculate that?


How can I make my far away command blocks work

I have command blocks on my adventure map, the map is partially parkour and has no ground just floating islands, I don't want people too see the command blocks so I put them 200 blocks away and they're supposed to have low render distance but if they have low render distance it won't load and the commands won't be executed, what do i do?


I use a dual-boot with windows and Ubuntu  Every topic I've read says I "will need to unmount the drive I want to back up"  Is there any way to back up the system with apps I installed and everything from LiveCD or Windows? If yes how? How do I restore it?  I want to back up the system on the same Drive . I mean I have a C:, D:, F: (the partition I want to recover Ubuntu on) and the Sys, Swap partitions  I hate having to install apps, theme, servers every time.


Let $\tau$ be lower limit topology on $\mathbb R.$ Then $(X,\tau)$ is   not second countable.   Suppose on the contrary there exists a countable basis for $(X,\tau)$. Let $\mathscr B=\{B_1,...,\}$ be the basis. Any non-empty open set is the union of elements of $\mathscr B.$ Where will I get a contradiction? How do I proceed the proof?


What happens to the questions after a Stack Exchange beta site closes?

When a Stack Exchange site labeled beta closes, what happens to the questions that were posted on the site? Do they ever get archived somewhere, or are they all just gone?


What is the average long-term annualized return on investments?

I've heard the number 7% thrown around a bunch of times, but I am struggling to find reputable data to back it up.   All I found was a quote from Warren Buffet that I couldn't find an original source for and data assembled by individuals on their personal websites. Is there something from an organization such as Market Watch making a statement about this?  I'm hoping to specifically find what the 10 or 20 year return is for investing in the S&P 500 index fund or another diversified portfolio option.


Lorentz Transformation - Derivation of $\beta$

How can one derive the equations for a Lorentz transformation? Is there a paper by Lorentz in which it is done? I think it is related to considering motion with respect to a beam of light. I am trying to understand how the scaling factor called $\beta$ arises.


Linear regression with non-normal residuals

As a follow up to this topic  I had a question. When we do OLS we have usually the normal model: $$ y_i=ax_i+\epsilon_i [1]$$ $$ \epsilon_i \sim N(0,\sigma^2) [2]$$ with independent residuals. Than OLS can be derived in a maximum likelihood setting maximizing the log likelihood. Fix $f(x|\sigma)=\frac{1}{\sqrt{2\pi\sigma^2}}e^{-x^2/\sigma^2}$ the density of the centered standard Gaussian. Then: $\log L(\alpha,\sigma)=\sum_i \log f(y_i-a x_i|\sigma)$ [3] and maximizing analytically one recovers ordinary OLS. Now [2] can be relaxed/changed as a hypothesis, for example we can have $\epsilon_i \sim$ Student's $t (\nu)$ or whatever parametric distribution we choose. Than [3] would change, a different $f$ should be used, and in the general case maybe one should make a numerical optimization. Is it common to have linear models with non normally distributed residuals applied in real scenario? Is there some example? If there is any software recommendation, it would also be useful :)


Disable javascript pausing background events during alert or confirm

I have two different  functions in javascript. Function A) is a function, which shows a countdown on the page. Function B) , the other function is completely indepentent from function A).  But, when I start an alert() or confirm() in function B), the countdown in function A) pauses. So every background script is pausing.  Is there a way to disable the pause without changing the alert() or confirm() to jquery? This script is only running on one specific machine, so I also could change some parameters in the browser.  thanks in advance


Is it ok that my asus k501lb will be plugged in always?

I have my asus k501lb laptop and it seems that the laptop's battery is non-removable, what is the disadvantage of this laptop battery? Is it good or not?... it seems that the new laptop now are none removable just like any smartphones... what is the alternative of this? I always use my laptop though for work.


Lost postgreSQL password in Windows installation

I have postgresql 9.2 installed on a windows XP machine. I have lost the postgres password.  I looked at answers given to a similar question asked 6 months ago. The answer given there required the editing of a file pg_hba.conf however I cannot find that file anywhere. Windows search doesn't find it.  I have tried uninstalling the postgreSQL installation but that seems to leave behind the password and security settings as on installing again the step to set the postgres password is missed out.  Help please?


can please someone help me? I do the work at school and I dont know how connect these two tables.    I have two tables :  |Analyze                  | | Data +-------------------------+ +-------------------------+ | id_analyze | Name       | | id_analyze | Standard   |   ---------------------------  ------------------------- | 1          | One          | 1          | A.11       | | 2          | two          | 1          | A.12       | | 3          | tree         | 1          | A.13       | | 4          | four         | 2          | A.21       | | 5          | five         | 2          | A.22       | | id_analyze | Name         | 3          | A.31       |         All, what I need is get output on web page from these two tables like:  | One  | A.11 | |      | A.12 | |      | A.13 | --------------- | Two  | A.21 | |      | A.22 |   I tried a lots of listing but nothing work. For example:  $choose = mysql_query("select * FROM Analyze", $connection); $choose2 = mysql_query("select * FROM Data,Analyze WHERE Data.id_analyze = Analyze.id_analyze", $connection);  while ($row = mysql_fetch_array( $choose ) ){        while ($row2 = mysql_fetch_array( $choose2 )) {         $Name = $row['Name'];         $Standard = $row2['Standard'];     } }


How to set up GRUB to triple boot: Ubuntu, Windows 7 and Joli OS?

I've a laptop with Windows 7 preinstalled. I shrunk Windows drive to install Ubuntu 12.04 from a Live USB.  But after installation, I am not seeing the GRUB menu. How to fix this?  Also I will be installing . So I want a GRUB menu with all the three OS's listed. Finally how can I change the order of GRUB menu after it appears.


I've adapted Peter Grill's \Menu command in  to type menu sequences in some documents. It looks like hyphenation is not allowed inside these menu sequences and I'd like to allow it. How can I do it?  As you can see from next code, hyphenation is working outside \menu  \documentclass[a5paper]{article} \usepackage[english,catalan]{babel} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{tikz} \usepackage{etoolbox}  \newtoggle{FirstOne}% \newcommand*{\menu}[1]{%    \toggletrue{FirstOne}%    \foreach \x in {#1} {%       \iftoggle{FirstOne}{}{${}\rightarrow{}$}%       \texttt{\x}%       \global\togglefalse{FirstOne}%    }% }%  \begin{document} Configura la simulació per analitzar les següents \emph{Global Statistics}:      Configura la simulació per analitzar les següents \menu{Global Statistics}: \begin{itemize} \item \menu{Traffic Sink, Traffic Received (bist/sec).} Marca també la casella \menu{Generate scalar data} i selecciona \menu{sample mean} del menú desplegable. \item \menu{Traffic Source, Traffic Sent (bist/sec).} Marca també la casella \menu{Generate scalar data} i selecciona \menu{sample mean} del menú desplegable. \item \menu{Node Statistics, Ethcoax, Collision Count} i \menu{Transmission attempts}. \item \menu{Node Statistics, Traffic Sink, Traffic Received (bist/sec).} \item \menu{Node Statistics, Traffic Source, Traffic Sent (bist/sec).} \end{itemize} \end{document}


Can vote more than once (when a question is migrated)

A  was recently migrated to  because it was about a Network-wide bug with the Stack Exchange iOS application.  Before it was migrated I upvoted the question on Meta Stack Overflow:    ..and the vote was carried across to Meta Stack Exchange, but it doesn't think I've voted yet:    ..meaning I can upvote the question again:    This bug could exist because the system may only migrate the number of votes, not including who actually voted.  If so, it can't really be called 'Migration, but rather be called copy and delete.  Is this bug intentional?


When uninstalling wine application their icons stay, how to remove them?

I want to remove "morrowind" and "manual". How do I do that?


Solving $\lim \limits _{x \to \infty} (\sqrt[n]{(x+a_1) (x+a_2) \dots (x+a_n)}-x)$

$$\lim \limits _{x \to \infty}\bigg(\sqrt[n]{(x+a_1) (x+a_2) \dots (x+a_n)}-x\bigg)$$ We can see the limit is of type $\infty-\infty$. I don't see anything I could do here. I can only see the geometric mean which is the $n$-th root term. Can I do anything with it? Any tips on solving this?


I am getting $status_date from mysql database and when I echo $status_date it looks like this ->  2016-01-08 22:18:14.  I am setting $now and when I echo it looks like this -> 2016-01-08 22:43:27.  I want to subtract $status_date from $now.  Here is my code:  $now = date("Y-m-d H:i:s");   $status_date = date("Y-m-d H:i:s",strtotime($row['status_date'])); $x = $now-$status_date;   $x returns this -> 0  Why is it not subracting?


difference in top command and gnome-system-terminal applet

I am running xubuntu 12.04, and i find that TOP command reports 900MB RAM usage where as gnome-system-terminal applet graphically shows only 300MB RAM usage. Why the values are differently reported?What is now the correct thing? and Why TOP reports it that way.  Thanks, Harish Pathangay


ConcurentModificationException when using Set

The runtime indicates the exception occurs when giving temp = keysit.next(). I thought this had been taken care of when I redefined keysit = keys.iterator() for the 2nd time, but maybe I'm missing the point. Any suggestions?  Map<Integer, Set<String>> lhm = new LinkedHashMap<Integer, Set<String>>();  public void sortMap() {     Set<Integer> keys = hm.keySet();     Iterator<Integer> keysit;     int iterations = keys.size();     int smallest;     int temp;     for(int i=0; i<iterations; i++) {         keysit = keys.iterator();         smallest = keysit.next();         keysit = keys.iterator();           while(keysit.hasNext()) {             temp = keysit.next();               if(temp<smallest)                  smallest = temp;             lhm.put(smallest, lhm.get(smallest));             keys.remove(smallest);         }     }     System.out.println(lhm); }


I want to forward the traffic from 85.25.47.11:9999 (linux) to 62.75.130.241:9987 You can see the IP is different. Is it possible to forward it in this way


Remastersys apparently let you do this? .  I have a development machine, and I'd like to basically clone it, and install it on a laptop, so I don't have to reinstall everything. Is that possible?  I have a bootable usb, that I made persistent, but I only used it to install ubuntu originally. Can I use that to accomplish this?


Scientists have found mammoth blood, and are planning to   How does one go from having its blood to a full blown living mammoth? Is it possible?    Why does it matter if the blood is frozen or not? Suppose one found dinosaur blood, could one clone a dinsosaur (as in say 'Jurassic Park')?


BIND9: How To Simulate NXDOMAIN Over Wildcard Record?

I have a BIND9 database with a wildcard record:  * IN CNAME host.mydomain.tld.   I want to get my DNS server to "spoof" NXDOMAIN for chosen names:  nxhost1 => NXDOMAIN nxhost2 => NXDOMAIN etc...   Is this achieveable with BIND9?  If so, how can I do it?  Thanks.


What's the difference between anonymous methods (C# 2.0) and lambda expressions (C# 3.0)?

What is the difference between anonymous methods of C# 2.0 and lambda expressions of C# 3.0.?


Do tag descriptions/wikis edit suggestions no longer require two reviews?

I tried to search for new and active topics on the subject here.  , only mods can approve tag description/wiki suggestions by placing one vote.  By I just approved a suggestion for both a tag  and , no other votes were needed (I'm >25k).  Has something changed? Or is my understanding incorrect?  If something has changed, does it impact edit suggestions to normal posts (questions and answers)?  In case related: I created the tag hours before the suggestions.


I can't use the add menu, how can I fix it?

I'm starting now to modelling in blender, I was trying to create an hexagon, as everyone do, I searched on YouTube and here I understood that you need to do 3 simple steps:  Add a cylinder Click on the menu in the left bottom part of the screen Reduce the number of vertices  And the magic is done, but for some reason my add menu doesn't work properly, as you can see in the photo it seems impossible to change the properties and the first time i click on it, it disapears!


How to convert FTPFile list to File List in Java?

I have a list of FTP files and I can only convert the first FTPFile to File. I am using org.apache.commons.net.ftp library. My code is works fine for the first time:     for (FTPFile file : files) {   if(ftpClient.sendNoOp()){    if(file.getName()!=null || !file.getName().equals("")) {            InputStream iStream=ftpClient.retrieveFileStream(file.getName());            File file2 = File.createTempFile("xml", null);            FileUtils.copyInputStreamToFile(iStream, file2);            iStream.close();                 }   } }   From this code the loop traverse only time and the FTPFile is converted to File and after that it will get exception which is created by null value generated in ftpClient.retrieveFileStream(file.getName()). Please help.


Is this sentence grammatically correct?     Who do I need to send product information to?


What does the light pinkish color indicate on the 'Questions' page?

I couldn't find anywhere what the light pink background color for some questions is about.


How to find out root password for installing software

I'm trying to install the  IDE in my Ubuntu and in the process it's asking for my root password which I don't remember. I know my  user password. How can I recover my root password?


Why didn't anybody Summon the Triwizard cup in the maze?

We know that the Triwizard cup itself was Summonable. After all, Harry did Summon it in the graveyard.  So why didn't any of the contestants Summon it while in the maze?  Canonical answers, please.


How to prove $1+x \leq e^x~\forall x \in \mathbb{R}?$

How to prove $$1+x \leq e^x~\forall x \in \mathbb{R}$$  I'm stuck, I tried taking logs but didn't know how to proceed.


What is the path to the kernel headers so I can install vmware?

I installed the VMware bundle on my Ubuntu 11.04 successfully but when I open it it gives me this window     and I don't know the path to this C headers.


I have been inserting some data in MYSQL with escaped quotes like this \' or \" the issue here is that mysql inserts the full sequence \' inestead of '  I cant find the solution online  thanks in advance


I spent time on due diligence and did not find this exact question, which surprised me greatly. I think it's a hugely important issue when it comes to Harry Potter. I see many questions posed with the presumption that Harry was a Horcrux -- but was he really? I'll give a couple of canon hints:     ‘Well,’ said Slughorn, not looking at Riddle, but fiddling with the ribbon on top of his box of crystallised pineapple, ‘well, it can’t hurt to give you an overview, of course. Just so that you understand the term. A Horcrux is the word used for an object in which a person has concealed part of their soul.’   [...]   ‘Encase? But how –?’   ‘There is a spell, do not ask me, I don’t know!’ said Slughorn, shaking his head like an old elephant bothered by mosquitoes. ‘Do I look as though I have tried it – do I look   like a killer?’   ‘No, sir, of course not,’ said Riddle quickly.   Half-Blood Prince - pages 464 - 465 - Chapter twenty-three, Horcruxes   Was Harry an actual, legitimate Horcrux? Why or why not?  I'm looking only for a canon-based answer, so basically I'm willing to accept Word of God (J.K. Rowling), a direct quote from any of the ten Harry Potter books, or a definitive statement from Pottermore. Just as a general FYI, I am 100% disinterested in anything the HP Wikia has to say on the matter, and will likely skip over any answer with Wikia content. If this question is found to be a duplicate, by all means vote accordingly.


Exception in thread "Thread-4" java.lang.NullPointerException in call the constructor

I am building a midi piano in java. In this case, I want to play pitches ,record pitches and playback them.  Then I used java thread to add pitch to queue and add delay to queue. I used thread object to these process and call it in constructor. After the call this constructor it gives NullPointException.  Can you help me found out why?  public PianoPlayer() throws MidiUnavailableException{      queue = new LinkedBlockingQueue<NoteEvent>();        delayQueue = new LinkedBlockingQueue<NoteEvent>();      machine = new PianoMachine(this);      processQueue.start();      processDelayQueue.start(); }  Thread processDelayQueue = new Thread() {     public void run(){         while(true){             if(queue.isEmpty()){             }             else{                 try {                     NoteEvent e=queue.take();                     midi.Midi.wait(100);                     queue.put(e);                             } catch (InterruptedException ex) {                     Logger.getLogger(PianoPlayer.class.getName()).log(Level.SEVERE, null, ex);                 }             }         }    } };


Wiener process definition as Gaussian summation

In  Wiener process is defined by summing white Gaussian random variables and then limit them when sample time go to zero. $$ {\bf{w}}(t) = \int_0^t {{\bf{\tilde q}}(\tau )} d\tau  = \mathop {\lim }\limits_{\Delta t \to 0} \sum\nolimits_{m = 1}^{M - 1} {{\bf{\tilde q}}\left( {\frac{{{\tau _m} + {\tau _{m + 1}}}}{2}} \right)\Delta t} $$ How we can reach from integral definition to summation definition ? ${\bf{\tilde q}}(t)$ is white Gaussian noise process.  EDIT: We can see Wiener process as the limit of a random walk as we let the sample time go to zero. Now the question is, How we can relate the Wiener process to random walk using the definition above?


What is the hotkey to put my Windows to sleep?

My keyboard doesn't have power-related keys. I would like to enter the hybrid sleep using the keyboard and only with a minimum of keystrokes.  If there is none, how do I bind a hotkey to it?


I was trying to find the min depth of a binary tree, code snippet is given below it is throwing a null pointer exception can someone pls help me

class Solution { static int min=0; public int minDepth(TreeNode root) { int count_left=0,count_right=0; if(root.left==null && root.right==null) return 1; count_left=count_left+1+minDepth(root.left); count_right=count_right+1+minDepth(root.right); if(count_left<count_right) { min=count_left; } else min=count_right; return min; } }


How can I read NotifyOSD messages after they are displayed?

I'd like to read a list of messages displayed by notify-osd from time to time. I'm using 12.04 still, if it matters. Is this possible?    questions from 2010 indicate that a log file should exist at ~/.cache/notify-osd.log. I have no such file, and I'd like to know if this is a bug (in which case this question should be closed) or if this log file depends on another setting (like System Settings -> Privacy)?  I don't care about storing data between reboots. I just want to browse messages from the current session.  EDIT: Two good answers now but I'd like to know if these messages are stored anywhere, (total guess, /tmp? RAM?) for a short period after appearing on the screen. Some sort of buffer must exist as they appear one after another, a few seconds each, even if there are 20-30 notifications over the span of a minute or two.  I failed to mention in my original question that I'm not interested in yet another PPA + indicator or excessive drive writes, I just want to know if it is possible to see the messages for a short time after they appear.  My use case for this is to go back and find what song was played a few minutes ago on a streaming radio station. I have it on as background music, and occasionally a tune sticks in my head after I hear it. I have no way of going back to see what played 1-2 songs ago.


Let $a,m,n \in \mathbf{N}$. Show that if $\gcd(m,n)=1$, then $\gcd(a,mn)=\gcd(a,m)\cdot\gcd(a,n)$.

Let $a,m,n\in\mathbf{N}$. Show that if $\gcd(m,n)=1$, then $\gcd(a,mn)=\gcd(a,m)\cdot\gcd(a,n)$.  Proof:  Let $u,v\in\mathbf{Z}$ such that $\gcd(m,n)=um+vn=1$. Let $b,c\in\mathbf{Z}$ such that $\gcd(m,a)=ab+cm$. Let $d,e\in\mathbf{Z}$ such that $\gcd(a,n)=ad+en$.  So $\gcd(a,m)\cdot\gcd(a,n)=a^2bd+cmen+aben+emad$.  Where do I go from here?


What is the most accurate method of the approximation of $\pi$

Question  What is the most effective way to approximate $\pi$. There are many a way that we can approximate $\pi$. The way I am looking for the most effective approximation of $\pi$ is via the equations in forms of products or sums. This means that there will be an exclusion of the complex realm as you would have to approximate $e$ first as well as the $cos(x)$ and $sin(x)$ functions due to the involvement of $e$.  So far I am currently aware of 2 methods of the approximation of $\pi$ being. $${{\pi}\over{2}} = \prod_{n=1}^{\infty}{{4n^2}\over{4n^2-1}}$$  $${\pi^2\over 6}={\zeta (2)}=\sum_{n=1}^{\infty}{1\over n^2}$$  I have been able to calculate that the first product method is more accurate as when you apply a variable to the $\infty$ of both you are able to see that the product method approaches $\pi$ at a faster rate.  I am more so interested in what other methods there are of the approximation of forumlae of $\pi$ and I do not require anyone to make the calculations of which is more accurate. If anyone has any ideas, please leave them down below. Thank you.


I am trying to copy the contents of one excel sheet into another sheet without the formatting applied to cells using Apache POI in java. But i have a NULL Pointer Exception Thrown in LINE switch (cell.getCellType()) { Why is this error appearing?   import java.io.File;     import java.io.FileInputStream;     import java.io.FileNotFoundException;     import java.io.FileOutputStream;     import java.io.IOException;      import org.apache.poi.xssf.usermodel.XSSFCell;     import org.apache.poi.xssf.usermodel.XSSFRow;     import org.apache.poi.xssf.usermodel.XSSFSheet;     import org.apache.poi.xssf.usermodel.XSSFWorkbook;      public class Automate {          public static void main(String[] args) {             // TODO Auto-generated method stub             final File myFile = new File(                     "sample.xlsx");             FileInputStream fis;             try {                 fis = new FileInputStream(myFile);                 // Finds the workbook instance for XLSX file                 final XSSFWorkbook wb = new XSSFWorkbook(fis);                 // Return first sheet from the XLSX workbook                 XSSFSheet sheet = wb.getSheetAt(0);                 System.out.println(sheet.getLastRowNum());                 XSSFWorkbook outWorkbook = getFilteredWorkBook(sheet);                  // save merged file                 File outFile = new File("C:\\filtered.xlsx");                 if (!outFile.exists()) {                     outFile.createNewFile();                 }                 FileOutputStream out = new FileOutputStream(outFile);                 outWorkbook.write(out);                 out.close();                 System.out.println("Files were created successfully");              } catch (FileNotFoundException e) {                 // TODO Auto-generated catch block                 e.printStackTrace();             } catch (IOException e) {                 // TODO Auto-generated catch block                 e.printStackTrace();             }          }          private static XSSFWorkbook getFilteredWorkBook(XSSFSheet sheet) {             // TODO Auto-generated method stub             XSSFWorkbook workbook = new XSSFWorkbook();             XSSFSheet outSheet = workbook.createSheet();             int i = 0;             for (int rowCount = 0; rowCount < sheet.getLastRowNum(); rowCount++) {                 System.out.println(rowCount);                 XSSFRow outRow = outSheet.createRow(i);                 XSSFRow row = sheet.getRow(rowCount);                 int j = 0;                  for (int colCount = 0; colCount < 10; colCount++) {                     System.out.println(colCount);                     XSSFCell outCell = outRow.createCell(j);                     XSSFCell cell = row.getCell(colCount);                     switch (cell.getCellType()) {                     case XSSFCell.CELL_TYPE_FORMULA:                         outCell.setCellFormula(cell.getCellFormula());                         break;                     case XSSFCell.CELL_TYPE_NUMERIC:                         outCell.setCellValue(cell.getNumericCellValue());                         break;                     case XSSFCell.CELL_TYPE_STRING:                         outCell.setCellValue(cell.getStringCellValue());                         break;                     case XSSFCell.CELL_TYPE_BLANK:                         outCell.setCellType(XSSFCell.CELL_TYPE_BLANK);                         break;                     case XSSFCell.CELL_TYPE_BOOLEAN:                         outCell.setCellValue(cell.getBooleanCellValue());                         break;                      default:                         outCell.setCellValue(cell.getStringCellValue());                         break;                     }                  }             }             return workbook;         }      }


Can't see exposure indicator in viewfinder on Nikon D7000

I can't see that - <---|---> + indicator in my viewfinder (I can see it only in manual mode and it used to be everywhere). I went through the whole menu and didn't find anything that may be causing it.   Any ideas?  EDIT: when I cover the lens that indicator shows up. But there's no use for this behavior :)


I installed Windows 10 and ubundu 18.4 in Lenovo V530s Intel 9th Gen Core i3 Tower Desktop .After installation I restarted but only opening windows 10.Grub menu does not display.I installed in UEFI mode.What change do  make in Bios to display grub menu. Please help me


This question came up after reading , in which it is re-iterated (as it has been many times on this site), that investing in the stock market, especially an index fund that tracks the top 100 / 500 companies in a country, basically always has great returns in the long run.  So my question is: Why isn't everybody rich?  If it is so easy (basically invest as heavily as you can in your youth to be rich into middle age and older), why doesn't everyone do this? There would be no need for pensions or any other savings or financial security that way, why even bother investing in assets like property that you have to manage when you can just have an index fund work for you?  I'm guessing that something is being missed here.


This BBC report () suggests that we should use "Dickens' Great Expectations", but I remember there is a rule from Strunk and White () that would suggest "Dickens's Great Expectations".    Is this just a difference due to British English vs American English?  BBC's report:     Armagh, Banbridge and Craigavon Borough Council's grammatical error   appeared on an advert for a performance of Charles Dickens' Great   Expectations in July.   Strunk and White     Form the possessive singular of nouns with 's.      Follow this rule whatever the final consonant. Thus write,    Charles's friend  Burns's poems the witch's malice         This is the usage of the   United States Government Printing Office and of the Oxford University   Press.   Exceptions are the possessives of ancient proper names in -es   and -is, the possessive Jesus', and such forms as for conscience'   sake, for righteousness' sake. ...


Complex integration around a singularity

I am trying to integrate the function $f(z)=$$\frac{5}{z^2}$ from -3 to 3 and I am supposed to develop a closed region that avoids the origin and use the analyticity of the function in this region to integrate the function in a way that is simpler than parametrizing along some path. Any suggestions?


I have a date variable in the YYYY-MM-DD format.   How can I change the date value to the previous day? So if the value of the variable was 2014-01-01 it would change to 2014-12-31.


How do I use only fingerprint to unlock my phone?

I got a Moto G4 Plus recently. It has a pretty fast fingerprint sensor. For my own reasons I don't want a secondary/backup(pattern/pin/etc) method to unlock my phone. I want to unlock it solely using my fingerprint. I'm ready to root it if needed. I know this comes with risks of being locked out of my phone or other emergencies, I'm ready for it. Does anyone have a way of achieving this?


Formatting number for 2 decimals - jquery

I have the following jquery function that auto populates a textbox based on the selection of a radio button option:  <script>     $(document).ready(function() {         $("#DinnerYes").click(function() {             $("#ThursdayDinnerFee").attr("value", 90);         });     });     $(document).ready(function() {         $("#DinnerNo").click(function() {             $("#ThursdayDinnerFee").attr("value", 0);         });     }); </script>   The script works and it auto populates the textbox (ThursdayDinnerFee), but I want the numbers to appear in the textbox as 0.00 and 90.00. I also need to keep the format as number because they will be used in a credit card transaction. If someone could help, I would greatly appreciate it. Thank you.


Let $f$ be a continuous function on an interval around $0$ and let $a_i=f(\frac{1}{i})$ (for large enough $i$)  i) Suppose $\sum a_i$ converges. Must $f'(0)$ exist?   ii) Suppose $f(0) = f'(0) = 0$. Must $\sum a_i$ converge?   This is question #6 from Spivak Calculus 4th edition. I already showed that, if $\sum a_i$ converges, $f(0) = 0$, and also that, if $f'(0)$ exists and $\sum a_i$ converges, then $f'(0) = 0$, and also that if $f''(0)$ exists and $f'(0) = f(0) = 0$ then $\sum a_i$ converges.


Please fix message for last rejected flag

My last flag has been declined by moderator, and now I see a message:      Your last flag was declined - please review it before flagging this post!   for ALL new flags. These new flags are currently in pending state. So I think notice message should be fixed to focus on last processed flag, not a pending ones.


According to  (better citation needed), Yoda said to Luke:     The Force is strong with your father, you, and your sister.   Did Leia ever use The Force?


I saw that some quite similar questions have already been asked on the forum, but, still, I can't find a way to solve my problem.  I've just installed the mactex package 2015 from  and then installed TeXworks. Now, when I try to compile any file I get the following error message:  It's in italian and it means that program "pdflatex" has not been found and that I need a TeX distribution like MacTex.   The point is that I've already installed the Mac distribution!  Any help?


I know that insider trading is illegal. However, is it true that the CEO of a listed company can still buy/sell their own stock? If he/she does so, isn't that technically insider trading? Or why is it different?  Even if people directly working for the company did not engage in insider trading, they will surely give "investment advice" to their friends and family.   Imagine that you are good friends with a few Fortune 500 company CEOs, and you own the stock of those companies. Every time you have coffee or dinner with one of your friend-CEOs, they might say something like "you know, I don't think our company is doing too well right now...", or "hey, we have something big coming up in the near future...".   Based on this indirect information, you could adjust your position in the stock and make profit when the news becomes public information and the stock price reacts. This kind of stuff must be going on all the time, right? Isn't this insider trading, and how can you ever prevent this?


What's an easy way to read random line from a file in Unix command line?


Let $A = \{1,2,\ldots,n\}$. Show that there is a bijection from ${\cal P}(A)$ with the cartesian product $X^n$ where $X = \{0, 1\}$.

I am in need of hints in proving this. I am unsure if this can be done using mathematical induction.


Find $\lim_{n \to \infty} n[(1+\frac{1}{n})^n - e]$

$\lim_{n \to \infty} n[(1+\frac{1}{n})^n - e]$  I let, $x = \frac{1}{n}$, then as   $\lim_{x \to 0} \frac{1}{x}[(1+x)^\frac{1}{x} - e] = \infty$  L'hopital's: $\lim_{x \to 0} \frac{\frac{1}{x}(1+x)^{\frac{1}{x}-1}}{1} = \frac{1}{0}(1+0)^{\frac{1}{0}-1} = \infty$  Again, if we apply L'hopital's: $\lim_{x \to 0} \frac{\frac{1}{x}(1+x)^{\frac{1}{x}-1}}{x+(1+x)}$. This is also going to $\infty$ as $x \to 0$. But, I know the answer is $\frac{-e}{2}$, and I am not even close. Can anyone please find me the mistakes here. Oh, I am supposed to use L'Hopital's rule.


Spring and hibernate database result spring comparison works but still throws an error

I have some values i have stored in mysal table. basically, they are some strings that hold the value up or down.  I want to fetch the data in my table and compare if they are equal to up or down  This is the code  String up = "up"; String down = "down";  @SuppressWarnings("deprecation") Query query = currentSession.createSQLQuery(            "select * from trades where trade_session_status=:trade_session_status AND trade_profit_worker_status=:trade_profit_worker_status"); query.setParameter("trade_session_status", "DONE"); query.setParameter("trade_profit_worker_status", "UNDONE"); @SuppressWarnings("rawtypes") List < Object[] > result = query.list();  for (Object[] objects: result) { Integer id = (Integer) objects[0]; String trade_prediction = (String) objects[10]; String trade_result = (String) objects[11];   if(trade_prediction.equals(up) && trade_result.equals(up)) { }   The code works and i can test if the strings are equal but somewhere down the line, i get an error on this line   if(trade_prediction.equals(up) && trade_result.equals(up)) {   but the program still works.  I get this error     SEVERE: Unexpected error occurred in scheduled task.   java.lang.NullPointerException           at com.boilerplate.components.Scheduler.profit_cron(Scheduler.java:396)   This is the line 396     if(trade_prediction.equals(up) && trade_result.equals(up)) { }   What could be causing the error?


Can someone tell me what is the name of this one? Then I can check a little more about it.