<?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: mixbo</title>
    <description>The latest articles on DEV Community by mixbo (@ihavecoke).</description>
    <link>https://dev.to/ihavecoke</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%2F57521%2Fde348d17-44d3-4af4-aef4-6fe29aa4fb70.jpeg</url>
      <title>DEV Community: mixbo</title>
      <link>https://dev.to/ihavecoke</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ihavecoke"/>
    <language>en</language>
    <item>
      <title>Nuxtjs Generate SEO metadata simple</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Sat, 02 Jan 2021 08:49:05 +0000</pubDate>
      <link>https://dev.to/ihavecoke/nuxtjs-generate-meta-info-simplely-237a</link>
      <guid>https://dev.to/ihavecoke/nuxtjs-generate-meta-info-simplely-237a</guid>
      <description>&lt;p&gt;when you use nuxtjs to support ssr, you can defined meta info in page vue component. and you should set metadata each page?&lt;/p&gt;

&lt;p&gt;No! you can just add &lt;code&gt;nuxt-seo-meta&lt;/code&gt; to your project.&lt;/p&gt;

&lt;p&gt;i have made this npm to reduce time defined redundancy meta.&lt;/p&gt;

&lt;p&gt;in &lt;code&gt;nuxt-seo-meta&lt;/code&gt; you just defined you care info and reset all meta info &lt;code&gt;nuxt-seo-meta&lt;/code&gt; will auto generate.&lt;br&gt;
include &lt;code&gt;twitter&lt;/code&gt;, &lt;code&gt;facebook&lt;/code&gt; social meta.&lt;/p&gt;

&lt;p&gt;here show the screenshoot for you&lt;/p&gt;

&lt;p&gt;use in &lt;code&gt;asyncData&lt;/code&gt;&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;async&lt;/span&gt; &lt;span class="nx"&gt;asyncData&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;seoMeta&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;seoMeta&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PageTitle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PageDescription&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PageUrl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SocialShareImage.png&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;use in head&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="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;$seoMeta&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="na"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$seoMeta&lt;/span&gt;&lt;span class="p"&gt;({...&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="kc"&gt;false&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;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OIIkdClX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://public.mixbo.cn/nuxtjs-seo-meta.png%3Ft1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OIIkdClX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://public.mixbo.cn/nuxtjs-seo-meta.png%3Ft1" alt="DemoImage" width="880" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;you can find more info &lt;a href="https://github.com/ihavecoke/nuxt-seo-meta#readme"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>ssr</category>
    </item>
    <item>
      <title>Seven problems nuxtjs resloved</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Sun, 02 Aug 2020 14:21:46 +0000</pubDate>
      <link>https://dev.to/ihavecoke/seven-problems-nuxtjs-resloved-46oj</link>
      <guid>https://dev.to/ihavecoke/seven-problems-nuxtjs-resloved-46oj</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OH-DLiue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oijt11zt3gqztpm1tg0t.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OH-DLiue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oijt11zt3gqztpm1tg0t.jpg" alt="Alt Text" width="880" height="880"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you thinks about  &lt;a href="https://nuxtjs.org"&gt;nuxtjs&lt;/a&gt; resloved what problems ? we know that &lt;strong&gt;nuxtjs&lt;/strong&gt; are awsome farmwork to write less and do more things automaic. &lt;/p&gt;

&lt;p&gt;Likes you can create file in &lt;code&gt;pages&lt;/code&gt; directory &lt;strong&gt;nuxtjs&lt;/strong&gt; will generate router for you. also you can create file in &lt;code&gt;store&lt;/code&gt; directory &lt;strong&gt;nuxtjs&lt;/strong&gt; will create namespace store for you when you use &lt;a href="https://vuex.vuejs.org/"&gt;vuex&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Easy to use and organization you code logic in &lt;strong&gt;nuxtjs&lt;/strong&gt; also best developer experience.  i have got seven point the &lt;strong&gt;nuxtjs&lt;/strong&gt; resloved for us from &lt;a href="https://nuxtjs.org"&gt;official webstie&lt;/a&gt;.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Building from scratch is difficult ?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Nuxtjs&lt;/strong&gt; help us intelligent &lt;strong&gt;vuex&lt;/strong&gt;, &lt;strong&gt;vue-router&lt;/strong&gt;, &lt;strong&gt;vue-meta&lt;/strong&gt; you just need run command &lt;code&gt;npx create-nuxt-app &amp;lt;project-name&amp;gt;&lt;/code&gt;  the full project necessary file and config will create for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  No standard folder structure ?
&lt;/h3&gt;

&lt;p&gt;Write project with vuejs and whitout farmwork not easy if you want to use &lt;strong&gt;vuex&lt;/strong&gt; ,&lt;strong&gt;vue-router&lt;/strong&gt;, &lt;strong&gt;vue-meta&lt;/strong&gt; etc.  organization the file structure by self is repetitived and cumbersome. &lt;strong&gt;Nuxtjs&lt;/strong&gt; can reslove it you can create file in pages directory will genreate route automaic. create file in store will create vuex store with namespace for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Routing config can get lengthy ?
&lt;/h3&gt;

