How to Use Binary Options Graphs - 6 Steps Every Trader ...

AMZN Trade Retrospective: Collecting a $.37 Credit for the Potential to Make Another $50

AMZN Trade Retrospective: Collecting a $.37 Credit for the Potential to Make Another $50
There are different ways to trade in a choppy environment. Here’s a deep dive on how I attempted to use weekly options to trade a potential bounce in AMZN, and collected $.37 initially, for the possibility of making $50 more, even though the trade ended up being only an $.81 winner.

The Entry

Last Thursday, 9/24, when $AMZN was trading at about $3000 a share, I was looking for a cheap way to play a bounce in the stock. During that time, my bias in the markets had begun to shift to a more bullish stance after seeing how the market had difficulty grinding lower. With that in mind, I wanted to play a potential bounce in tech. But I knew I didn’t want to pay a debit at all to play for a bounce that might not even happen, given how uncertain and choppy the markets had been, but I still wanted to set myself up to capture some large gains if AMZN did indeed bounce. Therefore, the strategy that made the most sense to me, was a Call broken wing butterfly.
Given that I’m a very short-term options trader who loves trading weeklies, I was trying to look for a cheap butterfly for the upcoming week that I could put on for a net credit. After exploring the options chain, I came across the +1/-2/+1 3300/3350/3450 call broken wing butterfly for the Oct 2 series. This fly, at the time (on Sept 24), was trading for a total of $.37 credit. Meaning, by putting on that butterfly, I would get paid $.37, and the following scenarios could happen:
  1. If AMZN decided to tank or hang out sideways and never get up close enough to the butterfly to expand the spread in my favor, then I’d walk away pocketing the $.37 credit
  2. If AMZN slowly crept up to reach exactly 3350 by expiration, I’d not only get to keep the credit, but also be able to sell the butterfly back out for $50. Of course, it doesn’t need to reach exactly 3350 by expiration. If AMZN slowly worked its way up to near 3300, then the butterfly would expand very nicely as well.
  3. If AMZN blew past 3400 by expiration, I’d see a loss, up to a maximum of $50 / spread (if $AMZN moves past 3450). That’s because the 3300/3350 long call vertical of the fly provides 50 points of coverage before I essentially start losing money from the 3350/3450 short vertical, up until that 3450 kicks in to cap off further upside losses.
