<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Denis Shtabnoy</title>
    <description>The latest articles on DEV Community by Denis Shtabnoy (@shtabnoy).</description>
    <link>https://dev.to/shtabnoy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F405645%2Fe4abac71-49f1-4265-a2a9-2ad60735a1e0.jpeg</url>
      <title>DEV Community: Denis Shtabnoy</title>
      <link>https://dev.to/shtabnoy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shtabnoy"/>
    <language>en</language>
    <item>
      <title>React Native AppState - A workaround to detect screen lock</title>
      <dc:creator>Denis Shtabnoy</dc:creator>
      <pubDate>Sun, 28 Mar 2021 22:06:43 +0000</pubDate>
      <link>https://dev.to/shtabnoy/react-native-appstate-a-workaround-to-detect-screen-lock-26cm</link>
      <guid>https://dev.to/shtabnoy/react-native-appstate-a-workaround-to-detect-screen-lock-26cm</guid>
      <description>&lt;p&gt;Hello devs 👋&lt;/p&gt;

&lt;p&gt;Today I'm gonna tell you about a hacky way to detect screen lock in react native applications (iOS only).&lt;/p&gt;

&lt;p&gt;As you probably already know, React Native gives you the &lt;a href="https://reactnative.dev/docs/appstate"&gt;AppState API&lt;/a&gt;, which helps to monitor the app state changes. But it's a bit restrictive, meaning that it has only three different states to look after (for Android, it's only two): &lt;code&gt;active,&lt;/code&gt; &lt;code&gt;inactive,&lt;/code&gt; and &lt;code&gt;background.&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem
&lt;/h3&gt;

&lt;p&gt;I worked on the app where I needed to track when a user locks the screen. I hadn't used AppState in react native applications before, so I was hoping that &lt;code&gt;background&lt;/code&gt; meant &lt;em&gt;"the screen is locked"&lt;/em&gt;. So I checked the basic flow of these states on my iPhone using &lt;a href="https://docs.expo.io/"&gt;Expo&lt;/a&gt;. I put a &lt;code&gt;console.log&lt;/code&gt; in the render method and started looking at the states in the terminal, turning the screen on and off and switching between the apps.&lt;/p&gt;

&lt;p&gt;Unfortunately, it turned out that the app always goes through the &lt;code&gt;background&lt;/code&gt; state no matter if you lock the screen or swipe to the Home screen or switch between the apps. And it doesn't only go directly to the &lt;code&gt;background&lt;/code&gt; state but also goes through &lt;code&gt;inactive&lt;/code&gt; on its way to &lt;code&gt;background.&lt;/code&gt; The only case when it doesn't go directly to the background is when you swipe up to the App Switcher and stay there for a while before swiping right or left to another app. This is the &lt;code&gt;inactive&lt;/code&gt; state.&lt;/p&gt;

&lt;h3&gt;
  
  
  App states
&lt;/h3&gt;

&lt;p&gt;So basically, we can divide the state changes into three different scenarios:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Whenever a user goes to the Home Screen, swipes to another app, or turns off the screen: &lt;code&gt;active -&amp;gt; inactive -&amp;gt; background.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If a user goes to the App Switcher without swiping to another app: &lt;code&gt;active -&amp;gt; inactive.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;When a user brings the app back to the foreground: &lt;code&gt;background -&amp;gt; active.&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  In the search for solutions
&lt;/h3&gt;

&lt;p&gt;Obviously, none of these cases fitted my need to track the screen lock. So I searched for some answers on the internet that could help me solve it. It turned out that the only way to do so is to exploit the magic of &lt;a href="https://reactnative.dev/docs/native-modules-intro"&gt;Native Modules&lt;/a&gt;. That means that I should either write a native module myself or use a third-party library to fill this gap.&lt;/p&gt;

&lt;p&gt;None of the options seemed very compelling to me. First of all, I'm not a swift or a kotlin programmer, and I don't have much time to look into it. Of course, it's fun to learn new stuff, but only when it's systematic, planned and balanced approach. Not when you have to learn something new ad hoc to solve a little problem that you have right here right now.&lt;/p&gt;

