Measuring ElasticScheduler with micrometer? - project-reactor

Is there any way to measure how ElasticScheduler utilities it's thread pools? I've went through code but I haven't seen any straightforward option to do it.

You can use method enableMetricson Schedulers class.
https://projectreactor.io/docs/core/release/api/reactor/core/scheduler/Schedulers.html#enableMetrics--

Related

How to set optuna's study.optimize verbosity to 0?

I want to set optuna's study.optimize verbosity to 0. I thought optuna.logging.set_verbosity(0) might do it, but I still get the Trial 0 finished with value .... updates for every trial
What is the correct way to do this? Unfortunately, extensive searching through the docs still only results in the above method.
Many thanks in advance
Try this:
optuna.logging.set_verbosity(optuna.logging.WARNING)
It basically changes the level of verbosity.
For more level choices, check optuna's official guides here.
optuna warnings tend to be raised using standard pythonic warnings.warn() (which explains why optuna.logging.set_verbosity() does not always work to suppress them), so you can silence them all at once with:
# treat all python warnings as lower-level "ignore" events
warnings.filterwarnings("ignore")
Be aware however, that this will silence also the useful and infrequent ones like deprecation warnings.

Is there a way to control dry/wet balance of AKOperationEffect?

In an attempt to smooth out crackling/zippering when changing parameters on an AKDelay, I switched to using AKOperationEffect. However, unlike AKDelay, AKOperationEffect has no dry/wet mix parameter. How do I change it?
I wound up composing a wrapper class with an optional AKDryWetMixer node that I just use for cases where the effect needs an additional dry/wet mixer (as is the case with AKOperationEffect). Seems fine.
Obviously, if there's a "proper" solution, or something obvious I'm missing, I'd appreciate a heads-up.

Code commenter gem

I was sure a few months ago there was a gem that made sure you've commented every single line of code. Or at least every single action. If you hadn't, it brought your attention to it after you'd run some sort of rake task.
Can't remember for the life of me what it was called.
But is it a good idea to comment every single line of code? I say yes, it solidifies your knowledge, gives you a last change to catch bugs/security holes and eases future development.
However, projects in github and really sparsely commented. Personally, I need to comment most lines before I start to realise what a piece of code does. Is this not the case for most? Do comments just trip the code ninjas up?
Commenting every single line of code is a horrible idea:
It's noisy and obfuscates the source
It becomes out of date trivially easily
Things to comment:
Tricky and/or hacky code
Complicated algorithms
Why something is doing what it's doing
Those comments should almost always live at the method level.
If a code block needs a comment it should probably be a method
If a line of code needs a comment it should probably be refactored
Code should speak for itself as much as possible. Appropriate naming goes a long way to eliminating the need for wads of commenting. Some documentation may absolutely be necessary, but in the case of large structural comments, it may make more sense to keep it out of the code, and in your wiki.
No, it's not a good idea to comment every line of code. A lot of code is self-explanatory. In fact, you should strive to make your code self-explanatory.
For example, you would never want to comment the following:
sum = 1 + 3
You should save your comments for things that need explaining.
What I think you mean is a gem that enforces proper documentation. Documentation is a comment that explains the purpose of a method or class, as well as details its parameters and return values.
Regarding the gem you're thinking of, it may be rubocop.

Converting C to Delphi - Guidance

I am converting a low level C library to Delphi.
I find a lot of casts. I think it is normal in C World. I think I am safe in throwing them out. Integer is 32 bit only here. What do you think?
What could be the overhead of OOP if I convert it to objects etc?
Similarly I want to know the cost of try .. finally and exceptions.
Give me any tip that you think would be useful.
3 Similarly I want to know the cost of try .. finally and exceptions.
The cost of a try ... finally is negligable except in tight loops (put them around and not in the loop). Use them liberally to protect all your resources by balancing all instantiations / opens / allocations with free's / closes / de-allocations.
<code-to-open-a-file>
try
...
finally
<code-to-close-the-file>
end;
The cost of a try ... except is noticeably higher. Use them to respond to exceptions occuring, but only when you can actually take some meaningful action like counter acting the reason for the exception, logging some specific information that would be lost at a higher level in your app, etc. Otherwise let the exception propagate to the caller of your code so it can (eventually) be caught at a more general level.
Never let exceptions escape your application or library or any thread within it.
Never "eat" exceptions by having an empty except block:
try
...
except
end;
There really is only one type of situation where this makes sense: catching exceptions in code that logs exceptions... And then always add a comment to say why you are eating the exception.
You may find some helpful suggestions in the answers to this question on SO:
Best resources for converting C/C++ dll headers to Delphi?
You may also want to take a look at the C-To-Pas project which aims to automate much of the conversion from C to Delphi.
Moving from a procedural language to OOP is a big leap. There are many advantages of using OOP. OOPs are easier to code and maintain. Choosing Delphi PL is a good choice because it can also access at low level by inserting assembly codes. Try-catch is used to prevent program crashes at run time because of exceptions.

What profilers and analyzers are there for Erlang/OTP?

Are there any good code profilers/analyzers for Erlang? I need something that can build a call graph (eg gprof) for my code.
For static code analysis you have Xref and Dialyzer, for profiling you can use cprof, fprof or eprof, reference here.
The 'fprof' module includes profiling features. From the fprof module documentation:
fprof:apply(foo, create_file_slow, [junk, 1024]).
fprof:profile().
fprof:analyse().
fprof:apply (or trace) runs the function, profile converts the trace file into something useful, and analyse prints out the summary. This will give you a list of function calls observed, what called them, and what they called, as well as wall-clock timing info.
Try this one: https://github.com/virtan/eep
You could get something like this https://raw.github.com/virtan/eep/master/doc/sshot1.png

Resources