So that is a rough outline of the potential scenarios that would happen with this trade.
Given the choppy market conditions, I was ok with risking $50/spread (point #3), in order to not lose money if I’m wrong on direction (point #1), while at the same time, keeping myself open to the possibility of the butterfly expanding in my favor (point #2) for some potentially very large gains.
But satisfying point #3 is tricky. I needed more data points suggesting that $AMZN wouldn’t surge higher early on in the trade. Because if $AMZN did surge higher early on in the trade, then while the 3300 long call would rise in value, those two 3350 short calls would also rise in value, and because there’d still be some time value left, they could be very juiced up and eat away at the profits of that 3300 long call, so much so that the 3450 long call won’t even be able to offset those losses, especially given how far out of the money that 3450 call is.

AMZN on 9/24, daily timeframe
Looking at the chart above on 9/24, we can see that AMZN was trading at around $3000/share. In order to reach $3300 (where the first long call of the broken wing butterfly is), the stock would need to
  1. Breach the 38% fib retracement (~AMZN=3131) of the move from the 9/2 high to the 9/21 low,
  2. Breach the 20MA and 50MA
  3. Breach the 50% fib retracement (~AMZN=3211)
  4. Breach the 61.8% fib retracement (~AMZN=3292)
before finally reaching the 3300 long call. All of these levels, I felt, should provide some resistance for AMZN to have to chew thru over the following week, before it even gets to the long call. And by that time, if AMZN did reach 3300, then the 3300 long call would still have a lot of extrinsic value left (somewhere around $20 on the last day), while the 3350 short calls would be very cheap (each around $5), so the entire spread could be roughly worth $10. Which would be great, because that means I’d be getting paid $.37 to make another $10.
So with all of the above considered, I chose to take on that upside risk, for a chance to make potentially $50 (realistically I try to aim for just half of the max profit: $25, and start harvesting profits and peeling off the flies at around $5-$10), and that day on 9/24, entered the Oct2 3300/3350/3450 call broken wing butterfly for a $.37 credit.
After entry, on Friday 9/25 and Monday 9/28, AMZN made steady progress upwards, from 3000 to 3175, breaching the 31.8% retracement and tagging the 20MA and 50MA from below.

AMZN on 9/28, daily timeframe
but this move wasn’t large and fast enough to expand the value of the 3350 short calls. In fact, theta did a great job draining those short calls, while the 3300 long call did a good job retaining its premium, so the butterfly had already expanded a bit in my favor, and I was sitting at about a small $1.00 profit.

The Adjustment

However, on Tuesday and Wednesday, AMZN began to stall out. By the end of Wednesday 9/30, when it looked like AMZN was putting in a topping tail, I decided that AMZN might not be able to make it near 3300 by expiration Friday, so I wanted to take in a bit more credit while I still could, before theta drained more of that 3300 long call. At the time, the spread was trading for almost $2.
That’s when I made a slight adjustment to the spread and sold the 3300/3310 call vertical.

AMZN on 9/30, daily timeframe
This essentially rolled the 3300 long call up to 3310, and I was able to collect a small $.44 credit for it. However, this adjustment did open me up to an additional $10 of risk to the upside, because now, the long call vertical portion of the butterfly is only $40 wide (instead of $50). Still, with only 2 days left for AMZN to go higher, I felt comfortable taking on a bit more upside risk knowing that theta is going to be working hard to drain those 3350 short calls if AMZN did decide to surge higher. And at that moment, I actually wanted AMZN to move more towards my fly. My deltas were still positive, and the risk graph showed that a move towards the short strikes of the fly would expand it by another $4-5 by Thursday.
So after this adjustment, the trade stood at a $.81 credit, and the profit potential on the fly was now $40 instead of $50. Which is still pretty good.

The Tease

On Thursday, AMZN showed some strength and closed above the 50% fib (3211), which meant that if on Friday, AMZN worked its way up to around 3300, the fly could potentially be worth $5-10. Things were looking good (on any continued bullishness, the next target for AMZN was the 61.8% fib retracement at ~3300). So I left the trade alone without making any more adjustments.

AMZN on 10/1, daily timeframe

The Flop

Unfortunately, on Thursday night, news broke out that Trump was diagnosed with Coronavirus, and the market fell lower. By the open, AMZN was already trading at around 3150, roughly 150 points below the fly. The spread had instantly lost all of its value, so I basically let it expire worthless and walked away pocketing the $.81 credit.

https://preview.redd.it/mpwrkjpk6xq51.png?width=4096&format=png&auto=webp&s=8dd7f4da7b000b2266ab57a3c23c1863f9423704
While the trade did not work out as well as I had liked, the important thing to note is that I was able to get paid even when the trade didn’t go in my favor. With options, there are ways to trade an underlying to a certain target without ponying up a debit, albeit at the cost of introducing tail risk, while offering the possibility of very large upside. This may be a style of trading that one can consider employing when the outlook of the markets is uncertain, as long as the trader is willing to make the necessary adjustments to control risk.
Which leads me to the following section:

FAQ

What if AMZN decided to surge very early on during the trade? What if AMZN had surged to 3300 with 4-5 DTE, hence juicing up the short calls and causing the butterfly to take on large negative deltas?
Even though the position would be very theta positive, I would pony up the debit to cap off the upside risk by buying the 3400/3450 call vertical, hence turning the 3300/3350/3450 broken wing butterfly into the 3300/3350/3400 balanced butterfly. From there on out until expiration, I would look for ways to reduce the debit incurred from that adjustment.

But what if AMZN tanked afterwards? You could end up getting whipsawed.
I’d rather be safe than sorry and make the necessary adjustments to avoid getting run over, because I don’t like playing the hope card. I could always undo the adjustment and look for ways to collect back more credit (at the cost of introducing risk elsewhere), depending on my new directional bias on AMZN at the time.

Your maximum loss is so large, $5000. I’d never make that bet, I would never risk $5000 to make $5000.
This style of trading is not for everyone. There are different ways to perceive risk. I don't really think of risk as binary as “max gain vs max loss”. If the trade goes against me, I’m not going to open myself up to the possibility of eating the maximum loss. I’m going to manage that risk and make sure that I don’t lose any money at all on the trade. Basically, I’m not going to just put on the trade, walk away to the prayer room, and come back at expiration and hope that AMZN expired at 3350.

Why not just join thetagang and slap on iron condors / credit spreads in this environment? You could’ve collected more credit by selling a 50 point wide put vertical with your bounce thesis.
Different traders have different styles. I personally don’t like pure premium selling strategies. I’d rather have long options in front of the shorts to open myself up for some large upside and convexity in the P/L curve, rather than limit myself to the concavity of pure premium selling strategies. Having long options in front of the shorts also helps me sleep better at night.

It’s hard to read this. Is there a more visual explanation?
Here’s a video on it: https://www.youtube.com/watch?v=8uq76fZ3EME

TL;DR - I used weekly options to trade a potential bounce in AMZN, and got paid $.37 initially to do so, for the possibility of making $50 more. While the trade did not pan out, I walked away pocketing $.81 for being wrong.
submitted by OptionsBrewers to options [link] [comments]

Retard Bot Update 2: What is there to show for six months of work?

Retard Bot Update 2: What is there to show for six months of work?
What is there to show? Not shit, that's why I made this pretty 4K desktop background instead:
4K
On the real: I've been developing this project like 6 months now, what's up? Where's that video update I promised, showing off the Bot Builder? Is an end in sight?
Yes sort of. I back-tested 6 months of data at over 21% on a net SPY-neutral, six month span of time (with similar results on a 16 year span) including 2 bear, 2 bull, 2 crab months. But that's not good enough to be sure / reliable. I had gotten so focused on keeping the project pretty and making a video update that I was putting off major, breaking changes that I needed to make. The best quant fund ever made, the Medallion fund, was once capable of roughly 60% per year consistently, but in Retard Bot's case 1.5% compounded weekly. "But I make 60% on one yolo" sure whatever, can you do it again every year, with 100% of your capital, where failure means losing everything? If you could, you'd be loading your Lambo onto your Yacht right now instead of reading this autistic shit.

The End Goal

1.5% compounded weekly average is $25K -> $57M in 10 years, securing a fairly comfortable retirement for your wife's boyfriend. It's a stupidly ambitious goal. My strategy to pull it off is actually pretty simple. If you look at charts for the best performing stocks over the past 10 years, you'll find that good companies move in the same general trajectory more often than they don't. This means the stock market moves with momentum. I developed a simple equation to conservatively predict good companies movements one week into the future by hand, and made 100%+ returns 3 weeks in a row. Doing the math took time, and I realized a computer could do much more complex math, on every stock, much more efficiently, so I developed a bot and it did 100% for 3 consecutive weeks, buying calls in a bull-market.
See the problem there? The returns were good but they were based on a biased model. The model would pick the most efficient plays on the market if it didn't take a severe downturn. But if it did, the strategy would stop working. I needed to extrapolate my strategy into a multi-model approach that could profit on momentum during all different types of market movement. And so I bought 16 years of option chain data and started studying the concept of momentum based quantitative analysis. As I spent more and more weeks thinking about it, I identified more aspects of the problem and more ways to solve it. But no matter how I might think to design algorithms to fundamentally achieve a quantitative approach, I knew that my arbitrary weights and variables and values and decisions could not possibly be the best ones.

Why Retard Bot Might Work

So I approached the problem from all angles, every conceivable way to glean reliably useful quantitative information about a stock's movement and combine it all into a single outcome of trade decisions, and every variable, every decision, every model was a fluid variable that machine learning, via the process of Evolution could randomly mutate until perfection. And in doing so, I had to fundamentally avoid any method of testing my results that could be based on a bias. For example, just because a strategy back-tests at 40% consistent yearly returns on the past 16 years of market movement doesn't mean it would do so for the next 16 years, since the market could completely end its bull-run and spend the next 16 years falling. Improbable, but for a strategy outcome that can be trusted to perform consistently, we have to assume nothing.
So that's how Retard Bot works. It assumes absolutely nothing about anything that can't be proven as a fundamental, statistical truth. It uses rigorous machine learning to develop fundamental concepts into reliable, fine tuned decision layers that make models which are controlled by a market-environment-aware Genius layer that allocates resources accordingly, and ultimately through a very complex 18 step process of iterative ML produces a top contender through the process of Evolution, avoiding all possible bias. And then it starts over and does it again, and again, continuing for eternity, recording improved models when it discovers them.

The Current Development Phase

Or... That's how it would work, in theory, if my program wasn't severely limited by the inadequate infrastructure I built it with. When I bought 16 years of data, 2TB compressed to its most efficient binary representation, I thought I could use a traditional database like MongoDB to store and load the option chains. It's way too slow. So here's where I've ended up this past week:
It was time to rip off the bandaid and rebuild some performance infrastructure (the database and decision stack) that was seriously holding me back from testing the project properly. Using MongoDB, which has to pack and unpack data up and down the 7 layer OSI model, it took an hour to test one model for one year. I need to test millions of models for 16 years, thousands of times over.
I knew how to do that, so instead of focusing on keeping things stable so I could show you guys some pretty graphs n shit, I broke down the beast and started rebuilding with a pure memory caching approach that will load the options chains thousands of times faster than MongoDB queries. And instead of running one model, one decision layer at a time on the CPU, the new GPU accelerated decision stack design will let me run hundreds of decision layers on millions of models in a handful of milliseconds. Many, many orders of magnitude better performance, and I can finally make the project as powerful as it was supposed to be.
I'm confident that with these upgrades, I'll be able to hit the goal of 60% consistent returns per year. I'll work this goddamn problem for a year if I have to. I have, in the process of trying to become an entrepreneur, planned project after project and given up half way through when it got too hard, or a partner quit, or someone else launched something better. I will not give up on this one, if it takes the rest of the year or five more.
But I don't think it'll come to that. Even with the 20% I've already achieved, if I can demonstrate that in live trading, that's already really good, so there's not really any risk of real failure at this point. But I will, regardless, finish developing the vision I have for Retard Bot and Bidrate Renaissance before I'm satisfied.

Tl;Dr

https://preview.redd.it/0plnnpkw5um51.png?width=3840&format=png&auto=webp&s=338edc893f4faadffabb5418772c9b250f488336
submitted by o_ohi to retard_bot [link] [comments]

Node.js Application Monitoring with Prometheus and Grafana

Hi guys, we published this article on our blog (here) some time ago and I thought it could be interesting for node to read is as well, since we got some good feedback on it!

What is application monitoring and why is it necessary?

Application monitoring is a method that uses software tools to gain insights into your software deployments. This can be achieved by simple health checks to see if the server is available to more advanced setups where a monitoring library is integrated into your server that sends data to a dedicated monitoring service. It can even involve the client side of your application, offering more detailed insights into the user experience.
For every developer, monitoring should be a crucial part of the daily work, because you need to know how the software behaves in production. You can let your testers work with your system and try to mock interactions or high loads, but these techniques will never be the same as the real production workload.

What is Prometheus and how does it work?

Prometheus is an open-source monitoring system that was created in 2012 by Soundcloud. In 2016, Prometheus became the second project (following Kubernetes) to be hosted by the Cloud Native Computing Foundation.
https://preview.redd.it/8kshgh0qpor51.png?width=1460&format=png&auto=webp&s=455c37b1b1b168d732e391a882598e165c42501a
The Prometheus server collects metrics from your servers and other monitoring targets by pulling their metric endpoints over HTTP at a predefined time interval. For ephemeral and batch jobs, for which metrics can't be scraped periodically due to their short-lived nature, Prometheus offers a Pushgateway. This is an intermediate server that monitoring targets can push their metrics before exiting. The data is retained there until the Prometheus server pulls it later.
The core data structure of Prometheus is the time series, which is essentially a list of timestamped values that are grouped by metric.
With PromQL (Prometheus Query Language), Prometheus provides a functional query language allowing for selection and aggregation of time series data in real-time. The result of a query can be viewed directly in the Prometheus web UI, or consumed by external systems such as Grafana via the HTTP API.

How to use prom-client to export metrics in Node.js for Prometheus?

prom-client is the most popular Prometheus client library for Node.js. It provides the building blocks to export metrics to Prometheus via the pull and push methods and supports all Prometheus metric types such as histogram, summaries, gauges and counters.

Setup sample Node.js project

Create a new directory and set up the Node.js project:
$ mkdir example-nodejs-app $ cd example-nodejs-app $ npm init -y 

Install prom-client

The prom-client npm module can be installed via:
$ npm install prom-client 

Exposing default metrics

Every Prometheus client library comes with predefined default metrics that are assumed to be good for all applications on the specific runtime. The prom-client library also follows this convention. The default metrics are useful for monitoring the usage of resources such as memory and CPU.
You can capture and expose the default metrics with following code snippet:
const http = require('http') const url = require('url') const client = require('prom-client') // Create a Registry which registers the metrics const register = new client.Registry() // Add a default label which is added to all metrics register.setDefaultLabels({ app: 'example-nodejs-app' }) // Enable the collection of default metrics client.collectDefaultMetrics({ register }) // Define the HTTP server const server = http.createServer(async (req, res) => { // Retrieve route from request object const route = url.parse(req.url).pathname if (route === '/metrics') { // Return all metrics the Prometheus exposition format res.setHeader('Content-Type', register.contentType) res.end(register.metrics()) } }) // Start the HTTP server which exposes the metrics on http://localhost:8080/metrics server.listen(8080) 

Exposing custom metrics

While default metrics are a good starting point, at some point, you’ll need to define custom metrics in order to stay on top of things.
Capturing and exposing a custom metric for HTTP request durations might look like this:
const http = require('http') const url = require('url') const client = require('prom-client') // Create a Registry which registers the metrics const register = new client.Registry() // Add a default label which is added to all metrics register.setDefaultLabels({ app: 'example-nodejs-app' }) // Enable the collection of default metrics client.collectDefaultMetrics({ register }) // Create a histogram metric const httpRequestDurationMicroseconds = new client.Histogram({ name: 'http_request_duration_seconds', help: 'Duration of HTTP requests in microseconds', labelNames: ['method', 'route', 'code'], buckets: [0.1, 0.3, 0.5, 0.7, 1, 3, 5, 7, 10] }) // Register the histogram register.registerMetric(httpRequestDurationMicroseconds) // Define the HTTP server const server = http.createServer(async (req, res) => { // Start the timer const end = httpRequestDurationMicroseconds.startTimer() // Retrieve route from request object const route = url.parse(req.url).pathname if (route === '/metrics') { // Return all metrics the Prometheus exposition format res.setHeader('Content-Type', register.contentType) res.end(register.metrics()) } // End timer and add labels end({ route, code: res.statusCode, method: req.method }) }) // Start the HTTP server which exposes the metrics on http://localhost:8080/metrics server.listen(8080) 
Copy the above code into a file called server.jsand start the Node.js HTTP server with following command:
$ node server.js 
You should now be able to access the metrics via http://localhost:8080/metrics.

How to scrape metrics from Prometheus

Prometheus is available as Docker image and can be configured via a YAML file.
Create a configuration file called prometheus.ymlwith following content:
global: scrape_interval: 5s scrape_configs: - job_name: "example-nodejs-app" static_configs: - targets: ["docker.for.mac.host.internal:8080"] 
The config file tells Prometheus to scrape all targets every 5 seconds. The targets are defined under scrape_configs. On Mac, you need to use docker.for.mac.host.internal as host, so that the Prometheus Docker container can scrape the metrics of the local Node.js HTTP server. On Windows, use docker.for.win.localhost and for Linux use localhost.
Use the docker run command to start the Prometheus Docker container and mount the configuration file (prometheus.yml):
$ docker run --rm -p 9090:9090 \ -v `pwd`/prometheus.yml:/etc/prometheus/prometheus.yml \ prom/prometheus:v2.20.1 
Windows users need to replace pwd with the path to their current working directory.
You should now be able to access the Prometheus Web UI on http://localhost:9090

What is Grafana and how does it work?

Grafana is a web application that allows you to visualize data sources via graphs or charts. It comes with a variety of chart types, allowing you to choose whatever fits your monitoring data needs. Multiple charts are grouped into dashboards in Grafana, so that multiple metrics can be viewed at once.
https://preview.redd.it/vt8jwu8vpor51.png?width=3584&format=png&auto=webp&s=4101843c84cfc6293debcdfc3bdbe70811dab2e9
The metrics displayed in the Grafana charts come from data sources. Prometheus is one of the supported data sources for Grafana, but it can also use other systems, like AWS CloudWatch, or Azure Monitor.
Grafana also allows you to define alerts that will be triggered if certain issues arise, meaning you’ll receive an email notification if something goes wrong. For a more advanced alerting setup checkout the Grafana integration for Opsgenie.

Starting Grafana

Grafana is also available as Docker container. Grafana datasources can be configured via a configuration file.
Create a configuration file called datasources.ymlwith the following content:
apiVersion: 1 datasources: - name: Prometheus type: prometheus access: proxy orgId: 1 url: http://docker.for.mac.host.internal:9090 basicAuth: false isDefault: true editable: true 
The configuration file specifies Prometheus as a datasource for Grafana. Please note that on Mac, we need to use docker.for.mac.host.internal as host, so that Grafana can access Prometheus. On Windows, use docker.for.win.localhost and for Linux use localhost.
Use the following command to start a Grafana Docker container and to mount the configuration file of the datasources (datasources.yml). We also pass some environment variables to disable the login form and to allow anonymous access to Grafana:
$ docker run --rm -p 3000:3000 \ -e GF_AUTH_DISABLE_LOGIN_FORM=true \ -e GF_AUTH_ANONYMOUS_ENABLED=true \ -e GF_AUTH_ANONYMOUS_ORG_ROLE=Admin \ -v `pwd`/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml \ grafana/grafana:7.1.5 
Windows users need to replace pwd with the path to their current working directory.
You should now be able to access the Grafana Web UI on http://localhost:3000

Configuring a Grafana Dashboard

Once the metrics are available in Prometheus, we want to view them in Grafana. This requires creating a dashboard and adding panels to that dashboard:
  1. Go to the Grafana UI at http://localhost:3000, click the + button on the left, and select Dashboard.
  2. In the new dashboard, click on the Add new panel button.
  3. In the Edit panel view, you can select a metric and configure a chart for it.
  4. The Metrics drop-down on the bottom left allows you to choose from the available metrics. Let’s use one of the default metrics for this example.
  5. Type process_resident_memory_bytesinto the Metricsinput and {{app}}into the Legendinput.
  6. On the right panel, enter Memory Usage for the Panel title.
  7. As the unit of the metric is in bytes we need to select bytes(Metric)for the left y-axis in the Axes section, so that the chart is easy to read for humans.
You should now see a chart showing the memory usage of the Node.js HTTP server.
Press Apply to save the panel. Back on the dashboard, click the small "save" symbol at the top right, a pop-up will appear allowing you to save your newly created dashboard for later use.

Setting up alerts in Grafana

Since nobody wants to sit in front of Grafana all day watching and waiting to see if things go wrong, Grafana allows you to define alerts. These alerts regularly check whether a metric adheres to a specific rule, for example, whether the errors per second have exceeded a specific value.
Alerts can be set up for every panel in your dashboards.
  1. Go into the Grafana dashboard we just created.
  2. Click on a panel title and select edit.
  3. Once in the edit view, select "Alerts" from the middle tabs, and press the Create Alertbutton.
  4. In the Conditions section specify 42000000 after IS ABOVE. This tells Grafana to trigger an alert when the Node.js HTTP server consumes more than 42 MB Memory.
  5. Save the alert by pressing the Apply button in the top right.

Sample code repository

We created a code repository that contains a collection of Docker containers with Prometheus, Grafana, and a Node.js sample application. It also contains a Grafana dashboard, which follows the RED monitoring methodology.
Clone the repository:
$ git clone https://github.com/coder-society/nodejs-application-monitoring-with-prometheus-and-grafana.git 
The JavaScript code of the Node.js app is located in the /example-nodejs-app directory. All containers can be started conveniently with docker-compose. Run the following command in the project root directory:
$ docker-compose up -d 
After executing the command, a Node.js app, Grafana, and Prometheus will be running in the background. The charts of the gathered metrics can be accessed and viewed via the Grafana UI at http://localhost:3000/d/1DYaynomMk/example-service-dashboard.
To generate traffic for the Node.js app, we will use the ApacheBench command line tool, which allows sending requests from the command line.
On MacOS, it comes pre-installed by default. On Debian-based Linux distributions, ApacheBench can be installed with the following command:
$ apt-get install apache2-utils 
For Windows, you can download the binaries from Apache Lounge as a ZIP archive. ApacheBench will be named ab.exe in that archive.
This CLI command will run ApacheBench so that it sends 10,000 requests to the /order endpoint of the Node.js app:
$ ab -m POST -n 10000 -c 100 http://localhost:8080/order 
Depending on your hardware, running this command may take some time.
After running the ab command, you can access the Grafana dashboard via http://localhost:3000/d/1DYaynomMk/example-service-dashboard.

Summary

Prometheus is a powerful open-source tool for self-hosted monitoring. It’s a good option for cases in which you don’t want to build from scratch but also don’t want to invest in a SaaS solution.
With a community-supported client library for Node.js and numerous client libraries for other languages, the monitoring of all your systems can be bundled into one place.
Its integration is straightforward, involving just a few lines of code. It can be done directly for long-running services or with help of a push server for short-lived jobs and FaaS-based implementations.
Grafana is also an open-source tool that integrates well with Prometheus. Among the many benefits it offers are flexible configuration, dashboards that allow you to visualize any relevant metric, and alerts to notify of any anomalous behavior.
These two tools combined offer a straightforward way to get insights into your systems. Prometheus offers huge flexibility in terms of metrics gathered and Grafana offers many different graphs to display these metrics. Prometheus and Grafana also integrate so well with each other that it’s surprising they’re not part of one product.
You should now have a good understanding of Prometheus and Grafana and how to make use of them to monitor your Node.js projects in order to gain more insights and confidence in your software deployments.
submitted by matthevva to node [link] [comments]

A very long, very indepth attempt at analizing Teemo

Warning, this is extremely long. Like 12 pages on a google doc long. You have been warned.

So there has been a lot of discussion about Teemo recently, from what his iconic skills are(all of them), to what items he can build(all of them), to what position he can be played in(... all of them), and it’s kinda went nowhere fast as Teemo, and by extension his player base, is just too flexible to be defined in any of these ways.
So what actually makes Teemo unique?
His playstyle.
Teemo is an old style of champion. I'm not talking about his art, or his kit(though both of these are technically also true), I'm talking about how Teemo’s goal isn’t to all in and combo his opponent down on their first mistake and snowball from there, but rather to create a lead from dozens of small victories. Your goal isn’t necessarily kill your opponent (though that’s always good) but to force them back, causing them to miss cs and xp repeatedly, or waste their time smashing blindly into a bush. And later in the game, while, again, killing people is now the goal, forcing them to have to back after tripping a few shrooms, or leading them on a fruitless chase through the jungle after splitpushing are just as useful to Teemo. If I had to describe Teemo's playstyle, it would be
Attritional, Rapid Force, Psycologically Manipulative, War Mastermind of Breakdown
I'm only half joking, as even though this is from a Spongebob theory video on Plankton, it actually describes Teemo to some degree.
As The Theorizer(the guy who made the video Im referencing) put it:
Attritional, someone who engages in attrition warfare. Rapid force, very fast, very hard attacks. Psychologically manipulative, basically, very good at trickery and getting people to do what you want. War mastermind, well duh, someone who is good with war. Breakdown, to break something down.
Only instead of getting a burger recipe, we are getting our enemies to tilt.
But with every new release Teemo has gotten more and more outclassed, as his opponents get more and more mobility that a small 10-52% movespeed boost can’t escape from. We all recognize that Teemo needs a rework, a Morgana/Ezreal level rework that modernizes Teemo’s kit without changing its functionality that much, but a rework nonetheless.
Last year u/RiotJag attempted to do a mini rework on Teemo, starting with this:
Base Mana Regen increased from 1.92 to 2.5
Mana Regen per level increased from 0.09 to 0.15
Mana/lvl up increased from 20 to 25
Toxic Shot (Passive)
Teemo’s basic attacks now deal 10-50 bonus magic damage and leave a Poison DoT that deals 24-192 magic damage over 4 seconds.
Toxic Shot damage (both the on-hit and the DoT) is amped by 50% whenever there are other Poison debuffs on the target
Blinding Dart (Q)
Base damage lowered from 80/125/170/215/260 to 80/115/150/185/220
AP Ratio lowered from 0.8 to 0.6
Now is a Poison Debuff
Move Quick (W)
No longer breaks stealth
Guerilla Warfare (E)
[New Active] After a 1 second delay, Teemo enters Camouflage for 3-5 seconds. Teemo is slowed by 25/22.5/20/17.5/15% during this effect, and gains 20/30/40/50/60% Attack Speed for 3 seconds when it ends. Camouflage does not tick down while Teemo is in a brush or is standing still.
Noxious Trap (R)
Base Damage lowered from 200/325/450 to 150/250/350
AP ratio lowered from 0.5 to 0.4
Mushrooms health increased from from [6 at all ranks] to [6/8/10]
Mushroom max ammo count up from [3 at all ranks] to [3/4/5]
And then after a few iterations it ended up like this
Base Mana Regen increased from 1.92 to 2.5
Mana Regen per level increased from 0.09 to 0.15
Mana/lvl up increased from 20 to 25
Base damage lowered from 54 to 51
Attack speed per level lowered from 3.38 to 2
Toxic Shot (Passive)
Teemo’s basic attacks now deal 8-50 bonus magic damage and leave a Poison DoT that deals 24-180 magic damage over 4 seconds.
Toxic Shot damage (both the on-hit and the DoT) is amped by 50% whenever there are other Poison debuffs on the target
Blinding Dart (Q)
Base damage lowered from 80/125/170/215/260 to 70/105/140/175/210
mana cost increased from 70/75/80/85/90 to 80/85/90/95/100
AP Ratio lowered from 0.8 to 0.6
Now is a Poison Debuff
Move Quick (W)
No longer breaks stealth
Guerilla Warfare (E)
Cooldown: 40/37/34/31/28
[New] "After a 1 second delay, Teemo becomes Invisible indefinitely if standing still or in brush, and can move up to 7/7.5/8/8.5/9 Teemos while out of brush, but any non-periodic damage from champions will break him out. Teemo can see 25% farther while stealthed. Upon breaking Guerilla Warfare, Teemo gains 20/30/40/50/60% Attack Speed for 3 seconds. While on cooldown, standing in brush will tick down guerilla Warfare's cooldown faster."
Stealth duration while moving: 2/2.25/2.5/2.75/3
>Noxious Trap (R)
Base Damage lowered from 200/325/450 to 150/250/350
AP ratio lowered from 0.5 to 0.4
Mushroom max ammo count up from [3 at all ranks] to [3/4/5]
Traps now become invisible after 1 second
Traps can continue to bounce on other traps
Additionally there were these prospective changes that were scrapped due to the community’s disinterest in the rework direction.
"Most recent version in testing was pretty E focused as follows (differences all versus previous prototype version, not versus live Teemo):
- No longer granted extra sight range
- CD didn't tick down faster in brush
- Distance while invisible up a bit
- CD lower
- Standing in brush slowly replenished distance Teemo could move while invisible
Haven't heard how playtesting with that went though. Expect this will likely continue as a slow burn project rather than something that gets released or killed quickly, especially given it's the secondary priority of the designer working on it."
After it was scrapped we got the quality of life buffs that we have now.
But lets discuss the rework.
I honestly thing that the _concept_ is the best shot at reworking Teemo. The numbers and exact implementation are debatable, but switching e and passive is a great idea as, after the shrooms, Teemo’s on hit poision is his most iconic ability. Not to mention it freed Teemo up to be able to max his abilities depending on what he needed for his matchup, rather than e max always, and then either q or w depending on choice.
The things people didn’t like about it though were:
The shrooms being nerfed damage wise.
I understand this one, Doomshroom Teemo is my favorite build, but his shrooms are problematic in their current state as they take up a large amount of Teemo's power budget, but also can amount to nothing as the enemy gets 5 sweepers and clears all of them. Not to mention how they synergize so well with Liandrie’s that its a core item for Teemo, despite the fact that his q, the only other ability that can proc it, does not utilize it all that well due to being a medium cooldown, single target spell that can only proc it once. And this is going to be a problem, as in the item update Liandries will be a mythic item, and Teemo builds Liandries [77.5% of the time!](https://www.leagueofgraphs.com/champions/items/teemo) To put this into perspective, Nashors tooth is only bought 61.5% of the time. An item that gives Teemo every stat he wants regardless of build(ignoring Tankmo) and reinforces Teemo's main damage outlet(basically increases e's on-hit damage by 150-30% depending on e rank, and the on-hit scaling from .3 to .45 AP), is bought 16.5% less often than an item that only synergizes with one skill. If this continues after the update, which it likely will as Liandries increases Shroom damage by 20-200%(depending on when it's bought, the target hit, and other items bought. The 200% would be lvl 1 ult, no other ap, and an 1000 health target with 50 mr) and its being _buffed_ via the mythic item stat bonus, that will be above the threshold that will cause Teemo to be changed due to [hardbinding](https://na.leagueoflegends.com/en-us/news/dev/dev-updated-approach-to-item-balancing/). Unless Zyra and Brand also buy it at the same rates after the update(as that would trigger the “nerf item” option), but unlike Teemo the item actually synergizes with their entire kit(plants and blaze, which utilize every ability) rather than just one ability.
It didn’t improve the w
This was a major hole in the rework, as while switching e and p is great, it wouldn’t be awful if they stayed the same. Meanwhile Teemo’s w is supposed to put the “swift” in his title of Swift Scout, and it does so… barely. Exactly what should happen with it is, as always, up to debate, but it needs changing to be on par with current LoL as the current w is supposed to help Teemo kite, yet even if you dodge everything thrown at you it can get disabled by a ludens proc hitting an ally.
The camo stealth makes him a worse Twitch.
This is half true. The first one, yes absolutely. But it didn’t stay as a camouflage ability. Sure, both are marksmen that can go invisible, but Twitch’s is for long distances and to keep him safe while he positions to obliterate the enemy team from 800 range, while Teemo’s is restricted range wise, and is more useful to dodge enemy's notice or wait for them to come to you rather than you going to them. At that point, they only share the fact that they both come out of stealth to surprise people(and a DOT, if 30 damage after 6 attacks at lvl 18 deserves to be called one), which every camoflage user does
And my own complaint about both proposed rework and live Teemo:
His kit has limited synergy.
Each part of Teemo's kit doesn't help the other parts very much. Over the years Teemo players have worked the separate parts of his kit into a cohesive playstyle, but each part of his kit just does it's own thing. Like for instance, in theory his blind should support keeping his w up, but in reality every champ, even Udyr, has a non auto attack way of hitting Teemo(Udyr typically has smite and he always can rush up to you with Bear and activate Phoenix stance), and many have attacks that are undodgable(unless you count not being in range to be targeted as dodging it, which for many champs is just being outside Teemo's attack range).
So, where should we go from here?

Well, we should discuss the purpose of his abilities.

If every part of his kit is iconic, and replacing them completely would change Teemo in a way that the playerbase wouldn’t like, then we should decide what role each of his abilities plays in his playstyle, and how they could be changed to better fit them.

Toxic Shot
This is the base of Teemo’s kit. Doing DOT damage after autoing someone is key to Teemo's attritional playstyle in lane, and hit and run/kiting playstyle later in the game. It has a decent base damage and a great scaling, and is just as useful for pure AP builds as on hit ones.
It does exactly what it needs to, nothing about it needs to be changed.
Blinding Dart
Teemo's reactive defense in a fight. On one hand, it's extremely powerful as can completely shut down the main damage of auto reliant champions(Yi, Udyr, some ADC's) for up to 2.5 seconds, provided they don't have on hit effects that ignore the blind and hit anyway. On the other hand, it's completely useless against every other type of champ(mages, assassins, tanks, spellslinger ADC's, most Juggernauts). Its not healthy for Teemo's main defensive tool to be useless(or of limited use, as I counted champs like Nunu who auto attack, but don't rely on it to do their job as part of it being useless) against 70% of the champion roster.
As people have talked about, Teemo _needs_ this in order to stay safe, yet in most of his matchups(regardless of role) it can't do anything to protect him, let alone later in the game when he has to face the other 4 enemy champs. And that's not counting the fact that ranged auto's that are in transit before the blind hits are not blocked, which means that even against a Vayne with Condenm on cooldown, it still can’t keep Teemo’s w up as even if you blind her first chance she probably will have lanched an auto already.
Move Quick
If blinding dart is a reactive defense, then Move Quick is supposed to be Teemo's proactive defense. When he was added, it allowed him to more easily kite slower enemy champions as there were fewer speedboosts and dashes, and in general lower mobility. Nowadays, the passive is deactivated rather quickly in a fight, and 3 seconds of MS isnt enough to give him a fighting chance of escaping/keeping up.
The intention of the skill is to allow Teemo greater kiting potential in fights, while giving enemies a way to shut it down to have a chance of catching Teemo. But the reality is that unless you are against a champ like Garen who has zero ranged attacks, you are not going to be able to keep it active, making it feel like an out of combat passive.
The issue is keeping the balance between Teemo having kiting power in a fight, and allowing enemies a chance to slow down Teemo, because whether we like it or not, Riot does want enemies to be able to catch kiting champs like Teemo, Kalista, and Ashe, because they would be horrible to play against otherwise. Right now, the balance is heavily skewed towards enemies, as any kind of damage will reduce Teemo's ability to kite enemies with matching boots to a singular 3 second burst for the rest of the fight.

