How to install latest version of tensorflow on Kaggle?

Question: I would like to use a specific version of Tensorflow on Kaggle.
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
!pip uninstall tensorflow -y
!pip install -q tensorflow-datasets tf-nightly==2.2.0-dev20200319
import tensorflow as tf
import tensorflow_datasets as tfds
import os
# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory

print(tf.__version__)

And the output on Kaggle is:
2.1.0

So it is not picking up the version I have tried to install.
How can I use version 2.2.X onwards on kaggle?
Answer: In the Kaggle documentation on TPU usage, they specify that TPU's are supported through TensorFlow 2.1, so I'm wondering if it's even possible. You shouldn't have to uninstall TensorFlow, and honestly I'm not sure if uninstalling will make a difference.
Here's what I tried in a Kaggle notebook:
!pip install tensorflow==2.2 gave this error:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f407a69b080>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/tensorflow/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f407a69bba8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/tensorflow/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f407a5f7160>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/tensorflow/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f407a5f7128>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/tensorflow/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f407a5f72e8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/tensorflow/
ERROR: Could not find a version that satisfies the requirement tensorflow==2.2 (from versions: none)
ERROR: No matching distribution found for tensorflow==2.2

!pip install tensorflow==1.1 gave the same error
However, !pip install tensorflow and !pip install tensorflow==2.1 works, however it installs TensorFlow 2.1.
Check out https://www.kaggle.com/docs/tpu for further information, or it might also be worth emailing them and asking. It would make sense if they only use TF 2.1 though for their kernels.


can't find executable file WSL2

Question: i'm using WSL2 with Ubuntu 20.04. I installed a program libFM and followed the installation process (which is fairly simple). When I try to reach executable using ./libFM it fails, returning the message "No such file or directory". When I specify the full address /libfm-1.42.src/bin/libFM it works fine.
I tried adding /libfm-1.42.src/bin/libFM to the $PATH in ~/.bashrc, but it still returns the same error message. What am I doing wrong?
Answer: You need to add the directory to PATH:
PATH=$PATH:/libfm-1.42.src/bin/

After adding it, you can run libFM instead of ./libFM. The latter will search for libFM in the current working dir only.
See also
Comment: No. `./` means the current working dir, and only this. I linked a question that has some further explanations in the answers.
Comment: Another short question on the matter, when I use ./ does it suppose to search recursively through the directories?

can't find executable file WSL2


Sleeping with pipes in Haste and Haskell

Question: I'm working on a Haskell program that makes heavy use of the Pipes library.  I'm porting part of the library to Haste.  The one place where I've hit a stumbling block is in the odd way that javascript handles sleeping.
What I wanted to write was a simple pipe that delays before sending its results
sleeper :: Int -> Pipe a a IO ()
sleeper time = forever $ do
                   temp <- await
                   sleep time
                   yield temp

However, it seems that the sleeping works like a callback.
setTimeout :: MonadIO m => Int -> IO () -> m ()

I tried doing
sleeper time = do
                   temp <- await
                   yield temp
                   setTimeout time $ sleeper time

But the types don't line up properly.  Is there a way to get a delaying pipe?
Comment: You could emulate sleeping by waiting on an mvar which gets populated in another thread via the callback.
Comment: Do you _really_ want to sleep in a JavaScript environment? I'm not familiar with Haste, but if it doesn't use a WebWorker, you would freeze up your environment.
Answer: You might want to look at https://github.com/imalsogreg/pipes-rt/blob/master/lib/Pipes/RealTime.hs#L127
There is a function pauseUntil there


How to differentiate which cables is which if there is no color codes

Question: I am trying to change my ceiling lamp to ceiling lamp with fan. However, when I took the ceiling lamp off, I see that the cables have the same color so I have no way differentiating them visually, which one is Neutral, Live and Earth wires.
Is there a device that I could use to find this out?
Here are the images of what I am seeing, the colors are exactly like on the picture.
Cables are covered with paint but once paint is removed, it does not help to see the colors really.

Maybe there is some kind of tool I can use to find out the type of cable?
And a follow up question because it is very related. Once I find the type of cable, I will need to extend a tiny bit one of the cables that is too short (by like 5 cm tops). Do I need to buy this specific type of cable or will any cable of the same mm work?
UPD:
Like pointed out by @Armand, one of those wires did not have bare metal and completely covered in paint - this was Earth and it was not used before I removed old lights. 1 down, 2 to go. The other 2 appeared way easier to figure out what to do with, as this is alternate current, any of them could have been used as Live and Neutral wires to connect my next ceiling fan, which worked out fine (not sure what consequences of this are, but it works).
Comment: Did you take a picture before disconnecting the wires to the ceiling lamp?
Comment: Where are you located at?
Comment: I am located in France, and sadly I did not pay attention to the way things were configured. You are right there were colors on my old lamp, which would have helped
Comment: First, to keep track of the wires now, mark each of the three by wrapping with a bit of electrical tape - either 3 different colors, or with black only use two pieces, one piece, and zero pieces to identify the 3 wires.
Comment: One of the wires (the rightmost in your photo) looks like it has no bare metal end - perhaps it was not connected to your light and only the other 2 were used? Also, especially in older installations there is sometimes no earth wire at all, just some number of hot/live and neutral wires. Also, sometimes there are two hot wires with different "phases". This is all to say that unexpected setups are frequent and can be very dangerous - you should consider having a professional look at it.
Comment: Finally to install a lamp or other item on the ceiling you also need to make sure it is physically secured in a way that will not interfere with or damage the wiring.
Comment: You have more problems than just wires. It appears that the ceiling surface was holding up the light. That's typically not strong enough to hold up a fan. In the US, you would use an "old work ceiling fan box". This might help solve your wire problem because you would have to cut a larger hole in the ceiling to install the box, and that might give you a better view of the wiring behind the ceiling.
Comment: Assuming there's some solid piece of wood  wood behind the ceiling that will be fine to attach the fan bracket to. Most of these Americans have closed minds, ignore them.
Comment: There's nothing "close minded" about making recommendations for a _safe_ installation, @Jasen. If _you_ want to install a ceiling fan by mounting it to a couple of plastic anchors in a drywall/plaster ceiling, then by all means, go right ahead. When the vibrations cause the fan to fall within the first day of running, don't come crying to us.
Answer: To figure out which wire is which, the solution is usually just to turn it on and watch it with a multimeter.  Make sure all of the wires are separated and not touching anything.  I like to use a multimeter with clamp leads, then I'll just clamp onto a hot wire, turn on the breaker, and see if that was it.  This way I'm not fumbling with my multimeter and hot wires and re-up my subscription to the 120 Club.
For short wires, it depends.  If the wires reach into your electrical box but are not quite long enough, then you don't need sheathed wire - you can just use regular wires pulled out of the sheath and extended with wire nuts, or even better a push-in connector (like those made by Wago).
If your wires aren't reaching your electrical box, and assuming you have finished walls, then I suggest putting in an "old work" electrical box.  All electrical junctions need to be in an electrical box, and an old-work box is a kind where you just cut a rectangular hole in your wall and push the box in.  Then you can do a junction in there, put a blank face on the box and paint it to match the wall.
Rule of thumb: regular wires only inside electrical boxes, and sheathed wire is required outside of electrical boxes.  Even if you are jumping between two boxes close together, it needs to be sheathed.
Comment: An old work box won't work.  You need a box rated for a ceiling fan.
Comment: They make old-work ceiling fan boxes, @JACK. I've got several installed in my house. ;) Remember, too, that this is in France and regulations are probably different there. It is important, though, to ensure proper mounting for a fan which will be heavier and have movement than the old light.
Comment: @FreeMan Right you are. I don't think that's what the OP is describing though so I pointed it out.
Comment: @JACK There are old work boxes that can hang a ceiling fan.  They have a channel through the middle so it straddles the 2x4 and the box is screwed directly to it.  The channel in the middle makes it tight to work in, but it's an option.
Comment: @Smith  Yes, I know. But the person asking the question doesn't know so you need to specify that they need a ceiling fan rated box.
Comment: if he was to move his entire dwelling to USA then yes he would require a ceiling box.
Comment: @JACK He is in France. US code doesn't apply. In Europe generally ceiling boxes are required in new builds, but older homes may still do without. Usually the light fixture is directly attached to the ceiling (hopefully on a joist or blocking between joists) and the cabling is going straight into the fixture.
Answer: You can use high voltage multimeter to detect voltages.
Comment: Can you please precise what this would tell me exactly? I have 3 things I need to find - Earth, Live, and Neutral. How can I find each of them? (lack of voltage in one, too much voltage in another etc). I am very new to this stuff
Comment: A standard multi meter would work no need for "high voltage" at least in code terms.
Comment: Your meter  should have "CAT II" or better if you're going to use it on house wiring,  but you're better off using a lamp. it's much harder to get the wrong answer from a lamp.


Apt-get commands failing with dependency issues after upgrading from 14 to 16

Question: The output from an apt-get upgrade:
sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 gstreamer1.0-clutter : Depends: libcogl15 (>= 1.15.8) but it is not     installable
 libnux-4.0-0 : Depends: libsigc++-2.0-0c2a (>= 2.0.2) but it is not installable
 orage : Depends: libical1 (>= 1.0) but it is not installable
 python : Depends: python-minimal (= 2.7.5-5ubuntu3) but 2.7.11-1 is installed
 python-dev : Depends: python (= 2.7.11-1) but 2.7.5-5ubuntu3 is installed
              Depends: libpython-dev (= 2.7.11-1) but 2.7.5-5ubuntu3 is installed
E: Unmet dependencies. Try using -f.

Comment: gstreamer1.0-clutter in 16.04 deps on libcogl20, seems your upgrade had issues. What does `apt-cache policy gstreamer1.0-clutter` return?
Comment: @doug `> apt-cache policy gstreamer1.0-clutter
gstreamer1.0-clutter:
  Installed: 2.0.8-1build1
  Candidate: 2.0.18-1
  Version table:
     2.0.18-1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
 *** 2.0.8-1build1 100
        100 /var/lib/dpkg/status`