&lt;p&gt;Use &lt;strong&gt;vue-router&lt;/strong&gt; you can custom you route one by one, it's ok when you project are small or simple. when you have big project and more and more page should defined in router. have you thinks use script to generate route config? &lt;strong&gt;Nuxtjs&lt;/strong&gt; resloved this problem, all you need is just create page you want in &lt;strong&gt;Nuxtjs&lt;/strong&gt; pages directory. &lt;/p&gt;

&lt;h3&gt;
  
  
  No strandard way to configure ?
&lt;/h3&gt;

&lt;p&gt;All configure file and configuration will defined and config in &lt;strong&gt;nuxt.config.js&lt;/strong&gt; all you need care about just one file. all intelligent module will worker.&lt;/p&gt;

&lt;h3&gt;
  
  
  Not SEO firendly ?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Nuxtjs&lt;/strong&gt; use &lt;strong&gt;vue-meta&lt;/strong&gt; generate SEO content info, you just need config less and more things &lt;strong&gt;Nuxtjs&lt;/strong&gt; will do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vue apps can load slowly ?
&lt;/h3&gt;

&lt;p&gt;If you use &lt;strong&gt;Nuxtjs&lt;/strong&gt; with &lt;code&gt;universal&lt;/code&gt; mode you can prerender page content with html, so that your user can fetch the page content quickly. which mean's you can use &lt;code&gt;universal&lt;/code&gt; mode to open &lt;strong&gt;SSR&lt;/strong&gt; mechanism&lt;/p&gt;

&lt;h3&gt;
  
  
  Difficult to change behavior ?
&lt;/h3&gt;

&lt;p&gt;You can extend &lt;strong&gt;Nuxtjs&lt;/strong&gt; farmwork functaion with nuxt &lt;code&gt;modules&lt;/code&gt; , &lt;code&gt;modules&lt;/code&gt; can write hight level funcation to you use nuxtjs core.&lt;/p&gt;

&lt;p&gt;Hopt it can help you :)&lt;/p&gt;

</description>
      <category>javscript</category>
      <category>notes</category>
    </item>
    <item>
      <title>How to preview image before upload to server </title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Sat, 25 Jul 2020 15:03:09 +0000</pubDate>
      <link>https://dev.to/ihavecoke/how-to-preview-image-before-upload-to-server-3i05</link>
      <guid>https://dev.to/ihavecoke/how-to-preview-image-before-upload-to-server-3i05</guid>
      <description>&lt;p&gt;Recently my team have case to upload image to server i just want to show progress to user image upload status. if show the user which image file upload is more graceful. so i just preview image and show the progress same time. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3k094xqhw3ela0kbrtvm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3k094xqhw3ela0kbrtvm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Look at the screenshoot. before the image show the upload icons. direction current image uploading to server. i thinks it's more simple and useful.&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="c1"&gt;// html code&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;input_file&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;file&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;multiple&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;change&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fileChange&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="c1"&gt;// here file agrument from html input file tag&lt;/span&gt;
&lt;span class="nf"&gt;covertInputImageToDataURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&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="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;FileReader&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&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="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readAsDataURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&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="c1"&gt;// event listener to input file tag &lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="nf"&gt;fileChange&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newFiles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input_file&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="c1"&gt;// covert all file to dataURL&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&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;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;newFiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newFiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fileID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;randomString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// random file id &lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dataURL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;covertInputImageToDataURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nx"&gt;files&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;fileID&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dataURL&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;Here is Vue.js Template Define&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// use files 
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;v-for=&lt;/span&gt;&lt;span class="s"&gt;"key in Object.keys(files)"&lt;/span&gt; &lt;span class="na"&gt;:key=&lt;/span&gt;&lt;span class="s"&gt;"key"&lt;/span&gt; &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;:src=&lt;/span&gt;&lt;span class="s"&gt;"files[key]['dataURL']"&lt;/span&gt; &lt;span class="na"&gt;:alt=&lt;/span&gt;&lt;span class="s"&gt;"key"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So far we just listener &lt;strong&gt;input&lt;/strong&gt; file tag file change event and covert files to dataURL. when we set &lt;strong&gt;img&lt;/strong&gt; &lt;code&gt;src&lt;/code&gt; attribute with dataURL the image will shown by the tag. we can know which image uploading. &lt;/p&gt;

