Get the name of the current method being executed Well what I am basically doing is an app which has many activities. I have a few friends with android phones and I gave them the app for testing. However, it sometimes goes into endless cycles and does strange behaviour which I am not able to understand due to their lack of programming experience and inability to dump the logcat in those particular moments.   So what I need to do is to create a static always visible window, probably popup window, that shows in which method is the program now.   So my question would be, which is the best way to achieve this functionality and how to retrieve the current method the App is in (it has several threads).
Getting the name of the currently executing method Is there a way to get the name of the currently executing method in Java?
cron ignores variables defined in ".bashrc" and ".bash_profile" I have defined "SHELL" variable in /etc/crontab file:  [martin@martin ~]$ grep SHELL /etc/crontab  SHELL=/usr/local/bin/bash [martin@martin ~]$ file /usr/local/bin/bash /usr/local/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 8.0 (800107), stripped [martin@martin ~]$    In addition, all my scripts in /etc/crontab file are started under user "martin". However /home/martin/.bash_profile(for login shell) and /home/martin/.bashrc(for non-logging shell) contain some variables which are ignored in case of cron job, but are used in case I log into machine over SSH or open new bash session. Why cron ignores those variables? Isn't cron simply executing "/usr/local/bin/bash my-script.sh" with permissions for user "martin"? Why can't I tame my ocelot? Rejecting a PhD offer after having accepted it. Advice? I have accepted a PhD offer from a very good university to do a project very close to my interests. I have told the project supervisor I accept it. In the meanwhile I have managed to secure a PhD offer from another 2 universities much better in world rankings and with better research groups and better faculty. Additionally these 2 universities do research exactly on what I want to devote my PhD research.  My only commitment to the first university is a mail confirming I accept. Nothing else. I understand declining the offer after already having accepted it is quite dishonest but it is a huge decision that will affect my future in a very significant level.   I would like your opinion and I would also like to ask for possible consequences of such an action. As far a postdocs concerned, in the first university there is no chance I ever get a postdoc since they do not actually do research on my area (except for the prospective supervisor and even he not as much).  UPDATE I have decided to do as I was afraid to. I have decided to choose a different university than the first one that I have already accepted the offer. My offer acceptance included:    An online "I accept" statement. An e-mail I sent stating "I accept the scholarship and this University is my first option"   I do not have any legal commitments since I have not signed anything. The supervisor of the first university though is really nice to me and continuously was sending me mails. How do I very nicely tell her I will not be joining in the end? Additionally the place I will go in the end will be for research in Mathematics and not Physics. Can I use this as a part of a sensical excuse?  WHAT I HAVE CHOSEN AND WHAT THE CONSEQUENCES WERE  I think that I should let people, especially other beginning grad students know what happened with my case. I have chosen to nicely tell the first university I got accepted that I will not be attending and will not be pursuing a PhD there since I decided I have different research interests (which is true). I had applied there in the first place since I was not sure what I wanted to do and because it was a nice program. Despite that, I got an offer from a World top university to work on 100% my research interests. I explained this to them, the first uni, and they happily let me go and wished me good luck, especially the supervisor who faught a lot secure me funding. I was lucky. Can anyone explain how Windows effectively limits the CPU?  Last time I tried some tricks to let my laptop not overheat, so I tried limiting the CPU to 70%.   As for my suprise it stopped my laptop from overheating - even when launching CPU intensive applications which caused my laptop to overheat and shut down, didn't overheat my laptop anymore!  I looked at task manager but the "CPU intensive" application still uses ~95% of CPU and the windows task manager shows a total of 100% CPU usage.  I have limited the CPU usage here ("plugged in" option was on 70% [both min and max] when testing the CPU intensive application):    How does Windows do this magic?   I see 100% CPU usage yet my CPU does not overheat. And I do not see any performance differences.  Does Windows limit the CPU speed? Like, if I have a 2.4 GHz processor, on 70% it will only have 1.68 GHz when limited? How is this possible (changing the CPU speed)? I thought you can only underclock when in BIOS?  If not, how does Windows accomplish this if not by changing the speed?    Side question: If it's about the speed, is there a way to set the CPU max state to 200% ? Why Wi-Fi is getting turned-on automatically in iOS 11 Script to raise a single window to the front how to output text to both screen and file inside a shell script? Currently I have a shell script which logs messages to a log file like this:  log_file="/some/dir/log_file.log" echo "some text" &gt;&gt; $log_file do_some_command echo "more text" &gt;&gt; $log_file do_other_command   When executing this script, there is no output to screen, and, since I'm connecting to the server via putty, I have to open another connection and do "tail -f log_file_path.log", because I can't terminate the running script and I want to see the output in real time.  Obviously, what I want is that the text messages are printed on screen and into file, but I'd like to do it in one line, not two lines, one of which has no redirection to file.  How to achieve this? How can you prove that the square root of two is irrational? Remove specific duplicates (all but latest) When removing duplicate rows, using the below query from  tutorial, how would I go about forcing which of the found duplicates to remove?  DELETE FROM dbo.ATTENDANCE      WHERE AUTOID NOT IN (SELECT MIN(AUTOID) _ FROM dbo.ATTENDANCE      GROUP BY EMPLOYEE_ID,ATTENDANCE_DATE)    And this works great. The reason why I am using this one is because the only unique id available is one in the IDENTITY column. And to determine if there are duplicate rows I have to look at a combination of multiple columns.    But if I have a set of duplicate rows how do I / how does SQL Server decide which to remove? And how would I force it to remove all but the one with the highest IDENTITY value?  EMPLOYEE_ID     ATTENDANCE_DATE     AUTOID A001            2011-01-01          1 A001            2011-01-01          2   If I would run the query now it happens to remove the second one, with AUTOID 2. But I am trying to remove all but this one (because this is the one latest added). How to automatically install entire Google Web Fonts collection? Q1. Find the general solution to the difference equation  $$ a_{n} - 4a_{n-1} + 3a_{n-2} = 6 $$    Q2. Solve the difference equation   $$ a_{n} - a_{n-1} - 2a_{n-2} = 0, a_0 = 2, a_1 = 4 $$    I am completely lost in solving recurrence relation questions. Can anyone guide me in steps to solve the following 2 questions? How can I use "." as the delimiter with String.split() in java "A/An" preceding a parenthetical statement When a/an precedes a parenthetical aside (sometimes seen in informal/conversational writing), should the vowel rule depend on the first word in parentheses, or the next word in the "regular" flow of the sentence?     I need a (memorable) idiom (preceding an m word; use a)   or     I need an (memorable) idiom (preceding an i word; use an) How do you run your own code alongside Tkinter's event loop? My little brother is just getting into programming, and for his Science Fair project, he's doing a simulation of a flock of birds in the sky. He's gotten most of his code written, and it works nicely, but the birds need to move every moment.  Tkinter, however, hogs the time for its own event loop, and so his code won't run. Doing root.mainloop() runs, runs, and keeps running, and the only thing it runs is the event handlers.  Is there a way to have his code run alongside the mainloop (without multithreading, it's confusing and this should be kept simple), and if so, what is it?  Right now, he came up with an ugly hack, tying his move() function to &lt;b1-motion&gt;, so that as long as he holds the button down and wiggles the mouse, it works. But there's got to be a better way. Potato Power. Self sustaining medium using a living potato plant possible? Would fewer Jedi be more powerful? Left pedal coming loose On my bike, which I just built out of spare parts, the left pedal seems to constantly be coming loose. It seems to come out about 5m every time I ride ~10km.  It's an old cotter pin crank, and the pedal is a left pedal (there's an L stamped into the end of the screw that goes into the crank). The pedal has a crack in one side of the axle compartment, but I don't think that would affect it.  I thought that these pedals had left-hand threads so that the action of pedalling would work to tighten the screw? If so, why would this be happening, and is there anything I can do about it short of replacing the crank and pedal? When I get a notification on android that someone had posted an answer or comment, if I click the notification, it opens the Stack Exchange app but shows the main view with the inbox opened, not the comment or answer that was in the notification.  If there is only one notification pending, when you tap it it should show you the actual contents rather than just the inbox. There is a classic problem:  Suppose that $X_1,\ldots,X_n$ form an i.i.d. sample from a uniform distribution on the interval $(0,\theta)$, where $\theta&gt;0$ is unknown. I would like to find the MLE of $\theta$.  The pdf of each observation will have the form: $$ f(x\mid\theta) =  \begin{cases} 1/\theta\quad&amp;\text{for }\, 0\leq x\leq \theta\\ 0 &amp;\text{otherwise}. \end{cases} $$ The likelihood function therefore has the form: $$ L(\theta) = \begin{cases} 1/\theta^n \quad&amp;\text{for }\; 0\leq x_i \leq \theta\;\; \text{for all }i,\\ 0 &amp;\text{otherwise}. \end{cases} $$ The general solution is usually that the MLE of theta must be a value of $\theta$ for which $\theta \geq x_i$ and which maximizes $1/\theta^n$ among all such values.   The reasoning is that since $1/\theta^n$ is a decreasing function of $\theta$, the estimate will be the smallest possible value of $\theta$ such that $\theta\geq x_i$.  Therefore, the mle of $\theta$, $\hat{\theta}$, is $\max(X_1,\ldots,X_n)$.  Here, I do not understand why we cannot just differentiate the likelihood function with respect to theta and then set it equal to $0$?  Thanks! I have a distribution of microparticles that follows a lognormal distribution. The cumulative distribution function thus is given by:  $$ F_X(x;\mu,\sigma) = \frac12 \operatorname{erfc}\!\left(-\frac{\ln x - \mu}{\sigma\sqrt{2}}\right) $$ $$ \mu = ln(M) + \sigma^2 $$  Now, the plot of the distribution function should be exactly the same no matter if the particle diameter $x$ is given in micrometers or meters (as long as I adapt the x-axis accordingly of course). However, this only works if I only convert $x$ and $M$, while not touching the numerical value of $\sigma$, and I don't understand why. $F_X$ has to be unitless, so $x$, $\mu$ and $\sigma$ should all have the same unit, right?