&lt;p&gt;That's why we usually use someone else's wheels instead of inventing our own. And this is when the third-party libraries and modules are at our service. So I looked for some React Native libraries on GitHub and found only &lt;a href="https://github.com/eliasrodeloso/react-native-lock-detection"&gt;this package&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But it is three years old, and it didn't work for me, unfortunately. And since I don't know how to debug native modules and I didn't want to spend more time on this, I continued searching, but everything else that I found was only some Objective C pieces of code like &lt;a href="https://stackoverflow.com/a/14271705/4010959"&gt;this one&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Another reason why I didn't want to use or create a native module for it was that I didn't want to eject from Expo because with it, React Native development is easier and much more fun. And of course, eventually, I would also have to write two different native modules: one for android and one for iOS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Workaround
&lt;/h3&gt;

&lt;p&gt;So I thought that maybe there is a way to bypass that limitation somehow, and I started looking closely at the behavior of that state changes. I noticed that when I minimize the app, i.e., go to the Home screen, the app goes from the &lt;code&gt;inactive&lt;/code&gt; state to &lt;code&gt;background&lt;/code&gt; a bit slower than when I lock the screen.&lt;/p&gt;

&lt;p&gt;Using the code from the &lt;a href="https://reactnative.dev/docs/appstate"&gt;App State&lt;/a&gt; React Native tutorial, I added two &lt;strong&gt;Date&lt;/strong&gt; objects to check the time difference, and it turned out that it was drastic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;appState&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;AppState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="nl"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nx"&gt;componentDidMount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;AppState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;change&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_handleAppStateChange&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;componentWillUnmount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;AppState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;change&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_handleAppStateChange&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;_handleAppStateChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nextAppState&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nextAppState&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;inactive&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nextAppState&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;background&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nextAppState&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;View&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Text&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Current&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;appState&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Text&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/View&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first scenario finished in &lt;code&gt;~800ms&lt;/code&gt;, while the latter one finished within &lt;code&gt;5-8ms&lt;/code&gt;. This is about &lt;strong&gt;100&lt;/strong&gt; times faster to lock the screen than to minimize the app.&lt;/p&gt;

&lt;p&gt;Thus, we can write an &lt;code&gt;if&lt;/code&gt; statement to check a transition from &lt;code&gt;inactive&lt;/code&gt; to &lt;code&gt;background.&lt;/code&gt; If it is done in less than &lt;code&gt;10ms&lt;/code&gt;, we can assume that it is the screen lock, and if more than &lt;code&gt;100ms&lt;/code&gt; we can assume that it is all other cases. &lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I understand that it is a completely unstable and very hacky workaround to make it work without any native modules and keeping Expo in the game. Of course, the numbers might be different from one version of iOS or Expo to another. Also, they might vary in the final build.&lt;/p&gt;

&lt;p&gt;And this only works for iPhones because Android, unfortunately, doesn't have the &lt;code&gt;inactive&lt;/code&gt; state. But it has &lt;code&gt;focus&lt;/code&gt; and &lt;code&gt;blur&lt;/code&gt; events, which might fix this issue. &lt;/p&gt;

&lt;p&gt;If you have any other solutions to this problem or some stable native modules, please share them with me. I would be glad to hear how you tackled this problem if you ever faced it. Also, any Android solution would be appreciated as well.&lt;/p&gt;

&lt;p&gt;Thank you! And happy coding!&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>react</category>
      <category>appstate</category>
      <category>screenlock</category>
    </item>
    <item>
      <title> Touching a quantum computer</title>
      <dc:creator>Denis Shtabnoy</dc:creator>
      <pubDate>Tue, 09 Jun 2020 22:21:46 +0000</pubDate>
      <link>https://dev.to/shtabnoy/touching-a-quantum-computer-158k</link>
      <guid>https://dev.to/shtabnoy/touching-a-quantum-computer-158k</guid>
      <description>&lt;p&gt;Try to remember the first time you saw a computer. Just a regular computer based on a binary set of rules, that we all use now. What did you feel back then? It was like a whole new world hidden inside it. The whole new universe was captivating you with its infinite tools and options. Some dinosaurs can remember computers without a GUI, only text-based terminal where you could gently ask "whoami", and your "metal servant" would kindly respond with your name. I saw my first PC not that long ago, about 15 years ago, at one of my local buddies home. That computer was powered by Microsoft's Windows XP, which was the most popular version of Windows back then. I was fascinated even by the welcoming screen with that famous sound and a "bliss" background of California's Wine Country (my favorite was Stonehenge anyway). And its graphic editor "Paint" would cause even more awe, admiration and joy. Later, when you started to get used to a computer, it started to reveal you more and more secrets and its endless possibilities.&lt;/p&gt;