&lt;p&gt;Help it can help you :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>ticks</category>
    </item>
    <item>
      <title>How to caculate emoji length?</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Mon, 20 Jul 2020 12:20:16 +0000</pubDate>
      <link>https://dev.to/ihavecoke/how-to-caculate-emoji-length-36df</link>
      <guid>https://dev.to/ihavecoke/how-to-caculate-emoji-length-36df</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j7JyuFn2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/17dv57h61f19kqq39d2c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j7JyuFn2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/17dv57h61f19kqq39d2c.jpg" alt="Alt Text" width="670" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Javascript we just call &lt;code&gt;length&lt;/code&gt; on String object will return the &lt;strong&gt;length&lt;/strong&gt; you want to get.&lt;/p&gt;

&lt;p&gt;But when you get &lt;strong&gt;emoji&lt;/strong&gt; length from &lt;strong&gt;javascript&lt;/strong&gt; become more trouble let show you what i found.&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ihavecoke&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="c1"&gt;// 9&lt;/span&gt;

&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;😁&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="c1"&gt;// 2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, when you call &lt;code&gt;length&lt;/code&gt; on &lt;code&gt;'ihavecoke'&lt;/code&gt;  you got length &lt;strong&gt;9&lt;/strong&gt; it's ture and make sense.&lt;/p&gt;

&lt;p&gt;The line number 3 you just got length &lt;strong&gt;2&lt;/strong&gt;. what ? a emoji char just &lt;strong&gt;2&lt;/strong&gt; length of string?&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;"👨‍👨‍👧‍👦".length&lt;/code&gt;  more strange that return &lt;strong&gt;11&lt;/strong&gt; why ? emoji char not return &lt;strong&gt;2&lt;/strong&gt; always?&lt;/p&gt;

&lt;p&gt;So how to caculate emoji length to &lt;strong&gt;1&lt;/strong&gt; length?  you can use &lt;a href="https://lodash.com/docs/4.17.15#toArray"&gt;lodash&lt;/a&gt; method &lt;code&gt;toArray&lt;/code&gt; it's simple and useful&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="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;😁&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;

&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;👨‍👨‍👧‍👦&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;

&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ihavecoke 🤩&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="c1"&gt;// 11&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So we got the &lt;strong&gt;1&lt;/strong&gt; length emoji lols &lt;/p&gt;

&lt;p&gt;Hope it can help you :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tricks</category>
    </item>
    <item>
      <title>write more flexbox code to query document element.</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Sun, 12 Jul 2020 02:37:03 +0000</pubDate>
      <link>https://dev.to/ihavecoke/write-more-flexbox-code-to-query-document-element-3gab</link>
      <guid>https://dev.to/ihavecoke/write-more-flexbox-code-to-query-document-element-3gab</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b_UZ8CE6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yit35qu0jjaa7m0dpocg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b_UZ8CE6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yit35qu0jjaa7m0dpocg.jpg" alt="Alt Text" width="710" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes you need check if HTML element present in &lt;strong&gt;document&lt;/strong&gt;, special your dom load from remote server and dynamic add to document. &lt;/p&gt;

&lt;p&gt;If you code query &lt;strong&gt;DOM&lt;/strong&gt; when document loaded, firt time the &lt;strong&gt;DOM&lt;/strong&gt; maybe present you can queried it.&lt;/p&gt;

&lt;p&gt;But if your &lt;strong&gt;DOM&lt;/strong&gt; load from server, you query code clound not found it anymore. becuase you query code execute before  **DOM **add to document&lt;/p&gt;

&lt;p&gt;How reslove it?  show me code to you&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;awaitSomethingReady&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;maxCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;500&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;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;getTestIntervalId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;maxCheckCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;maxCount&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;currentCheckCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="nx"&gt;getTestIntervalId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;setInterval&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="nx"&gt;currentCheckCount&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&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;maxCheckCount&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;currentCheckCount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;clearInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getTestIntervalId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nx"&gt;reject&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;condition&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;clearInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getTestIntervalId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nx"&gt;resolve&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="mi"&gt;50&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;I just want to check if &lt;strong&gt;div&lt;/strong&gt; with calss &lt;strong&gt;toolbar&lt;/strong&gt; present so use &lt;code&gt;awaitSomethingReady&lt;/code&gt;&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="nx"&gt;awaitSomethingReady&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.toolbar&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;then&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;found toolbar&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;catch&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;will found toolbar continue ...&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That all you will write more flexible code &lt;/p&gt;

&lt;p&gt;another way to quickly use npm &lt;a href="https://github.com/ihavecoke/live-query"&gt;live-query&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope it can help you &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>ticks</category>
    </item>
    <item>
      <title>What problems did active_support concerns solve?</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Thu, 02 Jul 2020 15:15:00 +0000</pubDate>
      <link>https://dev.to/ihavecoke/what-problems-did-activesupport-concerns-solve-56oe</link>
      <guid>https://dev.to/ihavecoke/what-problems-did-activesupport-concerns-solve-56oe</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FFdktGN6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/65670e41o57mxgrj2zq0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FFdktGN6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/65670e41o57mxgrj2zq0.jpg" alt="Alt Text" width="670" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the Rails project some of the most commonly used methods are extracted and generally placed in the corresponding concerns directory. generally different concern files are stored in these directories. a file is a module for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;UserPlan&lt;/span&gt;
  &lt;span class="kp"&gt;extend&lt;/span&gt; &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Concern&lt;/span&gt;
  &lt;span class="n"&gt;included&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; 
    &lt;span class="n"&gt;belongs_to&lt;/span&gt; &lt;span class="ss"&gt;:plan&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="n"&gt;class_method&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; 
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;cached_all_plan&lt;/span&gt; 
      &lt;span class="c1"&gt;#bala bala&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the module &lt;code&gt;extend ActiveSupport::Concern&lt;/code&gt; is used in this module. we will explore its benefits and why this module exists.&lt;/p&gt;