Comment: Try this - `sudo apt update`  followed by `sudo apt -s dist-upgrade` this is just a simulation, do the packages mentioned in your post get upgraded?
Comment: @doug Same error as above after running both commands
Comment: Seems like a real mess. orage & python-dev you could just remove but the other 3.. Sometimes one can go retrieve the newer packages & install with dpkg  or apt but this may be 'deeper' What happens if you try to install   libcogl20, do as a simulation, `sudo apt -s install  libcogl20`
Comment: @doug that gives me the same error as before. I managed to update everything but python-minimal, python, and python-dev by downloading the packages manually and installing with dpkg. The output of any apt command now is `The following packages have unmet dependencies:
 python : Depends: python-minimal (= 2.7.5-5ubuntu3) but 2.7.11-1 is installed
 python-dev : Depends: python (= 2.7.11-1) but 2.7.5-5ubuntu3 is installed` Any ideas?
Comment: Well for the moment you can just remove python-dev, re-install later if desired. What happens with python & dpkg?  (python-minimal is already installed at correct version
Answer: Some packages got obsoleted between 14.04 and 16.04, it's a very common occurence when upgrading distros. Here's what you do:
-see if your problem packages are available for 16.04. If they are, you may wish to sudo apt-get purge those packages and then re-install them. Your packages may have different dependencies under 16.04, but since they've been installed under 14.04, they have THAT list of delendencies.
-make sure your sources.list only contain valid entries for 16.04
-you may wish to reinstall 16.04 cleanly from scratch. "Dirty upgrades" like this don't always work 100% out of the box.
Answer: I've just upgraded from 14.04 Trusty to 16.04 Xenial.  I hit this problem where libcogl20 could not be installed because it broke libcogl15 and there were a number of dependencies on libcogl15, particularly the ubuntu-desktop package.  I obviously did not want to remove ubuntu-desktop and I could find no help here or on IRC.  This is what I did to resolve this.
I booted into recovery mode.  This has an option marked 'dpkg' that says it will fix broken packages.  I chose that and libcogl15 was going to be removed with a couple of other packages, I can't remember the names, but they did not include ubuntu-desktop so I decided this would fix my problem and it did.
There were a couple of things I needed to do before running the dpkg recover option.  First I needed to connect and ethernet cable and start networking (another option on the recovery menu).  Then I need to enter root terminal (another option).  There I found that resolv.conf was not populated so I had to create that with the nameserver.  I also found to route was wrong, so I need to add the correct default route.
After that I used ctrl-d to return to the menu and chose the dpkg option.  This magically sorted out my problem and I am now working successfully.
hth


Rails: How to change Bundler default version

Question: bundler (2.0.1, default: 1.17.2)
How could I change the default to 2.0.1
Comment: When I installed I set gem install --default bundler -v 'X.x.x' but now I have 2 defaults.
Comment: @Lomefin The previous version's gemspec must be removed from the /default directory. Eg `$ mv /usr/share/rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/bundler-1.17.2.gemspec ../` Note that this command moves the spec from /default into /specifications. It is no longer a default.
Comment: I guess you are mistaking what default gems are. They are not indicating default versions. See: https://stdgems.org/.
Answer: Following https://bundler.io/guides/bundler_2_upgrade.html#upgrading-applications-from-bundler-1-to-bundler-2, here's what worked for me:
gem install --default bundler
gem update --system
bundle update --bundler

Answer: I had this same concern when trying to setup Bundler gem 2.2.11 as the default gem on my machine.
Here's how I achieved it:
First, I listed and uninstalled all other versions of the Bundler gem because I did not need them:
gem list bundler
gem uninstall bundler

If you encounter an error like this
Gem bundler-2.1.4 cannot be uninstalled because it is a default gem

Simply run the command below to get your ruby installation directory:
gem environment | grep "INSTALLATION DIRECTORY"

This should display an output like this. In my case my ruby version was 2.7.2:
- INSTALLATION DIRECTORY: /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0

Next, navigate to the specifications/default directory of the INSTALLATION PATH:
cd /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/specifications/default

Remove/delete the bundler.gemspec file that you have there. In my case it was bundler-2.1.4.gemspec, so I ran the command:
rm bundler-2.1.4.gemspec

Next, I installed the Bundler gem 2.2.11 and made it the default gem:
gem install --default bundler -v 2.2.11

Next, I listed my Bundler versions:
gem list bundler

Finally, I updated my gems to use the newly installed Bundler:
gem update --system

That's all.
I hope this helps
Comment: Doing so you end up with to different versions if the bundler gem, but both being marked as default @iconoclast.
Comment: Why couldn't you just `gem install --default bundler -v 2.2.11` earlier to solve the problem of not being able to remove the newer version?
Comment: Doing so results in **two** different versions of the `bundler` gem, both being marked as `default`. (Very sorry... I repeated what was already written because I cannot edit the comment.) Also, you may be able to resolve the issue of two default versions of bundler here: [How can I remove default version of bundler?](https://stackoverflow.com/a/59636874/664833)
Comment: I still end up with a different default version when running `bundler -v` after successfully running those instructions.
Answer: What helped me is to delete the current default manually from the folder
lib\ruby\gems\2.6.0\specifications\default\
and then install fresh bundler as usually
gem install bundler
or as default
gem install --default bundler
Answer: You need to remove .spec file to remove the gem.
Steps:

gem env – try to search in provided list under GEM PATHS, in specifications/default
remove there bundler-VERSION.gemspec
install bundler, if you don't have specific: gem install bundler:VERSION --default
Answer: gem install --default bundler:<version>

Comment: Already covered in another answer.
Answer: You need to know where the default specs are, so use gem environment to find out.
the steps I used were:
gem environment
# note INSTALLATION DIRECTORY
cd <installation_dir>
cd specifications/default
rm bundler-2.1.4.gemspec
gem install --default bundler -v 2.2.11

Answer: To change the default version of Bundler used in your Rails application, you can specify the version in your Gemfile and then update it. Here's how you can do it:
Specify the Desired Bundler Version:
In your Gemfile, add the version of Bundler you want to use:
gem 'bundler', 'x.x.x'
Replace 'x.x.x' with the specific version of Bundler you want to use.
Update Bundler:
Open your terminal and run the following command:
gem install bundler -v x.x.x
Again, replace 'x.x.x' with the specific version of Bundler you want to set as default.
Update Gems:
After changing the Bundler version, you'll need to update the gems in your application:
bundle update
This will update all the gems in your application according to the version specified in your Gemfile.
Verify Bundler Version:
You can verify the Bundler version in your Rails application using the following command:
bundle -v
This will display the currently active version of Bundler.
Now, Bundler should use the version specified in your Gemfile by default for this Rails application.
Keep in mind that if you're working on multiple Rails projects, each project can have its own version of Bundler specified in its Gemfile. This allows you to use different versions of Bundler for different projects if needed.


Searching for strings in txt file

Question: I have multiple .txt files and I'm looking for any of such strings: lst = ['PASSED', 'FAILED', 'PASSED WITH WARNINGS']
I crated code, but it splits on whitespaces and I get just PASSED instaead of PASSED WITH WARNINGS. How to correct my code?
for i in range(len(tab)):
    with open(tab[i], 'r') as infile:
        lines = infile.readlines()
        var = [line for line in lines if (set(line.split()) & set(msgs))]
        print(var)

Example of my .txt file:
Some info here
Another info
Some more info
And so on...
2021_09_09_09_09_31     PASSED WITH WARNINGS
2021_09_09_09_09_34     PASSED WITH WARNINGS

Comment: Can you update your question with a short example for one of the .txt files you're parsing, and the expected output of that file?
Answer: lst = ['PASSED', 'FAILED', 'PASSED WITH WARNINGS']
for i in range(len(tab)):
    with open(tab[i], 'r') as infile:
        lines = infile.readlines()
        var = [line.split(" ", 1)[-1].strip() for line in lines if any([word in line for word in lst])]
        print(var)

Comment: a hacky way would be:
`var = [line.split(" ", 1)[-1] for line in lines if any([word in line for word in lst])]`
Comment: yes, apply a strip after it:

`var = [line.split(" ", 1)[-1].strip() ...`
Comment: And how to leave only message PASSED WITH WARNINGS without the timestamp?
Comment: But it leaves whitespace in front of PASSED WITH WARNINGS. Is there any way to delete this whitespace?
Comment: Thanks a lot! :)

Searching for strings in txt file


Hide multiple DIV ID elements using Javascript If url has specific text (Already have code that hides one)

Question: I have this script I often use, but I always add it to the code multiple times to hide multiple different things, which bad I believe. How can I add multiple IDs to it so I can hide multiple things

For example where it says "thisid", how do I add another ID within this same code
And also, if possible how can I add another style? I'd like to also have visibility = "hidden"; added as well.
Please, and thank you so much for having read this and helping
Edited for Chris help:
  var url = window.location.href;
  var msg = document.getElementById('thisid');
  // Check if URL contains the keyword
if( url.search( 'thisword' ) > 0 ) {

const idList = ['something', 'something-else', 'another-thing', 'yet-another'];

idList.forEach((id) => {
  const element = document.getElementById(id);
  if (element != null) {
    element.style.borderColor = 'green';
  element.style.display = 'none';
  element.style.visibility = 'hidden';
  } else {
    console.warn(`An ID was specified for an element that was not found - ${element}`);
}
});
}

Comment: Perhaps use `document.querySelectorAll()` and then loop over that to hide the item(s): `var msgs = document.querySelectorAll('#thisid, #anotherID, #yetAnotherID');`
Comment: Oh I hadn't seen this reply, thank you for this I'll try this out!
Answer: Since you specify you're going by unique ID's here's one way to just feed it an array of the desired ID's and do whatever to each instance. In the case an ID is incorrect, or not found we give a warning. I used borderColor for the example, but can easily change it to display = "none" or whatever. Cheers and next time, perhaps make an attempt on your own first then come back when you're stuck. :)

const idList = ['something', 'something-else', 'another-thing', 'yet-another'];

idList.forEach((id) => {
  const element = document.getElementById(id);
  if (element != null) {
    element.style.borderColor = 'green';
  } else {
    console.warn(`An ID was specified for an element that was not found - ${element}`);
  }
});
.container {
  display: flex;
}

.container div {
  height: 5rem;
  width: 100%;
  border: 20px red solid;
}

Comment: Thank you so much for this! I did attempt to, but what I tried wasn't working, I don't have much knowledge there. The code you gave, does it still work with the URL search portion I mentioned? I'm trying to hide things based on if the URL includes text, in the example I gave it hides the ID if the url cotains the text "thisword". And for the bordercolor example I knew how to change that, what I meant was if I can add an extra style, for example, both .bordercolor and .padding .display, is is possible to add those three in to that one code?
Comment: Sure it's possible. Would you like to compare your snippet to mine and maybe take a try at figuring out how? I'll give you a hint: Your `url` var could be added, your existing `if` statement arg could wrap my snippet to satisfy its condition before the next procedure of getting the elements and applying the changes. Stackoverflow is for folks looking to learn, not a free code service. Give it a go and if you get stuck we can take a look at your attempt and get you fixed up. :)
Comment: I understand, I've edited my original post since the code I have is too large to post here, please view the edited and let me know, I tried my best I apologize.


