RxJava's Observable class has plenty of methods that can be used to transform the stream of emitted items to the kind of data that you need. Those methods are at the very core of RxJava and form a big part of it's attraction. But there are other methods, that do not change the stream of items in any way - I call those methods side effect methods.
As a brief note to self, when you need to debug a chain of RxJava Observable method calls, you can use the
doOnNext method to log the current values or print them to STDOUT or STDERR with
println. Here’s an example from RxJava For Android Developers, where the debug output is logged with the Android
When I woke up last night it was a little windy outside, so I decided to unplug my MacBook Pro because the power tends to flicker here. When I picked up the MacBook I noticed that it was very warm, even though the lid was closed and it was in sleep mode. This morning I decided to dig into the “Why is my MacBook hot even though the lid is closed and it’s in sleep mode” question.
Android FAQ: When is the Android Fragment
onCreateOptionsMenu method called?
I was just working through a problem with an Android Menu and MenuItem, and added some debug code to the methods in my Android Fragment, and found that the
onCreateOptionsMenu method is called after
onStart. I didn’t put Log/debug code in every activity lifecycle method, but for the ones I did add logging code to, the specific order of the fragment method calls looked like this:
I needed to use Gnuplot a little bit over the last few days, mostly to create 2D line charts, and these are my brief notes on how to get started with Gnuplot. If you haven’t used it before, it’s a pretty amazing tool.
Jumping right in ...Back to top
Use MacPorts or Homebrew to install Gnuplot on Mac OS X systems:
port install gnuplot brew install gnuplotBack to top
Sample data files
My examples use the following 2-column and 4-column data files:Back to top
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.12, “Resolving Problems by Getting an SBT Stack Trace.”
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.13, “Setting the SBT Log Level.”
You’re having a problem compiling, running, or packaging your project with SBT, and need to adjust the SBT logging level to debug the problem. (Or, you’re interested in learning about how SBT works.)
Set the SBT logging level in your build.sbt file with this setting:
This article titled, Little things I like to do with git, has a fun series of git commands.
If you need to dump the contents of an array to the Android Log (Logcat) output, I can confirm that this approach works, at least with simple arrays of integers and strings that know how to print themselves:
If you’re trying to print more complicated arrays of custom objects you’ll probably need to implement good
toString methods on those objects, and then this technique should work.