&lt;p&gt;Let's start with the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;Foo&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;included&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;class_eval&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;method1&lt;/span&gt;
        &lt;span class="o"&gt;...&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;Bar&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;included&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;method1&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Host&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;Foo&lt;/span&gt; &lt;span class="c1"&gt;# The Foo module was introduced because the Bar module depends on it&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;Bar&lt;/span&gt; &lt;span class="c1"&gt;# Bar reference is to call its method1 method&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to use the &lt;code&gt;method1&lt;/code&gt; method in the &lt;code&gt;Host&lt;/code&gt; class, you must refer to the &lt;code&gt;Bar&lt;/code&gt; module but the &lt;code&gt;Bar&lt;/code&gt; module depends on the &lt;code&gt;Foo&lt;/code&gt; module. &lt;/p&gt;

&lt;p&gt;Did you find any problems? the &lt;code&gt;Host&lt;/code&gt; class does not care about the &lt;code&gt;Foo&lt;/code&gt; module but in order to call the &lt;code&gt;method1&lt;/code&gt; method when the &lt;code&gt;Bar&lt;/code&gt; is included. you have to Introduce the &lt;code&gt;Foo&lt;/code&gt; module.&lt;/p&gt;

&lt;p&gt;There is an improved code along the above logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;Bar&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;Foo&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;included&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;method1&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Host&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;Bar&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;Host&lt;/code&gt; only cares about the reference of &lt;code&gt;Bar&lt;/code&gt; so the &lt;code&gt;Foo&lt;/code&gt; module is put in the &lt;code&gt;Bar&lt;/code&gt;. It seems that there is no problem but when you implement the running code, you will find that the code cannot run. &lt;/p&gt;

&lt;p&gt;In the included hook method of the &lt;code&gt;Bar&lt;/code&gt; module the base object points to the &lt;code&gt;Host&lt;/code&gt; and the include &lt;code&gt;Foo&lt;/code&gt; in &lt;code&gt;Bar&lt;/code&gt; will put &lt;code&gt;method1&lt;/code&gt; on the instance object of &lt;code&gt;Bar&lt;/code&gt;. when the instance object of the Host calls &lt;code&gt;method1&lt;/code&gt;, it will throw a method not found exception&lt;/p&gt;

&lt;p&gt;How to do it?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'active_support/concern'&lt;/span&gt;
&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;Foo&lt;/span&gt;
  &lt;span class="kp"&gt;extend&lt;/span&gt; &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Concern&lt;/span&gt;
  &lt;span class="n"&gt;included&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;method1&lt;/span&gt;
      &lt;span class="o"&gt;...&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;Bar&lt;/span&gt;
  &lt;span class="kp"&gt;extend&lt;/span&gt; &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Concern&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;Foo&lt;/span&gt;

  &lt;span class="n"&gt;included&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;method1&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Host&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;Bar&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By referring to &lt;code&gt;ActiveSupport::Concern&lt;/code&gt; to solve the problem of interdependence between modules and modules.&lt;/p&gt;

&lt;p&gt;The comparison found that the code is much simpler and the call is also very convenient. the readability of the code has also become very good and very clear. now &lt;code&gt;ActiveSupport::Concern&lt;/code&gt; is quite widely used and many good gems will be used. after all It was put in the &lt;strong&gt;ActiveSupport&lt;/strong&gt; Gem.&lt;/p&gt;

&lt;p&gt;Hope it can help you :)&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title>HTTP version evolution 3</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Wed, 01 Jul 2020 12:31:53 +0000</pubDate>
      <link>https://dev.to/ihavecoke/http-version-evolution-3-20ie</link>
      <guid>https://dev.to/ihavecoke/http-version-evolution-3-20ie</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BOmmItbf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/crudsnlj7dkf4e85wy2j.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BOmmItbf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/crudsnlj7dkf4e85wy2j.jpg" alt="Alt Text" width="710" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have record article about HTTP/1 和 HTTP/2 at &lt;a href="https://dev.to/ihavecoke/http-version-evolution-2cef"&gt;HTTP version evolution&lt;/a&gt; &lt;a href="https://dev.to/ihavecoke/http-version-evolution-2-34kh"&gt;HTTP version evolution 2&lt;/a&gt; this article i will share my note with &lt;strong&gt;HTTP&lt;/strong&gt; evolution 3&lt;/p&gt;