&lt;p&gt;Today we live on the verge of a new technology revolution and we have a unique possibility to witness its birth in the form of quantum computers. And not only witness but touch it. By touching I mean not a literal touching, but running a task on it, experiment and get some graphical feedback. Probably you can even literally touch it if you're close to these universities and giant tech companies that have them in their mysterious basements where they are breaking cryptographic protocols and achieving "quantum supremacy". But I'm gonna tell you about some remote opportunities of touching a quantum computer.&lt;/p&gt;

&lt;p&gt;I don't remember exactly when I first heard about quantum computing, but once it settled in my head, it started to slowly grow there fueling my interest in that field. So from time to time I read some articles here and there about this mysterious topic not understanding much at first, but slowly acquiring basic ideas behind it. The main question you always have to ask yourself about any new technology is "why does it exist?", or rephrasing it, "why have people even invented it, for what purpose?". And this always helps to come to an understanding of every advance or progress that humans did. It also always means that there was something imperfect, something that was not enough to solve some problems, something that had to be changed in order to improve a technology, to simplify sophisticated tasks, to unfold a whole new branch of possibilities.&lt;/p&gt;

&lt;p&gt;In case of computing there always has been a problem with representing physical processes and simulating behavior of atoms and particles. These simulations are particularly useful in some realms of physics, chemistry, biology and medicine. They are based on quantum properties of matter, and therefore it has always been a challenge to write even a simplest simulation of a simplest molecule on a regular computer, cause it involves too many states of too many particles that are highly intertwined with each other. To put it simply all this things that could probably help us understand our world better, decode our genome or even find a cure from cancer are actually not possible to write even on the fastest supercomputer. I'm not going to dig deeper into the basics of quantum computing or quantum mechanics. For this purpose there's a &lt;a href="https://quantum.country/qcvc"&gt;great resource&lt;/a&gt; that explains everything you need to know about it in a very rigorous and strict scientific way.&lt;/p&gt;

&lt;p&gt;So this seemingly inconceivable branch of science kept haunting me forcing me to read more technical papers, than just mundane trivial explanations, where an author uses some wierd analogies just so even your grandma could understand it. And then finally I stumbled upon a D-Wave website, a Canadian company that produces quantum computers and drives a lot of R&amp;amp;D in that area. To my utter amazement and complete surprise it turned out that they also provide a possibility to use their quantum computers in the cloud.&lt;/p&gt;

&lt;p&gt;Stop for a couple of seconds here and ponder on this for a while. Quantum computer... in the cloud! Isn't it amazing? And furthermore, it's been there for quite some time now. I couldn't find an exact date when cloud quantum computers became a thing, but wikipedia says that back then in 2011 D-Wave announced first commercially available quantum computer. I have no idea how you could access this incredible machine almost 9 years ago, but now so many new tech companies, who provide quantum computing as a service, have emerged, like IBM with its IBM Q Experience, Microsoft with LIQUil, Google with its Quantum Playground and others. And all of the offer an incredible tool set to play around with their quantum computers. But for now I just focus on two of them, D-Wave and IBM. And I will try to describe you my experience with working with their quantum machines and express my feelings about that.&lt;/p&gt;

&lt;p&gt;I started to play around with D-Wave system called Leap, cause it was basically first that I found out there as I previously said. And it swallowed me completely. I was very excited by their demos. For instance, &lt;a href="https://cloud.dwavesys.com/leap/demos/factoring/intro"&gt;factoring with a quantum computer&lt;/a&gt; is so straightforward and well written, that it immediately became so clear to me, what the advantage of using a quantum computer for that kind of tasks is, and that our current cryptographic algorithms would be so weak for this incredible machines. Also, this demo maps all known features of binary computing to their twin brothers in the quantum world. So bits become qubits, logic gates become couples (basically, a bunch of qubits bundled together). And the icing on the cake, the most thrilling and exciting part, something that really hooked me on and forced me to write this post is the ability to run this demo on a real quantum computer hidden behind the curtains of the browser and network connection. A real physical D-Wave 2000Q quantum computer, that you can "touch" via code. Just think about it. These computers are still such a rare commodity. Only few companies and institutes have them and even fewer can afford to provide a service over cloud for everyone. And we have now a unique opportunity to try these things out, even though we still can not see them directly.&lt;/p&gt;