Finding Conjugate harmonic of $u = \frac{1}{2} ln(x^2 + y^2)$

Question: this is a nice community;
I've been facing a hard time answering this question, a detailed answer would be splendid.
$u = \frac{1}{2} ln(x^2 + y^2)$
find conjugate harmonic, and harmonic function.
Thanks very much
Edit: this is my solution so far
found ∂u∂x, it's square, and ∂u∂y with its square
tried using this equation (F(z)= integration(∂u∂x(z,0)- j∂u∂y(z,0))dz + jc)
....but couldn't get a sensible result of (v)
my results was F(z)=ln(z) +jc = ln(x+jy) + jc ..... as you can see this is not a satisfying solution
Comment: It is customary to include your work so far on the problem, and whether or not you have made any progress, to describe the particular difficulty you are having.
Comment: $$\frac{\partial u}{\partial x}=\frac{x}{x^2+y^2}$$
$$\frac{\partial u}{\partial y}=\frac{y}{x^2+y^2}$$
$$\left(\frac{\partial u}{\partial x}\right)^2+\left(\frac{\partial u}{\partial y}\right)^2=1$$
Comment: @KennyLau Do you know what a harmonic conjugate is?
Comment: Travis, I edited my question
Comment: Kenny lau, my request is for someone to help me finding the conjugate harmonic, and the function, thanks
Answer: Let $u(x,y)=\frac12 \log(x^2+y^2)$ for $(x,y)\ne(0,0)$.  If $v(x,y)$ is the harmonic conjugate of $u(x,y)$, then there is an analytic function $f(z)$ such that $f(z)=u(x,y)+iv(x,y)$.
If $f(z)$ is analytic, then $u(x,y)$ and $v(x,y)$ satisfy the Cauchy-Riemann Equations
$$\frac{\partial u(x,y)}{\partial x}=\frac{\partial v(x,y)}{\partial y} \tag 1$$
and
$$\frac{\partial u(x,y)}{\partial y}=-\frac{\partial v(x,y)}{\partial x} \tag 2$$
From $(1)$, we find that
$$\frac{\partial v(x,y)}{\partial y}=\frac{x}{x^2+y^2}\tag 3$$
Integrating $(3)$ with respect to $y$, we obtain
$$v(x,y)=\arctan2(y,x)+C(x) \tag 4$$
where $C(x)$ is an integration constant with respect to $x$ and $\arctan2(y/x)$ is defined as in THIS ARTICLE.
Applying the Cauchy-Riemann Equation $(2)$ to $(4)$ reveals
$$\frac{\partial u(x,y)}{\partial y}=\frac{y}{x^2+y^2}+C'(x)$$
from which we find $C'(x)=0$.
Therefore, setting the integration constant to $0$, the harmonic conjugate of $u(x,y)=\frac12 \log(x^2+y^2)$ is
$$v(x,y)=\arctan2(y,x)$$
Putting it all together,
$$f(z)=\frac12 \log(x^2+y^2)+i\arctan2(y,x)=\log(z)$$
Comment: You're welcome!  It was my pleasure Sero. -Mark
Comment: Thanks very much, I appreciate u taking your time to answer my question @Dr. MV


OAuth refresh token from Azure Bot Service

Question: I am using the OAuth capability in Azure Bot service to access the Microsoft Graph.
I have the need to communicate with the SharePoint Online REST endpoint. Typically, I would request and cache a refresh token from AAD, then use that refresh token to acquire a second access token, specifying the sharepoint.com address as the resource.
When using the OAuth connections in the Azure Bot service, I can get an access token by calling the GetUserToken method of the dialog context. However, I cannot get the refresh token from the bot service.
Q: Is the refresh token exposed as part of the BotBuilder library, or in some other fashion?
Comment: The refresh token is used by the service internally, and auto-refreshed.  If you require the refresh token for some reason, then make the call to retrieve one.  I don't see a way to get the refresh token from the Bot Service.
Comment: Hi Paul. Did my answer help you? Are you still ok? Please consider accepting my answer. Thanks!
Comment: As you noted yourself, the refresh token is provided to the bot service. My question was if the token was accessible by my code. While your answer is factually correct, it does not answer my question. Thank you contributing.
Answer: You must include the offline_access scope on your OAuth Bot configuration and on bots API permission within your Azure bot registration (Go to AAD - Application Registration (Preview) - API Permission).
Otherwise the bot service will not be able to refresh the token when it expired after 60 minutes by default.
For more information's on scopes see here.
Further explanation:
Without the offline_access scope included in the token request, the refresh token is not submitted and only an access token is provided. With the scope included, a refresh token will be provided to the caller which (in this case the bot service) can use to acquire a fresh token at any point until the refresh token itself expires.


Failed to install pyang

Question: I'm trying to install pyang by pip install pyang command and I got this error :
Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/pyang/
Thank you.
Comment: Your post is difficult to decipher, you need to learn how to use the formatting tools to make it easier for people to help you. re-wrote your post to make it look like it should then took a screen shot and deleted it so that you can see what your posts need to look like: https://i.imgur.com/fGMkmSG.png
Comment: you can provide your os version, python version etc. especially, error log, not just one line error message.
Answer: there may be a proxy issue. you can try downloading the whl file from:
https://pypi.org/project/pyang/#files
currently the link is this
after that open terminal and go to the whl file directory and type:
pip install yourpackagename.whl
and it's done.

Failed to install pyang


How does $(objectName) work in Scala Spark?

Question: Hi I am trying to learn org.apache.spark.ml design. I noticed in that param values are often retrieved by using $ symbol.
For example, in NGram.scala
val n: IntParam = new IntParam(this, "n", "number elements per n-gram (>=1)",
  ParamValidators.gtEq(1))

/** @group setParam */
def setN(value: Int): this.type = set(n, value)

/** @group getParam */
def getN: Int = $(n)

Is $ a Scala operator with general features?
I can see in eclipse (when I hoverover $(n)) that it is defined as
final protected def $[T](param: Param[T]): T
but I could not find the class where it was defined the above way.
Can you please tell me where this is defined ?
Answer: A dollar sign is a perfectly legal method name in Scala. You can see the definition of this method here.
In this case, it is simply an alias for getOrDefault.
Comment: Wow! Don't know how I missed it! I looked at this source code :-(. Thank you!


Why do Microwave oven UIs fail?

Question: I'm not a professional chef, but I do know my way around the kitchen and its machines. The dishwasher, the fridge, the freezer, the stove and the oven all works as expected in many homes. Could you start the dishwasher, my friends might say, but they never say – heat this in the microwave oven. Probably it's because they are programmable these days, and have plenty of buttons with arbitrary non-standard, non-conventional icons and no explanatory text to help. Fortunately there is a trend among microwave oven manufacturers to add a panic-button at the lower left of the control panel. It's the button that starts the microwave oven at max effect and runs for 30 seconds.

But I wonder why that is. All other kitchen machines could be operated fairly well if you give it a little time, but the microwave just doesn't. There can't be different designers, but maybe more options where microwave oven UI designers had to invent new symbols for new features and add a note in the manual?
Micah Wittman has even made an effort to start a "Microwave Oven UI Standard Project" to overcome this problem. I'd be happy to join if it is still running. So far this is his suggestion:

Still one wonders, why do Microwave UI fail?
Comment: @BenBrocka Your youth's showing.  :)  Analog dials were very common on 80's models because the mechanical timer was cheaper than a digital solution with a collection of discrete chips or a microcontroller.
Comment: What do you mean by "his suggestion"? That UI has long been in use on microwaves, before these new digital buttons (which I agree are confusing). My mother still has one of those microwaves with analog duration and power wheels and it looks something [like this](http://i.stack.imgur.com/PKBVR.jpg). I have a similar variant, with a wheel for duration, but a button for selecting power (which I almost never change from max). Also, it has a display which shows you a timer, that is, what duration you have selected, and the duration wheel has "steps" when you turn it, to snap to certain durations.
Comment: @Anderson I think he want to implement it as a standard, not that it is his design. That's what I think is "his suggestion".
Comment: My big problem is that the limited display + the programmability leads to a reference on an external lookup table. I hit "defrost" and it says "Which program, 1-4?". I have no way to know. So most of the buttons don't help.
Comment: I'm sure there is a sexist answer in how men and woman are different in the kitchen, but I don't want to go there. :)
Comment: @MathewFoscarini Oh please do, 'cause in our family my office is the kitchen and my wifes' office is the landry room :-)
Comment: Are you sketching with crayons? NICE.
Comment: I am not sure if anyone knows why each of the manufacturers fail exactly. But generally speaking they mostly fail because of fact that microwave oven is already something more than microwave power generating machine (with timer) and they fail to describe what it actually does. But thats what UI fail means, right? So, not a real answer anyway.
Comment: Are microwave UIs different in every continent? I think its in Don Normans DOET or POET whatever you want to call it that he goes on about Korean consumers associating a complex UI with a better product, I'm not sure where I'm going with this but you get the idea
Comment: @Captain they're apparently different...I've never ever seen a microwave with a dial here in the US, always a number pad. Cooking times come in minutes, so it's not a problem unless you're cooking something other than pre-prepared food in a microwave
Comment: @danneely ROFLOL
Comment: throwing this in a comment because I don't feel it's a full answer -- biggest problems are inconsistency between models/brands, which causes the most confusion, followed by the large number of advanced features which crowd the control panel. A touch screen UI that hid the advanced features and consistency between vendors would greatly alleviate the problems. So: manufacturing touch screens/programming touch UI isn't cheap enough yet, and competitors don't work together enough.
Comment: The trouble with analogue microwave controls is that they have a startlingly limited lifespan. I've never yet met an analogue microwave where the timer correctly goes to zero; they all stop a short time before the supposed end so you end up putting in excess time and then manually stopping them thus defeating the purpose of the timer. I just want power and time on a digital setting.
Comment: Every microwave I've seen has simple UI for time+power. Often they have programming abilities in addition to that, but luckily only in addition and not instead of a simple UI.
Comment: @TylerLangan, no, I was sketching with pencil—but I was also the colorist with crayon. :) Ha, never imagined my blog post would become the subject of a stackexchange-family site. Benny Skogbert is correct, the crux of the post is the idea of a minimum standard to include in an oven interface more so than the dial-design itself. To Jack Aidley's point, a time dial doesn't have to control a strictly mechanical wind-up timer; it could interface a logic board. Anyway, great discussion here.
Comment: Someone gave me a small (700 W) microwave with just the two knobs. Also, if the door is left open without the time knob above 0 the light does not stay on (so I can let it air out and dry). This is the best thing in the world. 99% of the time, I use the microwave to reheat a cup of coffee. Turn knob, wait a while, turn off if it ran too long, drink. I almost never use the power knob. Never run it more than 2 minutes. That is why I have a microwave, period.
Answer: One UI is analogic, the other (the failing one) is digital, that is, the appliance is a microwave-computer mongrel.
Alan Cooper, in his book "The inmates are running the asylum", teaches us that when you mix a computer with anything else, you always get a computer no matter what the anything else was.
Thus, mixing an oven with a computer, the outcome is a computer.
If you don't happen to have the Inmates book, you can read the chapter online opening the Amazon link above and following the Look inside the book link. After scrolling a lot the chapter is available, it's a highly recommended reading, somehow humorous, enlightening.
Then, back to the reasoning that tends to answer the question, IMO there are two main issues:
The first issue is that digital controls are less intuitive than analog controls. For example when you operate your mother's microwave, even for the first time, you know that turning the knobs clockwise you set a higher power level or a longer time. This is not so with the digital UI.
The other issue, an important one, is feature creep. The designers (usually engineers) try to give us more, because it's rather inexpensive, so they can solve us problems that we don't actually have.
Consider a digital UI made up of two button pairs, one pair to control power and the other to control time.
The effect of the buttons appears in a display, changing the power level gauge or the displayed time.
The UI completes with a [start] and a [stop/reset] button.
A digital UI such as this would be perfectly usable, even for everybody's grandmother (given that the labels are printed in a suitable font size).
This UI is usable by anyone because such an UI is aligned with the user's mental model.
Because, ultimately, the usable UI is the one that's aligned with the user's mental model (this concept is explained in another book by Alan Cooper, "About Face").
And an anecdotal story. I work for a software development factory, in locations populated by hundreds of people in their twenties, mostly of the nerd type.
At lunch time they avoid those microwaves of the digital type. Some kids really loathe them. The analog ones have a greater audience.
Comment: @DannyVarod Exact times are unnecessary. If I want 20 seconds, I'd rather just hit go and stand there for 20 seconds, than fiddle with some UI for 15 seconds to get the time precisely right.
Comment: @DanilAlxiuc: what is really important is the temperature of the milk, isn't it? Also, given a fixed time, the final temperature depends on the initial temperature in addition to time and power.
Parents have to touch the bottle, time settings are helpful. Ultimately the parents are responsible for the  toddler, not the microwave.
Comment: @DannyVarod, what are you microwaving for two hours?
Comment: @DanielAlexiuc If you have to heat a bottle of milk for an infant, the exact time is very important.
Comment: If you want to set a precise time, e.g. 20 secs (with microwaves, 10 secs can make a huge difference), then an analog control would make it more complicated. Especially since you need a range up to about 2 hours. This could be done with a non-linear analog control, but that would probably confuse most users.
Comment: Hi @Danny, my idea was a digital implementation of the usual well known analog UI.
Considering the issue you bring up, the digital version of the usual analog UI would have the advantage of letting the user set exact times!
Comment: @JuanLanus setting 5sec resolution for getting a drink just the right temperature would still be hard.
Comment: @SamuelEdwinWard in a plain microwave you can boil frozen vegetables in water in about 15mins. If you have an oven mode (convection) you can cook chicken in about 100 mins.
Comment: @Danny hey, we are at risk of starting recipes exchanging!  :-)  You seem to be quite an expert.
Comment: As a counterpoint: I used to love my last microwave with digital controls.  You know those ready meals you get with the directions like "microwave on full power for 3 minutes, then allow to stand for 1 minute, then on full power for 2 minutes"? I'd press (power) [100% shows up on screen] (3)(0)(0) (timer) [0%] (1)(0)(0) (power) [100%] (2)(0)(0) (start), then I could go away and come back 6 minutes later with the meal fully cooked. These days, I have an analog control machine, and have to come back half way through cooking. Sometimes the features of a computer are useful.
Comment: @Jules Quite right, once you overcome the threshold then complexity comes to help. Usability is, also, a balance between the cost of being able to use "it" against the benefits of doing so. You paid the cost of the learning rampage and reaped the benefits. Good! Sorry to read it's no more so.
Comment: For me the argument against complexity (even though it may have benefits) is this:

The primary benefit of a microwave is that using it requires less interaction from the user and takes less time than other methods.

Now if you want to be doing advanced cooking, this benefit is lost so why would you want that?

Well you may want complex and feature packed microwave if a microwave is your only tool - or if you don't know other methods.

So for us that would cook "properly" given the time, the microwave complexity works against us.
Comment: I suppose that if you mix a computer with a toddler you get a computer.
Answer: You made me think about it. My mental model is:

download bmml source – Wireframes created with Balsamiq Mockups
Please remember, it is not even UI wireframe, so forget the button sizes, fit for user expectations and all such UX stuff. Just shared a MM.
Oh, and another thing. No weighting information is intentional.
Comment: I couldn't disagree more with this answer; to me, this is what's wrong with the current trend of microwave UI. When I microwave something, I'm generally following the instructions on the packet. What if I'm reheating pasta (in your UI)? It's inherently unable to accommodate what people generally need to do.
Comment: +1 I really like this example because it makes the primary focus the *cooking*, rather than the *manipulation of  the tool*.
Comment: Are you a wegetarian? :)
Comment: I find it distrubing that people think microwave UIs fail.. I've not found a digital one I couldn't easily figure out, and even mid price range ones will have messages telling you what to do.  The most basic usage is the easier; enter in the amount of time you want and hit start.  How is that a fail exactly?
Comment: @derobert: Why do you think I should input the weighting info about a food I just put into it? Am I better at weighting? Is it too expensive to weight it in an oven? Remember UX.
Comment: "No weighting information is intentional." Ah, the fun of UX design that ignores fundamental physical realities of the system. Also, I'm surprised that you never heat things from refrigerated (but not frozen).
Comment: Wouldn't different types of fish (and sizes) cook at different rates regardless of the other settings?  So this "simple" UI is kind of fail anyway...  Hence why controlling the tool is the part we _do_ have to think about.
Comment: This wouldn't solve the most common use can I face when cooking: melting butter. Also, what about frozen dinners or popcorn or things that need a specific amount of time to cook?
Comment: @BartoszRakowski because it needs the food weight. Not sure about you, but I normally put my food in the microwave on a container (plate, bowl, etc.). That'd throw off the microwave's weight sensor, or complicate your UI (e.g., it'd need you to tare it first)
Comment: That is a drawback of a microwaves: it also heats a plate and the plate material is an influential factor. I initially focused rather on UI part of the design. Now you are pushing me deeper into redesigning a whole.
Comment: @Roddy of the Frozen Peas: ;) thats what is "advanced" for.
Comment: @Kit Grose: So, probably your mental model is different. By all means I am not implying there is only one.
Comment: @KitGrose Why didn't you downvote it if you disagree?
Comment: I like this answer because it's simple, to the point and makes you think about how a microwave oven UI could work if approached with a user-centered viewpoint instead of a microwave-centered viewpoint. It's not about whether the answer is correct in every conceivable situation, it's about whether the direction it inspires is meaningful.
Comment: @Rahul: because I think it's a valid response, just that it doesn't match my mental model or needs. It's not wrong, I just disagree with it.
Comment: If you have ever operated a regular oven, you should know, that the temperature isn't the only parameter - the cooking time is just as important. That and the vast diversity between the chemical structures and shapes of the food you put it, is why this concept just wouldn't work.
Comment: This answer is the opposite of simple and seems to be the problem that the original post talked about. All you need, in my opinion, is time input, power level (hi, medium, low), a start button and a cancel button.
Comment: My parents' microwave has these features, but they're hidden somewhere. It's all digital input, no analogue features at all. However, it also functions as a clock (digital) and as a timer (it can count down to a beep), which is quite handy in the kitchen.
Comment: If we had the tech to measure temperature remotely, that would be really neat - you'd simply say "get this to 60°C", and the microwave would fire until the content reaches 60°C.
Comment: @Jonathan We have the tech to make this! We can put a scale on the turntable. We can use an infrared thermometer to measure the surface temperature. All we need to make a perfect microwave is two sliders: "Fluid to Fluff" and "Cold to Hot". If we combine a frezer with a microwave it could even make hot stuff cold. A "macrowave". ;)
Comment: @Andy There are plenty that fail even your simple test. On my current microwave, to cook for a specific time, you must first press *power level* and then enter a time (no, not a power level!) and hit start. You can also press "add minute" to add one minute of cook time or "start" to add 30 seconds, but if you've used "add minute" you can only use "add minute" to add more time, and if you've used "start" you can only use "start" to add more time, so you can't do 1.5 minutes with "start" and "add minute". The result of all of this is that I round times to the nearest 30s and only ever use start.
Answer: To answer your question directly, I believe microwave UX is bad because people buy microwaves based on the feature list on the box (and "one-touch cooking of up to 99 different types of food!" sounds like a good thing while you're in an appliances store), and microwave computers can be engineered most cheaply if you ignore good design. Basically: as much as it drives me mental, I'm unlikely to throw away my microwave because its UX is terrible, and I'm not generally able to review the UX of a new microwave before I buy it.

More generally, microwave UX is a topic I spent some time discussing in my UX presentation Don't Cook Babies. You can watch the relevant section on YouTube. Tog also spends a little bit of time making a great point about microwave UI efficiency here.
To summarise my complaints with microwave UI:

The main way I wish to use my microwave is to put some food in it, and then follow the instructions on the food packaging itself to ascertain how long it needs to be in for. That means I generally want to enter a specific amount of time.
Manufacturers have all decided to put a bunch of pre-defined presets on the control panel instead of numbers, which I guess is great if you confine your cooking to those types of food, but means you're completely lost when you heat something that is either not one of the presets, or is a combination of multiple presets (e.g. reheating a plate with both meat and vegetables).
Most microwaves now have some kind of quick cook button, but they all tend to behave differently from microwave to microwave, so you can't ever learn how to use it reliably (as shown in the video, mine goes up by 30s increments at first, then spontaneously switches to 1m increments, then 10m increments at some point, and begins cooking immediately after first pressing the button).

To me, there are two main functions I wish to perform on a microwave:

Cook food for the time indicated on the packaging. The hardest part about this is that the packet generally says something like "cook for 3 minutes at 1,000W", and while conversion tables exist, I have no idea what power my microwave is running at, so they don't help me at all.
Defrost a certain amount of meat before cooking it. This is actually generally pretty well supported by most microwaves (although I still think they give me too many options). On my microwave I have to press "Defrost", then choose "Defrost by weight" (by moving my finger to the OK button), then type the weight in grams (moving my finger again), then press "Start" (moving my finger again).

What I literally never need to do is take a bunch of unpackaged food, e.g. "meat" and cook it for some unknown-to-me, but known-to-my-microwave amount of time (which microwaves seem to be optimising for nowadays).
To me, the ideal microwave UI would work as follows:

Provide a keypad to type in the time you wish to cook for (in minutes and seconds). If I press "Start" or just stop typing for more than, say, 5 seconds, start cooking on high for that long.
Put a weight sensor inside the microwave that can measure the weight of the food I put in it. Put a button on the front called "Defrost", that when pressed weighs the food and tells you how much it weighs in grams (e.g. 502g). You could type a different amount over the top of it if you need to (e.g. if the food is on a heavy plate), or you can just press "Start" (or walk away) and it would defrost.

Some things that wouldn't be possible on my microwave:

Manually specifying a heat level (always either defrost or high).
One-touch cooking of a variety of crazy things, including (but not limited to) healthy babies.

I think I would be able to preserve the ability to set the time but I don't value that functionality particularly highly myself (though I understand I'm apparently in the minority on that point).
Comment: The reason the microwave UI is not intuitive is because the marketing push with microwaves is all the "great" features is places at your fingertips. Back in "the day", when microwaves were new and exciting (and had dials - in the US) the entire reason for buying one was convenience. They were supposed to revolutionize the kitchen and free up the overworked housewife... etc.

That snazzy digital interface is designed to demonstrate all its "high-tech" features and sell the machine, not help you use it.
Comment: Yes, my combi microwave/grill/oven does 1,2,3,...9,10, 15, 20, ...Really frustrating for all the pre-made stuff that says heat for 12 or 14... I mention that half because it's bloody irritating and half because if designing a standard for microwaves, it needs to support microwave/oven/grill combos too.
Comment: Well, you could have it as a specific option. Or if most packages say "microwave on high" and mean 1000, just make your "high" setting 1000, and if it goes to eleven make it "extra high" or "super high" or something.
Comment: @yisela thanks, but I don't have any studies to cite and back up my opinion, so I simply added to this answer which talks to my point at the beginning ;-)
Comment: @TRiG: I'm aware of people using their microwave for that purpose, but I'm not sure it's a significant enough use-case to justify sacrificing simplicity for. I guess I'm OK with customers needing a separate egg timer (perhaps my fictional kitchen appliance design company will sell them together as a package).
Comment: "That means I generally want to enter a specific amount of time." - no, what you _actually_ want is the amount of time that is equivalent to the amount of time on the packet at (usually) 1000W. Why can't microwaves do _that_? - er, yeah, I see you mentioned that right below. Sorry
Comment: @ph33nyx That was the best answer I've read, why don't you post it as such?
Comment: @Random832: do you think users would freak out (at least a little) if they asked the microwave to cook for 5 minutes and it stopped after 3? That's the reason I wasn't sure I'd design it that way.
Comment: @Random832: now *that* is a good idea (adding heat levels _above_ high).
Comment: The one thing you've left out is the ability to enter a specific amount of time and **not cook** for that time, just beep at the end of it. My parents' microwave is very commonly used as an egg timer and for various similar kitchen-related functions.
Comment: @KitGrose "I have no idea what power my microwave is running at" -- really? Every microwave I've ever seen has a label like [one of these](http://images.knowhow.com/Kitchen%20Appliances/heating-categories.png), somewhere close to the "start" button, or on the door.  Do you not have one?
Comment: @Jules nope, never seen that label. Where are you from? Could be an EU or similar thing?
Comment: Possibly, I'm in the UK.  Seems like such an obvious thing to include, it amazes me that there aren't equivalents everywhere.
Answer: I worked on the UI of the Microwave in the photo.
The problem is in order to sell product the Sales & Marketing are convinced you need features. More features = good. (Increased selling price).
So as an Engineer how do you add Auto cook, auto defrost & selection of other features whilst keeping thing simple. Some Models you also have sell worldwide so no English text is allowed. You have to use symbols.
For basic cooking on the Oven shown, you rotate the dial to the time you want & hit the start button.
Or keep hitting the Start+30 until you get the time you want.
If you want more advanced features you can start to use other keys. Belive it or not there are some people out their who use their microwaves for serious cooking & want the extras.
We have tried to keep the basic controls, seperate & simple to use, But in the end the best you get is a control panel like edgarator's.
A couple of buttons people use and lots of them they don't.
Comment: +1 That's a great answer. I didn't notice the marketeer aspect of things, which we, consumers and users, feel is great in order to pay a higher price. Thanks, and welcome to UX.SE andye!
Comment: Always great to have the people actually involved in the design to answer the question, because it is very easy to be critical without knowing the whole story and realizing the different competing pressures that result in the final design. As for microwaves with better features outselling ones that are easier to use - I think the jury is still out on that one...
Comment: I came to this question after visiting the US and being amazed why they make microwave ovens so complicated there.  The answer, as I suspect, is not engineers, but *Sales & Marketing*.  So happy my own microwave has exactly the two dials it needs (power and time).
Answer: How about:

Originally for temperature cooking, I put that a temp probe might be useful, but it would be even better if the microwave could automatically detect the temperature of the food without you needing to hook up sensors to it.  Maybe it could somehow measure the thermal radiation of the food as it cooks to get an accurate reading...  Also, it would be nice to have an estimated time till the food is completed, so that you can bump up/down the power level if you want your food to be ready at a certain time, or maybe reverse that and tell the microwave "I want my chicken to be 165 degrees by 6:30pm, now make it happen microwave!".
Comment: I would hate a modal knob. I just know I'd end up twisting it in the wrong mode. Two knobs would be easier to use and take up about the same amount of space.
Comment: They make microwaves with temperature probes. Or at least did at one point, my parents had one 20 years ago...
Comment: @derobert: Did the microwave shut off when it got to the temperature you wanted to cook your food to?  If so: SWEET, I want it!
Comment: @Briguy37 yes, that's how it worked. Google tells me they still make them. Of course, microwaves often heat unevenly, so...
Comment: @BryanOakley:  That's true, although I'm not sure about it taking up the same amount of space since you'd still need the ability to select which cooking mode you are using.    Maybe instead of a single "Start" button you could put your "Cook By" "Time"/"Desired Temp" buttons there.
Comment: Answer updated based on the above comments
Comment: The desired temperature function would require sticking one or more probes into the food, since the temperature of the food is not uniform over its volume. Also, you might want the food to remain at that temperature for a specific amount of time.
Answer: The big problem with the dial approach suggested by Micah Wittman and quoted by you is that the dials can be inaccurate - mainly because they were originally a mechanical device. There are a number of issues that this raises:

You wind the dial to 30 seconds (say) but you might not get it exactly right and it could be anything from 27 to 33 seconds (for example).
Then as the dial winds down to zero it might actually take more or less time than it was set to.
When it hits 0 a mechanical switch has to trip to turn off the oven. This takes time.