&lt;h3&gt;
  
  
  TCP header block
&lt;/h3&gt;

&lt;p&gt;Although &lt;strong&gt;HTTP/2&lt;/strong&gt; solves the queue-blocking problem at the application level, the queue-blocking problem caused by the loss of a single packet in &lt;strong&gt;TCP&lt;/strong&gt; is called queue-blocking over &lt;strong&gt;TCP&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Test data shows that &lt;strong&gt;HTTP/1.1&lt;/strong&gt; transport efficiency is better than &lt;strong&gt;HTTP/2&lt;/strong&gt; when the system reaches a 2% packet loss rate.&lt;/p&gt;

&lt;h4&gt;
  
  
  The delay in establishing a TCP connection
&lt;/h4&gt;

&lt;p&gt;Network delay is also called &lt;strong&gt;Round Trip Time&lt;/strong&gt;. We refer to the total round-trip time between sending a packet from the browser to the server and returning the packet from the server to the browser as &lt;strong&gt;RTT&lt;/strong&gt;, which is an important indicator of network performance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When establishing a &lt;strong&gt;TCP&lt;/strong&gt; connection, three handshakes with the server are required to confirm the connection, which means that 1.5 &lt;strong&gt;RTT&lt;/strong&gt; is consumed before data can be transmitted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TLS&lt;/strong&gt; connections are made. there are two versions of &lt;strong&gt;TLS&lt;/strong&gt; -- &lt;strong&gt;TLS1.2&lt;/strong&gt; and &lt;strong&gt;TLS1.3&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We need to spend 3-4 &lt;strong&gt;RTTS&lt;/strong&gt; before transmitting the data&lt;/p&gt;

&lt;h4&gt;
  
  
  TCP protocol ossification
&lt;/h4&gt;

&lt;p&gt;Include router, firewall, NAT, switch and so on. they often rely on little-updated software that USES a lot of &lt;strong&gt;TCP&lt;/strong&gt; features that are set up and rarely updated.&lt;/p&gt;

&lt;h4&gt;
  
  
  QUIC protocol
&lt;/h4&gt;

&lt;p&gt;Based on &lt;strong&gt;UDP&lt;/strong&gt; it realizes the functions of multiple data streams and transmission reliability similar to &lt;strong&gt;TCP&lt;/strong&gt;. We call this set of functions &lt;strong&gt;QUIC protocol&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Realize functions like &lt;strong&gt;TCP&lt;/strong&gt; flow control and transmission reliability&lt;/li&gt;
&lt;li&gt;Integrated &lt;strong&gt;TLS&lt;/strong&gt; encryption function&lt;/li&gt;
&lt;li&gt;Implemented the multiplexing function in  *&lt;em&gt;HTTP/2 *&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Implemented a quick handshake function&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  HTTP/3
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Neither the server nor the browser provides complete support for &lt;strong&gt;HTTP/3&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;There are also very big problems in deploying &lt;strong&gt;HTTP/3&lt;/strong&gt; because the system kernel's optimization of &lt;strong&gt;UDP&lt;/strong&gt; is far from &lt;strong&gt;TCP&lt;/strong&gt; optimization, this is also an important reason that hinders &lt;strong&gt;QUIC&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The problem of the rigidity of the middle equipment. the optimization of &lt;strong&gt;UDP&lt;/strong&gt; by these devices is much lower than &lt;strong&gt;TCP&lt;/strong&gt;. according to statistics, when using &lt;strong&gt;QUIC&lt;/strong&gt; protocol there is about 3% to 7% packet loss rate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope it can help you :)&lt;/p&gt;

</description>
      <category>http</category>
    </item>
    <item>
      <title>HTTP version evolution 2 </title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Tue, 30 Jun 2020 15:20:45 +0000</pubDate>
      <link>https://dev.to/ihavecoke/http-version-evolution-2-34kh</link>
      <guid>https://dev.to/ihavecoke/http-version-evolution-2-34kh</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7WKeINEb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3rmlzrhjnewq46j5hdhx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7WKeINEb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3rmlzrhjnewq46j5hdhx.jpg" alt="Alt Text" width="670" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have record article about &lt;strong&gt;HTTP&lt;/strong&gt; beginning at &lt;a href="https://dev.to/ihavecoke/http-version-evolution-2cef"&gt;HTTP version evolution&lt;/a&gt;. this article i will share my note with &lt;strong&gt;HTTP&lt;/strong&gt; evolution 2&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the problems with HTTP/1.1
&lt;/h3&gt;

&lt;h5&gt;
  
  
  HTTP 1 features
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Added persistent connections &lt;/li&gt;
&lt;li&gt;The browser maintains up to 6 TCP persistent connections simultaneously for each domain name&lt;/li&gt;
&lt;li&gt;Using CDN to realize the domain name fragmentation mechanism&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  HTTP problems
&lt;/h5&gt;