&lt;p&gt;And of course everything comes with a price. Because of its structure complexity it's very hard to build, maintain and fix them. Therefore they are very expensive this days. This leads to the scarcity of these machines and to the time limits developers have to apply to reduce a rising demand. That's why after I ran my very first demo on a quantum computer, I saw that scary circle showed me how much time I have left. Actually I spent not that much by running just one factoring demo (because this demo was just about factoring number 21), about 0.36% of all the time available to me. But does that even matter if you can play with a real quantum machine?&lt;/p&gt;

&lt;p&gt;But this is just a tip of an iceberg. They created their own integrated into browser VSCode-like IDE, where you can run your own arbitrary python algorithms and challenge their computer to "solve your problems". Besides demos there are ready-to-use examples for problems that fit for quantum computers very well, great documentation and a learning platform. Seems like a really good place to start your journey into the vague world of quantum computing.&lt;/p&gt;

&lt;p&gt;Later I also found another great quantum cloud service made by another well-known mastodon tech company, that no one calls International Business Machines anymore. This one was as good as D-Wave or even better. It provides the same feature of having these &lt;a href="https://quantum-computing.ibm.com/jupyter"&gt;jupyter python notebooks&lt;/a&gt; where you can run your code against their quantum beasts. But also they have a nice interactive circuit building tool, where you can create a program by just dragging and dropping predefined elements of quantum circuits onto the board and then run it and see the result. For this ones you don't even need to have any programming skills. What's better with IBM is that "they have a ton load of money" they give your this all for free. But because of that, there's a long list of people willing to test their beautiful programs and you have to stay in line for quite some time (it was about 5-10 min for me). That's why ingenious engineers of IBM created a quantum simulator that you can also try. And you'll get result very fast, almost instantly, just wait when an http response comes back to you with the data from the server.&lt;/p&gt;

&lt;p&gt;It reminds me of the days when I was a kid and few people in my little town had computers back then. The majority would still go to so called "computer clubs" to play some computer games or surf the internet. They had to pay an hourly fee to get some time on those PCs with Windows 98 which were powered by incredibly fast Pentium III processors. And even then computers weren't that rare as quantum computers are today. And now, that era has long gone and changed to the era of social networks and mobile devices. It's fun to reminisce and get nostalgic about those times and compare it to the reality we have now. It helps to extrapolate changes into the future and assume that eventually everyone will have a personal quantum computer with its tiny cryostat encompassing its QPU made of millions of qubits. With that amount of power potentially you'll be able to bruteforce any modern encryption. That's why scientists already stay up all nights working on post-quantum cryptography, but that's another story.&lt;/p&gt;

&lt;p&gt;On the other hand, quantum computers now are designed to solve some specific tasks like analyzing complex molecules and chemical processes, finding new materials and using them to boost progress. So you would probably say that not everyone needs a quantum computer to share their instagram stories or watch new videos of their favorite blogger. That is actually true. You don't need to have a quantum computer for such trivial tasks. But if you're a scientist, a developer, an engineer or just a curious person who wants to contribute to something important for humanity, you will definitely appreciate a small personal quantum computer instead of using cloud-based mega expensive machines on the other side of the world. Also, quantum computers could be really helpful in the field of AI, cause machine learning matches really well with quantum computing and these two branches of science would definitely help one another in the future.&lt;/p&gt;

&lt;h4&gt;
  
  
  Resources
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://quantum-computing.ibm.com/"&gt;https://quantum-computing.ibm.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://cloud.dwavesys.com/leap"&gt;https://cloud.dwavesys.com/leap&lt;/a&gt; &lt;/p&gt;

</description>
      <category>quantumcomputing</category>
      <category>quantumcomputers</category>
      <category>quantum</category>
      <category>computing</category>
    </item>
  </channel>
</rss>
