<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" >

<channel><title><![CDATA[2BIT || ! 2BIT &#128104;&zwj;&#128187; - Blog]]></title><link><![CDATA[https://www.2bitornot2bit.com/blog]]></link><description><![CDATA[Blog]]></description><pubDate>Tue, 25 Jun 2024 09:09:41 -0700</pubDate><generator>Weebly</generator><item><title><![CDATA[DIY HomeKit System]]></title><link><![CDATA[https://www.2bitornot2bit.com/blog/diy-homekit-system]]></link><comments><![CDATA[https://www.2bitornot2bit.com/blog/diy-homekit-system#comments]]></comments><pubDate>Fri, 22 Jan 2021 12:39:50 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">https://www.2bitornot2bit.com/blog/diy-homekit-system</guid><description><![CDATA[So I wanted to connect my Smart-Home DIY system to Apple HomeKit and so it turns out it is not so hard to do.My system has an open source nodejs server and an easy to use API to control lights, TV, AC and more.The only thing I was missing is an easy to use UI with automation&nbsp; and security.It happens to be that I am an Apple fan with an iPhone so why not connect it to HomeKit and as a bonus I will have Siri commands from my iPhone and apple watch and even from the apple TV.To do that I used  [...] ]]></description><content:encoded><![CDATA[<div class="paragraph">So I wanted to connect my <a href="https://github.com/benchuk/SmartHomeDIY" target="_blank">Smart-Home DIY system</a> to Apple HomeKit and so it turns out it is not so hard to do.<br />My system has an open source <a href="https://github.com/benchuk/SmartHomeDIY/tree/master/SmartHome/web_server/PI%20Server/project_pi_node_server" target="_blank">nodejs</a> server and an easy to use API to control <a href="https://github.com/benchuk/SmartHomeDIY/tree/master/SmartHome/arduino_stations" target="_blank">lights</a>, TV, AC and more.<br />The only thing I was missing is an easy to use UI with automation&nbsp; and security.<br />It happens to be that I am an Apple fan with an iPhone so why not connect it to HomeKit and as a bonus I will have Siri commands from my iPhone and apple watch and even from the apple TV.<br />To do that I used <a href="https://nodered.org/" target="_blank">Node-Red</a>. installing it on windows is easy and you can even install it on&nbsp;raspberry pi. If you want to get an idea what Node-Red is doing exactly check their <a href="https://www.youtube.com/watch?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6&amp;v=ksGeUD26Mw0&amp;feature=youtu.be" target="_blank">intro</a>&nbsp;<br /><br />Once you have Node-Red installed you will have to install a plugin named&nbsp;&#8203;<a href="https://flows.nodered.org/node/node-red-contrib-homekit" target="_blank">node-red-contrib-homekit</a>.<br />You just click the menu icon -&gt; Manage palette -&gt; Install tab -&gt; search for: '<span style="color:rgb(85, 85, 85)">node-red-contrib-homekit-bridged' -&gt; click install&nbsp;</span><br /><br /></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/published/screen-shot-2021-01-22-at-14-59-08.png?1611320558" alt="Picture" style="width:297;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/published/screen-shot-2021-01-22-at-14-59-54.png?1611320581" alt="Picture" style="width:516;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div class="paragraph"><span>After that you will be able to build something Node-Red calls 'flow' which is actually a configuration or a description of your emulated apple devices and what to do when you press a button on the HomeKit app.</span><br />The end result will look something like this:</div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/screen-shot-2021-01-22-at-14-58-21_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div class="paragraph"><br />All you have to do now,&nbsp; is configure an 'Emulated HomeKit Device' and tell it what to do.<br /><br />To add one just drag from the left panel a node named 'HomeKit' and then drag a node named 'http request' we will connect them to each other in a second.<br /><br />&#8203;So let's start with the '<span>HomeKit</span>' node.<br />After placing it on the 'flow canvas' we can double click it and configure it, we will do a light switch:<br />You will have to define a Bridge (a backend container for the switch) and named it (in my case 'Light1'),&nbsp; the pin code is used when scanning from the Apple Home app - you can just leave it as is, basically just give it a name and save. then in the 'properties' assign it the service type Lightbulb (there are many services you can explore and each looks and behave differently on the apple Home app).</div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/published/screen-shot-2021-01-22-at-15-06-29.png?1611322514" alt="Picture" style="width:408;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/editor/screen-shot-2021-01-22-at-15-11-34.png?1611322552" alt="Picture" style="width:489;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/editor/screen-shot-2021-01-22-at-15-10-15.png?1611322590" alt="Picture" style="width:461;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div class="paragraph"><span>Now let's configure the http request node.</span><br /><span>Double click it and in the URL type 'http://YOUR_LOCL_IP_:PORT/API'</span><br /><span>(You could also use a javascript function node before and do some tricks if you wanted)</span></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/published/screen-shot-2021-01-22-at-15-07-28.png?1611322777" alt="Picture" style="width:424;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/published/screen-shot-2021-01-22-at-15-15-50.png?1611322616" alt="Picture" style="width:395;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div class="paragraph"><span>Now just connect the HomeKit node to the http request node by dragging a line between the little squares at the edge of the nodes.</span></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/published/screen-shot-2021-01-22-at-15-14-14.png?1611322635" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div class="paragraph"><strong><span>To make this node available we have to run the flow, so click 'deploy' on the top right&nbsp;</span><span>&#8203;</span></strong></div>  <div class="paragraph"><span>Now let's scan and configure this emulated device from the Home app on IOS.</span><ol><li>Tap the plus icon.</li><li>Add accessory</li><li>Click 'I Don't have a Code Or Cannot Scan'</li><li>Select the emulated device from the list ('Light1' in our case)</li></ol></div>  <div><div style="height:20px;overflow:hidden"></div> <div id='666474120804165044-slideshow'></div> <div style="height:20px;overflow:hidden"></div></div>  <div class="paragraph">That's it, when ever you click on the IOS app light button you will make an http call.<br />Note that the 'homekit-node' will send your http-node (or function) a 0 or 1 depending if the light should go off or on, this is why I have a function node in between the http-node and the homekit-node where I modify the URL before placing the http request, so my server will know if it is an 'on' or' off command.<br />Hope it works for you and that you will enjoy it as much as I do &#128104;&zwj;&#128187;</div>]]></content:encoded></item><item><title><![CDATA[Performance of JVM vs native vs the world]]></title><link><![CDATA[https://www.2bitornot2bit.com/blog/performance-of-jvm-vs-native-vs-the-world]]></link><comments><![CDATA[https://www.2bitornot2bit.com/blog/performance-of-jvm-vs-native-vs-the-world#comments]]></comments><pubDate>Fri, 15 Feb 2019 21:59:23 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">https://www.2bitornot2bit.com/blog/performance-of-jvm-vs-native-vs-the-world</guid><description><![CDATA[,Performance tests in several basic scenarios to estimate languages runtime performance​Lately I was trying to understand how virtual memory works&nbsp;and how JVM work and perform.My intuition was ' if a JVM is written in C, it is probably less performant than C 'So after a lot of reading and investigations I found out that the story is much more complicated then I have initially thought.JVM has many optimization which makes it very fast most of the time, it does has an overhead but the optim [...] ]]></description><content:encoded><![CDATA[<div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="https://www.2bitornot2bit.com/uploads/1/1/7/0/117028859/performance-tests_orig.jpg" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph">,<a href="https://117028859-642721740891937732.preview.editmysite.com/editor/main.php#">Performance tests in several basic scenarios to estimate languages runtime performance</a><br><br>&#8203;Lately I was trying to understand how <a href="https://manybutfinite.com/post/how-the-kernel-manages-your-memory/" target="_blank">virtual memory works</a><a href="https://www.ibm.com/developerworks/library/j-nativememory-linux/" target="_blank">&nbsp;</a>and how <a href="https://www.ibm.com/developerworks/library/j-nativememory-linux/" target="_blank">JVM work and perform</a>.<br>My intuition was ' if a JVM is written in C, it is probably less performant than C '<br>So after a lot of reading and investigations I found out that the story is much more complicated then I have initially thought.<br>JVM has many optimization which makes it very fast most of the time, it does has an overhead but the optimization in JIT make every thing worth it.<br>basically the JVM will loaded into native virtual memory (and be shared with other processes when possible)<br>it will use sophisticated algorithms to allocate memory on the native heap to create managed heap.<br>it will JIT to perform well, will vectorise&nbsp; actions and what not to make the run time overhead worth it.<br>At that point I was thinking ' OK, so javascript is a VM, it should probably also perform well '<br>But <a href="https://www.techempower.com/benchmarks/#section=test&amp;runid=8ca46892-e46c-4088-9443-05722ad6f7fb&amp;hw=ph&amp;test=plaintext" target="_blank">benchmark tests online showed different things</a>. I know javascript is single threaded but this tests take this into account (For example fork many process).<br>The V8 engine is highly optimized and <a href="https://blog.sessionstack.com/how-javascript-works-inside-the-v8-engine-5-tips-on-how-to-write-optimized-code-ac089e62b12e" target="_blank">make all kind of clever things</a> to perform faster, for example making a behind the scene classes and types and caches to speed up the execution.<br>V8 is still young compared to C and Java so I am sure it will be even better. my impression is that optimizing a dynamic language such as javascript is harder than a language like java, but I might be wrong here.<br><br>Any way I thought that I have to make my own test to better understand the performance difference in various situations, so here it is, <a href="https://github.com/benchuk/performance_tests" target="_blank">my results</a><br></div><div><div id="856748290307302406" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> <!-- bottom --><ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-7132923318074087" data-ad-slot="3932695135"></ins> </div></div><blockquote>1. &#8203;<span style="color:rgb(98, 98, 98)"><strong>java</strong> and <strong>node</strong> win when performing <strong>loops</strong> and in memory<br></span><br><span style="color:rgb(98, 98, 98)"><strong>2. c</strong> and <strong>go</strong> win as of for</span><span style="color:rgb(98, 98, 98)">&nbsp;</span><span style="color:rgb(98, 98, 98)"><strong>reading</strong> <strong>file</strong> from disk to memory</span><br><br><span style="color:rgb(98, 98, 98)">3. <strong>java</strong> wins in <strong>http</strong> server</span></blockquote><div class="paragraph">&#8203;<span style="color:rgb(98, 98, 98)">hope you will find this info helpful!</span><br></div>]]></content:encoded></item><item><title><![CDATA[Hosting android libraries on github]]></title><link><![CDATA[https://www.2bitornot2bit.com/blog/hosting-android-libraries-on-github]]></link><comments><![CDATA[https://www.2bitornot2bit.com/blog/hosting-android-libraries-on-github#comments]]></comments><pubDate>Thu, 03 Jan 2019 10:02:14 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">https://www.2bitornot2bit.com/blog/hosting-android-libraries-on-github</guid><description><![CDATA[&#8203;What to host you android custom library on your own&nbsp; public github account(Remote binary dependency)Let's start:Start with this oneContinue with thisAnd hereAnd this [...] ]]></description><content:encoded><![CDATA[<div class="paragraph">&#8203;What to host you android custom library on your own&nbsp; public github account<br />(Remote binary dependency)<br />Let's start:<ul><li>Start with this <a href="https://crushingcode.nisrulz.com/own-a-maven-repository-like-a-bosspart-1/" target="_blank">one</a></li><li>Continue with <a href="https://crushingcode.nisrulz.com/own-a-maven-repository-like-a-bosspart-2/" target="_blank">this</a></li><li>And <a href="https://gist.github.com/fernandezpablo85/03cf8b0cd2e7d8527063" target="_blank">here</a></li><li>And <a href="http://andydyer.org/blog/2014/10/05/hosting-android-dependencies-on-github/" target="_blank">this</a></li></ul></div>]]></content:encoded></item><item><title><![CDATA[Vue.js + Vuex + Vuetify]]></title><link><![CDATA[https://www.2bitornot2bit.com/blog/vuejs-vuex-vuetify]]></link><comments><![CDATA[https://www.2bitornot2bit.com/blog/vuejs-vuex-vuetify#comments]]></comments><pubDate>Thu, 03 Jan 2019 09:38:33 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">https://www.2bitornot2bit.com/blog/vuejs-vuex-vuetify</guid><description><![CDATA[Vuejs videosVuex:&nbsp; videosVuetify videos [...] ]]></description><content:encoded><![CDATA[<div class="paragraph"><ol><li>Vuejs <a href="https://www.youtube.com/playlist?list=PL4cUxeGkcC9gQcYgjhBoeQH7wiAyZNrYa" target="_blank">videos</a></li><li>Vuex:&nbsp; <a href="https://www.youtube.com/watch?v=BGAu__J4xoc&amp;list=PL4cUxeGkcC9i371QO_Rtkl26MwtiJ30P2" target="_blank">videos</a></li><li>Vuetify <a href="https://www.youtube.com/watch?v=2uZYKcKHgU0&amp;list=PL4cUxeGkcC9g0MQZfHwKcuB0Yswgb3gA5" target="_blank">videos</a></li></ol></div>]]></content:encoded></item><item><title><![CDATA[Kubernetes tutorial]]></title><link><![CDATA[https://www.2bitornot2bit.com/blog/kubernetes-tutorial]]></link><comments><![CDATA[https://www.2bitornot2bit.com/blog/kubernetes-tutorial#comments]]></comments><pubDate>Thu, 03 Jan 2019 09:08:20 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">https://www.2bitornot2bit.com/blog/kubernetes-tutorial</guid><description><![CDATA[       Learn Kubernetes basic - best video everSee usage video&nbsp;&#8203;Install&nbsp;&#8203;kubernetesAnother good intro video [...] ]]></description><content:encoded><![CDATA[<div class="wsite-youtube" style="margin-bottom:10px;margin-top:10px;"><div class="wsite-youtube-wrapper wsite-youtube-size-auto wsite-youtube-align-center"> <div class="wsite-youtube-container">  <iframe src="//www.youtube.com/embed/PH-2FfFD2PU?wmode=opaque" frameborder="0" allowfullscreen></iframe> </div> </div></div>  <div class="paragraph"><ol><li>Learn <a href="https://vimeo.com/245778144/4d1d597c5e" target="_blank">Kubernetes basic</a> - best video ever</li><li>See usage <a href="https://www.youtube.com/watch?v=1xo-0gCVhTU" target="_blank">video</a>&nbsp;</li><li><a href="https://matthewpalmer.net/kubernetes-app-developer/articles/guide-install-kubernetes-mac.html" target="_blank">&#8203;Install&nbsp;&#8203;kubernetes</a></li><li>Another good intro <a href="https://www.youtube.com/watch?v=1dgUXNVQS5o" target="_blank">video</a></li></ol></div>]]></content:encoded></item></channel></rss>