Guerilla warfare
The most underultilized part of Teemo's kit. In its current form it's incredibly strong, yet is extremely situational.
Its a decent strategic option for positioning mid game, as it can allow you to dodge an enemy(providing they didn't see you yet), or allow you to ambush people, but to use it offensively requires an enemy to come to you as you can only move inside bushes, and defensively it's limited to:
Dodging people that have not seen you
Becoming invincible to enemies that only have point and click damage(Vayne, Yi,)
Stalling for time so an ally can come save you
For such an integral part of Teemo’s kit… it feels a little tacked on. Its a situational fight opener or utility tool, and any attempt to use it while near enemy champs usually ends up with them knowing where you are and throwing skillshot after skillshot at you. Its not _bad,_ but to say it can’t be improved would be a lie.
Personally I like the sound of that last version, as it would differentiate between Teemo’s e and Twitch’s q, while fitting into Teemo’s playstyle nicely(or, at least, I already dash from bush to bush while in the enemy jungle to check if the coast is clear. Not sure about the rest of you). The fact that you would have to “charge up” movement time by staying in bushes helps give the feel that you are creeping around, without actually slowing Teemo down like the first version of the change.
Noxious Trap
Shrooms have 3 main uses:
Damage, be it wearing down enemies as they attempt to move throughout the map, making it so they always enter fights below full health or killing low health fleeing enemies
Granting vision of important areas, such as Dragon, Baron, and the enemy jungler's camps(or your jungle camps, if your jungler is being invaded)
CC, cutting off engage or escape paths, slowing enemies so that Teemo/his team have a chance to escape/engage.
Right now they do all of these well, except damage vs tanks, and don't have to be changed. But like I pointed out before Liandries is a massive amount of their power, and that isn't healthy as unless you are planning on ignoring the shrooms damage completely you have to buy it, and mythinc item, hardbinding, yada yada yada....
So if the Shrooms are changed they should aim to keep the same power, but less oppressive against squishes and more effective(or, rather, less ineffective) against tanky targets without having to rely on Liandries to the point where its a core item even against full squishy teams.

Suggestions on what could change

Toxic Shot
The only thing I would change about it is move it's ticks from 1/s to 4/s, like Singe's poison, Karthus's aoe, or 2/s like Casdiopia's poison. It would give a better readability on the damage for everyone involved, which, while it is a slight nerf to Teemo, clarity changes that increase counterplay allow for more power to be added elsewhere.
Also, unlike Singer's poison or Karthus's e, Teemo doesn't have a "turn on for one tick to farm and turn off" mechanic for his poison like they did, so other than age I can't think of why it is one second between ticks. The ‘surprise’ factor of how much damage it does is good for Teemo, but how much damage the enemy is taking shouldn't be something that is obscured.
Blinding Dart
The simplest change would be to make it apply nearsighted, which would have 3 effects.
  1. make it less of a hard counter to melee auto centric champs,while still allowing it utility
  2. Improves its usability against all kinds of champs, and opens up more uses than "damage" and "no auto attack for you"
  3. Allows Teemo to actually participate in gurilla warfare, making it possible for him to pop up, attack, and disappear on an enemy champ, providing he is outside their truncated vision range.
I have other ideas as to what can be done with this ability, but it makes more sense in context so that will be below.
Move Quick
I have two ideas for how this could be changed to be better:
  1. It does not break on damage from poisoned enemies, as well as increasing it to 10-30% because round numbers.
This one is kinda obvious of how it helps Teemo, but I like it because it allows Teemo to keep his speed if he gets the drop on enemies, but if they get in the first attack then they are rewarded with a Teemo that is easier to catch.
  1. Teemo’s base MS down to 325 (WAIT, don’t crucify me just yet), and decrease the % MS boost from 10-26% to 10-19%, and then add on +5-25 base MS per rank.
Now that sounds broken, as an increase of 5 base ms is a huge increase in winrate usually, but hear me out.
Rank 1: Teemo would have 325+5+10%= 330+10%=363 which is exactly the same as live.
Rank 2: Teemo would have 325+10+12.25%= 335+12.25%=376 the same as live.
Rank 3: Teemo would have 325+15+14.5%= 340+14.5%=389 the same as live.
Rank 4: Teemo would have 325+20+16.75%= 345+16.75%=403 the same as live.
Rank 5: Teemo would have 325+25+19%= 350+19%=416 the same as live.
Though a note is that with boots, ranks 1-4 actually give less ms than live. Its only 5-1 ms difference, which may not even end up showing up after the Movement speed soft caps apply. Except for Mobie boots, there is a significant difference there after the MS cap, but Teemo only builds them .03% of the time or so, and they are deactivated whenever someone trips a shroom, so that’s a sacrifice I'm willing to make.
The only noticeable thing that would change is how fast Teemo is when the passive is down, and how fast he is when using the w active(if im doing the math right it is slower by a max of 18 ms, with Mobie boots, but that makes sense as we are dropping 14% bonus ms on the w active in exchange for 25 flat ms, which means less of a boost with just it, but it scales better with other % movement boosts)
[Here is my compiled list of Teemo’s movement speed with every kind of boot + w](https://docs.google.com/document/d/1mkKCcFzXV8PbXseYadoi6z1rs9SN0xGRCFMjw4z3Ito/edit?usp=sharing), and [here is a graph that allows you to easily put in the variables if you want to check it out yourself](https://www.desmos.com/calculatoirneett3wh).
Gurilla warfare
In addition to the prospective changes that we never saw, which to me sounds like the best version(assuming the numbers are not terrible), here are a few ideas I thought of:
Teemo’s e breaks on damage outside bushes, but while inside a bush Teemo is obscured(you know, that broken “true stealth” thing Akali had, only there are no bushes inside tower range and Teemo doesn’t have 3 dashes so it should be less obnoxious) and the invisibility doesn’t break. What this basically means is if an enemy hits a scyre bloom or an ability that gives true sight on Teemo when he is inside a bush, he is still not able to be clicked on.
Standing still for 1 second increases shroom vision range over the next two seconds. I like this one, as it enhances the scouting aspect of his theme, but enemies can interact with it and it has to be something Teemo is actively doing, rather than just passive extra vision.
Noxious Trap
Assuming we are touching these, I honestly think having it apply % current health(better against tanks, not as oppressive against squishies), along with the passive poison would allow it to function both as a weakening chip damage, and potential low health killer, without getting into the 2 shot shroom territory as that feels bad to be on the end of. They should be able to kill if you run into a ton of them in a row, but not automatic death after hitting one from a fed Teemo.
I honestly haven’t thought of a better way other than that to keep the balance between chip damage and kill threat without entering the binary “die by 2 shrooms or 5 Sweepers” territory
And now for my Rework suggestion(do note that while I have considered the numbers I gave things, numbers are easily changed about and as such laying out the mechanics is my goal):

Toxic Shot
Teemo laces his attacks with poison from his Kumongu shrooms, causing his basic attacks to deal [10-50 + .3 AP] damage, and his basic attacks and spells to poison the target for [1.5-11.25 +.025 AP] every .25 seconds for 4 seconds.
Poisons from unique attacks(autos would be one unique attack, q is one, and shrooms count as one) stack up to three times, each new stack at 50% extra damage(so 175%, which max damage without refreshing the poison would be 315 + .7AP total at level 18, for landing a shroom, an auto, and a q).
Similar to Sol’s passive, I'm suggesting Teemo’s passive be the main source of his damage and tie his entire kit together. Maybe 175% is too low for 3 stacks, but I thought 200% might be too overbearing. Anyway, its not like numbers are not constantly changed.

Sporecloud Dart
Skillshot, 700 range, AOE detonation, 300 range, 80/85/90/95/100 mana cost
Does 50/75/100/125/150 +.4AP + 1bAD(bonus AD) damage to main target, applying on hit effects(not passive’s on hit), reduces vision range for them for 1.5/1.6/1.7/1.8/1.9/2 seconds, spreads passive DOT(not on hit) to target and nearby enemies
This one has many reasons:
By changing it to a skill shot, from a targeted skill, it allows enemies to do more than just “don’t get near Teemo” to avoid it, but in return the cc is better against a wider assortment of enemies rather than just auto reliant ones. It also means that if an enemy can get on you, they have a chance of actually hitting you, but it also keeps his ability to shut down enemy ADC’s intact, if a little less duration.
As it is a skill shot, I gave it slightly increased range so that Teemo has something to do in teamfights, but also increased its mana cost so it can’t be spammed
The reason it applies the passive in AOE is because I was inspired by Teemo’s skill in this TFT set, which is where the name comes from, and it addresses his issue in the jungle of having poor multi-target damage pre-6. This gives him a pre-6 option for clearing camps/pushing waves, and makes up in part for the damage that is lost from the shrooms(keep reading for that, its not as bad as you might think)
Move quick
10/15/20/25/30% ms
Does not break on damage from poisoned targets
That other option I outlined above would also work, I just thought of this one first and it fits with Teemo spreading poison everywhere.
Guerrilla Warfare
1.5 second arm time, indefinite while still/in bushes. Can move 2/2.25/2.5/2.75/3 seconds while stealthed, recharges slowly in bushes.
Element of Surprise: 20/30/40/50/60 AS for 3 seconds
Optional bonus:>! After standing still for 1 second, shroom's vision radius grows by 10/20/30/40/50% over the next 2 seconds.!<
Basically the prospective changes that we never saw. Not sure what the cooldown was going to be though.
The optional bonus is a different take on the “Teemo gains 25% sight range while stealthed” from the most recent one. Im not sure if it would be overpowered or not, but I thought why not? Its not like they haven’t removed mechanics before. Anyway, the idea would be that Teemo can set up a vision network, which enemies are already looking to clear because shrooms, but at the cost of doing things. Great for ambushes, not so much for watching for a gank.
Noxious Trap
Deal 10/15/20% max health, and applies Toxic Shot’s DOT(not the on hit)
Enemies effected by shrooms take .75% extra damage from Toxic Shot for every 1% missing health, capping at 50% damage(so 109/lvl 6 - 270/lvl 18 +.6 ap total damage, when they are at 33% health for just the shroom, and 472 +1.05 AP for 3 stacks)
Assuming the combo is just one auto, q, and shroom, that is a max of 100% tAD+ 100% bAD + 50 + 150 + 472 + 10% current health + 175% AP(so 672 + 175% AP + auto damage) when the enemy is at ⅓ health. That sounds like a lot, but its not that much for just one combo. For reference, Vigar can do 650 +150% AP with just his ult alone, and then has another 540+160% AP from his other abilities.
Anyway, the % current health would allow Teemo to affect Tanks with his Shrooms, without making it overbearing for squishies, while the pseudo-execute extra passive damage makes it so that Teemo can still kill with Shrooms, be it in fights or on fleeing enemies. The idea is to make 2 shot shrooms less feasible, but allow the damage to scale better. It also would only apply Liandries only once, which, while is a nerf, is one that ultimately benefits Teemo as Liandries would be an effective option for 2-3 tank teams, but not a mandatory item for every game you don’t go with On Hit Teemo.
submitted by TheLastBallad to TeemoTalk [link] [comments]

Dynamically indicate state, in addition to measurement reading, in Dashboard chart?

Summary: How can you indicate binary state data alongside numeric data in a Dashboard visualization?
I have several use cases for this, but let me describe just one:
I have a wood-fired boiler for home heating. It's basically a fire inside a surrounding tank of water (a "water jacket") that gets heated by the fire. When the water is hot enough, a pump pumps water in a loop through the water jacket, and out to a heat storage reservoir, which in turn heats the baseboards in the house.
I take temperature readings of the input and output pipes of the boiler, and I also have a relay to tell me when the pump is being triggered to run. I can do things like make a table of pump on and off times, but I'd like to see that information right there in the graph that shows me the water temperature of the input, output, and reservoir.
For example, if I could cause the boiler I/O lines on the chart to change color when pumping is occuring, that would be awesome. However, TTBOMK, if you change the color of a chart line, it changes the color for the whole line, not just those datapoints.
Another option would be to have a line on the chart that simply indicates status. It could sit at 80 degrees for "off" and jump up to 140 degrees for "on". That's something I could implement, but it's a very inelegant solution, would cause the charts to be very messy, and has scale issues (e.g. what if all the temperatures involved are much higher or lower than the fixed "on" and "off" values, and now my chart is scaling to the "on" and "off" values rather than the observed temperatures?).
Unfortunately, it doesn't work to simply change the name of the series (e.g. series 1 and series 2), causing the line to be a new color, because when the state changes back, the chart diligently draws a straight line from the last reading of series 1 before the reading switched to be series 2.
So: does anyone have a creative solution for indicating a binary state alongside numeric data in the same chart?
submitted by HungryLikeTheWolf99 to nodered [link] [comments]

First Time Going Through Coding Interviews?

This post draws on my personal experiences and challenges over the past term at school, which I entered with hardly any knowledge of DSA (data structures and algorithms) and problem-solving strategies. As a self-taught programmer, I was a lot more familiar and comfortable with general programming, such as object-oriented programming, than with the problem-solving skills required in DSA questions.
This post reflects my journey throughout the term and the resources I turned to in order to quickly improve for my coding interview.
Here're some common questions and answers
What's the interview process like at a tech company?
Good question. It's actually pretty different from most other companies.

(What It's Like To Interview For A Coding Job

First time interviewing for a tech job? Not sure what to expect? This article is for you.

Here are the usual steps:

  1. First, you’ll do a non-technical phone screen.
  2. Then, you’ll do one or a few technical phone interviews.
  3. Finally, the last step is an onsite interview.
Some companies also throw in a take-home code test—sometimes before the technical phone interviews, sometimes after.
Let’s walk through each of these steps.

The non-technical phone screen

This first step is a quick call with a recruiter—usually just 10–20 minutes. It's very casual.
Don’t expect technical questions. The recruiter probably won’t be a programmer.
The main goal is to gather info about your job search. Stuff like:

  1. Your timeline. Do you need to sign an offer in the next week? Or are you trying to start your new job in three months?
  2. What’s most important to you in your next job. Great team? Flexible hours? Interesting technical challenges? Room to grow into a more senior role?
  3. What stuff you’re most interested in working on. Front end? Back end? Machine learning?
Be honest about all this stuff—that’ll make it easier for the recruiter to get you what you want.
One exception to that rule: If the recruiter asks you about your salary expectations on this call, best not to answer. Just say you’d rather talk about compensation after figuring out if you and the company are a good fit. This’ll put you in a better negotiating position later on.

The technical phone interview(s)

The next step is usually one or more hour-long technical phone interviews.
Your interviewer will call you on the phone or tell you to join them on Skype or Google Hangouts. Make sure you can take the interview in a quiet place with a great internet connection. Consider grabbing a set of headphones with a good microphone or a bluetooth earpiece. Always test your hardware beforehand!
The interviewer will want to watch you code in real time. Usually that means using a web-based code editor like Coderpad or collabedit. Run some practice problems in these tools ahead of time, to get used to them. Some companies will just ask you to share your screen through Google Hangouts or Skype.
Turn off notifications on your computer before you get started—especially if you’re sharing your screen!
Technical phone interviews usually have three parts:

  1. Beginning chitchat (5–10 minutes)
  2. Technical challenges (30–50 minutes)
  3. Your turn to ask questions (5–10 minutes)
The beginning chitchat is half just to help your relax, and half actually part of the interview. The interviewer might ask some open-ended questions like:

  1. Tell me about yourself.
  2. Tell me about something you’ve built that you’re particularly proud of.
  3. I see this project listed on your resume—tell me more about that.
You should be able to talk at length about the major projects listed on your resume. What went well? What didn’t? How would you do things differently now?
Then come the technical challenges—the real meet of the interview. You’ll spend most of the interview on this. You might get one long question, or several shorter ones.
What kind of questions can you expect? It depends.
Startups tend to ask questions aimed towards building or debugging code. (“Write a function that takes two rectangles and figures out if they overlap.”). They’ll care more about progress than perfection.
Larger companies will want to test your general know-how of data structures and algorithms (“Write a function that checks if a binary tree is ‘balanced’ in O(n)O(n) ↴ time.”). They’ll care more about how you solve and optimize a problem.
With these types of questions, the most important thing is to be communicating with your interviewer throughout. You'll want to "think out loud" as you work through the problem. For more info, check out our more detailed step-by-step tips for coding interviews.
If the role requires specific languages or frameworks, some companies will ask trivia-like questions (“In Python, what’s the ‘global interpreter lock’?”).
After the technical questions, your interviewer will open the floor for you to ask them questions. Take some time before the interview to comb through the company’s website. Think of a few specific questions about the company or the role. This can really make you stand out.
When you’re done, they should give you a timeframe on when you’ll hear about next steps. If all went well, you’ll either get asked to do another phone interview, or you’ll be invited to their offices for an onsite.

The onsite interview

An onsite interview happens in person, at the company’s office. If you’re not local, it’s common for companies to pay for a flight and hotel room for you.
The onsite usually consists of 2–6 individual, one-on-one technical interviews (usually in a small conference room). Each interview will be about an hour and have the same basic form as a phone screen—technical questions, bookended by some chitchat at the beginning and a chance for you to ask questions at the end.
The major difference between onsite technical interviews and phone interviews though: you’ll be coding on a whiteboard.
This is awkward at first. No autocomplete, no debugging tools, no delete button…ugh. The good news is, after some practice you get used to it. Before your onsite, practice writing code on a whiteboard (in a pinch, a pencil and paper are fine). Some tips:

  1. Start in the top-most left corner of the whiteboard. This gives you the most room. You’ll need more space than you think.
  2. Leave a blank line between each line as you write your code. Makes it much easier to add things in later.
  3. Take an extra second to decide on your variable names. Don’t rush this part. It might seem like a waste of time, but using more descriptive variable names ultimately saves you time because it makes you less likely to get confused as you write the rest of your code.
If a technical phone interview is a sprint, an onsite is a marathon. The day can get really long. Best to keep it open—don’t make other plans for the afternoon or evening.
When things go well, you’ wrap-up by chatting with the CEO or some other director. This is half an interview, half the company trying to impress you. They may invite you to get drinks with the team after hours.
All told, a long day of onsite interviews could look something like this:

If they let you go after just a couple interviews, it’s usually a sign that they’re going to pass on you. That’s okay—it happens!
There are are a lot of easy things you can do the day before and morning of your interview to put yourself in the best possible mindset. Check out our piece on what to do in the 24 hours before your onsite coding interview.

The take-home code test

Code tests aren’t ubiquitous, but they seem to be gaining in popularity. They’re far more common at startups, or places where your ability to deliver right away is more important than your ability to grow.
You’ll receive a description of an app or service, a rough time constraint for writing your code, and a deadline for when to turn it in. The deadline is usually negotiable.
Here's an example problem:
Write a basic “To-Do” app. Unit test the core functionality. As a bonus, add a “reminders” feature. Try to spend no more than 8 hours on it, and send in what you have by Friday with a small write-up.
Take a crack at the “bonus” features if they include any. At the very least, write up how you would implement it.
If they’re hiring for people with knowledge of a particular framework, they might tell you what tech to use. Otherwise, it’ll be up to you. Use what you’re most comfortable with. You want this code to show you at your best.
Some places will offer to pay you for your time. It's rare, but some places will even invite you to work with them in their office for a few days, as a "trial.")
Do I need to know this "big O" stuff?
Big O notation is the language we use for talking about the efficiency of data structures and algorithms.
Will it come up in your interviews? Well, it depends. There are different types of interviews.
There’s the classic algorithmic coding interview, sometimes called the “Google-style whiteboard interview.” It’s focused on data structures and algorithms (queues and stacks, binary search, etc).
That’s what our full course prepares you for. It's how the big players interview. Google, Facebook, Amazon, Microsoft, Oracle, LinkedIn, etc.
For startups and smaller shops, it’s a mixed bag. Most will ask at least a few algorithmic questions. But they might also include some role-specific stuff, like Java questions or SQL questions for a backend web engineer. They’ll be especially interested in your ability to ship code without much direction. You might end up doing a code test or pair-programming exercise instead of a whiteboarding session.
To make sure you study for the right stuff, you should ask your recruiter what to expect. Send an email with a question like, “Is this interview going to cover data structures and algorithms? Or will it be more focused around coding in X language.” They’ll be happy to tell you.
If you've never learned about data structures and algorithms, or you're feeling a little rusty, check out our Intuitive Guide to Data Structures and Algorithms.
Which programming language should I use?
Companies usually let you choose, in which case you should use your most comfortable language. If you know a bunch of languages, prefer one that lets you express more with fewer characters and fewer lines of code, like Python or Ruby. It keeps your whiteboard cleaner.
Try to stick with the same language for the whole interview, but sometimes you might want to switch languages for a question. E.g., processing a file line by line will be far easier in Python than in C++.
Sometimes, though, your interviewer will do this thing where they have a pet question that’s, for example, C-specific. If you list C on your resume, they’ll ask it.
So keep that in mind! If you’re not confident with a language, make that clear on your resume. Put your less-strong languages under a header like ‘Working Knowledge.’
What should I wear?
A good rule of thumb is to dress a tiny step above what people normally wear to the office. For most west coast tech companies, the standard digs are just jeans and a t-shirt. Ask your recruiter what the office is like if you’re worried about being too casual.
Should I send a thank-you note?
Thank-you notes are nice, but they aren’t really expected. Be casual if you send one. No need for a hand-calligraphed note on fancy stationery. Opt for a short email to your recruiter or the hiring manager. Thank them for helping you through the process, and ask them to relay your thanks to your interviewers.
1) Coding Interview Tips
How to get better at technical interviews without practicing
Chitchat like a pro.
Before diving into code, most interviewers like to chitchat about your background. They're looking for:

You should have at least one:

Nerd out about stuff. Show you're proud of what you've done, you're amped about what they're doing, and you have opinions about languages and workflows.
Communicate.
Once you get into the coding questions, communication is key. A candidate who needed some help along the way but communicated clearly can be even better than a candidate who breezed through the question.
Understand what kind of problem it is. There are two types of problems:

  1. Coding. The interviewer wants to see you write clean, efficient code for a problem.
  2. Chitchat. The interviewer just wants you to talk about something. These questions are often either (1) high-level system design ("How would you build a Twitter clone?") or (2) trivia ("What is hoisting in Javascript?"). Sometimes the trivia is a lead-in for a "real" question e.g., "How quickly can we sort a list of integers? Good, now suppose instead of integers we had . . ."
If you start writing code and the interviewer just wanted a quick chitchat answer before moving on to the "real" question, they'll get frustrated. Just ask, "Should we write code for this?"
Make it feel like you're on a team. The interviewer wants to know what it feels like to work through a problem with you, so make the interview feel collaborative. Use "we" instead of "I," as in, "If we did a breadth-first search we'd get an answer in O(n)O(n) time." If you get to choose between coding on paper and coding on a whiteboard, always choose the whiteboard. That way you'll be situated next to the interviewer, facing the problem (rather than across from her at a table).
Think out loud. Seriously. Say, "Let's try doing it this way—not sure yet if it'll work." If you're stuck, just say what you're thinking. Say what might work. Say what you thought could work and why it doesn't work. This also goes for trivial chitchat questions. When asked to explain Javascript closures, "It's something to do with scope and putting stuff in a function" will probably get you 90% credit.
Say you don't know. If you're touching on a fact (e.g., language-specific trivia, a hairy bit of runtime analysis), don't try to appear to know something you don't. Instead, say "I'm not sure, but I'd guess $thing, because...". The because can involve ruling out other options by showing they have nonsensical implications, or pulling examples from other languages or other problems.
Slow the eff down. Don't confidently blurt out an answer right away. If it's right you'll still have to explain it, and if it's wrong you'll seem reckless. You don't win anything for speed and you're more likely to annoy your interviewer by cutting her off or appearing to jump to conclusions.
Get unstuck.
Sometimes you'll get stuck. Relax. It doesn't mean you've failed. Keep in mind that the interviewer usually cares more about your ability to cleverly poke the problem from a few different angles than your ability to stumble into the correct answer. When hope seems lost, keep poking.
Draw pictures. Don't waste time trying to think in your head—think on the board. Draw a couple different test inputs. Draw how you would get the desired output by hand. Then think about translating your approach into code.
Solve a simpler version of the problem. Not sure how to find the 4th largest item in the set? Think about how to find the 1st largest item and see if you can adapt that approach.
Write a naive, inefficient solution and optimize it later. Use brute force. Do whatever it takes to get some kind of answer.
Think out loud more. Say what you know. Say what you thought might work and why it won't work. You might realize it actually does work, or a modified version does. Or you might get a hint.
Wait for a hint. Don't stare at your interviewer expectantly, but do take a brief second to "think"—your interviewer might have already decided to give you a hint and is just waiting to avoid interrupting.
Think about the bounds on space and runtime. If you're not sure if you can optimize your solution, think about it out loud. For example:

Get your thoughts down.
It's easy to trip over yourself. Focus on getting your thoughts down first and worry about the details at the end.
Call a helper function and keep moving. If you can't immediately think of how to implement some part of your algorithm, big or small, just skip over it. Write a call to a reasonably-named helper function, say "this will do X" and keep going. If the helper function is trivial, you might even get away with never implementing it.
Don't worry about syntax. Just breeze through it. Revert to English if you have to. Just say you'll get back to it.
Leave yourself plenty of room. You may need to add code or notes in between lines later. Start at the top of the board and leave a blank line between each line.
Save off-by-one checking for the end. Don't worry about whether your for loop should have "<<" or "<=<=." Write a checkmark to remind yourself to check it at the end. Just get the general algorithm down.
Use descriptive variable names. This will take time, but it will prevent you from losing track of what your code is doing. Use names_to_phone_numbers instead of nums. Imply the type in the name. Functions returning booleans should start with "is_*". Vars that hold a list should end with "s." Choose standards that make sense to you and stick with them.
Clean up when you're done.
Walk through your solution by hand, out loud, with an example input. Actually write down what values the variables hold as the program is running—you don't win any brownie points for doing it in your head. This'll help you find bugs and clear up confusion your interviewer might have about what you're doing.
Look for off-by-one errors. Should your for loop use a "<=<=" instead of a "<<"?
Test edge cases. These might include empty sets, single-item sets, or negative numbers. Bonus: mention unit tests!
Don't be boring. Some interviewers won't care about these cleanup steps. If you're unsure, say something like, "Then I'd usually check the code against some edge cases—should we do that next?"
Practice.
In the end, there's no substitute for running practice questions.
Actually write code with pen and paper. Be honest with yourself. It'll probably feel awkward at first. Good. You want to get over that awkwardness now so you're not fumbling when it's time for the real interview.

2) Tricks For Getting Unstuck During a Coding Interview
Getting stuck during a coding interview is rough.
If you weren’t in an interview, you might take a break or ask Google for help. But the clock is ticking, and you don’t have Google.
You just have an empty whiteboard, a smelly marker, and an interviewer who’s looking at you expectantly. And all you can think about is how stuck you are.
You need a lifeline for these moments—like a little box that says “In Case of Emergency, Break Glass.”
Inside that glass box? A list of tricks for getting unstuck. Here’s that list of tricks.
When you’re stuck on getting started
1) Write a sample input on the whiteboard and turn it into the correct output "by hand." Notice the process you use. Look for patterns, and think about how to implement your process in code.
Trying to reverse a string? Write “hello” on the board. Reverse it “by hand”—draw arrows from each character’s current position to its desired position.
Notice the pattern: it looks like we’re swapping pairs of characters, starting from the outside and moving in. Now we’re halfway to an algorithm.
2) Solve a simpler version of the problem. Remove or simplify one of the requirements of the problem. Once you have a solution, see if you can adapt that approach for the original question.
Trying to find the k-largest element in a set? Walk through finding the largest element, then the second largest, then the third largest. Generalizing from there to find the k-largest isn’t so bad.
3) Start with an inefficient solution. Even if it feels stupidly inefficient, it’s often helpful to start with something that’ll return the right answer. From there, you just have to optimize your solution. Explain to your interviewer that this is only your first idea, and that you suspect there are faster solutions.
Suppose you were given two lists of sorted numbers and asked to find the median of both lists combined. It’s messy, but you could simply:

  1. Concatenate the arrays together into a new array.
  2. Sort the new array.
  3. Return the value at the middle index.