As the dial wears through use the potential error can build up, and you end up with food that's either undercooked (hasn't killed any bacteria, has cold spots) or overcooked (impaired flavour, hot spots that can burn).
The digital timers are a response to this, whether they are ones where you enter the times directly or turn a dial to update the time.
This isn't to defend the current designs - they could be better - but it's an explanation of where we are today.
What's required is to translate the physical act of turning a dial into something that sets a digital timer to an exact value and rather than controlling the countdown responds to it. Something like a touch screen that mimics the dial might be a workable solution.
Comment: While this is true if the dial were purely mechanical, it doens't need to be: there is a dial in the centre of the interface panel Benny posted and it's digital.
Comment: There's no reason why a mechanical dial can't control a digital timer. You might still have the issue of hitting 30 seconds precisely, but it seems reasonable that for times <= 30 seconds, increments of 5 seconds seems very reasonable. Who has _ever_ purposefully set a microwave to 27 seconds? If the mechanical dial says 27, simply round the digital up to 30.
Comment: @BryanOakley - no there isn't. But the **early** dials were mechanical
Comment: @BryanOakley Since you asked, I set microwaves to the second, if I cook the same food a lot I adjust based on past results, down to one second increments.  It probably has little effect but it takes the same amount time to hit any 2 buttons, so why not?
Comment: @BryanOakley I have, on my parents' microwave, when warming milk to create hot chocolate.  The microwave worked well, _if_ you got the power and time correct to within about a 2 second window - that didn't align with multiples of 5.
Comment: Dials that operate on very tight or non-linear scales must be a difficult UI for blind/low-vision users too (compared to braille on buttons, for instance).
Comment: @psr you can hit the same button twice much faster than a number then zero. So, I just press 22 for about 20 seconds, 55 for about 50. Variations of size of food will swamp out any difference that 10% of time would make. Using large microwave (<1000 W) for small food items is tough. Small unit (500-700 W) is far more useful for reheating things! To boil water for tea, I just press "Popcorn" (about 240 sec) and it works great. Precision is not necessary.
Answer: I don't understand what's wrong with the number pad and a power setting. Sure it doesn't cook turkey breast with a button, but neither does the turkey button. Anyone who has used a mid-low range microwave knows those buttons are nearly worthless. Why not satisfy peoples need for marketing with an "AUTO" button, which tries and fails to cook EVERYTHING. Rid the micro of all the extra buttons, give the sales a marketing gimmick, and the customer peace of mind.
Is it unethical? Probably. Any more than multiple buttons that don't work? no.
Comment: The compromise I've seen is to dual purpose the number pad.  Under each number label is a lightly colored label for a specific food.  I have no idea how to use these features, but they're there :)
Comment: Maybe just a single, monolithic button labeled: *Try not to burn the crap out of it!*
Answer: I agree with the sentiment of this question. I own a combi microwave oven that can also function as a hot-air oven and as a grill, and the operation is not easy at all.
But even if I limit myself to the microwave functions, there are many issues. There are modes for defrosting stuff, but the selection is using some arbitrary number that I have to look up (the food-types corresponding to the numbers are printed on the edge of the oven door...) and I always have to put in the weight I put in. Then, if I just want to operate manually, I actually have a dial available for the time and power, but it is the same dial. I have to use a button to switch if the dial operates the power or the time, and I can't see both at the same time. So, plenty of problems there...

My ideal microwave
I think my ideal microwave would support these use cases:

Follow the recipe kind of operation, so set a time and power accurately. I don't want to mess with conversion tables. If the device physically can't handle the given power, let it do the adjustment for me, but don't make me do the math. Use separate inputs for time and power, and show both.
Heat to a specific temperature. For instance, I have a baby, and I'd like to have the formula heated to 37 degrees C, no matter how cold it was when I put it in or how much is in the bottle.

That's really it. Defrosting is just heating to a set temperature. For quick operation, perhaps a set of pre-set, often used temperatures would be useful. I'd like the oven to do the work as much as possible, including measuring the temperature of whatever I put in as well as measuring the rate and evenness of the heating so it can adjust the power it uses or instruct the user to stir the food if needed. That should avoid needing to input the type of food I put in.
Comment: Maybe the microwave could read QR codes and "make it so"? What a tangled Web we weave...
Answer: I really like microwaves with an interface like this, I remember when I started looking at these in houses, I got amazed with the wittiness of the designers...

download bmml source – Wireframes created with Balsamiq Mockups
Need 2 minutes -> press +1 Minute, +1 Minute Start or Start 4 times...
I've never come across something like, "Microwave for 2:48" so pretty much, no one really ask you for fractions, it's either, 1 minute, 2 minutes, 3 minutes, 5 minutes or 10 minutes...
The logarithmic approach works best for me, and the quick start button makes wonders...
Comment: How about just the blue and red buttons?
Answer: I am astounded no one has mentioned the most useful button (and the only one I use besides opening the door) on the microwave, "add one minute and start" button, everything else is supplementary.
If a microwave UI has this button it gets a pass, if it has a button to read my mind and also analyse what substance has been loaded into it to calculate the time and power to run at but doesn't have this button, then it's a bad UI.
Answer: Top 4 reasons why microwave UIs fail:
1.) They are not designed to be USABLE, they are designed to be MARKETABLE based on comparison of feature lists.
2.) The people who design products like this A.) almost NEVER watch real users try to use the product in the environment / scenarios the product will be used in, and B.) on the rare occasions UX observations ARE part of the design process programmers and designers frequently have no empathy for users and tend to "explain away" the user's struggles.
3.) Products with digital controls and UIs are "computers" and run on software. Software is designed for the convenience of programmers, not for the convenience of users. (Read "The Inmates are Running the Asylum" by Alan Cooper. It's still the rule rather than the exception).
4.) Good UX is difficult and expensive, ESPECIALLY for embedded system designers. Who on the team of microwave designers is an expert in human cognitive processes? In my experience it's highly unlikely that even ONE person on such a team has ANY training, interest or experience in human cognition.
Read "Plans and Situated Actions" by Lucy Suchman. It's a hard read, but she nails the disconnect between programmers and UX.
<><>
I found this article while looking for a decent quality microwave with simple controls. I've searched for 40 minutes. I think no such thing exists. It should be so easy:

Two "soft" dials:
• Time, with a digital display to indicate exactly how much time is set/remaining.
• Power, with a digital display to indicate the % power in 10% increments.
• Variable ratio: turn slowly for small, faster for large increments
One lighted button: hit Green to go, Red to stop

If the product manager wants to add a bunch of garbage buttons, presets, programs and sensor controls go ahead if you must. But if the simple controls above are included (and visibly grouped on the panel) the microwave will be easy to use.
Comment: Make the people who design and build the product use it.
Answer: Personally, I am a fan of the two-dial variant, mainly because most microwaves I had were still stupid machines where a complex UI would just fake a complex device, that they are not. So what about newer and upcoming microwaves that are really "high-tech"? Would they demand a complete UI makeover?
I recently saw this microwave at an electronic store (which represents my personal worst case in microwave UIs). Apart from the membrane buttons, which by the way had no tactile feedback at all, we are presented a grid of seemingly unarranged control elements. Above all, the user is deprived of a conventional time and power selector. Instead he gets three different "Auto" setting and the possibility to enter the weight (?) of the meal.
While the microwaving system itself might be cleverly designed and the auto features are working as they should, the poor UI makes it very hard to trust the backend. And when you have no control of the cooking parameters, you HAVE to have faith in the automatic.
Maybe the two-knob version is already obsolete, but modern devcies that could use more suitable UIs should still communicate the feeling of the simple machines that microwaves once were.
Comment: I disagree strongly, that interface is remarkably free of cruft for an interface that's controlling three separate devices. It also has very standard time control buttons. I'd feel comfortable using it, and I don't even speak the language it's written in. On the other hand, I've never encountered a microwave with a wheel on it, so it might be I have a different user model to you.
Answer: The real problems are:

All the automated modes that don't work. Ovens don't have them and people don't get confused.
The microwaves with analog wheels that have more than one function or some non-standard function. - The wheel, if any, should control either the time or the power, not both and not the mode/function.
Small or hidden start/stop buttons - these should be the largest buttons and next to each other, either at the top, or better yet - at the bottom (since they are already there in many usable models).

A microwave should have a clean, simple UI:

Optional - For combined devices (e.g. MW+Grill+Oven) - Select mode (if not default = Microwave).
Optional - Select power (if not default = MAX).
Select duration.
Start

Also, microwaves should have a pause/cancel button, enabling the user to stop the cooking and then continue with the start button or the cancel the cooking.
An additional useful feature could be increase/reduce time (without waiting for operation to end).
The duration has to support fine resolution for short durations e.g. 10sec, 15sec, 20sec and etc. and long durations. This is hard to implement with an analog dial, especially since the user needs accurate feedback.
If the duration is not set with a dial, it should have a numberpad (assuming physical buttons are used), not +/- buttons which can take a lot of presses to get right.
The mode, power and duration should not use the same controls.
The controls should have clear labels (e.g. no icons that no one understands and no text that is poorly translated).
If the microwave has different modes, then the power should have separate controls per mode (e.g. 250W, 500W, 750W, 1000W for MW vs 100-250 degrees for oven vs upper/lower/both for grill).
Comment: I kept puzzling over the use of "100 degrees" on this and other answers, until I realized that you-all are not in the US. (Otherwise, why heat food to barely above room temp?)
Answer: The reason why microwave oven are so complicated is due to the competitive features that each manufacturer puts out to out-do one another. More features means more buttons and options.
It doesn't matter how useful or user-friendly that feature is, as long as it is unique and adds an additional tick on the box.
I doubt if anyone ever used the "Cook frozen chicken" or "Boil corn soup" feature (or any other advanced options like that) with their microwave ovens.
In my opinion, a microwave that offers basic Timer + Heat Level setting is the best. Anything more is just useless and makes the interface harder to use.
Comment: I've always believed that it's the job of a ux professional to take the feature set a device/product has, and create an interface that makes it intuitive. Claiming something has "too many features" is just abdicating our responsibility as an interface designer. WE go to war with the featureset we have, not the featureset we would have preferred, and we're damned well supposed to defeat the enemy anyway.

