<?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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Eftakhairul&#039;s World</title>
	<atom:link href="https://eftakhairul.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://eftakhairul.com</link>
	<description>Software Engineer, Tech Blogger and Open Source Enthusiast</description>
	<lastBuildDate>Fri, 07 Apr 2023 17:56:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.5</generator>
<site xmlns="com-wordpress:feed-additions:1">23774340</site>	<item>
		<title>Github&#8217;s &#8220;repository not found&#8221; error and How to fix it</title>
		<link>https://eftakhairul.com/githubs-repository-not-found-error-and-how-to-fix-it/</link>
					<comments>https://eftakhairul.com/githubs-repository-not-found-error-and-how-to-fix-it/#respond</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Fri, 07 Apr 2023 17:51:56 +0000</pubDate>
				<category><![CDATA[Tech]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2529</guid>

					<description><![CDATA[<p>GitHub is an excellent platform for managing code repositories and collaborating with other developers. One of the great features of GitHub is Github Action, which automates your workflow for private and public repositories. However, recently, I noticed that GitHub Action is throwing an error while using GITHUB_TOKEN in the private repo. This issue is not <a class="read-more" href="https://eftakhairul.com/githubs-repository-not-found-error-and-how-to-fix-it/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/githubs-repository-not-found-error-and-how-to-fix-it/">Github’s “repository not found” error and How to fix it</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>GitHub is an excellent platform for managing code repositories and collaborating with other developers. One of the great features of GitHub is Github Action, which automates your workflow for private and public repositories. However, recently, I noticed that GitHub Action is throwing an error while using <strong>GITHUB_TOKEN</strong> in the private repo. This issue is not occurring for the private repos under the Enterprise Plan. In my case, it was the private repo under the Free Plan. The error looks like below:</p>
<pre class="wp-block-code"><code>
Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +a6f81a034bf482d652ccb6d1609f1a25d8ec947b:refs/remotes/pull/5/merge
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/eftakhairul/helloworld/' not found
  The process '/usr/bin/git' failed with exit code 128
  Waiting 18 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +a6f81a034bf482d652ccb6d1609f1a25d8ec947b:refs/remotes/pull/5/merge
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/eftakhairul/helloworld/' not found
  The process '/usr/bin/git' failed with exit code 128
  Waiting 11 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +a6f81a034bf482d652ccb6d1609f1a25d8ec947b:refs/remotes/pull/5/merge
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/eftakhairul/helloworld/' not found
  Error: The process '/usr/bin/git' failed with exit code 128
</code></pre>
<h3>Why?</h3>
<p>I found an issue reported on May 22, 3020. The issue is probably due to the default token: GITHUB_TOKEN doesn&#8217;t have permission to checkout the private repo. It doesn&#8217;t work even if you setup the permissions to GITHUB_TOKEN to access other private repo. Right now, the issue is closed. Multiple users reported that they were having the same issues. Today I got the same error.</p>
<h3>Solutions</h3>
<p>I don&#8217;t know whether the Github will fix it or not.  However, there is a work around to bypass the issue. I will explain that one now.</p>
<h5>Steps:</h5>
<p>1. Generate your own Persona access token with the proper permissions. <strong>Go to: settings &gt; Developer settings under your account &amp; create Personal access tokens.  Click on Tokens (classic)</strong></p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.16.13-PM.png?ssl=1"><img fetchpriority="high" decoding="async" class="wp-image-2535 alignleft" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.16.13-PM.png?resize=743%2C183&#038;ssl=1" alt="" width="743" height="183" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.16.13-PM.png?resize=300%2C74&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.16.13-PM.png?resize=1024%2C253&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.16.13-PM.png?resize=768%2C190&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.16.13-PM.png?resize=1536%2C380&amp;ssl=1 1536w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.16.13-PM.png?resize=2048%2C507&amp;ssl=1 2048w" sizes="(max-width: 743px) 100vw, 743px" data-recalc-dims="1" /></a><br />
With the following permissions</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/permission.png?ssl=1"><img decoding="async" class=" wp-image-2536 alignleft" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/permission.png?resize=682%2C241&#038;ssl=1" alt="" width="682" height="241" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/permission.png?resize=300%2C106&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/permission.png?resize=1024%2C363&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/permission.png?resize=768%2C273&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/permission.png?w=1420&amp;ssl=1 1420w" sizes="(max-width: 682px) 100vw, 682px" data-recalc-dims="1" /></a></p>
<p>2. Add the token to the repo&#8217;s Secrets. <strong>Go to: Repo&#8217;s Settings &gt;  Secrets and variables &gt; Actions</strong></p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.32.41-PM.png?ssl=1"><img decoding="async" class="alignnone wp-image-2538" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.32.41-PM.png?resize=634%2C298&#038;ssl=1" alt="" width="634" height="298" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.32.41-PM.png?resize=300%2C141&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.32.41-PM.png?resize=1024%2C480&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.32.41-PM.png?resize=768%2C360&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.32.41-PM.png?resize=1536%2C720&amp;ssl=1 1536w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2023/04/Screenshot-2023-04-05-at-9.32.41-PM.png?w=1766&amp;ssl=1 1766w" sizes="(max-width: 634px) 100vw, 634px" data-recalc-dims="1" /></a></p>
<p>3. Update your Action&#8217;s workflow steps</p>
<pre class="wp-block-code"><code>
- uses: actions/checkout@v2
  with:
    token: ${{ secrets.YOUR_CUSTOM_GITHUB_TOKEN }}
</code></pre>
<p>Re-run your Github&#8217;s workflow again. It will work. Happy Hacking <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p><p>The post <a href="https://eftakhairul.com/githubs-repository-not-found-error-and-how-to-fix-it/">Github’s “repository not found” error and How to fix it</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/githubs-repository-not-found-error-and-how-to-fix-it/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2529</post-id>	</item>
		<item>
		<title>Inspect HTTP Request and Response in Golang</title>
		<link>https://eftakhairul.com/inspect-http-request-and-response-in-golang/</link>
					<comments>https://eftakhairul.com/inspect-http-request-and-response-in-golang/#respond</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Sun, 22 May 2022 04:49:29 +0000</pubDate>
				<category><![CDATA[GO]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Golang]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2460</guid>

					<description><![CDATA[<p>Golang is getting popular for writing a web applications. One of the core concepts of this web application is handling requests and responses. In Golang, net/http package from the standard library provides all HTTP requests and responses mechanisms.  As a developer, you often print this HTTP request or the response for debug purposes. net/http/httputil package <a class="read-more" href="https://eftakhairul.com/inspect-http-request-and-response-in-golang/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/inspect-http-request-and-response-in-golang/">Inspect HTTP Request and Response in Golang</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><span data-preserver-spaces="true">Golang is getting popular for writing a web applications. One of the core concepts of this web application is handling requests and responses. In Golang, <code>net/http</code> package from the standard library provides all HTTP requests and responses mechanisms. </span></p>
<p><span data-preserver-spaces="true">As a developer, you often print this HTTP request or the response for debug purposes. <code>net/http/httputil</code> package has two excellent methods <strong>DumpRequest</strong> for printing pretty request. and <strong>DumpResponse</strong> methods for printing pretty response.  Let&#8217;s look at examples&#8230;</span></p>
<h5><span data-preserver-spaces="true">Example of httputil.DumpRequest :</span></h5>
<pre class="wp-block-code"><code>
requestDump, err := httputil.DumpRequest(req, true)
if err != nil {
fmt.Println(err)
}
fmt.Printf("%q", requestDump)
</code></pre>
<p>Output:</p>
<pre class="wp-block-code"><code>
POST / HTTP/1.1
Host: www.example.com
Accept: */*
Content-Length: 6
Content-Type: application/x-www-form-urlencoded
User-Agent: curl/7.71.1

foo=bar
</code></pre>
<p><span data-preserver-spaces="true">It prints the whole request object. If you don&#8217;t want the body, change the boolean argument from <strong>true</strong> to <strong>false</strong> in <code>httputil.DumpRequest()</code>.</span></p>
<p><span data-preserver-spaces="true">You can also print only the body of the request. Just read the body from buffer. </span></p>
<pre class="wp-block-code"><code>
buf, err := ioutil.ReadAll(req.Body)
if err != nil {
	fmt.Println(err) //log it
	return
}
fmt.Printf("%+v", string(buf))
</code></pre>
<p><span data-preserver-spaces="true"><strong>Remember</strong>, you will have to write it back after reading it from the buffer; neither request will fail.</span></p>
<pre><code>req.Body = ioutil.NopCloser(bytes.NewBuffer(buf))</code></pre>
<p>&nbsp;</p>
<h5></h5>
<h5><span data-preserver-spaces="true">Example of httputil.DumpResponse:</span></h5>
<pre class="wp-block-code"><code>
dumpResponse, err := httputil.DumpResponse(resp, true)
if err != nil {
	fmt.Println(err)
}

fmt.Printf("%q", dumpResponse)
</code></pre>
<p>Output:</p>
<pre><code>
HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 357425
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Fri, 25 Feb 2022 06:48:03 GMT
Etag: "3247526947+gzip"
Expires: Fri, 04 May 2022 06:48:03 GMT
Last-Modified: Thu, 03 May 2022 07:18:26 GMT
Server: ECS (bsa/EB18)
Vary: Accept-Encoding
X-Cache: HIT

&lt;html&gt; 
&lt;head&gt; 
    &lt;title&gt;Example Domain&lt;/title&gt; 
    &lt;meta <span class="nv">charset</span><span class="o">=</span><span class="s2">"utf-8"</span> /&gt; 
    &lt;meta http-equiv<span class="o">=</span><span class="s2">"Content-type"</span> <span class="nv">content</span><span class="o">=</span><span class="s2">"text/html; charset=utf-8"</span> /&gt; 
    &lt;meta <span class="nv">name</span><span class="o">=</span><span class="s2">"viewport"</span> <span class="nv">content</span><span class="o">=</span><span class="s2">"width=device-width, initial-scale=1"</span> /&gt; 
 ...
</code></pre><p>The post <a href="https://eftakhairul.com/inspect-http-request-and-response-in-golang/">Inspect HTTP Request and Response in Golang</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/inspect-http-request-and-response-in-golang/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2460</post-id>	</item>
		<item>
		<title>Build SQL update query for HTTP Patch request in Golang</title>
		<link>https://eftakhairul.com/build-sql-update-query-for-http-patch-request-in-golang/</link>
					<comments>https://eftakhairul.com/build-sql-update-query-for-http-patch-request-in-golang/#respond</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Sun, 20 Mar 2022 19:54:42 +0000</pubDate>
				<category><![CDATA[GO]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Golang]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2422</guid>

					<description><![CDATA[<p>It seems pretty straightforward to implement HTTP Patch request. The handler receives the request, unmarshals the body, validates the payload, sanitizes it and then sends it to persist layer for persisting into the Database. Let&#8217;s look into an example. For example, we are updating a user resource. type UserResource struct { FirstName string `json:"first_name,omitempty" db:"first_name"` <a class="read-more" href="https://eftakhairul.com/build-sql-update-query-for-http-patch-request-in-golang/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/build-sql-update-query-for-http-patch-request-in-golang/">Build SQL update query for HTTP Patch request in Golang</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2022/03/1200px-Go_Logo_Blue.svg_.png?ssl=1"><img loading="lazy" decoding="async" class="size-medium wp-image-2442 aligncenter" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2022/03/1200px-Go_Logo_Blue.svg_.png?resize=300%2C113&#038;ssl=1" alt="" width="300" height="113" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2022/03/1200px-Go_Logo_Blue.svg_.png?resize=300%2C113&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2022/03/1200px-Go_Logo_Blue.svg_.png?resize=1024%2C385&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2022/03/1200px-Go_Logo_Blue.svg_.png?resize=768%2C289&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2022/03/1200px-Go_Logo_Blue.svg_.png?w=1200&amp;ssl=1 1200w" sizes="(max-width: 300px) 100vw, 300px" data-recalc-dims="1" /></a>It seems pretty straightforward to implement HTTP Patch request. The handler receives the request, unmarshals the body, validates the payload, sanitizes it and then sends it to persist layer for persisting into the Database. Let&#8217;s look into an example.</p>
<p>For example, we are updating a user resource.</p>
<pre class="wp-block-code"><code>
type UserResource struct {
    FirstName   string `json:"first_name,omitempty" <span class="pl-s">db</span>:"first_name"`
    LastName    string `json:"last_name,omitempty"  <span class="pl-s">db</span>:"last_name"`
    Age         int    `json:"age,omitempty"        <span class="pl-s">db</span>:"age"`
    Email       string `json:"email,omitempty"      <span class="pl-s">db</span>:"email"`
}
</code></pre>
<p><span data-preserver-spaces="true">We expect the user to send partial fields to update the resource in an HTTP Patch request. WE use </span><strong><span data-preserver-spaces="true">omitempty</span></strong><span data-preserver-spaces="true"> tag in our UserResource, which means the user resource object might be missing multiple properties; thus, we cannot just prepare a statement with hard-coded fields and placeholders. I will have to build it dynamically, and this is where all the complexity started.</span></p>
<p><span data-preserver-spaces="true">One easy solution is using an ORM. For example, GORM has a function: Updates. It supports updating DB with <code>struct</code> or <code>map[string]interface{}</code>, when updating with <code>struct</code>, it will only update non-zero fields by default and updating with map, you can pass selective fields.</span></p>
<pre class="wp-block-code"><code>db.Model(&amp;user).Updates(<span class="keyword">map</span>[<span class="keyword">string</span>]<span class="keyword">interface</span>{}{<span class="string">"first_name"</span>: <span class="string">"John"</span>, "last_name": "Doe", <span class="string">"age"</span>: <span class="number">18</span>})</code></pre>
<p><span data-preserver-spaces="true">What if you didn&#8217;t use any ORM in your project. Well, the only solution is now to make SQL update queries dynamically. You might use string manipulation or a complex </span><a class="editor-rtfLink" href="https://pkg.go.dev/reflect" target="_blank" rel="noopener"><span data-preserver-spaces="true">reflect package</span></a><span data-preserver-spaces="true"> to build the query. When I was looking for potential solution, I found an excellent open-source library: </span><a class="editor-rtfLink" href="https://github.com/imdario/mergo" target="_blank" rel="noopener"><span data-preserver-spaces="true">https://github.com/imdario/mergo</span></a></p>
<p><strong><span data-preserver-spaces="true">Mergo</span></strong><span data-preserver-spaces="true"> merged structs and maps in Golang. By using the transformer WithOverride, you can overwrite the values of the destination object.</span></p>
<pre class="wp-block-code"><code>
if err := mergo.Merge(&amp;dst, src, mergo.WithOverride); err != nil {
  // handling error
}</code></pre>
<p>In our case, we can retrieve the user resource from DB, override the user resource with request data and persists the user resource object again.</p>
<pre class="wp-block-code"><code>
var userRequest UserResource
json.Unmarshal([]byte(`{"LastName": "Smith"}`), &amp;userRequest)

// Retrieve user resource from DB 
user, err := RetiveUser(userId) 


// Override user with partial userRequest object value
if err := mergo.Merge(&amp;user, userRequest, mergo.WithOverride); err != nil {
	// handle error
}

// Update user in DB again
if err := UpdateUser(user); err != nil {
	// handle error
}
</code></pre>
<p><span data-preserver-spaces="true">Inside </span><strong><span data-preserver-spaces="true">UpdateUser</span></strong><span data-preserver-spaces="true"> function, you will not have to write SQL queries dynamically. You write a regular update query with all fields. Because by merging the userRequest object with the user object, you have all the fields and values.</span></p><p>The post <a href="https://eftakhairul.com/build-sql-update-query-for-http-patch-request-in-golang/">Build SQL update query for HTTP Patch request in Golang</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/build-sql-update-query-for-http-patch-request-in-golang/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2422</post-id>	</item>
		<item>
		<title>Upgrade to PHP 7.4 from PHP 7.2</title>
		<link>https://eftakhairul.com/upgrade-to-php-7-4-from-php-2-0/</link>
					<comments>https://eftakhairul.com/upgrade-to-php-7-4-from-php-2-0/#respond</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Sat, 05 Jun 2021 19:17:17 +0000</pubDate>
				<category><![CDATA[Tech]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2403</guid>

					<description><![CDATA[<p>This is the upgrade of my previous post . Previously, I showed how to upgrade to 7.2. Now, it&#8217;s time for one more jump to new version. The latest version of PHP comes with a couple of changes Arrow functions (Adds short closures) Preloading to improve performance Typed properties in classes Improved type variance The <a class="read-more" href="https://eftakhairul.com/upgrade-to-php-7-4-from-php-2-0/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/upgrade-to-php-7-4-from-php-2-0/">Upgrade to PHP 7.4 from PHP 7.2</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>This is the upgrade of my previous post . Previously, I showed <a href="https://eftakhairul.com/upgrade-php-from-7-0-to-7-2/">how to upgrade to 7.2</a>. Now, it&#8217;s time for one more jump to new version.</p>



<p>The latest version of PHP comes with a couple of changes</p>
<ul>
<li><a href="https://wiki.php.net/rfc/arrow_functions_v2">Arrow functions</a> (Adds short closures)</li>
<li><a href="https://wiki.php.net/rfc/preload">Preloading</a> to improve performance</li>
<li><a href="https://wiki.php.net/rfc/typed_properties_v2">Typed properties</a> in classes</li>
<li><a href="https://stitcher.io/blog/new-in-php-74#improved-type-variance-rfc">Improved type variance</a></li>
<li>The <a href="https://wiki.php.net/rfc/null_coalesce_equal_operator">null coalescing assignment operator</a> as a shorthand</li>
<li><a href="https://wiki.php.net/rfc/ffi">FFI</a> for better extension development in PHP</li>
<li>Underscores can be used to format numeric values</li>
<li>Spread operator in arrays</li>
<li>Opcache Preloading</li>
</ul>



<p>More details: <a href="http://php.net/releases/7_4_0.php">http://php.net/releases/7_4_0.php</a></p>



<p>Even it&#8217;s your first time, just follow the following steps. First, update your system.</p>



<pre class="wp-block-code"><code>
sudo apt-get update
sudo apt-get install python-software-properties
</code></pre>



<p>Second, add Ondřej’s PPA to the system’s Apt sources:</p>



<pre class="wp-block-code"><code>sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php</code></pre>



<p>Update your local package cache again</p>



<pre class="wp-block-code"><code>sudo apt-get update</code></pre>



<p>Now Install PHP 7.4</p>



<pre class="wp-block-code"><code>sudo apt-get install php7.4</code></pre>



<p>In order to version check, run: <br /><code>php -v</code></p>



<p>You also need to install some modules</p>



<pre class="wp-block-code"><code>sudo apt-get install libapache2-mod-php7.4 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-pspell php7.4-readline php7.4-soap php7.4-xml php7.4-zip</code></pre>



<p>One more module for Nginx server</p>



<pre class="wwp-block-code"><code>sudo apt-get install php7.4-fpm</code></pre>



<p>You can check whether the installation is successful or not.</p>
<pre class="wp-block-code"><code>php-fpm7.4 -v</code></pre>



<h4 class="wp-block-heading"><strong>Attention:</strong></h4>



<p>You can ignore the following steps if you install PHP 7.4 for the first time.</p>



<p><strong>For Nginx Server</strong></p>



<p>Update the unix socket path at default configuration as well as other configurations.</p>



<pre class="wp-block-preformatted"><strong>/</strong>var<strong>/</strong>run<strong>/</strong>php<strong>/</strong>php7.4-fpm.sock</pre>



<p>Check the Nginx configuration</p>
<pre class="wp-block-code"><code>sudo nginx -t</code></pre>
<p>Restart the Nginx server</p>



<pre class="wp-block-code"><code>sudo service nginx restart</code></pre>
<p>&nbsp;</p>



<p><strong>For Apache server</strong></p>



<p>You need to disable the old version on Apache and tell Apache to use PHP 7.4.</p>



<pre class="wp-block-code"><code>sudo a2dismod php7.2  
sudo a2enmod php7.4</code></pre>



<p>Restart the Apache server</p>



<pre class="wp-block-code"><code>sudo /etc/init.d/apache2 restart</code></pre>



<p>&nbsp;</p>
<p><strong>Last Part, update the php ini for better performance in web application</strong></p>
<p>Update the following values in php.ini. php.ini  located in <code>/etc/php/7.4/fpm/php.ini</code> for Nginx and located in <code>/etc/php/7.4/apache2/php.ini</code> for apache.</p>
<pre class="wp-block-code"><code>upload_max_filesize = 32M <br />post_max_size = 48M <br />memory_limit = 256M <br />max_execution_time = 600 <br />max_input_vars = 3000 <br />max_input_time = 1000</code></pre>
<p>&nbsp;</p>
<p>Now, you can remove the old version</p>





<pre class="wp-block-code"><code>sudo apt-get install ppa-purge
sudo apt-get purge php7.2-common</code></pre>



<p>Happy hacking <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p><p>The post <a href="https://eftakhairul.com/upgrade-to-php-7-4-from-php-2-0/">Upgrade to PHP 7.4 from PHP 7.2</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/upgrade-to-php-7-4-from-php-2-0/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2403</post-id>	</item>
		<item>
		<title>Backup your Seagate Personal Cloud to pCloud</title>
		<link>https://eftakhairul.com/backup-your-seagate-personal-cloud-to-pcloud/</link>
					<comments>https://eftakhairul.com/backup-your-seagate-personal-cloud-to-pcloud/#comments</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Sun, 08 Nov 2020 00:29:06 +0000</pubDate>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2362</guid>

					<description><![CDATA[<p>I was looking for a proper solution to take the backup of my Seagate Personal Clould (NAS server) to another cloud storage. It&#8217;s just an extra layer of backup in case any hazard occurs in my home. Seagate Personal cloud already has some built-in supports for well known cloud services likes Dropbox, One drive and <a class="read-more" href="https://eftakhairul.com/backup-your-seagate-personal-cloud-to-pcloud/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/backup-your-seagate-personal-cloud-to-pcloud/">Backup your Seagate Personal Cloud to pCloud</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I was looking for a proper solution to take the backup of my Seagate Personal Clould (NAS server) to another cloud storage. It&#8217;s just an extra layer of backup in case any hazard occurs in my home. Seagate Personal cloud already has some built-in supports for <span data-dobid="hdw">well known </span>cloud services likes Dropbox, One drive and others. But, it doesn&#8217;t have the support for the cloud service I use: pCloud.  I am big fan of pCloud  because of it life time pricing policy. I am not marketing for it, I just use it.</p>
<p>The whole solution will be something like below:</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/pcloud_backup.jpg?ssl=1"><img loading="lazy" decoding="async" class="wp-image-2371 aligncenter" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/pcloud_backup.jpg?resize=388%2C172&#038;ssl=1" alt="pcloud_arch_design" width="388" height="172" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/pcloud_backup.jpg?w=431&amp;ssl=1 431w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/pcloud_backup.jpg?resize=300%2C133&amp;ssl=1 300w" sizes="(max-width: 388px) 100vw, 388px" data-recalc-dims="1" /></a></p>
<p>My all device will be connected to Segete NAS where I will keep all of my primary backups. Then, Seagate personal cloud will sync with secondary cloud backup service: pCloud. I was planning to write a custom script. But, then after some googling, I found that both pCloud and Seagete support <span class="ILfuVd"><span class="hgKElc"><b>WebDAV</b></span></span> protocol.</p>
<p>&nbsp;</p>
<p><strong>What is <span class="ILfuVd"><span class="hgKElc">WebDAV</span></span> protocol?</strong></p>
<p>WebDAV stands for <strong>Web Distributed Authoring and Versioning</strong>. It&#8217;s an extension to HTTP that lets clients edit content remotely. Basically, WebDAV enables a web server to act as a file server.</p>
<p>It uses stand HTTP headers, methods and ports (443 for SSL/TLS) for create, move, edit and delete files and folders.</p>
<p>&nbsp;</p>
<p><strong>How did I implement it?</strong></p>
<p>Steps:<br />
1.  SSL/TLS enabled pCloud WebDAV url is <strong>webdav.pcloud.com</strong></p>
<p>2. Log in into your Seagate personal cloud and navigate to Backup Manager</p>
<p>3. Configure pCloud url with usernamae and password.</p>
<p>Select following options  into Backup Wizard</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.01.04-PM.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter wp-image-2372" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.01.04-PM.png?resize=570%2C412&#038;ssl=1" alt="" width="570" height="412" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.01.04-PM.png?w=714&amp;ssl=1 714w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.01.04-PM.png?resize=300%2C217&amp;ssl=1 300w" sizes="(max-width: 570px) 100vw, 570px" data-recalc-dims="1" /></a></p>
<p>Click on <strong>Next</strong>. Configure WebDAV URL in destination with username and password.</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-7.25.07-PM.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-2377" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-7.25.07-PM.png?resize=749%2C553&#038;ssl=1" alt="" width="749" height="553" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-7.25.07-PM.png?w=749&amp;ssl=1 749w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-7.25.07-PM.png?resize=300%2C221&amp;ssl=1 300w" sizes="(max-width: 749px) 100vw, 749px" data-recalc-dims="1" /></a></p>
<p>Click on <strong>Next</strong>.</p>
<p>It will connect to pCloud and will list all the folders of source (Seagate personal cloud) &amp; designation (pCloud).<br />
You will have to choice folder of source  you sync with destination folder.</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.27.56-PM.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-2373" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.27.56-PM.png?resize=768%2C609&#038;ssl=1" alt="" width="768" height="609" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.27.56-PM.png?w=768&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.27.56-PM.png?resize=300%2C238&amp;ssl=1 300w" sizes="(max-width: 768px) 100vw, 768px" data-recalc-dims="1" /></a></p>
<p>Click on <strong>Next</strong>.<br />
On next window, it will ask whether you want delete file from destination folder or not. Keep uncheck if you want. Click On <strong>Next</strong> again.</p>
<p>Now you will have to select backup mode.</p>
<p><strong>Manual</strong>:  you will have to  click that button manually to take the backup. Better for one time backup.<br />
<strong>Schedule</strong>: You can take the backup periodically based on time, day and month.</p>
<p>In this case, I choose weekly schedule backup. I want to take backup every Friday night.</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.41.02-PM.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-2374" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.41.02-PM.png?resize=774%2C535&#038;ssl=1" alt="" width="774" height="535" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.41.02-PM.png?w=774&amp;ssl=1 774w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.41.02-PM.png?resize=300%2C207&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.41.02-PM.png?resize=768%2C531&amp;ssl=1 768w" sizes="(max-width: 774px) 100vw, 774px" data-recalc-dims="1" /></a></p>
<p>Click On <strong>Next</strong>. It will show summary.</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.43.54-PM.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-2375" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.43.54-PM.png?resize=759%2C588&#038;ssl=1" alt="" width="759" height="588" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.43.54-PM.png?w=759&amp;ssl=1 759w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2020/11/Screen-Shot-2020-11-07-at-6.43.54-PM.png?resize=300%2C232&amp;ssl=1 300w" sizes="(max-width: 759px) 100vw, 759px" data-recalc-dims="1" /></a>Click on Finish. You are done.</p>
<p>It will start immediately as well as it will take backup on every week.</p>
<p>&nbsp;</p>
<p><strong>What are the cloud storage services that support WebDAV protocol?</strong></p>
<table>
<tbody>
<tr>
<td>1&amp;1 Online-Speicher (DSL)</td>
<td>https://sd2dav.1und1.de</td>
</tr>
<tr>
<td>1&amp;1 Online-Speicher (Webhosting)</td>
<td>https://webdav.office.1und1.de</td>
</tr>
<tr>
<td>blaucloud</td>
<td>https://{username}.blaucloud.de/remote.php/webdav</td>
</tr>
<tr>
<td>Box</td>
<td>https://dav.box.com/dav</td>
</tr>
<tr>
<td>Cubby</td>
<td>https://webdav.cubby.com</td>
</tr>
<tr>
<td>freenetcloud</td>
<td>https://webmail.freenet.de/webdav</td>
</tr>
<tr>
<td>GMX MediaCenter</td>
<td>https://webdav.mc.gmx.net</td>
</tr>
<tr>
<td>HiDrive</td>
<td>https://webdav.hidrive.strato.com</td>
</tr>
<tr>
<td>IceDrive</td>
<td>https://webdav.icedrive.io/</td>
</tr>
<tr>
<td>IDrive</td>
<td>https://dav.idrivesync.com</td>
</tr>
<tr>
<td>kDrive</td>
<td>https://connect.drive.infomaniak.com</td>
</tr>
<tr>
<td>Koofr</td>
<td>https://app.koofr.net/dav/Koofr</td>
</tr>
<tr>
<td>MagentaCLOUD</td>
<td>https://webdav.magentacloud.de</td>
</tr>
<tr>
<td>Mail.Ru</td>
<td>https://webdav.cloud.mail.ru</td>
</tr>
<tr>
<td>Nextcloud</td>
<td>https://{host}/{path}/remote.php/dav/files/{username}<br />
or<br />
https://{host}/{path}/remote.php/webdav</td>
</tr>
<tr>
<td>ownCloud</td>
<td>https://{host}/{path}/remote.php/webdav</td>
</tr>
<tr>
<td>pCloud</td>
<td>https://webdav.pcloud.com</td>
</tr>
<tr>
<td>Seafile (self-hosted)</td>
<td>https://{host}/{path}/seafdav</td>
</tr>
<tr>
<td>STACK</td>
<td>https://{username}.stackstorage.com/remote.php/webdav</td>
</tr>
<tr>
<td>Strato HiDrive</td>
<td>https://webdav.hidrive.strato.com</td>
</tr>
<tr>
<td>Syncwerk (formerly Seafile.de)</td>
<td>https://app.syncwerk.com/seafdav</td>
</tr>
<tr>
<td>WEB.DE Online-Speicher</td>
<td>https://webdav.smartdrive.web.de</td>
</tr>
<tr>
<td>wölkli</td>
<td>https://cloud.woelkli.com/remote.php/webdav</td>
</tr>
<tr>
<td>Yandex.Disk</td>
<td>https://webdav.yandex.com</td>
</tr>
<tr>
<td>Mailbox.org</td>
<td>https://dav.mailbox.org/servlet/webdav.infostore/</td>
</tr>
</tbody>
</table>
<p>Note: Some cloud services may disable WebDAV access when two factor authentication is enabled. pCloud does that too.</p>
<p>Happy Hacking <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p><p>The post <a href="https://eftakhairul.com/backup-your-seagate-personal-cloud-to-pcloud/">Backup your Seagate Personal Cloud to pCloud</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/backup-your-seagate-personal-cloud-to-pcloud/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2362</post-id>	</item>
		<item>
		<title>Logging with Winston  in your Node.js application</title>
		<link>https://eftakhairul.com/logging-with-winston-in-your-node-js-application/</link>
					<comments>https://eftakhairul.com/logging-with-winston-in-your-node-js-application/#comments</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Wed, 21 Aug 2019 05:15:39 +0000</pubDate>
				<category><![CDATA[Framework]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Nodejs]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[nodejs]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2158</guid>

					<description><![CDATA[<p>Logging is an essential part of application.  According to Twelve-Factor App methodology it&#8217;s the XI factor of application development. A proper logging gives you a valuable insite of your application. In Node.js application, it is always suggested to use logging libraryrather than just using console.log  in productione environment. Log4js, Bunyan , and Winston are the <a class="read-more" href="https://eftakhairul.com/logging-with-winston-in-your-node-js-application/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/logging-with-winston-in-your-node-js-application/">Logging with Winston  in your Node.js application</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Logging is an essential part of application.  According to Twelve-Factor App methodology it&#8217;s the <strong>XI </strong>factor of application development. A proper logging gives you a valuable insite of your application. In Node.js application, it is always suggested to use logging libraryrather than just using console.log  in productione environment. <a href="https://www.npmjs.com/package/log4js">Log4js</a>, <a class="markup--anchor markup--p-anchor" href="https://www.npmjs.com/package/bunyan" target="_blank" rel="nofollow noopener noreferrer" data-href="https://www.npmjs.com/package/bunyan">Bunyan</a> , and <a href="https://www.npmjs.com/package/winston">Winston</a> are the best logging libraries among other libraries. I am not going to discuss here which is the best logging library among them.</p>
<p>In this tutorials I will cover the Winston logging library with <a href="https://www.npmjs.com/package/morgan">Morgan</a> logger middleware. Winston is most popular, simple and versatile logging library for NodeJs application. You can easily customize it, format the log messages and send them any internal or cloud log management tools.</p>
<h2>Logging with Winston</h2>
<p>Let&#8217;s create a custom nodejs app with Winston logging library. Create a blank <code>package.json</code> file that automatically accepts all the defaults without prompting.</p>
<pre lang="bash">mkdir ~/myapp 
cd ~/myapp
npm init -y
</pre>
<p>Install Winston</p>
<pre lang="bash">npm install  winston --save</pre>
<p>Now, create a <code>config</code> folder file with <code>logger.js</code> file which contains the winston configuraiton.</p>
<pre lang="bash">mkdir ~/myapp/config
touch  ~/myapp/config/logger.js</pre>
<p>Let&#8217;s talk about a little bit about Winston logging library. It supports</p>
<ul>
<li style="text-align: left;">Pre-defined levels as well as custom error levels</li>
<li style="text-align: left;">Multiple transports as well as custom transport</li>
<li style="text-align: left;">Handle exceptions</li>
<li>Different log formats as well as custom formats</li>
</ul>
<h4>Transport</h4>
<p>Transport is a concept that stores or output the logs into file, console, stream or cloud platform over http. It&#8217;s loaded as module while creating an instance of a winston logger. You can use multiple transports at different log level at the same time. What it means actually you can output to console and send to http at the same time. Built-in available transports are <a href="https://github.com/winstonjs/winston/blob/master/docs/transports.md#console-transport">Console</a>, <a href="https://github.com/winstonjs/winston/blob/master/docs/transports.md#file-transport">File</a>, <a href="https://github.com/winstonjs/winston/blob/master/docs/transports.md#http-transport">Http</a> and <a href="https://github.com/winstonjs/winston/blob/master/docs/transports.md#stream-transport">Stream</a>. There are also some aditional <a href="https://github.com/winstonjs/winston/blob/master/docs/transports.md#community-transports">community transports</a> available.</p>
<h4 id="winston-logging-levels">Logging level</h4>
<p>Logging level is part of transport which indicate the minimum logging priority that transport will listen out for.  Logong level is denoted the by integer number and it follows <code>npm</code> logging levels.</p>
<ul>
<li><strong>0</strong>: error</li>
<li><strong>1</strong>: warn</li>
<li><strong>2</strong>: info</li>
<li><strong>3</strong>: verbose</li>
<li><strong>4</strong>: debug</li>
<li><strong>5</strong>: silly</li>
</ul>
<p>For example, you configure transport with setting logging level to <code>debug: 4.</code>This means, it will log levels</p>
<ul>
<li>4 (debug)</li>
<li>3 (verbose)</li>
<li>2 (info)</li>
<li>1 (warn)</li>
<li>0 (error)</li>
</ul>
<p>If you set the logging level to <strong>info then the logs will show only info messages  as well as less than or equal to this level</strong>, You wont see the debug or verbose messages. This helps to avoid clutter in the logs and prevents too much info being shown in the logs in a production environment.</p>
<p>Next, define a logger with a very basic winston configurations.</p>
<pre lang="javascript">//~/myapp/config/logging.js
// Import modules
const winston = require('winston');

// Logger configuration
const logConfiguration = {
    exitOnError: false,
    transports: [
        new winston.transports.Console({
            level: 'info'
        }),
        new winston.transports.File({
            level: 'error',
            filename: `./logs/app.log`
        })
    ]
};

// Create the logger
const logger = winston.createLogger(logConfiguration);

// Export the logger
module.exports = logger;
</pre>
<p>Let me explain what properties I configured here. In <code>logConfiguration</code> object, I initiated two transports: console with level: info  and file with level: error. File tranporter will log only errors into <code>log/app.log</code> file at application root. Console transporter will log upto info or any logs less than info level. I also set <code>exitOnError</code> to false. Means it will not exit after logging an uncaughtException.</p>
<pre lang="javascript">Now, I am going to use the logger in my app.js.
//~/myapp/app.js
const logger = require('./config/logger');
logger.info("hello world!");</pre>
<p>It print <code>hello world!</code> in console as below. It doesn&#8217;t add any log into app.log file because of log level.</p>
<pre lang="json">{"message":"hello world!","level":"info"}
</pre>
<p>Now, we print another log with error level.</p>
<pre lang="javascript">logger.error("error occured");</pre>
<p>This time, you see following message in console as well into app.log file.</p>
<pre lang="json">{"message":"hello world!","level":"error"}</pre>
<h4>Custom log formats</h4>
<p>Another important advantage of Winston is customizing log message format as well as creating your own custom format. By default it supports JSON formatting, coloring log output, and the ability to change with formats. You can add different message formats to diferent transports.  Let’s start with an example that adds a timestamp, label, colorizes the level and message, lowercase message content and prints using the template <code class="highlighter-rouge"> [level] [timestamp-label]:  message</code>.</p>
<pre lang="javascript">// Import modules
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, label, colorize, printf } = format;

const customFormat = printf(({ level, message, label, timestamp }) =&gt; {
  return `$[${level}] [${timestamp}-${label}] ${message.toLowerCase()}`;
});

// Logger configuration
const logConfiguration = {
  format: combine(
    label({ label: 'Custom APP log!' }),
    timestamp(),
    colorize({ all: true }),  
    customFormat
  ),
  transports: [
    new transports.Console({ level: 'info' })
  ],
  exitOnError: false,
};

// Create the logger
const logger = createLogger(logConfiguration);
</pre>
<p>Now if you try again <code>logger.info("HELLO WORLD")</code>, you will see following message into console.</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2019/04/log.png?ssl=1"><img loading="lazy" decoding="async" class="size-large wp-image-2201 alignleft" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2019/04/log.png?resize=1024%2C39&#038;ssl=1" alt="" width="1024" height="39" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2019/04/log.png?resize=1024%2C39&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2019/04/log.png?resize=300%2C11&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2019/04/log.png?resize=768%2C29&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2019/04/log.png?w=1372&amp;ssl=1 1372w" sizes="(max-width: 1000px) 100vw, 1000px" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>More details on format: <a href="https://github.com/winstonjs/winston#formats">See Winston Format </a></p>
<h4></h4>
<h4>Send log message to Cloud platform</h4>
<p>There are multiple cloud platforms with paid and limited free subscribtions where you can send log messages. I used couple of them, but for this tutorials I chose Papertrail.</p>
<pre lang="javascript">// import modules
const winston = require('winston');

// Install papertail: npm install winston-papertrail --save
// Requiring `winston-papertrail` will expose  
require('winston-papertrail').Papertrail;

const winstonPapertrail = new winston.transports.Papertrail({
        level: 'info',
        colorize: true, 
        host: 'logs.papertrailapp.com', 
        port: 12345 });
 
// Logger configuration 
const logConfiguration = { 
   exitOnError: false, 
   transports: [winstonPapertrail] 
};


// Create the logger 
const logger = winston.createLogger(logConfiguration); 

// Export the logger 
module.exports = logger;
</pre>
<p>&nbsp;</p>
<p>I almost covered everything about Winston as a proper logger. One more thing I want to add using winston with morgan.</p>
<p>&nbsp;</p>
<h2>Why Morgan?</h2>
<p>Morgan is HTTP request middleware logger for Node.js. It basically simplifies the process of request logging. Most of the time it&#8217;s used with Winston to consolidate HTTP request data logs.  <span class="comment-copy">Morgan supports a handful of pre-defined logged formats with well-know names/structures: <strong>combined, common, dev, short, tiny </strong>as well as custom format<strong>. </strong>Beside the format, it also accepts following properties as into its optiont object.</span></p>
<ul>
<li>immediate: set it to true in order to log request even server crashes.</li>
<li>skip: skip log outputs based on some custom logic</li>
<li>stream: Output stream for writing log lines. Defaults to <code>process.stdout</code></li>
</ul>
<p>Let&#8217;s look at an example of Morgan with Winston logger into an express based Node.js application. By default,  it outputs to the console, so let&#8217;s define a stream function into Winston so that we can transfer morgan&#8217;s output into the Winston log files.</p>
<pre lang="javascript">//~/myapp/config/logging.js
...

logger.stream = {
  write: function(message, encoding) {
    logger.info(message);
  },
};


// Export the logger 
module.exports = logger;
</pre>
<p>In app.js (Example based on express framework)</p>
<pre lang="javascript">const express = require('express');
const bodyParser = require('body-parser');
const app = express();


const morgan = require('morgan');
const logger = require('./config/logger');

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));

app.use(morgan('combined', {
    immediate: true,
    stream: logger.stream
}));

...
</pre>
<p>Morgan supports token. To know more details token and l<span class="comment-copy">ogged format:  <a href="https://www.npmjs.com/package/morgan">Morgan NPM Package documentation</a> </span></p>
<p>In this tutotial, I mostly focused on Winston logger with Morgan HTTP middleware for <span data-dobid="hdw">simplicity</span>. I mentioned before that there are more better logger libraries availabe based on different features. Choice one that best fits into your application. Happy Hacking.</p><p>The post <a href="https://eftakhairul.com/logging-with-winston-in-your-node-js-application/">Logging with Winston  in your Node.js application</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/logging-with-winston-in-your-node-js-application/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2158</post-id>	</item>
		<item>
		<title>SSH to AWS EC2 instance without key pairs</title>
		<link>https://eftakhairul.com/ssh-to-aws-ec2-instance-without-key-pairs/</link>
					<comments>https://eftakhairul.com/ssh-to-aws-ec2-instance-without-key-pairs/#respond</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Tue, 18 Sep 2018 06:39:28 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2099</guid>

					<description><![CDATA[<p>This is a common issue for the developers to access ec2 instances by username and password authentication.  It requires a few steps to do that. First, login as root using the key pairs. Second, create a user sudo adduser username Third, you need to grant root level permission to the new user visudo Add following <a class="read-more" href="https://eftakhairul.com/ssh-to-aws-ec2-instance-without-key-pairs/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/ssh-to-aws-ec2-instance-without-key-pairs/">SSH to AWS EC2 instance without key pairs</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>This is a common issue for the developers to access ec2 instances by username and password authentication.  It requires a few steps to do that.</p>
<p>First, <span id="m_-6587614647460356856gmail-6" class="m_-6587614647460356856gmail-gr_ m_-6587614647460356856gmail-gr_6 m_-6587614647460356856gmail-gr-alert m_-6587614647460356856gmail-gr_spell m_-6587614647460356856gmail-gr_inline_cards m_-6587614647460356856gmail-gr_disable_anim_appear m_-6587614647460356856gmail-ContextualSpelling m_-6587614647460356856gmail-multiReplace">login</span> as root using the key pairs.<br />
Second, create a user</p>
<pre class="m_-6587614647460356856gmail-wp-block-code"><code>sudo adduser username</code></pre>
<p>Third, you need to grant root level permission to the new user</p>
<pre class="m_-6587614647460356856gmail-wp-block-code"><code>visudo</code></pre>
<p>Add following line</p>
<pre class="m_-6587614647460356856gmail-wp-block-code"><code>username ALL=(ALL) ALL</code></pre>
<p>Forth, edit <code>/etc/ssh/sshd_config</code><span id="m_-6587614647460356856gmail-179" class="m_-6587614647460356856gmail-gr_ m_-6587614647460356856gmail-gr_179 m_-6587614647460356856gmail-gr-alert m_-6587614647460356856gmail-gr_gramm m_-6587614647460356856gmail-gr_inline_cards m_-6587614647460356856gmail-gr_disable_anim_appear m_-6587614647460356856gmail-Style m_-6587614647460356856gmail-multiReplace"> setting</span> and then <span id="m_-6587614647460356856gmail-208" class="m_-6587614647460356856gmail-gr_ m_-6587614647460356856gmail-gr_208 m_-6587614647460356856gmail-gr-alert m_-6587614647460356856gmail-gr_gramm m_-6587614647460356856gmail-gr_inline_cards m_-6587614647460356856gmail-gr_run_anim m_-6587614647460356856gmail-Style m_-6587614647460356856gmail-multiReplace">set </span><code>PasswordAuthentication</code><span id="m_-6587614647460356856gmail-208" class="m_-6587614647460356856gmail-gr_ m_-6587614647460356856gmail-gr_208 m_-6587614647460356856gmail-gr-alert m_-6587614647460356856gmail-gr_gramm m_-6587614647460356856gmail-gr_inline_cards m_-6587614647460356856gmail-gr_disable_anim_appear m_-6587614647460356856gmail-Style m_-6587614647460356856gmail-multiReplace"> to</span> yes. Open the vim or nano</p>
<pre class="m_-6587614647460356856gmail-wp-block-code"><code>sudo vim /etc/ssh/sshd_config</code></pre>
<p>Find and set PasswordAuthentication to yes</p>
<pre class="m_-6587614647460356856gmail-wp-block-code"><code>PasswordAuthentication yes</code></pre>
<p>Finally, restart the <code>ssh</code> daemon</p>
<p><strong>For Ubuntu</strong></p>
<pre class="m_-6587614647460356856gmail-wp-block-code"><code>sudo service ssh restart
</code></pre>
<p><strong>For CentOS</strong></p>
<pre class="m_-6587614647460356856gmail-wp-block-code"><code>sudo service sshd restart</code></pre>
<p>Done, now you are able to login into your ec2 instance without the key pairs.  Happy Hacking <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p><p>The post <a href="https://eftakhairul.com/ssh-to-aws-ec2-instance-without-key-pairs/">SSH to AWS EC2 instance without key pairs</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/ssh-to-aws-ec2-instance-without-key-pairs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2099</post-id>	</item>
		<item>
		<title>Upgrade PHP from 7.0 to 7.2</title>
		<link>https://eftakhairul.com/upgrade-php-from-7-0-to-7-2/</link>
					<comments>https://eftakhairul.com/upgrade-php-from-7-0-to-7-2/#respond</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Fri, 14 Sep 2018 06:20:30 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorials]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=2085</guid>

					<description><![CDATA[<p>A long ago, I wrote about how to upgrade to 7.0. PHP 7.2 is released. Now, it&#8217;s the time again to upgrade to the new version.  The latest version of PHP comes with a couple of changes Convert numeric keys in object/array casts Counting of non-countable objects Object typehint HashContext as Object Argon2 in password <a class="read-more" href="https://eftakhairul.com/upgrade-php-from-7-0-to-7-2/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/upgrade-php-from-7-0-to-7-2/">Upgrade PHP from 7.0 to 7.2</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>A long ago, I wrote about <a href="https://eftakhairul.com/upgrade-to-php-7/">how to upgrade to 7.0</a>. PHP 7.2 is released. Now, it&#8217;s the time again to upgrade to the new version.</p>



<p> The latest version of PHP comes with a couple of changes</p>



<ul>
<li><a href="https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts">Convert numeric keys in object/array casts</a></li>
<li><a href="https://wiki.php.net/rfc/counting_non_countables">Counting of non-countable objects</a></li>
<li><a href="https://wiki.php.net/rfc/object-typehint">Object typehint</a></li>
<li><a href="https://wiki.php.net/rfc/hash-context.as-resource">HashContext as Object</a></li>
<li><a href="https://wiki.php.net/rfc/argon2_password_hash">Argon2 in password hash</a></li>
<li><a href="https://wiki.php.net/rfc/improved-tls-constants">Improve TLS constants to sane values</a></li>
<li><a href="https://wiki.php.net/rfc/mcrypt-viking-funeral">Mcrypt extension removed</a></li>
<li><a href="https://wiki.php.net/rfc/libsodium">New sodium extension</a></li>
</ul>



<p>More details: <a href="http://php.net/releases/7_2_0.php">http://php.net/releases/7_2_0.php</a></p>



<p>Even it&#8217;s your first time, just follow the following steps. First, update your system.</p>



<pre class="wp-block-preformatted">sudo apt-get update<br />sudo apt-get install python-software-properties</pre>



<p>Second, add Ondřej’s PPA to the system’s Apt sources:</p>



<pre class="wp-block-preformatted">sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php</pre>



<p>Update your local package cache again</p>



<pre class="wp-block-code"><code>sudo apt-get update</code></pre>



<p>Now Install PHP 7.2</p>



<pre class="wp-block-preformatted">sudo apt-get install php7.2</pre>



<p>In order to version check, run: php -v</p>



<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" class="wp-image-2086" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2018/09/Screen-Shot-2018-09-14-at-2.00.40-AM.png?ssl=1" alt="" data-recalc-dims="1" /></figure>
</div>



<p>You also need to install some modules</p>



<pre class="wp-block-code"><code>sudo apt-get install libapache2-mod-php7.2 php7.2-cgi php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pspell php7.2-readline php7.2-soap php7.2-xml php7.2-zip</code></pre>



<p>One more module for Nginx server</p>



<pre class="wp-block-preformatted">sudo apt-get install php7.2-fpm</pre>



<p>&nbsp;</p>



<h4 class="wp-block-heading"><strong>Attention:</strong></h4>



<p>You can ignore the following steps if you install PHP 7.2 for first time.</p>



<p><strong>For Nginx Server</strong></p>



<p>Update the unix socket path at default configuration as well as other configurations. </p>



<pre class="wp-block-preformatted"><strong>/</strong>var<strong>/</strong>run<strong>/</strong>php<strong>/</strong>php7.2-fpm.sock</pre>



<p>estart the Nginx server</p>



<p>sudo service nginx restart</p>



<p><strong>For Apache server</strong></p>



<p>You need to disable the old version on Apache and tell Apache to use PHP 7.2.</p>



<pre class="wp-block-preformatted">sudo a2dismod php7.0  <br />sudo a2enmod php7.2</pre>



<p>Restart the Apache server</p>



<pre class="wp-block-code"><code>sudo /etc/init.d/apache2 restart</code></pre>



<p>Now, you can remove the old version.</p>



<p>&nbsp;</p>



<pre class="wp-block-code"><code>sudo apt-get install ppa-purge
sudo apt-get purge php7.0-common</code></pre>



<p>Happy hacking <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>&nbsp;</p><p>The post <a href="https://eftakhairul.com/upgrade-php-from-7-0-to-7-2/">Upgrade PHP from 7.0 to 7.2</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/upgrade-php-from-7-0-to-7-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2085</post-id>	</item>
		<item>
		<title>GIT Squashing and open source contribution</title>
		<link>https://eftakhairul.com/git-squashing-and-open-source-contribution/</link>
					<comments>https://eftakhairul.com/git-squashing-and-open-source-contribution/#respond</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Mon, 12 Feb 2018 21:09:34 +0000</pubDate>
				<category><![CDATA[Tech]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=1877</guid>

					<description><![CDATA[<p>Never thought that GIT squashing would be that important for the open source contribution. I was contributing to an open source project. I finished the feature and created a pull request. Surprise!!! the community didn&#8217;t accept my pull request. Okay. &#8230; It was not rejected because of my wrong implementation or bad code. It was rejected just <a class="read-more" href="https://eftakhairul.com/git-squashing-and-open-source-contribution/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/git-squashing-and-open-source-contribution/">GIT Squashing and open source contribution</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Never thought that GIT squashing would be that important for the open source contribution. I was contributing to an open source project. I finished the feature and created a pull request. Surprise!!! the community didn&#8217;t accept my pull request. Okay. &#8230; It was not rejected because of my wrong implementation or bad code. It was rejected just because of my commit history.</p>
<p>So, in the open source project, this is kinda common practice to use one commit message per feature/branch per push. It actually makes sense when you look at the commit history of an open source project. Nobody wants to see your code noises in the commit history. Basically, you will have to squash multiple commits into one commit before creating pull request.</p>
<h4>What is GIT Squashing?</h4>
<p>Normally, we do commit as we progress.  But, we don&#8217;t want to push all of them into the repository. GIT squashing compress down multiple commits into one single meaningful commit. Sometime, we do some unnecessary commits or we find some commits that should be belong to the same logical change-set. GIT squashing enables rewrite the history by keeping one commit message,  and squashing those subsequent commits into the previous one.</p>
<p>In this tutorial we will use GIT interactive rebase command for squashing. We will use <code>squash</code> and <code>fixup</code>.</p>
<ul>
<li><code>squash</code> (<code>s</code> for short), which melds the commit into the previous one (the one in the line before)</li>
<li><code>fixup</code> (<code>f</code> for short), which acts like “squash”, but discards this commits message</li>
</ul>
<p>Let&#8217;s go through an example. We have five commits in log history.</p>
<pre lang="bash">bbf19a9 my 1st commit
9added2 my 2nd commit
1a8482a my 3rd commit
68782bd my 4th commit
3c9956e my 5th commit
</pre>
<p>We want squash the last three commits (3c9956e to 1a8482a) into the first commit (bbf19a9 )and discard the forth commit from the last (9added2). You need to run the command: <strong>interactive (-i for short ) rabsae</strong></p>
<pre lang="bash">git rebase -i HEAD~5</pre>
<p>It will show a list of each commit  as below in your default git editor (either nano or vim)</p>
<pre lang="bash">pick bbf19a9 my 1st commit
pick 9added2 my 2nd commit
pick 1a8482a my 3rd commit
pick 68782bd my 4th commit
pick 3c9956e my 5th commit

# Rebase 187a597..3c9956e onto 187a597 (5 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
</pre>
<p>The above screen already describes with all the options and what exactly you have to use based on our requirement. In our case, we use squash and fixup.</p>
<pre lang="bash">pick bbf19a9 my 1st commit
fixup 9added2 my 2nd commit
squash 1a8482a my 3rd commit
squash 68782bd my 4th commit
squash 3c9956e my 5th commit
</pre>
<p>You can also use <code><strong>s</strong></code> as short for squash and <code><strong>f</strong></code> as short for fixup.</p>
<p>Save and exit the editor. It will show another screen</p>
<pre lang="bash"># This is a combination of 5 commits.
# This is the 1st commit message:

my 1st commit

# The commit message #2 will be skipped:

# third commit

# This is the commit message #3:

my 3rd commit

# This is the commit message #4:

my 4th commit

# This is the commit message #5:

my 5th commit

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Sat Nov 11 18:29:04 2017 -0500
#
# interactive rebase in progress; onto 187a597
# Last commands done (5 commands done):
# s 68782bd fifth commit
# s 3c9956e sixth commit
# No commands remaining.
# You are currently rebasing branch 'master' on '187a597'.
#
# Changes to be committed:
# modified: indext.html
#
</pre>
<p>The above screen describes what would be your new modified and composite commit message. You can leave as it is or you can write your new commit message. If you leave as it, all commit messages will appear except the commit: <code>my 2nd commit</code>.</p>
<p>If you check git log, you will get one commit with all of your changes</p>
<pre lang="bash">git log 
</pre>
<h4>When you shouldn&#8217;t do this?</h4>
<p>Don&#8217;t sqaush or rewrite the history if they have been already push to public repository.</p>
<p>Some developers have different thought, they don&#8217;t like to squash because the commits are well-structured a series of commits which represents a logical series of meaningful changes. The main trick is not squashing everything into one gigantic commits, rather clean up or remove the unnecessary commits from git change history.</p>
<h4>Tips:</h4>
<p>1. To halt the squashing middle of rebase, simple run this command: <code>git rebase --abort</code><br />
2. To see git log in a cleaner way: <code>git log --pretty=oneline</code><br />
3. To rewrite the commit message, use <strong>reword</strong> rather than squash or fixup.<br />
4. Just to change the last commit message: <code>git commit --amend</code></p>
<h4>Helpful links:</h4>
<p>https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History<br />
http://stackoverflow.com/questions/2563632/how-can-i-merge-two-commits-into-one</p><p>The post <a href="https://eftakhairul.com/git-squashing-and-open-source-contribution/">GIT Squashing and open source contribution</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/git-squashing-and-open-source-contribution/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1877</post-id>	</item>
		<item>
		<title>Transfer tokens from orderbook.io to MyEtherWallet (MEW) wallet</title>
		<link>https://eftakhairul.com/transfer-tokens-from-orderbook-io-to-myetherwallet-mew-wallet/</link>
					<comments>https://eftakhairul.com/transfer-tokens-from-orderbook-io-to-myetherwallet-mew-wallet/#comments</comments>
		
		<dc:creator><![CDATA[Eftakhairul Islam]]></dc:creator>
		<pubDate>Sun, 17 Dec 2017 05:48:47 +0000</pubDate>
				<category><![CDATA[cryptocurrency]]></category>
		<category><![CDATA[ethereum]]></category>
		<guid isPermaLink="false">https://eftakhairul.com/?p=1977</guid>

					<description><![CDATA[<p>It&#8217;s always suggested to transfer tokens to a new wallet that supports ERC20 tokens. MyEtherWallet (aka MEW) is an ERC20-compliant wallet and you can hold any ERC20 tokens there. &#160; In this tutorial, I will cover how to transfer tokens from orderbook.io to MyEtherWallet.  I used Hacken Token (HKN) as example and wrote this tutorial <a class="read-more" href="https://eftakhairul.com/transfer-tokens-from-orderbook-io-to-myetherwallet-mew-wallet/">&#8230;&#160;<span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://eftakhairul.com/transfer-tokens-from-orderbook-io-to-myetherwallet-mew-wallet/">Transfer tokens from orderbook.io to MyEtherWallet (MEW) wallet</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s always suggested to transfer tokens to a new wallet that supports ERC20 tokens. MyEtherWallet (aka MEW) is an ERC20-compliant wallet and you can hold any ERC20 tokens there.</p>
<p>&nbsp;</p>
<p>In this tutorial, I will cover how to transfer tokens from orderbook.io to MyEtherWallet.  I used Hacken Token (HKN) as example and wrote this tutorial for newbies.</p>
<h3></h3>
<h3>Step 1: You can skip this step if you already have a MyEtherWallet wallet.</h3>
<p>To create wallet, please visit any of following links:</p>
<ul>
<li>Text tutorials: https://www.cryptocompare.com/wallets/guides/how-to-use-myetherwallet/</li>
<li>Video tutorials: https://www.youtube.com/watch?v=phht73IvUDI</li>
</ul>
<p>&nbsp;</p>
<h3>Step 2: Copy your Ethereum address from MyEtherWallet wallet</h3>
<ol>
<li>Login to <a href="https://www.myetherwallet.com/">MyEtherWallet wallet</a></li>
<li> Copy your Ethereum address  (Account Address)</li>
</ol>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.56.00-PM-01.png?ssl=1"><img loading="lazy" decoding="async" class="wp-image-1981 alignleft" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.56.00-PM-01.png?resize=470%2C274&#038;ssl=1" alt="" width="470" height="274" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.56.00-PM-01.png?resize=300%2C175&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.56.00-PM-01.png?resize=768%2C449&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.56.00-PM-01.png?resize=1024%2C598&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.56.00-PM-01.png?w=2000&amp;ssl=1 2000w" sizes="(max-width: 470px) 100vw, 470px" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>(NB. Don&#8217;t use the address in the picture above, <strong>use your own Ethereum address</strong>)</p>
<p>&nbsp;</p>
<h3>Step 3: Withdraw tokens from orderbook.io</h3>
<p>1. Login to <a href="https://www.orderbook.io">orderbook.io</a></p>
<p>2. Navigate to BALANCES tab and click on the Withdraw icon on the right of the token.</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.03.25-AM-01.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1980" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.03.25-AM-01.png?resize=1024%2C54&#038;ssl=1" alt="" width="1024" height="54" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.03.25-AM-01.png?resize=1024%2C54&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.03.25-AM-01.png?resize=300%2C16&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.03.25-AM-01.png?resize=768%2C40&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.03.25-AM-01.png?w=2000&amp;ssl=1 2000w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.03.25-AM-01.png?w=3000&amp;ssl=1 3000w" sizes="(max-width: 1000px) 100vw, 1000px" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>3. You will get two inputs fields. Type your <strong>Etherium address</strong> in the recipient field and the amount you want to withdraw in the amount field. Click on <strong>CONFIRM</strong> and you are done. Orderbook charged me 2 HKN fees for withdrawing HKN tokens. For different tokens, fees could be different.</p>
<p>5. You will receive a verification code through your email/phone.  A pop-up will come for the final withdraw confirmation, you will have to type verification code as below and then click on <strong>CONFIRM</strong>.<a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.05.29-PM-01.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter wp-image-1979 size-medium" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.05.29-PM-01.png?resize=300%2C270&#038;ssl=1" alt="" width="300" height="270" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.05.29-PM-01.png?resize=300%2C270&amp;ssl=1 300w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.05.29-PM-01.png?resize=768%2C692&amp;ssl=1 768w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.05.29-PM-01.png?resize=1024%2C923&amp;ssl=1 1024w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-16-at-11.05.29-PM-01.png?w=1888&amp;ssl=1 1888w" sizes="(max-width: 300px) 100vw, 300px" data-recalc-dims="1" /></a></p>
<h3></h3>
<h3>Step 4: Load token to MyEtherWallet</h3>
<p>1. Again, login to your MyEtherWallet</p>
<p>2. Click on <strong>Add Custom Tokens</strong></p>
<p>3. Type your token&#8217;s contact address,  symbol and decimals. And, then click on &#8220;<strong>Save&#8221;</strong> button as below. Following example is based on Hacken Token (HKN )</p>
<p><a href="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.19.02-AM.png?ssl=1"><img loading="lazy" decoding="async" class="aligncenter wp-image-1978 size-full" src="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.19.02-AM.png?resize=530%2C295&#038;ssl=1" alt="" width="530" height="295" srcset="https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.19.02-AM.png?w=530&amp;ssl=1 530w, https://i0.wp.com/eftakhairul.com/wp-content/uploads/2017/12/Screen-Shot-2017-12-17-at-12.19.02-AM.png?resize=300%2C167&amp;ssl=1 300w" sizes="(max-width: 530px) 100vw, 530px" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>You can also follow this tutorial: https://myetherwallet.github.io/knowledge-base/send/adding-new-token-and-sending-custom-tokens.html</p>
<p>&nbsp;</p>
<p>Finally, Click on <strong>Load Tokens</strong>. You will see your token balance. BTW, It might take some times to finish your transaction, so don&#8217;t be panic.. just wait.</p><p>The post <a href="https://eftakhairul.com/transfer-tokens-from-orderbook-io-to-myetherwallet-mew-wallet/">Transfer tokens from orderbook.io to MyEtherWallet (MEW) wallet</a> first appeared on <a href="https://eftakhairul.com">Eftakhairul's World</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://eftakhairul.com/transfer-tokens-from-orderbook-io-to-myetherwallet-mew-wallet/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1977</post-id>	</item>
	</channel>
</rss>