Notice that you could’ve also arrived at this algorithm by using trick (2): Solve a simpler version of the problem. “How would I find the median of one sorted list of numbers? Just grab the item at the middle index. Now, can I adapt that approach for getting the median of two sorted lists?”
When you’re stuck on finding optimizations
1) Look for repeat work. If your current solution goes through the same data multiple times, you’re doing unnecessary repeat work. See if you can save time by looking through the data just once.
Say that inside one of your loops, there’s a brute-force operation to find an element in an array. You’re repeatedly looking through items that you don’t have to. Instead, you could convert the array to a lookup table to dramatically improve your runtime.
2) Look for hints in the specifics of the problem. Is the input array sorted? Is the binary tree balanced? Details like this can carry huge hints about the solution. If it didn’t matter, your interviewer wouldn’t have brought it up. It’s a strong sign that the best solution to the problem exploits it.
Suppose you’re asked to find the first occurrence of a number in a sorted array. The fact that the array is sorted is a strong hint—take advantage of that fact by using a binary search.

Sometimes interviewers leave the question deliberately vague because they want you to ask questions to unearth these important tidbits of context. So ask some questions at the beginning of the problem.
3) Throw some data structures at the problem. Can you save time by using the fast lookups of a hash table? Can you express the relationships between data points as a graph? Look at the requirements of the problem and ask yourself if there’s a data structure that has those properties.
4) Establish bounds on space and runtime. Think out loud about the parameters of the problem. Try to get a sense for how fast your algorithm could possibly be:

When All Else Fails
1) Make it clear where you are. State what you know, what you’re trying to do, and highlight the gap between the two. The clearer you are in expressing exactly where you’re stuck, the easier it is for your interviewer to help you.
2) Pay attention to your interviewer. If she asks a question about something you just said, there’s probably a hint buried in there. Don’t worry about losing your train of thought—drop what you’re doing and dig into her question.
Relax. You’re supposed to get stuck.
Interviewers choose hard problems on purpose. They want to see how you poke at a problem you don’t immediately know how to solve.
Seriously. If you don’t get stuck and just breeze through the problem, your interviewer’s evaluation might just say “Didn’t get a good read on candidate’s problem-solving process—maybe she’d already seen this interview question before?”
On the other hand, if you do get stuck, use one of these tricks to get unstuck, and communicate clearly with your interviewer throughout...that’s how you get an evaluation like, “Great problem-solving skills. Hire.”

3) Fixing Impostor Syndrome in Coding Interviews
“It's a fluke that I got this job interview...”
“I studied for weeks, but I’m still not prepared...”
“I’m not actually good at this. They’re going to see right through me...”
If any of these thoughts resonate with you, you're not alone. They are so common they have a name: impostor syndrome.
It’s that feeling like you’re on the verge of being exposed for what you really are—an impostor. A fraud.
Impostor syndrome is like kryptonite to coding interviews. It makes you give up and go silent.
You might stop asking clarifying questions because you’re afraid they’ll sound too basic. Or you might neglect to think out loud at the whiteboard, fearing you’ll say something wrong and sound incompetent.
You know you should speak up, but the fear of looking like an impostor makes that really, really hard.
Here’s the good news: you’re not an impostor. You just feel like an impostor because of some common cognitive biases about learning and knowledge.
Once you understand these cognitive biases—where they come from and how they work—you can slowly fix them. You can quiet your worries about being an impostor and keep those negative thoughts from affecting your interviews.