&lt;p&gt;The problems is utilization of bandwidth is not ideal&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Bandwidth refers to the maximum number of bytes that can be sent or received per second. &lt;/p&gt;

&lt;p&gt;the maximum number of bytes that can be sent per second is called &lt;strong&gt;upstream bandwidth&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;the maximum number of bytes that can be received per second is  &lt;strong&gt;downstream bandwidth&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The reason why &lt;strong&gt;HTTP/1.1&lt;/strong&gt; is not ideal for bandwidth utilization is because it is difficult for &lt;strong&gt;HTTP/1.1&lt;/strong&gt; to use up bandwidth for the following three reasons&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;*&lt;em&gt;TCP *&lt;/em&gt; slow start&lt;/li&gt;
&lt;li&gt;Simultaneously open multiple &lt;strong&gt;TCP&lt;/strong&gt; connections, then these connections will compete for fixed bandwidth&lt;/li&gt;
&lt;li&gt;The problem of &lt;strong&gt;HTTP/1.1&lt;/strong&gt; queue blocking.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  HTTP 2.0
&lt;/h3&gt;

&lt;p&gt;To solve the above problem the idea of  &lt;strong&gt;HTTP/2&lt;/strong&gt; is that a domain name uses only one long &lt;strong&gt;TCP&lt;/strong&gt; connection to transmit data, and realizes parallel requests for resources,it can send requests to the server at any time without waiting for the completion of other requests.&lt;/p&gt;

&lt;h4&gt;
  
  
  Multiplexing implementation
&lt;/h4&gt;

&lt;h5&gt;
  
  
  The introduction of the binary framing layer realizes the multiplexing technology of HTTP
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;First the browser prepares the request data, including the request line, request header, and other information. If it is the **POST **method then there must be a request body.&lt;/li&gt;
&lt;li&gt;After the data is processed by the binary frame layer, it will be converted into frames with request ID numbers, and these frames will be sent to the server through the protocol stack. 
After receiving all the frames, the server will merge all the frames with the same ID into a complete request message.&lt;/li&gt;
&lt;li&gt;The server then processes the request and sends the processed response line, response header, and response body to the binary framing layer, respectively.&lt;/li&gt;
&lt;li&gt;Similarly the binary framing layer converts these response data into frames with request ID numbers and sends them to the browser through the protocol stack.&lt;/li&gt;
&lt;li&gt;After receiving the response frame, the browser will submit the frame data to the corresponding request according to the ID number.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Other features
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;You can set the priority of the request, when sending the request mark the priority of the request&lt;/li&gt;
&lt;li&gt;Server push you can directly push the data to the browser in advance&lt;/li&gt;
&lt;li&gt;Header compression, which compresses the request header and response header&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope it can help you :)&lt;/p&gt;

</description>
      <category>http</category>
    </item>
    <item>
      <title>HTTP version evolution</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Mon, 29 Jun 2020 12:28:01 +0000</pubDate>
      <link>https://dev.to/ihavecoke/http-version-evolution-2cef</link>
      <guid>https://dev.to/ihavecoke/http-version-evolution-2cef</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XQ9QSwOQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1deshry2rg4lnxo6dnts.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XQ9QSwOQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1deshry2rg4lnxo6dnts.jpg" alt="Alt Text" width="880" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;HTTP&lt;/strong&gt; protocol is the communication language between the browser and the server, the latest version has reached &lt;strong&gt;HTTP 3.0&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I have read some articles and made some records of the evolution of the &lt;strong&gt;HTTP&lt;/strong&gt; version. here I will share some key points for you&lt;/p&gt;

&lt;h3&gt;
  
  
  First version HTTP/0.9
&lt;/h3&gt;

&lt;p&gt;First verssion &lt;strong&gt;HTTP&lt;/strong&gt; mainly used for academic communication. used to transfer &lt;strong&gt;HTML&lt;/strong&gt; hypertext content between networks, using a request-response model.  a request is sent from the client and the server returns data. &lt;/p&gt;

&lt;p&gt;In general the demand at that time was very simple, it was used to transmit small &lt;strong&gt;HTML&lt;/strong&gt; files. &lt;/p&gt;

&lt;p&gt;Has three characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There is only one request line. and there is no &lt;strong&gt;HTTP&lt;/strong&gt; request header and request body&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The server did not return header information&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The content of the returned file is transmitted as a stream of &lt;strong&gt;ASCII&lt;/strong&gt; characters&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  HTTP/1.0
&lt;/h3&gt;

