<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mehakdeep Singh on Medium]]></title>
        <description><![CDATA[Stories by Mehakdeep Singh on Medium]]></description>
        <link>https://medium.com/@mehakkahlon?source=rss-36ce12a82c52------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4t84QIi0Gek0T5Ig.jpg</url>
            <title>Stories by Mehakdeep Singh on Medium</title>
            <link>https://medium.com/@mehakkahlon?source=rss-36ce12a82c52------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 10:24:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehakkahlon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Thank You Stan Marsh]]></title>
            <link>https://medium.com/gojekengineering/thank-you-stan-marsh-29db553544bf?source=rss-36ce12a82c52------2</link>
            <guid isPermaLink="false">https://medium.com/p/29db553544bf</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[legacy-systems]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Mehakdeep Singh]]></dc:creator>
            <pubDate>Wed, 02 May 2018 09:59:16 GMT</pubDate>
            <atom:updated>2019-01-31T07:14:00.579Z</atom:updated>
            <content:encoded><![CDATA[<h4>Salutations to a dear old friend. You have served us well.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvynAenKKY2lsaHZSL48Og.jpeg" /><figcaption><a href="http://bit.ly/2LwwwqI">gojek.jobs</a></figcaption></figure><p>At its peak, in 2015, GO-JEK had a few hundred drivers. It was around this time, we were onboard as consultants for a relatively unknown, unheard of startup. We took up the challenge because the market potential was unlike anything we had seen. But that’s a <a href="https://blog.gojekengineering.com/my-go-jek-story-af5f1925bfe">story in itself</a>. <strong>3 years ago when we began consulting for GO-JEK, this was the very first command we ran; we all remember it vividly:👇</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*heqCvXof_T237BYXo0Yejw.png" /><figcaption>Stan Marsh build step</figcaption></figure><p>The legacy backend codebase was named <strong>Stan Marsh</strong>. And… it really was something. It was a monolith on which, over 18 months, 18+ products were going to depend.</p><p>Looking at the code, one could understand the evolution GO-JEK has gone through — the decisions taken then and the footprints of each developer. This was at a time when we <em>weren’t</em> experiencing millions of orders a day. It was the backbone. It was all we had.</p><blockquote><strong>Stan Marsh has seen and helped GO-JEK grow from a hundred odd drivers to more than 1 million registered drivers today.</strong></blockquote><p>Over the three years since that day, we extracted more than 100 microservices from this monolithic MVP. Step by step. Deploying it is still an occasion, and only a few brave folks dare to take that leap. 😂</p><p>But the time has come to put it to bed and let the new generation take over. I’d hate to see Stan Marsh go, but as with everything technology, change is apparently the only constant. Or so we’re told.</p><p>At this moment, I can’t help but look back at those days when Stan Marsh was a nuisance, an irritant we couldn’t get rid of. But today, as I write this, I remember everything it stood for — an untold story of our own evolution from couple of orders to a 100+ million orders every month.</p><p>So long Stan Marsh, and thanks for all the fish. ❤️</p><p>P.S: More to come on a detailed journey and steps taken to transition from Stan Marsh to microservices.</p><p>We have hard technical problems at GO-JEK and want as much help as we can get from engineers. We’re changing the digital economy of Southeast Asia and want the sharpest minds to work with us. Please check out <a href="http://bit.ly/2LwwwqI">gojek.jobs </a>for openings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*l53Qb_OeQpMomqv_5dHPlw.png" /><figcaption><a href="http://bit.ly/2LwwwqI">gojek.jobs</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29db553544bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gojekengineering/thank-you-stan-marsh-29db553544bf">Thank You Stan Marsh</a> was originally published in <a href="https://medium.com/gojekengineering">Gojek Product + Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Mongo geoNear Saved the Day]]></title>
            <link>https://medium.com/@mehakkahlon/how-mongo-geonear-saved-the-day-8df5e8b86150?source=rss-36ce12a82c52------2</link>
            <guid isPermaLink="false">https://medium.com/p/8df5e8b86150</guid>
            <category><![CDATA[geonear]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Mehakdeep Singh]]></dc:creator>
            <pubDate>Fri, 18 Sep 2015 00:00:00 GMT</pubDate>
            <atom:updated>2018-06-18T07:19:46.644Z</atom:updated>
            <content:encoded><![CDATA[<p>The requirement was straightforward: Save users’ locations (latitudes &amp; longitudes) &amp; query against them to produce a list of nearby users within a set radius of any user.</p><p>We chose <a href="http://redis.io/commands#geo">Redis</a> with Lua Geo Scripting, and we set up 1 master to write &amp; 2 slaves to read from. The updates were matching the incoming rate and the slaves were handling the reads, The numbers climbed up to 80,000 requests per minute.</p><p>Then we came to know about an <a href="https://groups.google.com/forum/#!topic/redis-db/w6zcOzVtPXg">issue</a> in Redis-Geo, that it doesn’t sync the Geo Data at all.</p><p>The fix for this is expected in the next Redis update version <a href="http://antirez.com/news/89">3.2</a> &amp; the only temporary solution was to restart slaves, which as a force resync doesn’t really work when you have to restart slaves every minute.</p><p>This stop gap solution wasn’t going to work, so we decided to use <a href="http://docs.mongodb.org/manual/reference/command/geoNear/">MongoDb-geoNear</a>. We set up the same 1 master &amp; 2 slaves environment and to handle the request load efficiently we made a few enhancements.</p><p>One was introducing <a href="http://www.rabbitmq.com/">Rabbitmq</a>, thus queuing up all the update requests so as to not overload Mongo &amp; leaving no chance of losing any requests.</p><p>Another was moving Mongo to a RAM disk. Since the data size itself was not large, this step gave a huge boost in load performance, and the last one was making the correct set of indexes.</p><p>The solution worked. We have been keeping up with the load consistently as the number of requests has only grown. The sync happens on time, and there are no more slave restarts.</p><p><em>Originally published at </em><a href="http://mehakkahlon.com/blog/2015/09/18/how-mongo-geo-near-saved-us/"><em>mehakdeep.github.io</em></a><em> on September 18, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8df5e8b86150" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tutorial: To-do App With RubyMotion]]></title>
            <link>https://medium.com/@mehakkahlon/tutorial-to-do-app-with-rubymotion-d1026e3c253a?source=rss-36ce12a82c52------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1026e3c253a</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[rubymotion]]></category>
            <dc:creator><![CDATA[Mehakdeep Singh]]></dc:creator>
            <pubDate>Mon, 22 Jun 2015 00:00:00 GMT</pubDate>
            <atom:updated>2018-06-18T07:27:08.465Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post we will cover what RubyMotion is &amp; take you through how to use it by building a simple To-Do app. It’s a longish post, so to save you some trouble here’s a simple index:</p><p><strong>What is RubyMotion?</strong></p><p>Simply put RubyMotion is a tool that allows you to write iOS apps in Ruby whilst bypassing Objective C altogether. RubyMotion compiles the Ruby code to machine code, which is same as Objective C, and thus the device can’t tell the difference between RubyMotion and the objective C iOS apps.</p><p><strong>Why use RubyMotion?</strong></p><p>If you know Ruby well and you want to start building iOS apps, there’s nothing better than RubyMotion. Sure you have to learn a new framework (Cocoa Touch), but that’s easier &amp; quicker than rather than learning a new language (Swift, Objective C). The icing on the cake is that RubyMotion preserves the iOS SDK exactly as intended by Apple, so all existing code examples and tutorials are perfectly translatable.</p><p><strong>Installation</strong></p><blockquote><a href="http://www.rubymotion.com/">RubyMotion</a><em> is created by Hipbyte. It’s a paid software with 30 days fully functional trial, which is enough time for you to try and see if it suits you.</em></blockquote><p>It requires Xcode, which can be downloaded from the app store. Other dependencies are iOS simulator and command line tools.</p><p><strong>Homework</strong></p><p>If you’re completely new to RubyMotion, a very good place to start is by completing the following two tutorials to build a hello world app.</p><ul><li><a href="http://www.rubymotion.com/developers/guides/manuals/cocoa/getting-started/">getting-started</a></li><li><a href="http://rubymotion-tutorial.com/1-hello-motion">hello-motion</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/0*LLa6xTX-VPrp7IZe.png" /></figure><p>Once you go through these tutorials, your key takeaways should be:</p><ul><li>rake command is used to run app on simulator</li><li>Everything that is visible on the screen is a UIView</li><li>Views can have subviews, and that can keep on going.</li><li>It uses the Model-View-Controller pattern.</li></ul><p><strong>To-do App Tutorial: Setup</strong></p><p>Let’s begin with our tutorial:</p><p>motion create todo</p><p>Create a List Controller , which is UIViewController, right now it sets background color as white.</p><pre>class ListController &lt; UIViewController def viewDidLoad super self.view.backgroundColor = UIColor.blackColor end end</pre><p>Change the change app_delegate to load our new controller as root view controller.</p><pre>class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @window.makeKeyAndVisible @window.rootViewController = ListController.new @window.rootViewController.wantsFullScreenLayout = true $root_controller = @window.rootViewController true end end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*Hzy0lA-FpNRh43ab.png" /></figure><p><strong>Add Text Area</strong></p><p>Now we added a UITextArea and a UIButton. We call add_task function on button click. Which just prints a log right now.</p><p>The rest of the code is pretty self-explanatory for Ruby users.</p><p>Now the listcontroller looks like</p><pre>class ListController &lt; UIViewController def viewDidLoad super self.view.backgroundColor = UIColor.whiteColor add_text_area end def add_text_area text_field_view = UITextField.alloc.initWithFrame(CGRectMake(0, 20, self.view.frame.size.width - 50, 40)) text_field_view.delegate = self text_field_view.borderStyle = UITextBorderStyleRoundedRect text_field_view.textColor =UIColor.blackColor text_field_view.becomeFirstResponder text_field_view.placeholder = &quot;new task&quot; text_field_view.textAlignment = NSTextAlignmentLeft self.view.addSubview(text_field_view) #add button add_task_button = UIButton.buttonWithType UIButtonTypeCustom add_task_button.setFrame(CGRectMake(self.view.frame.size.width - 40, 20, 35, 40)) add_task_button.setTitleColor(UIColor.blackColor, forState: UIControlStateNormal) add_task_button.setTitle(&quot;Add&quot;, forState: UIControlStateNormal) add_task_button.addTarget(self, action: :add_task, forControlEvents: UIControlEventTouchUpInside) self.view.addSubview add_task_button end def add_task NSLog(&quot;Task Added&quot;) end end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*ANUKoDWPRkkoTMqb.png" /></figure><p><strong>Add Empty Table</strong></p><p>Now we will add an Empty UITable for our app. <a href="http://rubymotion-tutorial.com/5-tables/">This</a> is a very good introduction to using tables in RubyMotion.</p><p>First we will initialize an empty table and add it to the main view as a subview.</p><pre>def add_task_list table_view = UITableView.alloc.initWithFrame(CGRectMake(0, 70, self.view.frame.size.width, 200)) table_view.dataSource = self table_view.delegate = self table_view.clipsToBounds = false self.view.addSubview table_view end</pre><p>This function sets the values for each row in the table, which right now would be nil.</p><pre>def tableView(tableView, cellForRowAtIndexPath: indexPath) @reuseIdentifier ||= &quot;cell&quot; cell = tableView.dequeueReusableCellWithIdentifier(@reuseIdentifier) cell ||= UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: @reuseIdentifier) cell end</pre><p>This function returns total number of rows in the table. We have hard-coded it to 10 for demo.</p><pre>def tableView(tableView, numberOfRowsInSection: section) 10 end</pre><p>And the viewDidLoad now looks like this.</p><pre>def viewDidLoad super self.view.backgroundColor = UIColor.whiteColor add_text_area add_task_list end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*caK5LxTNglhgGHan.png" /></figure><p><strong>Following The MVC</strong></p><p>Now we will create a list_view in app/views/ , which is a UIView and move all the code there.</p><p>We override the initWithFrame function for the ListView, which is a setter for this class.</p><pre>def initWithFrame frame super add_text_area add_task_list end</pre><p>And we initialize this view from our ListController.</p><pre>def viewDidLoad super self.view.backgroundColor = UIColor.whiteColor list_view = ListView.alloc.initWithFrame(self.view.frame) self.view.addSubview(list_view) end</pre><p><strong>Adding a task</strong></p><p>Now we will implement the function of when a task is created it gets added to the list.</p><p><strong>using attr_accessor</strong></p><p>Now we need to alter these views from different functions, so we will use the attr_accessor so that we can set and use attributes :)</p><p>attr_accessor :text_area, :task_list, :add_task_button</p><p>self.text_area = text_field_view</p><p>Now we store the tasks in attribute which is an array and add the current text of the text_area to that array when add_task button is clicked. Then we reload the table data.</p><pre>def add_task NSLog(&quot;Task Added&quot;) self.tasks &lt;&lt; self.text_area.text self.task_list.reloadData end</pre><p>Select appropriate value for the table row.</p><pre>def tableView(tableView, cellForRowAtIndexPath: indexPath) @reuseIdentifier ||= &quot;cell&quot; cell = tableView.dequeueReusableCellWithIdentifier(@reuseIdentifier) cell ||= UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: @reuseIdentifier) cell.textLabel.text = &quot;#{self.tasks[indexPath.row]}&quot; cell end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*OORewxoqsZxpYfGE.png" /></figure><p><strong>Add Local Database</strong></p><p>In its current stage the app will not store any data. That means when you restart the app, all the tasks will be gone. We will create local storage with NanoStore as DB. And Cocoapods to integrate the nanostore.</p><ul><li><a href="https://github.com/tciuro/NanoStore">NanoStore</a></li><li><a href="https://github.com/siuying/NanoStoreInMotion">NanoStoreInMotion</a></li></ul><p>Add required gems to Gemfile</p><p>gem &#39;motion-cocoapods’</p><p>gem &#39;nano-store&#39;</p><p>here is the RakeFile</p><pre># -*- coding: utf-8 -*- $:.unshift(&quot;/Library/RubyMotion/lib&quot;) require &#39;motion/project/template/iOS&#39; require &#39;motion-cocoapods&#39; require &#39;nano-store&#39; begin require &#39;bundler&#39; Bundler.require rescue LoadError end Motion::Project::App.setup do |app| # Use `rake config&#39; to see complete project settings. app.name = &#39;todo&#39; app.pods do pod &#39;NanoStore&#39; end end</pre><p>Install the gems and pods.</p><p>bundle install</p><p>bundle exec rake pod:install</p><p>And to the app_delegate add following line to set db file path.We will use a local file as DB.</p><pre>documents_path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0] NanoStore.shared_store = NanoStore.store(:file, documents_path + &quot;/nano.db&quot;)</pre><p><strong>Bringing Models in Action</strong></p><p>Now we will create a model for tasks and store it locally.</p><pre>class Task &lt; NanoStore::Model attribute :name attribute :created_at end</pre><p>Loading all tasks in memory when ListView loaded.</p><pre>def initWithFrame frame super self.tasks = Task.all.sort {|a,b| b.created_at &lt;=&gt; a.created_at} add_text_area add_task_list end</pre><p>Create new task in the DB with add task function.</p><pre>def add_task NSLog(&quot;Task Added&quot;) task = Task.create(:name =&gt; self.text_area.text, :created_at =&gt; Time.now) self.tasks.unshift(task) self.task_list.reloadData self.text_area.text = &quot;&quot; end</pre><p><strong>Different Sections for Completed &amp; Pending Tasks</strong></p><p>Now we will separate the table in 2 sections, completed and pending tasks. After all that is the point of a To-do app. We will set it so that clicking on a task will move it from one section to another.</p><p>We have 2 attributes :completed_tasks, :uncompleted_tasks</p><p>And we initialize these 2 attrbutes with required data.</p><pre>self.completed_tasks = Task.find(:completed, NSFEqualTo, 1).sort { |a, b| b.created_at &lt;=&gt; a.created_at } self.uncompleted_tasks = Task.find(:completed, NSFEqualTo, 0).sort { |a, b| b.created_at &lt;=&gt; a.created_at }</pre><p>We add these 2 sections in our table “pending” and “completed”.</p><pre>def numberOfSectionsInTableView(tableView) 2 end</pre><pre>def tableView(tableView, titleForHeaderInSection: section) if section == 1 &quot;completed&quot; elsif section == 0 &quot;pending&quot; end end</pre><pre>def tableView(tableView, cellForRowAtIndexPath: indexPath) @reuseIdentifier ||= &quot;cell&quot; cell = tableView.dequeueReusableCellWithIdentifier(@reuseIdentifier) cell ||= UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: @reuseIdentifier) if indexPath.section == 0 cell.textLabel.text = &quot;#{self.uncompleted_tasks[indexPath.row].name}&quot; elsif indexPath.section == 1 cell.textLabel.text = &quot;#{self.completed_tasks[indexPath.row].name}&quot; end cell end</pre><pre>def tableView(tableView, numberOfRowsInSection: section) if section == 0 Task.find(:completed, NSFEqualTo, 0).count self.uncompleted_tasks.count elsif section == 1 Task.find(:completed, NSFEqualTo, 1).count else 0 end end</pre><p>This Function handles the event when any row is clicked.</p><pre>def tableView(tableView, didSelectRowAtIndexPath: indexPath) tableView.deselectRowAtIndexPath(indexPath, animated: true) cell = tableView.cellForRowAtIndexPath(indexPath) self.mark_as_done(cell) end</pre><p>And the mark_as_done function toggles the task between completed and pending.</p><pre>def mark_as_done cell task = Task.find(:name, NSFEqualTo, cell.textLabel.text).first task.completed = !task.completed task.save self.reload_table_sections end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*Xw_2e_oavJRWC_tu.png" /></figure><p>Here is the <a href="https://github.com/mehakdeep/todo">Link</a> to the source code.</p><p><strong>The End</strong></p><p><em>Originally published at </em><a href="http://mehakkahlon.com/blog/2015/06/22/tutorial-to-do-app-with-rubymotion/"><em>mehakdeep.github.io</em></a><em> on June 22, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1026e3c253a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>