Everything you could know

Here’s how impostor syndrome works.
Software engineering is a massive field. There’s a huge universe of things you could know. Huge.
In comparison to the vast world of things you could know, the stuff you actually know is just a tiny sliver:
That’s the first problem. It feels like you don’t really know that much, because you only know a tiny sliver of all the stuff there is to know.

The expanding universe

It gets worse: counterintuitively, as you learn more, your sliver of knowledge feels like it's shrinking.
That's because you brush up against more and more things you don’t know yet. Whole disciplines like machine learning, theory of computation, and embedded systems. Things you can't just pick up in an afternoon. Heavy bodies of knowledge that take months to understand.
So the universe of things you could know seems to keep expanding faster and faster—much faster than your tiny sliver of knowledge is growing. It feels like you'll never be able to keep up.

What everyone else knows

Here's another common cognitive bias: we assume that because something is easy for us, it must be easy for everyone else. So when we look at our own skills, we assume they're not unique. But when we look at other people's skills, we notice the skills they have that we don't have.
The result? We think everyone’s knowledge is a superset of our own:
This makes us feel like everyone else is ahead of us. Like we're always a step behind.
But the truth is more like this:
There's a whole area of stuff you know that neither Aysha nor Bruno knows. An area you're probably blind to, because you're so focused on the stuff you don't know.

We’ve all had flashes of realizing this. For me, it was seeing the back end code wizard on my team—the one that always made me feel like an impostor—spend an hour trying to center an image on a webpage.

It's a problem of focus