&lt;p&gt;Supporting multiple types of file downloads is a core requirement of &lt;strong&gt;HTTP/1.0&lt;/strong&gt;. including &lt;strong&gt;JavaScript&lt;/strong&gt;, &lt;strong&gt;CSS&lt;/strong&gt;, &lt;strong&gt;pictures&lt;/strong&gt;, &lt;strong&gt;audio&lt;/strong&gt;, &lt;strong&gt;video&lt;/strong&gt; etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP/1.0&lt;/strong&gt; negotiates and communicates through request headers and response headers. requesting file types and returning file types. E.g&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// request
accept: text/html
accept-encoding: gzip, deflate, br
accept-Charset: ISO-8859-1,utf-8
accept-language: zh-CN,zh

// response
content-encoding: br
content-type: text/html; charset=UTF-8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  HTTP/1.1
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;HTTP/1.1&lt;/strong&gt; has made a lot of updates on the basis of &lt;strong&gt;HTTP/1.0&lt;/strong&gt; including&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Improve the persistent connection. multiple &lt;strong&gt;HTTP&lt;/strong&gt; requests can be transmitted on a &lt;strong&gt;TCP&lt;/strong&gt; connection. as long as the browser or server does not explicitly disconnect, the &lt;strong&gt;TCP&lt;/strong&gt; connection will be maintained.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Immature &lt;strong&gt;HTTP&lt;/strong&gt; pipeline to solve the problem of queue blocking by pipeline technology.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provide virtual host support, the &lt;strong&gt;Host field&lt;/strong&gt;  is added to the request header to indicate the current domain name address, so that the server can do different processing according to different Host values.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provides perfect support for dynamically generated content, introducing &lt;strong&gt;chunk transfer&lt;/strong&gt; mechanism. the server will divide the data into several data blocks of any size, each data block will be attached with the length of the last data block, and finally use a zero-length block as a sign of sending data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Client &lt;strong&gt;cookies&lt;/strong&gt; security mechanism&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Continue to share tomorrow， Hope it can help you  :)&lt;/p&gt;

</description>
      <category>http</category>
      <category>network</category>
    </item>
    <item>
      <title> Confusion of new managers.</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Sun, 28 Jun 2020 13:30:59 +0000</pubDate>
      <link>https://dev.to/ihavecoke/confusion-of-new-managers-67p</link>
      <guid>https://dev.to/ihavecoke/confusion-of-new-managers-67p</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_XerH_Hd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zlmlf51ab7z9cepsqfzh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_XerH_Hd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zlmlf51ab7z9cepsqfzh.jpg" alt="Alt Text" width="640" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I recently read an article about management and made some notes to share with you&lt;/p&gt;

&lt;h3&gt;
  
  
  As a new manager the following four types of statements are the most common
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A last resort I can’t do technology for a lifetime&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;many seniors have transferred to management, and I have to change.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Success in the eyes of others&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; If you can be a company executive, others will think of me as an excellent and successful person.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Not disappointing the expectations of the organization&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The superior said that I am suitable for management, and I cannot live up to his expectations for me.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Subjective daydreaming about management&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; You don’t need to do everything by yourself, just arrange for the subordinates to do it, it should be easier.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No matter which of the above four categories, it is difficult for you to go a long way in management. because the above four types of statements all belong to the category of "external drive".&lt;/p&gt;

&lt;h3&gt;
  
  
  It is time to consider your own internal motivation and real demands, three important questions to help you make a judgment.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Do you agree with the value of management?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I think management work is not as valuable as technical work, and solving problems through technical means is the coolest thing. &lt;/li&gt;
&lt;li&gt;Even if many people think you are suitable for management, if you do not think management is valuable, you will not be happy to do it for a long time.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Are you passionate about management and enjoying these jobs?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do you enjoy being responsible for the coordination and promotion of a large project? will its successful launch give you a strong sense of accomplishment?&lt;/li&gt;
&lt;li&gt;Have you ever thought about what kind of processes and mechanisms can deal with the omissions in team work?&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Do you value growth in management?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every manager starts from the technical backbone or business backbone. Prior to this, there was not much learning and accumulation of management, which means that you have good management plasticity, and it also means that you have too much &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Things need learning and training.
&lt;/h3&gt;

&lt;p&gt;There is a lot of awareness and ability to expand management&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Greater responsibility.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A more stereoscopic perspective&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A more flexible way of thinking.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Seems to be challenges and requirements, so what can I get?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First of all when you reach a larger platform, your ability and vision will be greatly improved&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Secondly not only become stronger you also have a team, you can handle bigger and more complicated things and make greater achievements. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This will give you a stronger sense of accomplishment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your influence has increased significantly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your abilities, achievements, and influence have been comprehensively improved, and you have received more spiritual and material rewards.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope it can help you :)&lt;/p&gt;