Why do Microwave oven UIs fail?


Recovering a half-encrypted disk

Question: Recently I filed a bug against what, from my perspective, was a majorly annoying bug with the Ubuntu installer.
It would appear, however, that my troubles installing Ubuntu are not related to Ubuntu but rather that when trying out an installation of Manjaro Linux a few days ago, I accidentally selected "Encrypt disk" and "Use LVM", and I assumed that a simple fresh partition table would make the encryptedness go away.
Now that I've tried to install Ubuntu 14.04 with Ubiquity crashing in the same place, I see that there's obviously an error with the disk in some way.
It's not physically damaged, as far as I can tell from the SMART status (included below), and gparted doesn't complain about IO errors formatting or writing the disk.
I've also verified the hashes and integrity of all the many LiveCDs I used.
Assuming that the encryption is the issue, what can I do to recover my disk so that Ubuntu will install? Do I write every sector full of zeroes? (Wouldn't that take days?)
If encryption isn't the issue, what is?
Assuming encryption isn't the issue, what is?

here's smartctl -a /dev/sda, yielding, as expected, no errors:
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-24-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     SanDisk SDSSDA240G
Serial Number:    153655402044
LU WWN Device Id: 5 001b44 ed2285a3c
Firmware Version: U21010RL
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-2 T13/2015-D revision 3
SATA Version is:  SATA >3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Dec 26 21:37:31 2015 EST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM level is:     254 (maximum performance)
Rd look-ahead is: Disabled
Write cache is:   Enabled
ATA Security is:  ENABLED, PW level MAX, not locked, frozen [SEC6]
Wt Cache Reorder: Unavailable

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:        (    0) seconds.
Offline data collection
capabilities:            (0x71) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0002) Does not save SMART data before
                    entering power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    (  10) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  5 Reallocated_Sector_Ct   -O--CK   100   100   000    -    0
  9 Power_On_Hours          -O--CK   143   100   000    -    143
 12 Power_Cycle_Count       -O--CK   100   100   000    -    833
166 Unknown_Attribute       -O--CK   100   100   000    -    1
167 Unknown_Attribute       -O--CK   100   100   000    -    0
168 Unknown_Attribute       -O--CK   100   100   000    -    12
169 Unknown_Attribute       -O--CK   100   100   000    -    46
170 Unknown_Attribute       -O--CK   100   100   000    -    0
171 Unknown_Attribute       -O--CK   100   100   000    -    0
172 Unknown_Attribute       -O--CK   100   100   000    -    0
173 Unknown_Attribute       -O--CK   100   100   ---    -    7
174 Unknown_Attribute       -O--CK   100   100   000    -    57
187 Reported_Uncorrect      -O--CK   100   100   000    -    0
194 Temperature_Celsius     -O---K   061   100   000    -    39 (0 52 0 0 0)
199 UDMA_CRC_Error_Count    -O--CK   100   100   000    -    0
230 Unknown_SSD_Attribute   -O--CK   100   100   000    -    0
232 Available_Reservd_Space PO--CK   100   100   004    -    100
233 Media_Wearout_Indicator -O--CK   100   100   000    -    1872
241 Total_LBAs_Written      ----CK   253   253   000    -    1687
242 Total_LBAs_Read         ----CK   253   253   000    -    891
                            ||||||_ K auto-keep
                            |||||__ C event count
                            ||||___ R error rate
                            |||____ S speed/performance
                            ||_____ O updated online
                            |______ P prefailure warning

General Purpose Log Directory Version 1
SMART           Log Directory Version 1 [multi-sector log support]
Address    Access  R/W   Size  Description
0x00       GPL,SL  R/O      1  Log Directory
0x01       GPL,SL  R/O      1  Summary SMART error log
0x02       GPL,SL  R/O      1  Comprehensive SMART error log
0x03       GPL,SL  R/O      1  Ext. Comprehensive SMART error log
0x04       GPL,SL  R/O      8  Device Statistics log
0x06       GPL,SL  R/O      1  SMART self-test log
0x07       GPL,SL  R/O      1  Extended self-test log
0x09       GPL,SL  R/W      1  Selective self-test log
0x10       GPL,SL  R/O      1  NCQ Command Error log
0x11       GPL,SL  R/O      1  SATA Phy Event Counters
0x30       GPL,SL  R/O      9  IDENTIFY DEVICE data log
0x80-0x9f  GPL,SL  R/W     16  Host vendor specific log
0xe0       GPL,SL  R/W      1  SCT Command/Status
0xe1       GPL,SL  R/W      1  SCT Data Transfer

SMART Extended Comprehensive Error Log Version: 1 (1 sectors)
No Errors Logged

SMART Error Log Version: 1
No Errors Logged

SMART Extended Self-test Log Version: 1 (1 sectors)
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

SCT Commands not supported

Device Statistics (GP Log 0x04)
Page Offset Size         Value  Description
  1  =====  =                =  == General Statistics (rev 2) ==
  1  0x008  4              833  Lifetime Power-On Resets
  1  0x010  4              143  Power-on Hours
  1  0x018  6             1687  Logical Sectors Written
  1  0x020  6         67940491  Number of Write Commands
  1  0x028  6              891  Logical Sectors Read
  1  0x030  6         42663463  Number of Read Commands
  2  =====  =                =  == Free-Fall Statistics (empty) ==
  3  =====  =                =  == Rotating Media Statistics (empty) ==
  4  =====  =                =  == General Errors Statistics (rev 1) ==
  4  0x008  4                0  Number of Reported Uncorrectable Errors
  4  0x010  4               57  Resets Between Cmd Acceptance and Completion
  5  =====  =                =  == Temperature Statistics (rev 1) ==
  5  0x008  1               39  Current Temperature
  5  0x010  1             -110  Average Short Term Temperature
  5  0x018  1             -124  Average Long Term Temperature
  5  0x020  1               51  Highest Temperature
  5  0x028  1               10  Lowest Temperature
  5  0x030  1             -110  Highest Average Short Term Temperature
  5  0x038  1                1  Lowest Average Short Term Temperature
  5  0x040  1               -1  Highest Average Long Term Temperature
  5  0x048  1                0  Lowest Average Long Term Temperature
  5  0x050  4                0  Time in Over-Temperature
  5  0x058  1              100  Specified Maximum Operating Temperature
  5  0x060  4                0  Time in Under-Temperature
  5  0x068  1                0  Specified Minimum Operating Temperature
  6  =====  =                =  == Transport Statistics (rev 1) ==
  6  0x008  4             4442  Number of Hardware Resets
  6  0x018  4                0  Number of Interface CRC Errors
  7  =====  =                =  == Solid State Device Statistics (rev 1) ==
  7  0x008  1                0  Percentage Used Endurance Indicator

SATA Phy Event Counters (GP Log 0x11)
ID      Size     Value  Description
0x0001  2            0  Command failed due to ICRC error
0x0002  2            0  R_ERR response for data FIS
0x0003  2            0  R_ERR response for device-to-host data FIS
0x0004  2            0  R_ERR response for host-to-device data FIS
0x0005  2            0  R_ERR response for non-data FIS
0x0006  2            0  R_ERR response for device-to-host non-data FIS
0x0007  2            0  R_ERR response for host-to-device non-data FIS
0x0008  2            0  Device-to-host non-data FIS retries
0x0009  2            0  Transition from drive PhyRdy to drive PhyNRdy
0x000a  2            4  Device-to-host register FISes sent due to a COMRESET
0x000b  2            0  CRC errors within host-to-device FIS
0x000d  2            0  Non-CRC errors within host-to-device FIS
0x000f  2            0  R_ERR response for host-to-device data FIS, CRC
0x0010  2            0  R_ERR response for host-to-device data FIS, non-CRC
0x0012  2            0  R_ERR response for host-to-device non-data FIS, CRC
0x0013  2            0  R_ERR response for host-to-device non-data FIS, non-CRC

Comment: You're correct. Writing a new partition table to the drive should get rid of any interference with previous partitions or data. I don't believe that the (half-)encrypted partition is related to your installation issue. Did you [verify the integrity](//help.ubuntu.com/community/HowToMD5SUM) of the disk image(s) used as source to create the installation media? Did you verify the integrity of the installation medium itself with the appropriate boot menu option?
Comment: @DavidFoerster I did indeed both verify the md5 and check the integrity at boot of each live cd of the pile that i've used.
Comment: Thanks. It would be best to clarify that in your question for future readers, since it's the first go-to for installation issue. It's best to have everything relevant in one place. **:-)** Also, comments may be deleted for various reasons. Unfortunately I don't have any other suggestions on the issue to offer.
Answer: At this point what I would recommend is a full wipe of the drive. As a disclaimer this really does a full wipe making anything there impossible to recover!  For HDD's you'd use dd if=/dev/zero of=/dev/sdX but appears you've got an SSD so it's a tad more involved.
Start by checking that security is not enabled (FYI: this all must be done as root/sudo and I'm using /dev/sda as that's what your output above shows.  You can replace that with whatever the drive in question is.):
# hdparm -I /dev/sda
[...truncated...]
Security:
    Master password revision code = 65534
            supported
    not     enabled
    not     locked
            frozen
    not     expired: security count
            supported: enhanced erase
    2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.

That not enabled line means we can proceed with ease, we now enable security:
# hdparm --user-master u --security-set-pass tempPassword /dev/sda

The password doesn't matter it'll be cleared too. Let's do a quick sanity check to make sure that worked.
#hdparm -I /dev/sda
[...]
Security:
    Master password revision code = 65534
            supported
            enabled
[...]