Focusing on what you don't know causes you to underestimate what you do know. And that's what causes impostor syndrome.
By looking at the vast (and expanding) universe of things you could know, you feel like you hardly know anything.
And by looking at what Aysha and Bruno know that you don't know, you feel like you're a step behind.
And interviews make you really focus on what you don't know. You focus on what could go wrong. The knowledge gaps your interviewers might find. The questions you might not know how to answer.
But remember:
Just because Aysha and Bruno know some things you don't know, doesn't mean you don't also know things Aysha and Bruno don't know.
And more importantly, everyone's body of knowledge is just a teeny-tiny sliver of everything they could learn. We all have gaps in our knowledge. We all have interview questions we won't be able to answer.
You're not a step behind. You just have a lot of stuff you don't know yet. Just like everyone else.

4) The 24 Hours Before Your Interview

Feeling anxious? That’s normal. Your body is telling you you’re about to do something that matters.

The twenty-four hours before your onsite are about finding ways to maximize your performance. Ideally, you wanna be having one of those days, where elegant code flows effortlessly from your fingertips, and bugs dare not speak your name for fear you'll squash them.
You need to get your mind and body in The Zone™ before you interview, and we've got some simple suggestions to help.
5) Why You're Hitting Dead Ends In Whiteboard Interviews

The coding interview is like a maze

Listening vs. holding your train of thought

Finally! After a while of shooting in the dark and frantically fiddling with sample inputs on the whiteboard, you've came up with an algorithm for solving the coding question your interviewer gave you.
Whew. Such a relief to have a clear path forward. To not be flailing anymore.
Now you're cruising, getting ready to code up your solution.
When suddenly, your interviewer throws you a curve ball.
"What if we thought of the problem this way?"
You feel a tension we've all felt during the coding interview:
"Try to listen to what they're saying...but don't lose your train of thought...ugh, I can't do both!"
This is a make-or-break moment in the coding interview. And so many people get it wrong.
Most candidates end up only half understanding what their interviewer is saying. Because they're only half listening. Because they're desperately clinging to their train of thought.
And it's easy to see why. For many of us, completely losing track of what we're doing is one of our biggest coding interview fears. So we devote half of our mental energy to clinging to our train of thought.
To understand why that's so wrong, we need to understand the difference between what we see during the coding interview and what our interviewer sees.

The programming interview maze

Working on a coding interview question is like walking through a giant maze.
You don't know anything about the shape of the maze until you start wandering around it. You might know vaguely where the solution is, but you don't know how to get there.
As you wander through the maze, you might find a promising path (an approach, a way to break down the problem). You might follow that path for a bit.
Suddenly, your interviewer suggests a different path:
But from what you can see so far of the maze, your approach has already gotten you halfway there! Losing your place on your current path would mean a huge step backwards. Or so it seems.
That's why people hold onto their train of thought instead of listening to their interviewer. Because from what they can see, it looks like they're getting somewhere!
But here's the thing: your interviewer knows the whole maze. They've asked this question 100 times.

I'm not exaggerating: if you interview candidates for a year, you can easily end up asking the same question over 100 times.
So if your interviewer is suggesting a certain path, you can bet it leads to an answer.
And your seemingly great path? There's probably a dead end just ahead that you haven't seen yet:
Or it could just be a much longer route to a solution than you think it is. That actually happens pretty often—there's an answer there, but it's more complicated than you think.

Hitting a dead end is okay. Failing to listen is not.

Your interviewer probably won't fault you for going down the wrong path at first. They've seen really smart engineers do the same thing. They understand it's because you only have a partial view of the maze.
They might have let you go down the wrong path for a bit to see if you could keep your thinking organized without help. But now they want to rush you through the part where you discover the dead end and double back. Not because they don't believe you can manage it yourself. But because they want to make sure you have enough time to finish the question.
But here's something they will fault you for: failing to listen to them. Nobody wants to work with an engineer who doesn't listen.
So when you find yourself in that crucial coding interview moment, when you're torn between holding your train of thought and considering the idea your interviewer is suggesting...remember this:
Listening to your interviewer is the most important thing.
Take what they're saying and run with it. Think of the next steps that follow from what they're saying.
Even if it means completely leaving behind the path you were on. Trust the route your interviewer is pointing you down.
Because they can see the whole maze.
6) How To Get The Most Out Of Your Coding Interview Practice Sessions
When you start practicing for coding interviews, there’s a lot to cover. You’ll naturally wanna brush up on technical questions. But how you practice those questions will make a big difference in how well you’re prepared.
Here’re a few tips to make sure you get the most out of your practice sessions.
Track your weak spots
One of the hardest parts of practicing is knowing what to practice. Tracking what you struggle with helps answer that question.
So grab a fresh notebook. After each question, look back and ask yourself, “What did I get wrong about this problem at first?” Take the time to write down one or two things you got stuck on, and what helped you figure them out. Compare these notes to our tips for getting unstuck.
After each full practice session, read through your entire running list. Read it at the beginning of each practice session too. This’ll add a nice layer of rigor to your practice, so you’re really internalizing the lessons you’re learning.
Use an actual whiteboard
Coding on a whiteboard is awkward at first. You have to write out every single character, and you can’t easily insert or delete blocks of code.
Use your practice sessions to iron out that awkwardness. Run a few problems on a piece of paper or, if you can, a real whiteboard. A few helpful tips for handwriting code:

Set a timer
Get a feel for the time pressure of an actual interview. You should be able to finish a problem in 30–45 minutes, including debugging your code at the end.
If you’re just starting out and the timer adds too much stress, put this technique on the shelf. Add it in later as you start to get more comfortable with solving problems.
Think out loud
Like writing code on a whiteboard, this is an acquired skill. It feels awkward at first. But your interviewer will expect you to think out loud during the interview, so you gotta power through that awkwardness.
A good trick to get used to talking out loud: Grab a buddy. Another engineer would be great, but you can also do this with a non-technical friend.
Have your buddy sit in while you talk through a problem. Better yet—try loading up one of our questions on an iPad and giving that to your buddy to use as a script!
Set aside a specific time of day to practice.
Give yourself an hour each day to practice. Commit to practicing around the same time, like after you eat dinner. This helps you form a stickier habit of practicing.
Prefer small, daily doses of practice to doing big cram sessions every once in a while. Distributing your practice sessions helps you learn more with less time and effort in the long run.
part -2 will be upcoming in another post !
submitted by Cyberrockz to u/Cyberrockz [link] [comments]

ResultsFileName = 0×0 empty char array Why? Where are my results?

Edit: Turns out I was missing a needed toolbox.
Hello,
I am not getting any errors and I do not understand why I am not getting any output. I am trying to batch process a large number of ecg signals. Below is my code and the two relevant functions. Any help greatly appreciated. I am very new.
d = importSections("Dx_sections.csv"); % set the number of recordings n = height(d); % settings HRVparams = InitializeHRVparams('test_physionet') for ii = 1:n % Import waveform (ECG) [record, signals] = read_edf(strcat(d.PID(ii), '/baseline.edf')); myecg = record.ECG; Ann = []; [HRVout, ResultsFileName] = Main_HRV_Analysis(myecg,'','ECGWaveform',HRVparams) end function [HRVout, ResultsFileName ] = Main_HRV_Analysis(InputSig,t,InputFormat,HRVparams,subID,ann,sqi,varargin) % ====== HRV Toolbox for PhysioNet Cardiovascular Signal Toolbox ========= % % Main_HRV_Analysis(InputSig,t,InputFormat,HRVparams,subID,ann,sqi,varargin) % OVERVIEW: % % INPUT: % InputSig - Vector containing RR intervals data (in seconds) % or ECG/PPG waveform % t - Time indices of the rr interval data (seconds) or % leave empty for ECG/PPG input % InputFormat - String that specifiy if the input vector is: % 'RRIntervals' for RR interval data % 'ECGWaveform' for ECG waveform % 'PPGWaveform' for PPG signal % HRVparams - struct of settings for hrv_toolbox analysis that can % be obtained using InitializeHRVparams.m function % HRVparams = InitializeHRVparams(); % % % OPTIONAL INPUTS: % subID - (optional) string to identify current subject % ann - (optional) annotations of the RR data at each point % indicating the type of the beat % sqi - (optional) Signal Quality Index; Requires a % matrix with at least two columns. Column 1 % should be timestamps of each sqi measure, and % Column 2 should be SQI on a scale from 0 to 1. % Use InputSig, Type pairs for additional signals such as ABP % or PPG signal. The input signal must be a vector containing % signal waveform and the Type: 'ABP' and\or 'PPG'. % % OUTPUS: % results - HRV time and frequency domain metrics as well % as AC and DC, SDANN and SDNNi % ResultsFileName - Name of the file containing the results % % NOTE: before running this script review and modifiy the parameters % in "initialize_HRVparams.m" file accordingly with the specific % of the new project (see the readme.txt file for further details) % EXAMPLES % - rr interval input % Main_HRV_Analysis(RR,t,'RRIntervals',HRVparams) % - ECG wavefrom input % Main_HRV_Analysis(ECGsig,t,'ECGWavefrom',HRVparams,'101') % - ECG waveform and also ABP and PPG waveforms % Main_HRV_Analysis(ECGsig,t,'ECGWaveform',HRVparams,[],[],[], abpSig, % 'ABP', ppgSig, 'PPG') % % DEPENDENCIES & LIBRARIES: % HRV Toolbox for PhysioNet Cardiovascular Signal Toolbox % https://github.com/cliffordlab/PhysioNet-Cardiovascular-Signal-Toolbox % % REFERENCE: % Vest et al. "An Open Source Benchmarked HRV Toolbox for Cardiovascular % Waveform and Interval Analysis" Physiological Measurement (In Press), 2018. % % REPO: % https://github.com/cliffordlab/PhysioNet-Cardiovascular-Signal-Toolbox % ORIGINAL SOURCE AND AUTHORS: % This script written by Giulia Da Poian % Dependent scripts written by various authors % (see functions for details) % COPYRIGHT (C) 2018 % LICENSE: % This software is offered freely and without warranty under % the GNU (v3 or later) public license. See license file for % more information %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if nargin < 4 error('Wrong number of input arguments') end if nargin < 5 subID = '0000'; end if nargin < 6 ann = []; end if nargin < 7 sqi = []; end if length(varargin) == 1 || length(varargin) == 3 error('Incomplete Signal-Type pair') elseif length(varargin) == 2 extraSigType = varargin(2); extraSig = varargin{1}; elseif length(varargin) == 4 extraSigType = [varargin(2) varargin(4)]; extraSig = [varargin{1} varargin{3}]; end if isa(subID,'cell'); subID = string(subID); end % Control on signal length if (strcmp(InputFormat, 'ECGWaveform') && length(InputSig)/HRVparams.Fs< HRVparams.windowlength) ... || (strcmp(InputFormat, 'PPGWaveform') && length(InputSig)/HRVparams.Fs 300 s VLF = [0.0033 .04]; % Requires at least 300 s window LF = [.04 .15]; % Requires at least 25 s window HF = [0.15 0.4]; % Requires at least 7 s window HRVparams.freq.limits = [ULF; VLF; LF; HF]; HRVparams.freq.zero_mean = 1; % Default: 1, Option for subtracting the mean from the input data HRVparams.freq.method = 'lomb'; % Default: 'lomb' % Options: 'lomb', 'burg', 'fft', 'welch' HRVparams.freq.plot_on = 0; % The following settings are for debugging spectral analysis methods HRVparams.freq.debug_sine = 0; % Default: 0, Adds sine wave to tachogram for debugging HRVparams.freq.debug_freq = 0.15; % Default: 0.15 HRVparams.freq.debug_weight = .03; % Default: 0.03 % Lomb: HRVparams.freq.normalize_lomb = 0; % Default: 0 % 1 = Normalizes Lomb Periodogram, % 0 = Doesn't normalize % Burg: (not recommended) HRVparams.freq.burg_poles = 15; % Default: 15, Number of coefficients % for spectral estimation using the Burg % method (not recommended) % The following settings are only used when the user specifies spectral % estimation methods that use resampling : 'welch','fft', 'burg' HRVparams.freq.resampling_freq = 7; % Default: 7, Hz HRVparams.freq.resample_interp_method = 'cub'; % Default: 'cub' % 'cub' = cublic spline method % 'lin' = linear spline method HRVparams.freq.resampled_burg_poles = 100; % Default: 100 %% 11. SDANN and SDNNI Analysis Settings HRVparams.sd.on = 1; % Default: 1, SD analysis 1=On or 0=Off HRVparams.sd.segmentlength = 300; % Default: 300, windows length in seconds %% 12. PRSA Analysis Settings HRVparams.prsa.on = 1; % Default: 1, PRSA Analysis 1=On or 0=Off HRVparams.prsa.win_length = 30; % Default: 30, The length of the PRSA signal % before and after the anchor points % (the resulting PRSA has length 2*L) HRVparams.prsa.thresh_per = 20; % Default: 20%, Percent difference that one beat can % differ from the next in the prsa code HRVparams.prsa.plot_results = 0; % Default: 0 HRVparams.prsa.scale = 2; % Default: 2, scale parameter for wavelet analysis (to compute AC and DC) %% 13. Peak Detection Settings % The following settings are for jqrs.m HRVparams.PeakDetect.REF_PERIOD = 0.250; % Default: 0.25 (should be 0.15 for FECG), refractory period in sec between two R-peaks HRVparams.PeakDetect.THRES = .6; % Default: 0.6, Energy threshold of the detector HRVparams.PeakDetect.fid_vec = []; % Default: [], If some subsegments should not be used for finding the optimal % threshold of the P&T then input the indices of the corresponding points here HRVparams.PeakDetect.SIGN_FORCE = []; % Default: [], Force sign of peaks (positive value/negative value) HRVparams.PeakDetect.debug = 0; % Default: 0 HRVparams.PeakDetect.ecgType = 'MECG'; % Default : MECG, options (adult MECG) or featl ECG (fECG) HRVparams.PeakDetect.windows = 15; % Befautl: 15,(in seconds) size of the window onto which to perform QRS detection %% 14. Entropy Settings % Multiscale Entropy HRVparams.MSE.on = 1; % Default: 1, MSE Analysis 1=On or 0=Off HRVparams.MSE.windowlength = []; % Default: [], windows size in seconds, default perform MSE on the entire signal HRVparams.MSE.increment = []; % Default: [], window increment HRVparams.MSE.RadiusOfSimilarity = 0.15; % Default: 0.15, Radius of similarity (% of std) HRVparams.MSE.patternLength = 2; % Default: 2, pattern length HRVparams.MSE.maxCoarseGrainings = 20; % Default: 20, Maximum number of coarse-grainings % SampEn an ApEn HRVparams.Entropy.on = 1; % Default: 1, MSE Analysis 1=On or 0=Off HRVparams.Entropy.RadiusOfSimilarity = 0.15; % Default: 0.15, Radius of similarity (% of std) HRVparams.Entropy.patternLength = 2; % Default: 2, pattern length %% 15. DFA Settings HRVparams.DFA.on = 1; % Default: 1, DFA Analysis 1=On or 0=Off HRVparams.DFA.windowlength = []; % Default [], windows size in seconds, default perform DFA on the entair signal HRVparams.DFA.increment = []; % Default: [], window increment HRVparams.DFA.minBoxSize = 4 ; % Default: 4, Smallest box width HRVparams.DFA.maxBoxSize = []; % Largest box width (default in DFA code: signal length/4) HRVparams.DFA.midBoxSize = 16; % Medium time scale box width (default in DFA code: 16) %% 16. Poincaré plot HRVparams.poincare.on = 1; % Default: 1, Poincare Analysis 1=On or 0=Off %% 17. Heart Rate Turbulence (HRT) - Settings HRVparams.HRT.on = 1; % Default: 1, HRT Analysis 1=On or 0=Off HRVparams.HRT.BeatsBefore = 2; % Default: 2, # of beats before PVC HRVparams.HRT.BeatsAfter = 16; % Default: 16, # of beats after PVC and CP HRVparams.HRT.GraphOn = 0; % Default: 0, do not plot HRVparams.HRT.windowlength = 24; % Default 24h, windows size in hours HRVparams.HRT.increment = 24; % Default 24h, sliding window increment in hours HRVparams.HRT.filterMethod = 'mean5before'; % Default mean5before, HRT filtering option %% 18. Output Settings HRVparams.gen_figs = 0; % Generate figures HRVparams.save_figs = 0; % Save generated figures if HRVparams.save_figs == 1 HRVparams.gen_figs = 1; end % Format settings for HRV Outputs HRVparams.output.format = 'csv'; % 'csv' - creates csv file for output % 'mat' - creates .mat file for output HRVparams.output.separate = 0; % Default : 1 = separate files for each subject % 0 = all results in one file HRVparams.output.num_win = []; % Specify number of lowest hr windows returned % leave blank if all windows should be returned % Format settings for annotations generated HRVparams.output.ann_format = 'binary'; % 'binary' = binary annotation file generated % 'csv' = ASCII CSV file generated end 
submitted by MisuzBrisby to matlab [link] [comments]