</description>
      <category>tech</category>
      <category>note</category>
    </item>
    <item>
      <title>javascript optional chaining</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Sat, 27 Jun 2020 09:55:27 +0000</pubDate>
      <link>https://dev.to/ihavecoke/javascript-optional-chaining-l11</link>
      <guid>https://dev.to/ihavecoke/javascript-optional-chaining-l11</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6uIfnwSW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4q56d1194l88u8kkyvzu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6uIfnwSW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4q56d1194l88u8kkyvzu.jpg" alt="Alt Text" width="710" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may write code in &lt;strong&gt;javascript&lt;/strong&gt; like this:&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;baz&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;baz&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;We want to call &lt;code&gt;baz()&lt;/code&gt; but first need check if &lt;code&gt;foo&lt;/code&gt; , &lt;code&gt;foo.bar&lt;/code&gt;, &lt;code&gt;foo.bar.baz&lt;/code&gt;  present.  i think this is a little bit more prolixity. &lt;/p&gt;

&lt;p&gt;Now you can write code like&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="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;baz&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That all, just need use &lt;code&gt;?.&lt;/code&gt; operator, this called &lt;strong&gt;optional chainning&lt;/strong&gt;.  you need do something in &lt;strong&gt;babel&lt;/strong&gt; config&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="c1"&gt;// babel.config.js&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;env&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="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@babel/plugin-proposal-optional-chaining&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="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  More &lt;strong&gt;optional Channing&lt;/strong&gt; example:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Dealing with optional callbacks or event handlers
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;onContent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="c1"&gt;// ... do something with the data&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;?.(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// no exception if onError is undefined&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;h4&gt;
  
  
  Optional chaining with expressions
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;nestedProp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;?.[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;prop&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Array item access with optional chaining
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arrayItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;?.[&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can found more api &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining"&gt;optional chainning&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope it can help you :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tricks</category>
    </item>
    <item>
      <title>The difference between Ruby alias and alias_method</title>
      <dc:creator>mixbo</dc:creator>
      <pubDate>Fri, 26 Jun 2020 14:37:09 +0000</pubDate>
      <link>https://dev.to/ihavecoke/the-difference-between-ruby-alias-and-aliasmethod-5de3</link>
      <guid>https://dev.to/ihavecoke/the-difference-between-ruby-alias-and-aliasmethod-5de3</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--696fB060--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xw9mkm972psx5f61xugs.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--696fB060--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xw9mkm972psx5f61xugs.jpg" alt="Alt Text" width="710" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In some open source &lt;strong&gt;ruby&lt;/strong&gt; projects  you may see similar &lt;code&gt;alias&lt;/code&gt; and &lt;code&gt;alias_method&lt;/code&gt; methods. what are the specific use of these two methods? how are these two methods different? let's look at the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;#alias&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;full_name&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Mixbo"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;alias&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt; &lt;span class="n"&gt;full_name&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="no"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;#=&amp;gt;Mixbo&lt;/span&gt;

&lt;span class="c1"&gt;#alias_method&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;full_name&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Mixbo"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="kp"&gt;alias_method&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:full_name&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="no"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;#=&amp;gt; Mixbo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above examples all output the "Mixbo" string before renaming the &lt;code&gt;full_name&lt;/code&gt; in the &lt;code&gt;User&lt;/code&gt; class. from this example alone we can't see the difference between the two methods continue:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;#alias_method&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;full_name&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Super Mixbo"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rename&lt;/span&gt;
    &lt;span class="kp"&gt;alias_method&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:full_name&lt;/span&gt; &lt;span class="c1"&gt;#==&amp;gt; Note that alias_method is used here&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Mixbo&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;full_name&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Mixbooooo"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="n"&gt;rename&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="no"&gt;Mixbo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;full_name&lt;/span&gt; &lt;span class="c1"&gt;#=&amp;gt; "Mixbooooo"&lt;/span&gt;


&lt;span class="c1"&gt;#alias&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;full_name&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Super Mixbo"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rename&lt;/span&gt;
    &lt;span class="k"&gt;alias&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt; &lt;span class="ss"&gt;:full_name&lt;/span&gt; &lt;span class="c1"&gt;#==&amp;gt; Note that alias is used here&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Mixbo&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;full_name&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Mixbooooo"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="n"&gt;rename&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="no"&gt;Mixbo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;#=&amp;gt; 'Super Mixbo'&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the above example we can see that when there is an inheritance relationship between classes. &lt;code&gt;alias&lt;/code&gt; will not affect its subclasses. related &lt;code&gt;alias_method&lt;/code&gt; will find the closest method of the same name in its subclass to operate (for example, &lt;code&gt;full_name&lt;/code&gt; above)&lt;/p&gt;

&lt;h3&gt;
  
  
  So &lt;code&gt;alias&lt;/code&gt; and &lt;code&gt;alias_method&lt;/code&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Can give an alias to a method&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;alias&lt;/code&gt; is generally valid when the source code is interpreted by the compiler&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;alias_method&lt;/code&gt; is generally valid when the code is running&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Generally I use &lt;code&gt;alias_method&lt;/code&gt; a little more.&lt;/p&gt;

&lt;p&gt;Hope it can help you :)&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>ticks</category>
    </item>
  </channel>
</rss>
