-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
278 lines (232 loc) · 15.3 KB
/
index.html
File metadata and controls
278 lines (232 loc) · 15.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Personal blog of Pranav Prakash">
<meta property="og:site_name" content="Pranav Prakash"/>
<title>Pranav Prakash · Blog</title>
<link rel="preconnect" href="//cdnjs.cloudflare.com">
<link rel="preconnect" href="//fonts.googleapis.com">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'/>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/pure-min.css"/>
<!--[if lte IE 8]>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/grids-responsive-old-ie-min.css"/>
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/grids-responsive-min.css"/>
<!--<![endif]-->
<!--[if lte IE 8]>
<link rel="stylesheet" href="/build/style-old-ie.min.css"/>
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="/build/style.min.css"/>
<!--<![endif]-->
<!--[if gt IE 8]><!-->
<script async src="/build/app.min.js"></script>
<!--<![endif]-->
<!--[if lt IE 9]>
<script async src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div id="layout" class="pure-g">
<div class="sidebar pure-u-1 pure-u-md-1-4">
<div class="header">
<img class="navimg" src="/assets/img/pranav.jpg" alt="Pranav"/>
<h1 class="brand-title">Pranav Prakash</h1>
<h2 class="brand-tagline">Software Developer, Photographer, Computer Addict & Web Enthusiast</h2>
<h4 class="social">
<a href="/feed.xml"><i class="social-icon icon-rss-square"></i></a>
<a href="http://in.linkedin.com/in/pranavprakash/"><i class="social-icon icon-linkedin-square"></i></a>
<a href="https://stackoverflow.com/users/4105652/pranav-prakash"><i class="social-icon icon-stack-overflow"></i></a>
<a href="https://github.com/pranavpr/"><i class="social-icon icon-github-square"></i></a>
</h4>
<nav class="nav">
<ul class="nav-list">
<li class="nav-item">
<a class="pure-button" href="/">Home</a>
</li>
<li class="nav-item">
<a class="pure-button" href="/about/">About</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="content pure-u-1 pure-u-md-3-4">
<div>
<div class="posts">
<h1 class="content-subhead">Latest Post</h1>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting" >
<header class="post-header">
<h2 itemprop="name headline" class="post-title">
<a href="/2017/10/18/debugging-es2017-async-await-in-vs-code-using-source-maps/" itemprop="url">
Debugging ES2017 async/await in VS Code using Source Maps
</a>
</h2>
<p class="post-meta">
<i class="icon-clock-o"> </i><a itemprop="datePublished" content="18 Oct 2017" href="#" class="post-author">18 Oct 2017</a> <i class="icon-tags"></i>
<a itemprop="keywords" href="/tags/nodejs/" class="post-category post-category-n">NODEJS</a> <a itemprop="keywords" href="/tags/javascript/" class="post-category post-category-j">JAVASCRIPT</a> <a itemprop="keywords" href="/tags/es2017/" class="post-category post-category-e">ES2017</a> <a itemprop="keywords" href="/tags/vs-code/" class="post-category post-category-v">VS CODE</a>
</p>
</header>
<div itemprop="articleBody" class="post-description">
<p>
<p><code class="highlighter-rouge">async/await</code> has been the most promising feature of ES2017. It allows you to write asynchronous code in more elegant way saving you from the hassles of callback. <code class="highlighter-rouge">async/await</code> is supported from Node versions >= 8.5. However if you are writing JavaScript code targeting Node versions < 8.5, you need to set up a transpiler like Babel to convert your code compatible to your version of Node. To debug in this scenario, you need to make sure that <a href="https://www.html5rocks.com/en/tutorials/developertools/sourcemaps/">Source Maps</a> are generated and are linked in transpiled version generated by Babel. To do so, add following parameters in your <code class="highlighter-rouge">.babelrc</code> file:</p>
<figure class="highlight"><pre><code class="language-json" data-lang="json"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
</pre></td><td class="code"><pre><span class="s2">"sourceMaps"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="s2">"retainLines"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span></pre></td></tr></tbody></table></code></pre></figure>
<a href="/2017/10/18/debugging-es2017-async-await-in-vs-code-using-source-maps/">Continue Reading »</a>
</p>
</div>
<meta itemprop="wordCount" content="558">
<meta itemprop="author" content="Pranav Prakash">
</article>
<h1 class="content-subhead">Recent Posts</h1>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting" >
<header class="post-header">
<h2 itemprop="name headline" class="post-title">
<a href="/2017/09/30/building-a-fast-text-suggester-using-node-js-koa2-and-elasticsearch/" itemprop="url">
Building a fast text suggester using Node.js, Koa2 and Elasticsearch
</a>
</h2>
<p class="post-meta">
<i class="icon-clock-o"> </i><a itemprop="datePublished" content="30 Sep 2017" href="#" class="post-author">30 Sep 2017</a> <i class="icon-tags"></i>
<a itemprop="keywords" href="/tags/nodejs/" class="post-category post-category-n">NODEJS</a> <a itemprop="keywords" href="/tags/elasticsearch/" class="post-category post-category-e">ELASTICSEARCH</a> <a itemprop="keywords" href="/tags/koa2/" class="post-category post-category-k">KOA2</a>
</p>
</header>
<div itemprop="articleBody" class="post-description">
<p>
<p>In this blog post, I’ll show you how to create a fast text suggester using Koa2 framework of Node.js backed by Elasticsearch. <a href="http://koajs.com/">Koa2</a> is a minimalist framework developed by team behind <a href="http://expressjs.com/">Express.js</a> and comes with no middlewares inbuilt. <a href="https://www.elastic.co/products/elasticsearch">Elasticsearch</a> is a distributed search engine which comes with handy features for doing full text search.</p>
<p>To start with, I’ll use the <a href="https://www.npmjs.com/package/koa-api-generator">koa-api-generator</a> to bootstrap the application. Start by issuing following commands</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
</pre></td><td class="code"><pre>npm i <span class="nt">-g</span> koa-api-generator
koa-api node-search-engine <span class="o">&&</span> <span class="nb">cd </span>node-search-engine
npm install</pre></td></tr></tbody></table></code></pre></figure>
<a href="/2017/09/30/building-a-fast-text-suggester-using-node-js-koa2-and-elasticsearch/">Continue Reading »</a>
</p>
</div>
<meta itemprop="wordCount" content="1397">
<meta itemprop="author" content="Pranav Prakash">
</article>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting" >
<header class="post-header">
<h2 itemprop="name headline" class="post-title">
<a href="/2017/09/13/case-insensitive-exact-match-search-in-elasticsearch/" itemprop="url">
Case insensitive exact match search in Elasticsearch
</a>
</h2>
<p class="post-meta">
<i class="icon-clock-o"> </i><a itemprop="datePublished" content="13 Sep 2017" href="#" class="post-author">13 Sep 2017</a> <i class="icon-tags"></i>
<a itemprop="keywords" href="/tags/elasticsearch/" class="post-category post-category-e">ELASTICSEARCH</a>
</p>
</header>
<div itemprop="articleBody" class="post-description">
<p>
<p>I had a requirement where I needed to do exact match search in ElasticSearch. After searching a bit I landed to <a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/_finding_exact_values.html">this</a> page of ElasticSearch documentation. I was thrilled that I got the solution quickly (thanking god and ElasticSearch team in my mind). Hence I started testing by creating an index using request below:</p>
<figure class="highlight"><pre><code class="language-json" data-lang="json"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre><span class="err">PUT</span><span class="w"> </span><span class="err">localhost</span><span class="p">:</span><span class="mi">9200</span><span class="err">/products/</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="s2">"mappings"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"product"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"properties"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"productName"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"string"</span><span class="p">,</span><span class="w">
</span><span class="s2">"index"</span><span class="p">:</span><span class="w"> </span><span class="s2">"not_analyzed"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span></pre></td></tr></tbody></table></code></pre></figure>
<a href="/2017/09/13/case-insensitive-exact-match-search-in-elasticsearch/">Continue Reading »</a>
</p>
</div>
<meta itemprop="wordCount" content="920">
<meta itemprop="author" content="Pranav Prakash">
</article>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting" >
<header class="post-header">
<h2 itemprop="name headline" class="post-title">
<a href="/2017/05/16/automated-postgresql-backups/" itemprop="url">
Automated PostgreSQL backups
</a>
</h2>
<p class="post-meta">
<i class="icon-clock-o"> </i><a itemprop="datePublished" content="16 May 2017" href="#" class="post-author">16 May 2017</a> <i class="icon-tags"></i>
<a itemprop="keywords" href="/tags/postgresql/" class="post-category post-category-p">POSTGRESQL</a> <a itemprop="keywords" href="/tags/cron/" class="post-category post-category-c">CRON</a> <a itemprop="keywords" href="/tags/shell/" class="post-category post-category-s">SHELL</a> <a itemprop="keywords" href="/tags/devops/" class="post-category post-category-d">DEVOPS</a>
</p>
</header>
<div itemprop="articleBody" class="post-description">
<p>
<p>Recently we migrated one of our applications from MongoDB to PostgreSQL (which is a story for another time) at work. Similar to the script I developed for MongoDB in my last <a href="/2017/02/04/automate-mongodb-backups-using-cron-and-shell-script/">blog post</a>, I developed one for PostgreSQL. <code class="highlighter-rouge">pg_dump</code> utility of PostgreSQL provides some nifty <a href="https://www.postgresql.org/docs/9.6/static/app-pgdump.html">options</a> to create different formats to create backup files. My script produces two types of backup files:</p>
<ul>
<li>Plain bakup - This produces a gzipepd version of SQL script file which you can execute to restore the database.</li>
<li>Custom backup - This produces a compressed custom-format archive suitable for input into <code class="highlighter-rouge">pg_restore</code>.</li>
</ul>
<a href="/2017/05/16/automated-postgresql-backups/">Continue Reading »</a>
</p>
</div>
<meta itemprop="wordCount" content="939">
<meta itemprop="author" content="Pranav Prakash">
</article>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting" >
<header class="post-header">
<h2 itemprop="name headline" class="post-title">
<a href="/2017/02/04/automate-mongodb-backups-using-cron-and-shell-script/" itemprop="url">
Automate MongoDB backups using Cron and Shell Script
</a>
</h2>
<p class="post-meta">
<i class="icon-clock-o"> </i><a itemprop="datePublished" content="04 Feb 2017" href="#" class="post-author">04 Feb 2017</a> <i class="icon-tags"></i>
<a itemprop="keywords" href="/tags/devops/" class="post-category post-category-d">DEVOPS</a> <a itemprop="keywords" href="/tags/mongodb/" class="post-category post-category-m">MONGODB</a> <a itemprop="keywords" href="/tags/cron/" class="post-category post-category-c">CRON</a> <a itemprop="keywords" href="/tags/shell/" class="post-category post-category-s">SHELL</a>
</p>
</header>
<div itemprop="articleBody" class="post-description">
<p>
<p>After having a bitter experience of losing data due to execution of wrong command, I decided to backup my database regularly. Hence I wrote a simple shell script which backs up the database and produces gzipped version of backup files. Below is the shell script:</p>
<a href="/2017/02/04/automate-mongodb-backups-using-cron-and-shell-script/">Continue Reading »</a>
</p>
</div>
<meta itemprop="wordCount" content="608">
<meta itemprop="author" content="Pranav Prakash">
</article>
<div class="footer">
<div class="pure-menu pure-menu-horizontal pure-menu-open">
<ul>
<li><a href="/page/2/">« Older</a></li>
<li>Newer »</li>
</ul>
<p>
© 2017. All rights reserved.
</p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-48826636-1', 'auto');
</script>
</body>
</html>