Implementing BST in Rust (Qustion)

After reading the book 'Learn Rust With Entirely Too Many Linked Lists'. I decided the best way to test my understanding is to implement Binary Search Tree in Rust. I took the list structure from the book and added left and right links instead of one
Now I'm stuck on how to implement the Insert operation.
More generally, I'm struggling to find a clean way to way of implementing a running pointer that traverse through nodes of a data structure (be it a tree, a graph, or any thing of sort) and then edit (insert/delete/update) a certain node in that structure?
this an example of the structure I'm trying to implement
 head | None or Box(2) / \ None or Box(1) None or Box(3) 
Here is the structure definition:
pub struct BinarySearchTree { head: Link } type Link = Option>>; struct Node { val: T, left: Link, right: Link, } 
and This is my implementation of the insert method, which is not clean and does not compile.

 pub fn insert(&mut self,value:T){ let new_node = Box::new(Node{ val: value, left: None, right:None }); let current = self.head.as_mut(); match current{ None => self.head = Some(new_node), Some(_) =>{ //ERROR: move occurs because value has type `&mut std::boxed::Box>`, which does not implement the `Copy` trait while let Some(node) = current{ if node.val > new_node.val{ match &mut node.left { None =>{ node.left = Some(new_node); break }, //ERROR: cannot assign twice to immutable variablerustc(E0384) Variable: current Some(_) => current = node.left.as_mut(), } } else if node.val < new_node.val{ match &mut node.right { None =>{ node.right = Some(new_node); break }, //ERROR: cannot assign twice to immutable variablerustc(E0384) Some(_) => current = node.right.as_mut(), } } } } } } 
submitted by myweb6316 to rust [link] [comments]

[N] Tensorflow 2.3.0 Released!

There is also a new experimental tf.data API for saving and loading datasets(https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/data/experimental/save)
https://github.com/tensorflow/tensorflow/commit/4d58a67a9f19ab8d0cfbb2d8e461ebb73ce06db6
https://github.com/tensorflow/tensorflow/issues/38483#issuecomment-640963109

https://github.com/tensorflow/tensorflow/releases/tag/v2.3.0

Release 2.3.0

Major Features and Improvements


In addition checkout the detailed guide for analyzing input pipeline performance with TF Profiler.

Breaking Changes


Known Caveats


Bug Fixes and Other Changes

TF Core:


tf.data:


tf.distribute:


tf.keras:


tf.lite:


Packaging Support


Profiler


TPU Enhancements


Tracing and Debugging


XLA Support


submitted by IIIBlueberry to MachineLearning [link] [comments]

Binary Options Trading Strategy: Graphic Trend Analysis Using 5 Minute Candlestick Charts Binary Options Line Chart Trading Pattern Iq Option Trading Binary Options Beginners Training To $500 Per Hour ... Technical Trend analysis - read trading graphs in stocks Market  Iq Option - iq options basics How to trade Binary Option with Line Chart EP01 Read Graph Before 5 Sec100% Winning StrategyTrading ... Binary Options - This Alligator Indicator Helped Me Win ... 2016 how to read binary options graphs

Binary options charts are used by traders to track the progress and movement of various assets. There are multiple types of charts used for numerous types of trading, but there are some common ones that you will see more often. From simple one screen line formats to multiple screens displaying various assets and data, it is essential to make sure you have the tools you need to be able to trade ... Free Binary Options Charts >>>Click Here To Learn How To Use This Binary Options Chart<<< Different Types of Charts for Binary Options Trading. When you start trading binary options, there are several types of charts you will see most often. Each type of binary options chart has advantages and disadvantages, and once you understand the ... For each graph, we can choose so called timeframe, which is just an option of how large period of time one candle represents. The most common choices for binary options traders are 1 minute, 5 minutes, 15 minutes and 1 hour timeframes. When trading binary options we will probably use mostly the first three. Other than that, people also use 4 ... Deploying 5g semiconductor companies how to read bar graphs in binary options live in the same amount in spite of business days. Some light of assets, and volume was the taker and forex and the raspibolt. Sensing, including comparison coinbase pro offers a lower than traditional currencies will not for. This time period, the end up that may only deposit it easy to buy bitcoin. This is ... Optionfair Binary Options Graphs. Why Binary Options cannot be Considered as an Investment. There are plenty of investment choices on the market. Here we explore what binary options. Every trader knows that using graphs is a vital step to success. Read all you need to know about using binary options graphs to increase your trading success. How to read binary options charts. There’s lots of binary options strategies on this website. You will find strategies not only for trading 5 minute options and 15 minute options, but even short-term options such as 60 second binary options and long-term options for 60 minutes and more. Where to get more charting. If you have used any of the binary options broker platforms, or you are just a beginner who has looked around one or two of the platforms, one thing will stand out in a glaring fashion: the absence of interactive charts.Charts are the mainstay of technical analysis in the binary options market. Without charts, there would be no analysis of assets for trading ... Binary options graphs provide you with a visual context for placing a trade. How much you rely on the graph data to place your trade will depend on your entry rules. Entry rules are part of coming up with a trading method, also called a trading system. Having a method is a key component to becoming a real, professional trader instead of a gambler. Some trading methods rely heavily on the ... Simulink deposit binary graphs residents binary options review looks. binary binary code oder halbautomatischen system for binary How moneybookers. Options for review read signals that there are known to. Options trading zutun und meine erfahrungen. Option bot password written by bloomberg. Basically, binary options trading involves making predictions on whether an underlying asset is going to go up or down. In this trading, there are only two outcomes: you either win or lose. As a trader, it helps to understand binary options trading before you begin trading. Binary trading is different from traditional options, and you will find that it has different fees, risks, and payouts.

[index] [10757] [616] [25024] [29741] [29474] [9418] [14728] [7044] [27611] [24565]

Binary Options Trading Strategy: Graphic Trend Analysis Using 5 Minute Candlestick Charts

$1000 win iq option strategy 2020iq option moving average strategy 2020 never loss-binary option - Duration: 6:00. Candlestick Technical Trader 16,815 views 6:00 USA Friendly Broker: https://secure.raceoption.com/tiny/dNeIk Graphic Trends Charts: https://www.investing.com/charts/forex-charts You make 30 minute trades ... Binomo - For extra benefits and fast withdrawal you can sign up from here https://binomo.com?a=9843a1548e7b&t=6 olymp trade - For extra benefits and fast wit... New video 2016 2016 how to read binary options graphs To begin Binary Trading you will need a solid chart software to help make your decisions a Rank Site Name Broker Site Bonus Read Review Open ... binary options trading, binary options trading signals, binary options review, binary options binary software binary trading binary options brokers binary options strategy binary option binary ... 100% winning strategy iq option strategy 2020 iq option moving average strategy 2020 iq trading - Duration: 10:48. Candlestick Technical Trader 21,267 views 10:48 Binary Option trades have immediate execution. Executing an Options trade can be made for as little as $20. The returns on a Binary Options trade are instant from the moment a trade has closed ... Demo trading (no registration needed) - https://goo.gl/mw13WY For Mobile (iOS, Android) - https://goo.gl/IsVqqM Subscribe. 00:38 – activating alligator indic...

https://arab-binary-option.provpothundulag.ml