It now says enabled, so we can now perform the actual wipe:
# hdparm --user-master u --security-erase tempPassword /dev/sda

One last sanity check with # hdparm -I /dev/sda should reveal a not enabled like in the first check.
Reference: What is the recommended way to empty a SSD?
Comment: The command failed for *me* on *my* Toshiba, with all the OEM BIOS (from 2012) passwords enabled. Works On My Machine™, but maybe not so much for other machines.
Comment: Awesome thanks, that is helpful. I imagine that you're not the only one where a BIOS password on a disk could cause these issues. Although usually by the time you're making changes to a disk it is unlocked so this is definitely interesting.
Comment: I actually solved the problem on my own; it was because the SSD was password-protected! However, you are sorely in need of rep and I greatly appreciate your effort, so congrats! :D
Comment: It should be noted that the command to set the password for the SSD will fail with an Input/Output Error if there's a hardware password on the disk.
Comment: First, thanks. Second, now I'm curious you're saying the above command would fail if there is a password set... where? bios?

Recovering a half-encrypted disk


NoSuchMethodError using Google Endpoints

Question: I am creating an Android app using Google App Engine. In order to use GCM (Google Cloud Messaging), I have created a GCM module in Android Studio. This module provides a sample code that registers devices in the Datastore.
All was working well yesterday, and although nothing changed, I have this error when I try to register my device :
java.lang.NoSuchMethodError: com.google.appengine.api.datastore.Cursor: method <init>()V not found

I don't know what exactly means the notation <init>()V, but I found the Cursor class to be generated by the Google plugin of Android Studio, here :

This is the decompiled code inside Cursor.class :
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.google.appengine.api.datastore;

import java.io.Serializable;

public final class Cursor implements Serializable {
    private String webString;

    public Cursor(String webString) {
        this.webString = webString;
    }

    public String toWebSafeString() {
        return this.webString;
    }

    public static Cursor fromWebSafeString(String encodedCursor) {
        if(encodedCursor == null) {
            throw new NullPointerException("encodedCursor must not be null");
        } else {
            return new Cursor(encodedCursor);
        }
    }

    public boolean equals(Object o) {
        if(this == o) {
            return true;
        } else if(o != null && this.getClass() == o.getClass()) {
            Cursor cursor = (Cursor)o;
            return this.webString.equals(cursor.webString);
        } else {
            return false;
        }
    }

    public int hashCode() {
        return this.webString.hashCode();
    }

    public String toString() {
        return this.webString;
    }
}

Finally, this is my build.gradle :
// If you would like more information on the gradle-appengine-plugin please refer to the github page
// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
    }
}

repositories {
    jcenter();
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'

sourceCompatibility = 1.7
targetCompatibility = 1.7

dependencies {
    appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
    compile 'com.google.appengine:appengine-endpoints:1.9.18'
    compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
    compile 'javax.servlet:servlet-api:2.5'
    compile 'com.googlecode.objectify:objectify:4.0b3'
    compile 'com.ganyo:gcm-server:1.0.2'
}

appengine {
    downloadSdk = true
    appcfg {
        oauth2 = true
    }
    endpoints {
        getClientLibsOnBuild = true
        getDiscoveryDocsOnBuild = true
    }
}

Because I changed nothing in the concerned code, I really can't understand what happened and I found nothing useful on the web.
Thank you in advance for your help.
Edit : StackTrace from the backend log
Answer: It's looking for the empty constructor : method init()v not found
It appears this could be because Cursor.java is pulled from your <module>/build/classes/main (or <module>/build/exploded-app/WEB-INF/classes/main), when really it should just be pulled in from a library appengine-api-1.0-sdk-<version>.jar.
Have you added the source for a Cursor.java into your project src folder somehow? The App Engine build creates a runnable build at <module>/build/exploded-app and the cursor class is usually sourced from <module>/build/exploded-app/WEB-INF/lib/appengine-api-1.0-sdk-<version>.jar
Comment: In fact, the App Engine module used to generate the class `Cursor` as you can see in my post. However, when I looked the real class inside the SDK, it was a totally different code (with the constructor).

I tried to remove the generated class and to build the project, but everytime it was re-generated.

The only solution I found was to update to the new SDK `1.9.20`. Not the class is not generated anymore, but I still don't understand this behaviour. Thank you for your comment.
Comment: That's very strange, it does not do that for my installation using 1.9.18.
Comment: Yes, I haven't found any similar issue. I assume this is a configuration problem, or a conflict problem, as I work with shared sources.
Comment: If it's not too much trouble, can you try with a clean build and 1.9.18? Usually something like `./gradlew clean assemble` or maybe just delete the `/build` directory and try again? I suspect that the Cursor class ended up in there some how and was never cleaned out.
Comment: Before updating to `1.9.20` i've tried your two solutions. That's why I choosed the "radical" solution. :)


Difference in declaring public and private variables in a C# class

Question: I have an example as follows:
public static String DocNum
{
    get;
    set;
}

private static String DocNum2;
public static String DocNum2GetSet {
    get
    {
        return DocNum2;
    }
    set
    {
        DocNum2 = value;
    }
}

I was wondering if one declaration benefits the other. Simple question, hoping for a simple answer.
Comment: I believe the first is shorthand only available in .NET 4.0 or newer.
Answer: There is no difference in usage; it's just that the first code is neater and therefore easier to write and read.  The second code is required if you need to add any extra code, e.g. validation or raising an event in the setter.
Answer: In the second case, you are providing consistent API, where you can later modify the underlying structure without having to have consumers change their code.
For example, right now you are storing DocNum2 in a private string.  You could later modify this to go get that data from a file or some other resource and the consumer of the code would be none the wiser.
Answer: The first example is referred to as an Auto-Implemented Property. It's shorthand for a full property which is the second of your examples. It's valid in C# 3.0 and later.
It's often sufficient but if you need custom logic or validation the full property is usually what you'll use. You'll also use the full property when doing things that implement INotifyPropertyChanged.


What's the best practice for handling old events when generating subscribable ICS files?

Question: I have a script whose output is an ICS file that my friends and I subscribe to in our various calendar applications.
The script generates a "fresh" calendar each time, and only has events that take place in the future.
Since this script is only for my personal use I am not overly concerned, but it make think - Is this poor practice?
If I had my script parse the ICS file, add new events, and then write it back to the file, would it not grow very large over time, and with more and more users over time it will cost more in terms of bandwith.
How do the professionals handle this? What is considered best practice?
Answer: I don't know that there is a 'best practice'.
Google always issues the old events and I don't think has an option for future events only.  This can be very annoying - the whole lot has to be parsed!
Some apps allow one to request future events only.
I think apps do what makes sense for their calendars.  If it's a calendar of upcoming fixtures, do they really need the history?
Answer: Creating a REST-based backend using ical4j, I faced the same problem.
I looked at various providers of ICS information.
All of them provided events within a one-year range, including all old events. This has the up-point, that the ICS file does not change frequently and can be cached.
Sure, the file has to be parsed, but transmission time (or lack thereof, due to caching) is dominating.


How do I remove the fitting for this drain so that I can fit a base cabinet over top?

Question: Let me start by saying I'm in no way a plumber, but I know some basics to get by and hoping this is something I can tackle myself. I just want to make sure I know what materials I'm dealing with, what fittings I would need, and any potential problems I may face before they happen.
I just demo'd my kitchen and was left with this drain pipe that connected my garbage disposal to the drain. Im hoping I can disassemble it enough so that I'm left with a straight pipe so I can get the new base cabinet in easily when the time comes.
This house is over 100 years old, so I believe this may be cast iron? Does that look correct? It also looks like it may be a little corroded. How would I go about getting this fitting off without having to cut the pipe? Would I use heat the same way I would for a copper pipe? Is there then a specific kind of fitting I would need to reattach a pvc pipe to it?
Answer: The house might be 100 Yr old but the pipe installation was made from copper using soldering.
It does not look like cast iron pipe, more like heavily oxidized copper.
Regular copper soldering tools should work. Give it a test with some sand paper removing the patina to see.
What gives it away ? The pipe thickness is more like copper than cast iron which would be much thicker.
A magnet would stick to cast iron but not to copper.
Comment: Thank you, I will try the magnet method and torch. Yeah that electrical cable isn't in the most ideal spot. I have an electrician coming out to redo everything this week, so I'll wait until he has that moved.
Comment: Totally agree, +1 from me as the magnet from the solution would help the OP in identification of the metal.
Comment: To the OP - if you get yourself a small propane torch to unsolder that pipe (as opposed to just cutting it), make very certain that the yellow cable is kept *far away* from the heat! (and remember that the pipe itself will also get hot enough to melt/burn the cable insulation)
Answer: Taking the copper apart is unnecessary extra work.
Unless you want to practice your sweating technique, just cut the vertical pipe high enough to have at least a couple of inches sticking up through the floor of the cabinet.
Then use a proper sized Fernco fitting to attach new PVC to the copper. The shielded type may be overkill, but it is insurance if you have aggressive people that indiscriminately shove things under the sink. In most areas the shielded connecters are allowed inside walls. You don't have that situation, so you have gone above and beyond.
In my area inspectors allow fernco when connecting dissimilar materials. However they don't allow the flexible or Fernco P-traps.
If you un-solder and reconnect the copper elbow and pipe, you are still tasked with connecting to PVC for the rest of the drain. Shark bite and other larger sized fittings to make that connection are difficult to find. Take the easy route.
Comment: @Dylan L, YW...often after installing a new cabinet,  plumbing things don't line up. This gives you the opportunity to make everything fit correctly.
Comment: Thank you! This is just what I was looking for. I hadn't posted the rest of the pipe situation since I was only allowed one photo, but there is a connection to plastic already made where it attached to the garbage disposal. I was hoping maybe I could still keep that intact and reattach once the base cabinet is installed, but if it's easier to just cut the pipe, I can do that instead. https://i.imgur.com/JwWBLY5.jpg