<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on Osman Goni Nahid</title><link>https://osmangoninahid.github.io/posts/</link><description>Recent content in Blog on Osman Goni Nahid</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 19 Sep 2026 00:00:00 +0400</lastBuildDate><atom:link href="https://osmangoninahid.github.io/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>We were hashing every byte twice: making 500 GiB volume imports fast</title><link>https://osmangoninahid.github.io/hashing-every-byte-twice/</link><pubDate>Sat, 19 Sep 2026 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/hashing-every-byte-twice/</guid><description>&lt;p&gt;On the platform I work on, a &lt;em&gt;workspace volume&lt;/em&gt; is a Kubernetes PVC that users fill from Hugging Face or an S3 bucket and then mount into training or inference workloads. The import runs as a one-off pod: download, then record metadata (a file tree with per-file hashes, and one digest for the whole volume) back to the control plane.&lt;/p&gt;&#10;&lt;p&gt;Customers importing 500 GiB+ models started reporting that the download finished in a reasonable time and then the pod sat for &lt;strong&gt;hours&lt;/strong&gt; in the metadata step. This is the story of why, and what fixed it.&lt;/p&gt;</description></item><item><title>Common Problem on Scaling Nodejs</title><link>https://osmangoninahid.github.io/common-problem-on-scaling-nodejs/</link><pubDate>Tue, 22 Jan 2019 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/common-problem-on-scaling-nodejs/</guid><description>&lt;p&gt;I have built lots of NodeJS apps and scaled them to millions of requests. The most common problem you will see is Garbage collection pauses and memory leaks which sometime gives random distribution of time response of requests. The problem is not the GC but the way you have written code.&lt;/p&gt;&#10;&lt;p&gt;Another is Memory leaks you will find them in production and see your app crashing a lot and no idea why it crashed because locally everything seemed to be fine but you gotta find them.&lt;/p&gt;</description></item><item><title>Database Indexing, performance and How It Works</title><link>https://osmangoninahid.github.io/database-indexing-and-how-it-works/</link><pubDate>Sat, 08 Dec 2018 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/database-indexing-and-how-it-works/</guid><description>&lt;p&gt;Indexing in Database is a wide topic. Database indexing plays a important role in your query result performance. But like everything this too has a trade off. I know and assumed that you already worked with &lt;code&gt;Indexing&lt;/code&gt; and you indexed your few field of your database table, But in this post I will explain a bit tho I&amp;rsquo;m not a good writer will try to finish within short. What is Indexing, How it works etc.&lt;/p&gt;</description></item><item><title>No more express-generator on API building with NodeJS</title><link>https://osmangoninahid.github.io/no-more-express-generator-on-api-building-nodejs/</link><pubDate>Mon, 19 Mar 2018 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/no-more-express-generator-on-api-building-nodejs/</guid><description>&lt;img src="https://user-images.githubusercontent.com/6789760/37593802-7b1d071c-2b9d-11e8-9e5d-c0d778fa56dc.jpg" alt="spready" style="width: 600px;"/&gt;&#10;&lt;p&gt;Combined (Front-end and Back-end) application is no more nowadays. The way of doing front-end and backend in same application with same stack is old now. The problem with this model is that it tightly couples front-end and back-end development into a single development stack and imposes restraints on technology choices.&lt;/p&gt;&#10;&lt;p&gt;But whilst this has been the best solution for some time, this was primarily due to poor performing web browsers not being able to handle complex operations that are required to run a modern day website.&lt;/p&gt;</description></item><item><title>Resolving Google Play services Incompatibility in React-Native(Android)</title><link>https://osmangoninahid.github.io/google-play-service-version-incompatibility-react-native/</link><pubDate>Thu, 21 Dec 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/google-play-service-version-incompatibility-react-native/</guid><description>&lt;p&gt;In react-native when we use any external library where &lt;code&gt;play-services&lt;/code&gt; are required like &lt;code&gt;react-native-maps&lt;/code&gt; for google map there is an android project into this library where play-services v8.x.x included into gradle and in your project you are using play-services v9.x.x for another reason&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="https://cdn57.androidauthority.net/wp-content/uploads/2016/09/react-native-logo.jpg" alt="react-native-android-ios"&gt;&lt;/p&gt;&#10;&lt;p&gt;We are using &lt;code&gt;react-native&lt;/code&gt; for our mobile application where have to build and deploy both android and ios from same branch. Last week our frontend (mobile) team were facing an issue with &lt;code&gt;play-services&lt;/code&gt; version incompatibility and &lt;code&gt;multidex&lt;/code&gt; issue. That MultiDex is a common issue in native android for different version of google-play-services and we can solve it by two way, either we can make a common version for all types play-services dependencies or in gradle we can set &lt;code&gt;multidex : true&lt;/code&gt;. So it&amp;rsquo;s easy for native.&lt;/p&gt;</description></item><item><title>Use Cases for Using Let and Const in JavaScript</title><link>https://osmangoninahid.github.io/use-cases-for-using-let-and-const-in-js/</link><pubDate>Wed, 20 Dec 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/use-cases-for-using-let-and-const-in-js/</guid><description>&lt;p&gt;There are now two new ways to declare variables in JavaScript: &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;.The only way to declare a variable in JavaScript was to use the keyword &lt;code&gt;var&lt;/code&gt;. To understand why let and const were added, it’s probably best to look at an example of when using var can get us into trouble.&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;function getThing(isDoes) {&#10; if (isCold) {&#10; var foo = &amp;#39;Grab a jacket!&amp;#39;;&#10; } else {&#10; var bar = &amp;#39;It’s a shorts kind of day.&amp;#39;;&#10; console.log(foo);&#10; }&#10;}&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="let-and-const"&gt;let and const&lt;/h3&gt;&#10;&lt;p&gt;Variables declared with &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; eliminate this specific issue of hoisting because they’re scoped to the block, not to the function. Previously, when you used var, variables were either scoped globally or locally to an entire function scope.&lt;/p&gt;</description></item><item><title>Separating Schema, Method and Statics in Mongoose NodeJS</title><link>https://osmangoninahid.github.io/separating-methods-schema-statics-mongoose/</link><pubDate>Fri, 01 Dec 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/separating-methods-schema-statics-mongoose/</guid><description>&lt;p&gt;&lt;img src="https://raw.githubusercontent.com/daton89-topperblues/mongoose-transactions/master/docs/img/mongoose-transactions.png" alt="mongoose-nodejs-mongodb"&gt;&lt;/p&gt;&#10;&lt;p&gt;Database logic should be encapsulated within the data model. Mongoose provides 2 ways of doing this, methods and statics. Methods adds an instance method to documents whereas Statics adds static &amp;ldquo;class&amp;rdquo; methods to the Models itself. like example below:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;const bookSchema = mongoose.Schema({&#10; title: {&#10; type : String,&#10; required : [true, &amp;#39;Book name required&amp;#39;]&#10; },&#10; publisher : {&#10; type : String,&#10; required : [true, &amp;#39;Publisher name required&amp;#39;]&#10; },&#10; thumbnail : {&#10; type : String&#10; }&#10; type : {&#10; type : String&#10; },&#10; hasAward : {&#10; type : Boolean&#10; }&#10;});&#10;&#10;//method&#10;bookSchema.methods.findByType = function (callback) {&#10; return this.model(&amp;#39;Book&amp;#39;).find({ type: this.type }, callback);&#10;};&#10;&#10;// statics&#10;bookSchema.statics.findBooksWithAward = function (callback) {&#10; Book.find({ hasAward: true }, callback);&#10;};&#10;&#10;const Book = mongoose.model(&amp;#39;Book&amp;#39;, bookSchema);&#10;export default Book;&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It&amp;rsquo;s awesome right? Yeah!. But what if, you have a complex schema , large amount of field and schemas the number of methods and statics are pretty large.&lt;/p&gt;</description></item><item><title>One-Way vs. Two-Way Data Binding</title><link>https://osmangoninahid.github.io/one-way-and-two-way-data-binding/</link><pubDate>Sat, 25 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/one-way-and-two-way-data-binding/</guid><description>&lt;p&gt;Two-way binding is simply a way to sync data to a view and vice versa (mvvm pattern). One-way data binding refers to the design pattern found in component based frameworks, where a child component cannot modify data passed by a parent component, as that creates spaghetti code.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="https://image.slidesharecdn.com/qew2fe1qfouq3ez0irrw-signature-a5e16f8a5f9bf5c06bfd992151090953475efa37da75f9eed6674474188d6d90-poli-141218052940-conversion-gate02/95/angular-js-10-638.jpg?cb=1418892818" alt="One-way vs Two-way data binding"&gt;&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;Image source slideshare&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h4 id="one-way-data-binding"&gt;One-Way Data Binding&lt;/h4&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;One-way data binding refers to the design pattern found in component based frameworks, where a child component cannot modify data passed by a parent component, as that creates spaghetti code.&lt;/p&gt;</description></item><item><title>Calling and Executing C++ Code from Node.js</title><link>https://osmangoninahid.github.io/calling-cpp-into-nodejs/</link><pubDate>Sun, 19 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/calling-cpp-into-nodejs/</guid><description>&lt;p&gt;There is three general ways of integrating C++ code with a Node.js application - although there are lots of variations within each category like: Automation, Shared Library and Addon. Each of them has advantage and disadvantage as well&lt;/p&gt;&#10;&lt;p&gt;It&amp;rsquo;s not that hard to execute &lt;code&gt;C++&lt;/code&gt; code with JavaScript. NodeJS can not only load and/or execute the JavaScript libraries and/or files, but also be extended with native modules (compiled C/C++ code). While this does not mean that you should wipe out your existing JavaScript modules into C++, this knowledge might come in handy in specific use cases.&lt;/p&gt;</description></item><item><title>Working with Geospatial support in MongoDB with NodeJS</title><link>https://osmangoninahid.github.io/nodejs-mongodb-geolocation/</link><pubDate>Sun, 19 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/nodejs-mongodb-geolocation/</guid><description>&lt;p&gt;MongoDB’s geospatial indexing allows you to efficiently execute spatial queries on a collection that contains geospatial shapes and points. This tutorial will briefly introduce the concepts of geospatial indexes, and then demonstrate their use with $geoWithin, $geoIntersects, and geoNear.&lt;/p&gt;&#10;&lt;p&gt;At my current project I’m working on requires storage of and queries on Geospatial data. We are using MongoDB, which has good support for Geospatial data, at least good enough for my needs. This post walks through the basics of how to work with mongodb geospatial data in &lt;code&gt;Nodejs&lt;/code&gt; application.&#10;We are using MongoDB &lt;code&gt;3.4&lt;/code&gt;. Mongo has some very awesome and useful function for doing spatial operation like &lt;code&gt;$geoNear&lt;/code&gt; &lt;code&gt;$near&lt;/code&gt; &lt;code&gt;$nearSphere&lt;/code&gt; &lt;code&gt;$centerSphere&lt;/code&gt; etc. All of them has some restriction like they don&amp;rsquo;t support shading. Here I will use &lt;code&gt;$near&lt;/code&gt; with nodejs example.&lt;/p&gt;</description></item><item><title>When Object.assign() Is Risky</title><link>https://osmangoninahid.github.io/when-object-assign-is-risky/</link><pubDate>Tue, 14 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/when-object-assign-is-risky/</guid><description>&lt;p&gt;Javascript &lt;code&gt;Object.assign&lt;/code&gt; allows you to copy one set of an object non-inherited properties to another.It has a signature of Object.assign(target, &amp;hellip;sources). The target object is the first parameter and is also used as the return value. Object.assign() is useful for merging objects or cloning them shallowly. code sample below :&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;const adminPrivileges = {&#10; canCreate: true,&#10; canDelete: true,&#10; canUpdate : true,&#10; canRead : true&#10;};&#10;&#10;const userPrivileges = Object.assign({}, adminPrivileges, {&#10; canCreate: false,&#10; canDelete: false,&#10; canUpdate : false,&#10; canRead : true&#10;});&#10;&#10;console.log(userPrivileges);&#10;// { canCreate: false,&#10;// canDelete: false,&#10;// canCreate: false,&#10;// canRead: false }&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;But&lt;/code&gt; The &lt;em&gt;Risky&lt;/em&gt; is that if you forget to include {} will result in accidentally modifying the original object causing nasty consequences later and its hard to notice.&lt;/p&gt;</description></item><item><title>ES6 Style Module Import and Destructuring Assignment</title><link>https://osmangoninahid.github.io/es6-style-module-import-and-destructing/</link><pubDate>Thu, 09 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/es6-style-module-import-and-destructing/</guid><description>&lt;p&gt;Though I&amp;rsquo;m a big fan of ES6 and always I try to do everything with ES6 instead of ES5 but sometimes have to write JS code into ES5. That&amp;rsquo;s why I try to make the ES6 flavour into ES5 codes.&lt;/p&gt;&#10;&lt;p&gt;In JavaScript it is often more clear to only import parts of modules/objects when they are needed. Before ES6 this was a cumbersome task which required assigning to multiple variables. For example, in Node.js:&lt;/p&gt;</description></item><item><title>Mongo DB change stream new Feature of Mongo 3.6</title><link>https://osmangoninahid.github.io/mongodb-change-stream/</link><pubDate>Wed, 08 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/mongodb-change-stream/</guid><description>&lt;p&gt;Those days are gone when people didn&amp;rsquo;t expect information for momentary access to data. Nowadays expectation everywhere is real-time action and result. Something is happened? not 1 day ago, not even 1 min ago but just now. Being notified constantly on any change of data points a bit critical from many application nowadays. So the upcoming &lt;code&gt;MongoDB3.6&lt;/code&gt; introduces a new &lt;code&gt;$changeStream&lt;/code&gt; aggregation pipeline operator.&lt;/p&gt;&#10;&lt;h3 id="change-stream"&gt;Change Stream:&lt;/h3&gt;&#10;&lt;p&gt;Change streams are being implemented in the driver with a new aggregation operator, &lt;code&gt;$changeStream&lt;/code&gt; and watch method in the API. Where able to specify a &lt;code&gt;$change&lt;/code&gt; stage at the beginning of our pipeline and request that notifications are sent for specific changes or hooking something to a particular collection.&lt;/p&gt;</description></item><item><title>Significant Benefits of Microservice Architecture Pattern</title><link>https://osmangoninahid.github.io/significant-benifits-of-microservice/</link><pubDate>Wed, 08 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/significant-benifits-of-microservice/</guid><description>&lt;p&gt;In Microservice architecture there is a number of benefits. I’ll point some major benefits of microservice rather than monolithic approach, what I got from my experience.&lt;/p&gt;&#10;&lt;h3 id="splitting-problem-complexity"&gt;Splitting Problem Complexity:&lt;/h3&gt;&#10;&lt;p&gt;Microservice architecture pattern tackles the problem complexity by decomposing what would otherwise be a monstrous monolithic application into a set of services. While the total amount of functionality is unchanged, the application has been broken up into manageable chunks or services. Each service has a well-defined boundary in the form of a remote procedure call driven message API(RPC). The microservice architecture pattern enforces a level of modularity that in practice is extremely difficult to achieve with a monolithic code base. We/Developers are able to focus on a specific problem or part of the problem on a specific boundary of a service. On the other hand, Individual services are much faster to develop and easier to understand and maintain.&lt;/p&gt;</description></item><item><title>Flavour of Async/await ES2017</title><link>https://osmangoninahid.github.io/async-await-es7/</link><pubDate>Wed, 01 Nov 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/async-await-es7/</guid><description>&lt;p&gt;One really exciting thing for JS Developer that last week was dropped Node 7.6 which brought support for &lt;code&gt;async/await&lt;/code&gt;. If you haven&amp;rsquo;t heard of async/await before, it&amp;rsquo;s an amazing update to JavaScript (ES2017) that allows us to write synchronous looking asynchronous code without nested callbacks or even chained &lt;code&gt;.then()&lt;/code&gt; promises.&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;/* Forgot Password Flow*/&#10;export default forgotPassword = async(req,res,next) =&amp;gt; {&#10; // Checking if user exist&#10; const user = await User.findOne({email : req.body.email}) ;&#10;&#10; if(!user){&#10; req.flash = (&amp;#39;error&amp;#39; , &amp;#39;No Account found with this email&amp;#39;);&#10; return res.redirect(&amp;#39;/login&amp;#39;)&#10; }&#10;// Set password reset token for user&#10; user.resetPasswordToken = crypto.randomBytes(20).toString(&amp;#39;hex&amp;#39;);&#10; user.resetPasswordExpires = Date.now() + 3600000 ; // 1 hour&#10; await user.save()&#10;// Sent Password reset email to User&#10; await mail.send({&#10; user,&#10; file:&amp;#39;password-reset&amp;#39;,&#10; resetUrl : `http://${req.headers.host}/account/reset/${user.resetPasswordToken}`,&#10; subject: &amp;#39;Password Reset&amp;#39;&#10; });&#10;req.flash(&amp;#39;success&amp;#39;, &amp;#39;You have been emailed a password reset link.&amp;#39;);&#10;res.redirect(&amp;#39;/login&amp;#39;);&#10;};&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Happy coding :)&lt;/p&gt;</description></item><item><title>A Fundamental Go-through into Javascript World</title><link>https://osmangoninahid.github.io/fundamental-go-through-on-js/</link><pubDate>Tue, 08 Aug 2017 00:00:00 +0400</pubDate><guid>https://osmangoninahid.github.io/fundamental-go-through-on-js/</guid><description>&lt;p&gt;JavaScript is a cross-platform, object-oriented scripting language. It is a small and lightweight language. Inside a host environment like a web browser.&lt;/p&gt;&#10;&lt;p&gt;JavaScript contains a standard library of objects like other languages, such as Array, Date, Math and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects.&lt;/p&gt;&#10;&lt;p&gt;This is a fundamental overview to introduce new developers to JavaScript and help experienced developers learn and explore more about its best practices.&lt;/p&gt;</description></item></channel></rss>