<?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 Mehul Mohan on Medium]]></title>
        <description><![CDATA[Stories by Mehul Mohan on Medium]]></description>
        <link>https://medium.com/@mehulmpt?source=rss-1a9b993f35da------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uNPRszPXa6Th4uHx3eUvmQ.jpeg</url>
            <title>Stories by Mehul Mohan on Medium</title>
            <link>https://medium.com/@mehulmpt?source=rss-1a9b993f35da------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 05:18:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehulmpt/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[Some thoughts on new DeepSeek v4 flash]]></title>
            <link>https://medium.com/@mehulmpt/some-thoughts-on-new-deepseek-v4-flash-3464beea8368?source=rss-1a9b993f35da------2</link>
            <guid isPermaLink="false">https://medium.com/p/3464beea8368</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[deepseek]]></category>
            <dc:creator><![CDATA[Mehul Mohan]]></dc:creator>
            <pubDate>Sun, 02 Aug 2026 16:05:29 GMT</pubDate>
            <atom:updated>2026-08-02T16:05:29.884Z</atom:updated>
            <content:encoded><![CDATA[<p>DeepSeek v4 flash, a new AI model, was recently introduced and got some crazy hype. Look at this image (don’t worry if you do not understand it, we’ll get into it)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AUJkQWMZo5lkqj_7plqNkQ@2x.png" /></figure><p>A simple way to understand is that the model that is at the top-left most wins the market. That model is cheap <strong>and</strong> intelligent.</p><p>AI is here to stay. I hope we have established this by now. There are, of course, still naysayers and people who still believe their work must be pure. I’m not saying everything is AI-replaceable now, but an outright ban on AI in your field of work is definitely a bad decision.</p><p>Worst-case scenario, it can be a second opinion guy for you. And if AI is too bad for the kind of digital work you do, you should probably create an AI bench and share it with labs, and see the magic of AI labs bringing that capability to life in weeks.</p><p>Anyway, getting back to the DeepSeek v4 flash moment.</p><h3>What is DeepSeek v4 flash?</h3><p>It’s not a new model. This was, in fact, released almost 3 months back, named DeepSeek v4 flash preview.</p><p>It is a ~300 billion parameter model. What this means, simply speaking, is that there are ~300 billion numbers (yes, literally numbers, for example: 0.31337). The more “numbers” a model has (cool researchers call them weights), the more information the AI model can store and learn when you train it. This doesn’t, however, mean that big models (with, let’s say 1 trillion weights) would always be smarter than smaller models. A lot depends on how they are trained as well.</p><h3>What is model training exactly?</h3><p>I don’t want to get into details in this blog post, it requires a different breakdown altogether, but simply speaking, training has broadly two parts:</p><ul><li>Pretraining: This is the stage where all of our concerns about big AI labs stealing internet data and training on all of it go. All the blog posts, YouTube videos, and music that were generated are fed as a pretraining stage. Arbitrary data is just dumped as much as possible to “wake up” the AI.</li><li>Post-training: Post-training is where a lot of modern AI magic is. Post-training allows you to train AI towards some specific capabilities (say, cybersecurity) using various techniques. Post-training is what DeepSeek did on their existing v4 flash model.</li></ul><h3>How much was DeepSeek improved?</h3><p>Let’s take a look at the same image as before, but I have now added the previous-generation DeepSeek v4 flash too:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*MhNbgB2X23HVAyjncdeSFg@2x.png" /></figure><p>This graph somewhat gives us an idea of how good a model is for doing a task (which is what we end up using models for) vs how much they cost (which is what will determine how much you will use them for and how many other interesting use cases could unlock).</p><p>DeepSeek v4 had a significant jump from its older generation to the newer generation in capability (40 to 50 jump), while keeping cost roughly the same per task ($0.02 to $0.03 per task).</p><p>Remember that this is the same model in size, so it still has the same amount of information it can hold. It has just been trained better. What this effectively means is that there is scope for bigger models (like Kimi K3, DeepSeek v4 Pro) retaining their current sizes but having massive improvements in performance at the same price range.</p><p>Now I want to address one thing. We have all these benchmarks and numbers to throw around and figure out which model is better, however, it is equally true that models that are roughly similar in intelligence on benchmarks can still have a very high difference in how humans perceive them and like working with them.</p><h3>The elephant in the room</h3><p>The discussion would be incomplete without mentioning that DeepSeek v4 is fully open-source, MIT license. Simply speaking, this means that you can download those 300 billion numbers on your computer, and if you have a big enough computer, you can run this AI on your own. You don’t have to send your data to anyone else on the internet.</p><p>This is a big deal. Sure, you cannot run this on your own hardware (your computer is too weak), but that doesn’t stop other startups and companies having a few million dollars to build a business out of it. Look at this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*BfRv3RRbmblS9d-c7gxYFw@2x.png" /></figure><p>These are some of the many companies outside of DeepSeek providing inference for DeepSeek v4 flash. And in so many cases, the rates are cheaper than DeepSeek (excluding the cache hit rates).</p><p>If you try to figure out companies that can serve, say, GPT-5.6 Luna (which is also in the graph image I shared earlier), the only company that can serve it is OpenAI.</p><h3>DeepSeek trained on our data, then gave it back</h3><p>It was impossible to get AI of today at scale without so much data humanity produced over the last few decades. This data doesn’t belong to just a single lab or a couple of labs.</p><p>Companies like DeepSeek and Kimi giving away frontier model weights for free, even if you cannot run them on your own for now, is actually a great thing. It pushes for universal access to AI. Competition between companies will create innovation that reduces hardware and inference costs, if not now, then eventually.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3464beea8368" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How React Native constructs app layouts (and how Fabric is about to change it)]]></title>
            <link>https://medium.com/free-code-camp/how-react-native-constructs-app-layouts-and-how-fabric-is-about-to-change-it-dd4cb510d055?source=rss-1a9b993f35da------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd4cb510d055</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Mehul Mohan]]></dc:creator>
            <pubDate>Thu, 17 Jan 2019 17:38:30 GMT</pubDate>
            <atom:updated>2019-01-17T17:41:25.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujoyIWzko6WTIW8HhpIBwA.jpeg" /></figure><p>The React Native team has been working on something which is fundamentally going to change how the internals of React Native communication work with the host Operating System. It is nicely codenamed “project fabric” (until there’s an official name released).</p><p><strong><em>Quick shameless plug:</em></strong><em> If you’re getting started with React Native, here’s my 95% off course on how to get started with it:</em><strong><em> </em></strong><a href="http://bit.ly/rn-basics-medium"><strong><em>React Native — The First Steps</em></strong></a></p><p>Let us discuss what it actually is and what changes it brings to you as a developer.</p><h3>How React Native works right now</h3><p>If we take a look, React Native right now uses 3 threads:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*fKuJS2I7kvpcyII3x0Mxww.jpeg" /></figure><ol><li>UI Thread — This is the main application thread on which your Android/iOS app is running. It has access to UI and your UI can be changed only by this thread.</li><li>Shadow Thread — This thread is the background thread used by React Native to calculate your layout created using React library.</li><li>JavaScript Thread — This thread is the place where your JavaScript code (your React code, essentially) lives and executes.</li></ol><h4>The inner workings…</h4><p>Let’s start from the beginning. Suppose you want to draw a red box in the center of your screen. So what happens is that your JS thread contains code to create a layout, i.e. that red box on the screen. Here’s a typical code snippet which might achieve that for React Native (RN):</p><pre>&lt;View style={{ flex: 1, justifyContent: &quot;center&quot;, alignItems: &quot;center&quot; }}&gt;<br>&lt;View style={{width: 100, height: 100, backgroundColor: &quot;red&quot;}}&gt;&lt;/View&gt;<br>&lt;/View&gt;</pre><p>The host operating system has its own layout implementation and does not follow the kind of flexbox code you just wrote. Therefore, RN first of all has to convert your flexbox coded layout into a layout system which your host operating system can understand.</p><p>Hold on! Before doing that, we need to offload this layout calculation part to another thread so we can keep executing our JavaScript thread. Hence, RN uses the Shadow Thread which essentially constructs a tree of your layout you coded in your JS thread. In this thread, RN uses a layout engine called <a href="https://github.com/facebook/yoga">Yoga</a> which converts the flexbox-based layout into a layout system which your native host can understand.</p><p>React Native uses something called a React Native bridge to communicate this information from the JS thread to the Shadow thread. In a nutshell, this simply serializes the data in JSON format and transfers it as a string over the bridge.</p><p>At this point, we’re in the Shadow thread. The JS thread is executing and there’s nothing drawn on the screen.</p><p>Now, once we have the rendered markup from yoga, this information is again transferred to UI thread via the React Native bridge. Again, this does some serialization on the Shadow thread and deserialization on the main thread. Here, the main thread then renders the UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*jsICCO6sFLBZt1Bd0VNPfQ.jpeg" /></figure><h3>Problems with this approach</h3><p>If you see, all the communication among threads happens over a bridge which works, but is full of limitations. These include:</p><ul><li>it’s slow to transfer large chunks of data (say an image file converted into base64 string), and</li><li>there’s unnecessary data copying if the same task can be implemented just by pointing to the data in memory (again, say an image)</li></ul><p>Next, all communication is asynchronous, which in most cases is good. However, there is no way currently to update the UI thread from the JS thread synchronously. This creates a problem when you’re using, say, FlatList with a huge list of data. (You can think of FlatList as a weaker implementation of RecyclerView.)</p><p>Finally, due to this asynchronous nature of communication between the JS thread and UI thread, native modules which strictly require synchronous data access cannot be used to a complete extent. For example, RecyclerView’s Adapter on android requires synchronous access to the data it is rendering for not having flickers on screen. This is not possible right now due to the multi-threaded architecture setup by React Native.</p><h3>Introducing Fabric</h3><p>Take a step back and think about your browser. If you take a deeper look, the input fields, the buttons, etc. are actually Operating System-specific. Therefore, it is your browser which asks your OS (Windows, Mac, Linux, or pretty much anything else) to draw, for example, an input field somewhere on a webpage. Holy moly! See the beautiful mapping from browsers to React Native.</p><ul><li>UI Thread → UI Thread</li><li>Browser rendering engine → React Native rendering engine (Yoga/Shadow thread)</li><li>JavaScript thread → JavaScript thread</li></ul><p>We know that modern browsers are very mature and handle all these tasks efficiently. So why not React Native? What is the missing piece of the puzzle which brutally restricts React Native but not browsers?</p><h4>Exposing Native API calls directly to JavaScript</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*AYVSGcao8TZW-POMIZRTeg.jpeg" /></figure><p>Have you ever just written commands like document.getElementById and commands like setTimeout and setInterval in your console and seen the output? Oh! Their implementation is actually [native code] ! What does that mean?</p><p>You see, when you execute these functions, they do not call any JavaScript code. Instead, these functions are linked directly to native C++ code which is called. So the browser does not let JS communicate with the host Operating System using bridging, but instead, directly exposes JS to the OS using native code! In a nutshell, this is what React Native Fabric would do: eliminate the bridge and let the UI be controlled directly from the JS thread using native code.</p><h3>Takeaways</h3><ol><li>RN Fabric allows the UI thread (where UI is drawn) to be in sync with the JS thread (where the UI is programmed)</li><li>Fabric is still under development, and the React Native team did hasn’t mentioned a public release date as of now. But I’m pretty sure that we’ll see something awesome this year.</li><li>Frameworks for app development like these (RN, NativeScript, Flutter) are getting better day by day!</li></ol><p><em>Image sources: </em><a href="https://www.slideshare.net/axemclion/react-native-fabric-review20180725"><em>https://www.slideshare.net/axemclion/react-native-fabric-review20180725</em></a></p><h3>TL;DR</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzsnSqdXqs64%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzsnSqdXqs64&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzsnSqdXqs64%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d0ae8fbe30079b765062aeab7649839/href">https://medium.com/media/1d0ae8fbe30079b765062aeab7649839/href</a></iframe><h3>Liked this article?</h3><p>If you liked this article, feel free to give me some claps and connect with me on <a href="https://twitter.com/mehulmpt">twitter</a>. You know the best part? Claps and twitter both are free! If you have any questions, feel free to drop them in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd4cb510d055" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-react-native-constructs-app-layouts-and-how-fabric-is-about-to-change-it-dd4cb510d055">How React Native constructs app layouts (and how Fabric is about to change it)</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to secure your WebSocket connections]]></title>
            <link>https://medium.com/free-code-camp/how-to-secure-your-websocket-connections-d0be0996c556?source=rss-1a9b993f35da------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0be0996c556</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Mehul Mohan]]></dc:creator>
            <pubDate>Mon, 12 Nov 2018 22:09:03 GMT</pubDate>
            <atom:updated>2018-11-13T10:32:24.366Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*OO2brLI8iR1wo8bJx7TKOg.jpeg" /></figure><p>The Web is growing at a massive rate. More and more web apps are dynamic, immersive and do not require the end user to refresh. There is emerging support for low latency communication technologies like websockets. Websockets allow us to achieve real-time communication among different clients connected to a server.</p><p>A lot of people are unaware of how to secure their websockets against some very common attacks. Let us see what they are and what should you do to protect your websockets.</p><h3>#0: Enable CORS</h3><p>WebSocket doesn’t come with CORS inbuilt. That being said, it means that any website can connect to any other website’s websocket connection and communicate without any restriction! I’m not going into reasons why this is the way it is, but a quick fix to this is to verify Origin header on the websocket handshake.</p><p>Sure, Origin header can be faked by an attacker, but it doesn’t matter, because to exploit it, attacker needs to fake the Origin header on victim’s browser, and modern browsers do not allow normal javascript sitting in web browsers to change Origin header.</p><p>Moreover, if you’re actually authenticating users using, preferably, cookies, then this is not really a problem for you (more on this on point #4)</p><h3>#1: Implement rate limiting</h3><p>Rate limiting is important. Without it, clients can knowingly or unknowingly perform a DoS attack on your server. DoS stands for Denial of Service. DoS means a single client is keeping the server so busy that the server is unable to handle other clients.</p><p>In most of the cases it is a deliberate attempt by an attacker to bring down a server. Sometimes poor frontend implementations can also lead to DoS by normal clients.</p><p>We’re gonna make use of the leaky bucket algorithm (which apparently is a very common algorithm for networks to implement) for implementing rate limiting on our websockets.</p><p>The idea is that you have a bucket which has a fixed size hole at its floor. You start putting water in it and the water goes out through the hole at the bottom. Now, if your rate of putting water into the bucket is larger than the rate of flowing out of the hole for a long time, at some point, the bucket will become full and start leaking. That’s all.</p><p>Let’s now understand how it relates to our websocket:</p><ol><li>Water is the websocket traffic sent by the user.</li><li>Water passes down the hole. This means the server successfully processed that particular websocket request.</li><li>Water which is still in the bucket and has not overflowed is basically pending traffic. The server will process this traffic later on. This could also be bursty traffic flow (i.e. too much traffic for a very small time is okay as long as bucket doesn’t leak)</li><li>Water which is overflowing is the traffic discarded by the server (too much traffic coming from a single user)</li></ol><p>The point here is, you have to check your websocket activity and determine these numbers. You’re going to assign a bucket to every user. We decide how big the bucket should be (traffic which a single user could send over a fixed period) depending on how large your hole is (how much time on average does your server need to process a single websocket request, say saving a message sent by a user into a database).</p><p>This is a trimmed down implementation I’m using at <a href="https://codedamn.com/">codedamn</a> for implementing leaky bucket algorithm for the websockets. It is in NodeJS but the concept remains same.</p><pre>if(this.limitCounter &gt;= Socket.limit) {</pre><pre>if(this.burstCounter &gt;= Socket.burst) {</pre><pre>   return &#39;Bucket is leaking&#39;</pre><pre>}</pre><pre>++this.burstCounter</pre><pre>return setTimeout(() =&gt; {</pre><pre>this.verify(callingMethod, ...args)</pre><pre>setTimeout(_ =&gt; --this.burstCounter, Socket.burstTime)</pre><pre>}, Socket.burstDelay)</pre><pre>}</pre><pre>++this.limitCounter</pre><p>So what’s happening here? Basically, if the limit is crossed as well as the burst limit (which are constants set), the websocket connection drops. Otherwise, after a particular delay, we’re gonna reset the burst counter. This leaves space again for another burst.</p><h3>#2: Restrict payload size</h3><p>This should be implemented as a feature within your server-side websocket library. If not, its time to change it to a better one! You should limit the maximum length of the message that could be sent over your websocket. Theoretically there is no limit. Of course, getting a huge payload is very likely to hang that particular socket instance and eat up more system resources than required.</p><p>For example, if you’re using WS library for Node for creating websockets on server, you can use the <a href="https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback">maxPayload option</a> to specify the maximum payload size in bytes. If the payload size is bigger than that, the library will natively drop the connection.</p><p>Do not try to implement this on your own by determining message length. We don’t want to read the whole message into the system RAM first. If it is even 1 byte greater than our set limit, drop it. That could be only implemented by the library (which handles messages as a stream of bytes rather than fixed strings).</p><h3>#3: Create a solid communication protocol</h3><p>Because now you’re on a duplex connection, you could be sending anything to the server. The server could send any text back to client. You would need to have a way for effective communication between both.</p><p>You can’t send raw messages if you want to scale the messaging aspect of your website. I prefer using JSON, but there are other optimized ways to set up a communication. However, considering JSON, here’s what a basic messaging schema would look like for a generic site:</p><pre>Client to Server (or vice versa): <br>{ status: &quot;ok&quot;|&quot;error&quot;, event: EVENT_NAME, data: &lt;any arbitrary data&gt; }</pre><p>Now it’s easier for you on the server to check for valid events and format. Drop the connection immediately and log the IP address of the user if the message format differs. There’s no way the format would change unless someone is manually tingling with your websocket connection. If you’re on node, I recommend using the <a href="https://github.com/hapijs/joi">Joi library</a> for further validation of incoming data from user.</p><h3>#4: Authenticate users before WS connection establishes</h3><p>If you’re using websockets for authenticated users, it is a pretty good idea to only allow authenticated users to establish a successful websocket connection. Don’t allow anyone to establish a connection and then wait for them to authenticate over the websocket itself. First of all, establishing a websocket connection is a bit expensive anyway. So you don’t want unauthorized people hopping on your websockets and hogging connections which could be used by other people.</p><p>To do this, when you’re establishing a connection on frontend, pass some authentication data to websocket. It could be a header like X-Auth-Token: &lt;some token assigned to this client on login&gt;. By default, cookies would be passed anyway.</p><p>Again, it really comes down to the library you’re using on the server for implementing websockets. But if you’re on Node and using WS, there’s this <a href="https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback">verifyClient</a> function which gets you access to info object passed to a websocket connection. (Just like you have access to req object for HTTP requests.)</p><h3>#5: Use SSL over websockets</h3><p>This is a no-brainer, but still needs to be said. Use wss:// instead of ws://. This adds a security layer over your communication. Use a server like Nginx for reverse proxying websockets and enable SSL over them. Setting up Nginx would be a whole another tutorial. I’ll leave the directive you need to use for Nginx for those folks who are familiar with it. <a href="http://nginx.org/en/docs/http/websocket.html">More info here</a>.</p><pre>location /your-websocket-location/ {<br>    proxy_pass ​http://127.0.0.1:1337;<br>    proxy_http_version 1.1;<br>    proxy_set_header Upgrade $http_upgrade;<br>    proxy_set_header Connection &quot;Upgrade&quot;;<br>}</pre><p>Here it is assumed your websocket server is listening on port 1337 and your users connect to your websocket in this fashion:</p><pre>const ws = new WebSocket(&#39;wss://yoursite.com/your-websocket-location&#39;)</pre><h3>Questions?</h3><p>Have any questions or suggestions? Ask away!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0be0996c556" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-secure-your-websocket-connections-d0be0996c556">How to secure your WebSocket connections</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Here are my favorite hacks for creating production level apps with React Native]]></title>
            <link>https://medium.com/free-code-camp/here-are-my-favorite-hacks-for-creating-production-level-apps-with-react-native-6f0369d879b2?source=rss-1a9b993f35da------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f0369d879b2</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Mehul Mohan]]></dc:creator>
            <pubDate>Tue, 18 Sep 2018 21:57:29 GMT</pubDate>
            <atom:updated>2019-01-15T18:46:40.844Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCJ_bcWjUGSK19znF1KMwg.jpeg" /></figure><p>Trust me when I say this, React Native is hard. And it’s not the usual hard of what we think hard is. It is hard in terms of working with in general. In this blog post, I’ll go over some tips and tricks and eventually the best practices I’ve deployed for one of my apps coded in React Native: <a href="http://play.google.com/store/apps/details?id=com.codedamn">codedamn Android</a> (or <a href="https://itunes.apple.com/us/app/codedamn/id1426709377">codedamn iOS</a>).</p><p><strong><em>Quick shameless plug:</em></strong><em> If you’re getting started with React Native, here’s my 95% off course on how to get started with it:</em><strong><em> </em></strong><a href="http://bit.ly/rn-basics-medium"><strong><em>React Native — The First Steps</em></strong></a></p><p>Hi! My name is Mehul. I’m a student, <a href="https://youtube.com/c/codedamn">youtuber</a>, <a href="https://stackoverflow.com/users/2513722/mehulmpt">fullstack developer</a>, app developer and can deploy servers as well. Recently, I decided to launch a developer focused platform (you guessed it right, codedamn). To get it off the ground real quick on mobile devices, I went with React Native. Partly because I’m not a huge fan of Swift and Xcode for now. But little did I know that I’d be interacting more with native code than I thought. Anyway, let’s begin with the information I want to mention.</p><p><em>Note: At the time of writing this article, React Native was at v0.57-rc4. Check if some of the things are already available/fixed in recent React Native version!</em></p><h3>#0: Know what you’re doing</h3><p>Realize that the React Native world is a lonely world right now. You might get yourself into a problem which no one has faced till now (or you’re not able to google it properly). Always keep VCS up with your native project and regularly commit your changes (all the cool kids call it CI). It helps you to revert back to the last working copy pretty quickly without losing a lot of code.</p><p>It is equally important to know what you’re doing. You might end up breaking your project completely if you’re unaware. If you did not use a VCS, well then you are in trouble.</p><h3>#1: Upgrade your JSC</h3><p>JSC (JavaScriptCore) is a webkit based JavaScript engine used by React Native on Android platforms to evaluate your JavaScript code. Don’t tell me you thought that React Native converts JavaScript into native code. It doesn’t! ;-)</p><p>Whatever JS you write is still executed as JavaScript only by JSC on Android. The problem is React Native ships with a very old version of JSC. This means you have to use babel transformations extensively. Sometimes there are bugs so nasty you’ll pull your hair every time you sit to code, because of an older version of JSC.</p><p>I learned it the hard way after wasting a day of debugging. There was an unknown random fatal error in between app execution. After studying the logs for quite some time, I came to a conclusion that the app was crashing somewhere where [Symbol.iterator] is used in the transpiled JS code by babel.</p><p>Now, Symbols is an ES6 thing. Babel did not transpile this further, and JSC was so old it wasn’t able to hold up simple things like these and crashed. I wasted almost a day behind figuring out that JSC upgrade was a better solution than other patchy hacks.</p><p>Upgrading your JSC is pretty straightforward. Follow this <a href="https://github.com/react-community/jsc-android-buildscripts">github repo</a> and you should be up and running in no time.</p><h3>#2: Setup Redux correctly</h3><p>Redux can be a pain to setup correctly. And by setting it up correctly, I mean integrating it deeply with your app. Whether it is your own reducers or whether it is React navigation. Setting up react navigation with Redux is a great decision for the long-term even though the React navigation page gives a warning about this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*Y90wOCGTc9kKfh4cXM6S5A.png" /></figure><p>Heck no. We’re talking about enterprise and production level apps here. Go ahead and store your navigation state in Redux and gain very fine control over your state.</p><p>But remember, with great power comes great responsibility. With such fine control over your navigation, make sure you set it up correctly. Or else your app will randomly crash. It’s going to be a pain to set it up initially, but trust me its worth the time.</p><p>Read about Redux and its integration with <a href="https://reactnavigation.org/docs/en/redux-integration.html">react navigation here</a>.</p><h3>#3: Use available automation tools like fastlane</h3><p>Fastlane is a great command line utility for automating a lot of common tasks you’ll encounter. It is more like time optimization rather than code optimization. I think it deserves a spot here because it saves a lot of time once setup correctly.</p><p>Checkout fastlane here: <a href="https://fastlane.tools/">https://fastlane.tools/</a></p><h3>#4: Do error handling correctly</h3><p>Don’t expect your users to ping you with exactly how the app crashes. With more complex apps, it is difficult to find specific steps which lead to the app crash. I use sentry.io for error handling on my apps, and I personally like it a lot. It can hook up in your build steps and even upload the sourcemap to their servers so you can see the actual code, not random garbage in your crash traces.</p><p>Sentry is available at <a href="https://sentry.io/">https://sentry.io/</a></p><h3>#5: Do debugging the right way!</h3><p>Are you still using that fancy chrome inspect console to debug your React Native apps? And how about Redux? Another tab? What if you want to clear the async storage of your app? Force stop the app and clear data? Seems too tedious especially when you’re actively developing the application. Instead, use a standalone dedicated debugger for react native. Best part? It’s free!</p><p>Here’s your React Native debugger: <a href="https://github.com/jhen0409/react-native-debugger">https://github.com/jhen0409/react-native-debugger</a></p><h3>5 quick tips:</h3><ul><li>Keep your file structure organized. It is very important to scale your application.</li><li>Avoid using expo for your apps. PLEASE NO. Even if you use it you’ll realize you HAVE to eject at some point, and then good luck figuring out all the mess. It’s not impossible, it will eat a lot of your time later on. Remember, expo is good but we’re talking about long-term business/startup related apps and not a cat age app (for which expo would be good).</li><li>MAKE SURE to create a package-lock.json file (if using npm). You’ll regret it a big time later when you accidentally remove your node_modules folder and realize no package on npm cares about semantic versioning.</li><li>Do not use very heavy UI libraries with React Native. It slows down performance even in production. I do not recommend <a href="https://nativebase.io/">NativeBase</a> as of now, even though it seems very fancy in terms of UI. It’s expensive on performance. There are much better options available like <a href="https://github.com/callstack/react-native-paper">react native paper</a>.<br>Thanks to <a href="https://medium.com/u/22eb9715fa4f">Andre Biel</a> for the comment, please make sure to review this doc page thoroughly if you’re tired of slow RN apps and/or profiling them. It is a goldmine: <a href="https://facebook.github.io/react-native/docs/performance.html">https://facebook.github.io/react-native/docs/performance.html</a></li><li>Take advantage of React Native’s replacing JS bundle on the fly without re-submitting the app to app stores using technologies like <a href="https://microsoft.github.io/code-push/">CodePush</a>.</li><li>Get comfortable with at least the basics of native code on both platforms. Especially the build files on Android and pod files on iOS. Those are some files you’ll spend most of your spending-time-on-native time on.</li></ul><p>I will continue to write blog posts on React Native as a series of posts, maybe, let’s see!</p><h3>Questions?</h3><p>Ask away in the comments below! I’ll be happy to help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f0369d879b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/here-are-my-favorite-hacks-for-creating-production-level-apps-with-react-native-6f0369d879b2">Here are my favorite hacks for creating production level apps with React Native</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Have you learned how to learn coding?]]></title>
            <link>https://medium.com/@mehulmpt/have-you-learned-how-to-learn-coding-d4e160bfb89b?source=rss-1a9b993f35da------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4e160bfb89b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mehul Mohan]]></dc:creator>
            <pubDate>Tue, 07 Aug 2018 10:59:13 GMT</pubDate>
            <atom:updated>2018-08-07T10:59:13.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vjPgyS08qc6PJEnoD-cGfg.jpeg" /></figure><p><strong><em>Disclaimer</em></strong><em>: The article below is strictly written for people who can/want to get out of their comfort zone because they realise nothing grows in comfort zone.</em></p><p>I’m the guy who follows and treats a lot of entrepreneurs as my mentors, chiefly Gary Vaynerchuk and Tai Lopez, and I’m a developer too. Some people might not like Gary or Tai, or even both, but that’s not the point. The point is to pick the best of all worlds and combine them. Now, before starting, I want to give a little bit about myself and hope to establish a little credibility in front of you to keep you motivated to read this article.</p><p>I’m Mehul, as the author’s field says, and I’m a content developer at <a href="https://youtube.com/c/codedamn">codedamn</a>. This channel was started back in 2015 as a initiative for me to give back what I’ve been learning from the internet for free, for free. I’ve 70K+ subscriber base and I’m continually putting in effort to provide value by learning stuff myself and applying it to the real world.</p><p>Let us discuss some ways I’m doing it myself. As I said, I’m a big time follower of Gary Vaynerchuk, and something that attracts me the most is his intense energy. The energy TO DO stuff! Tai? The best thing he has said is that you don’t learn everything all by yourself. That doesn’t necessarily mean you can’t teach yourself. That means you cannot teach yourself without good resources. Those resources could be videos, podcasts, books, people, anything. But out of all of them, the most important one is learning by DOING. What I see around myself is not a lot of people are actually doing anything useful. Mind you, working and doing useful things which contribute are two completely different things.</p><p>If you’re a programmer, coder, whatever, and you want to learn something, the first question you’ve to ask yourself is why, and not what. I see tons of questions floating all the time on Quora and similar sites: “What should I learn as my first programming language”, “XYZ v/S ABC for first time programmer” and all that crap. WHY do you want to learn programming in the first place? Find the purpose. I started back more or less around 6 years ago with programming. I was fascinated with the “Subscribe us now!” and “Receive a newsletter” widgets which we could place on our simple stupid blogs by just copying pasting a bunch of text in Blogger’s widget section. It seemed crazy to me that just simple text could render such stuff, (I was 13 at the time, so I was not really stupid to have that question, I guess). That got me into HTML/CSS and I learned to customize and tweak those little code snippets myself. Did you see the message I didn’t explicitly said here? I learned by DOING and had a PURPOSE!</p><p>Once you have your purpose, and it could be literally anything, from creating a facebook like bot, your favourite sports match score updater, auto-follow-5-people-a-day twitter bot, a simple platformer game, ANYTHING. Once you have that, now you need to search for the technology which can help you. And trust me when I say this, whatever problems you’re facing, especially as a beginner to intermediate developer, there’s almost zero probability that you’re the first one on this planet to face that challenge. This brings me to another aspect of beginners and that is they don’t search for answers! It makes me think and frustrates me sometimes, but its stunningly large spread belief that you need someone’s help to begin coding. Absolutely not! Doing coding on a computer is like real world car-driving-and-hitting-a-person which cannot be undo-ed. Its good to have help on your side, but honestly you physically need nobody to learn anything in this era of Internet.</p><p>Let’s say you picked up creating a facebook like bot. Find your tech stack. Do extensive google search and read stackoverflow answers. Not clear about any term in that answer? Google that. Keep googling. Programming is recursive. And once you hit the base condition, you’ll have all your answers sorted. For facebook like bot example, you’d probably end up with JavaScript + Browser extensions (that’s the simplest you can go), but you might end up with Python + &lt;some python library&gt; as well. And that’s fine. Now you have to decide how to learn the things you picked up.</p><p>Some people might argue with me on this one, but I think Udemy is a strictly a no-go for beginners if you have time and want to learn how to learn stuff. Mind you, you have to learn how to learn, not learn JavaScript or Python or anything.</p><blockquote>Give a Man a Fish, and You Feed Him for a Day. Teach a Man To Fish, and You Feed Him for a Lifetime</blockquote><p>You have to teach yourself to fish, paid courses give you the fish. Its not gonna help in long term.</p><p>I guarantee you whatever you want to learn is already available on YouTube, if you’re starting as a beginner or intermediate. People complaint about “content quality” or “code snippets” not available. What are you complaining about? Go DO IT YOURSELF. That’s how you learn. That’s how everybody has learned. From whatever source you’re learning, its extremely important to do it yourself. Your brain retains information for much much more duration if you do it yourself rather than just audio or visual input.</p><p>You want to learn about JavaScript? Great! Pick ANY youtube playlist and follow along with it. Fire up a text editor, get a chair, and START CODING. Try to follow the person in the video, go out of boundaries, question stuff, try different stuff, see errors, google errors, read about related articles, expand your knowledge, like there are so many ways to learn! You just have to DO! Start DOING! One of the reasons I appreciate consuming others’ content is that it gives you perspective on how they think, how they approach a problem and how they code it away. Copy the best ones, leave the rest.</p><p>I’ve been working on a similar set of tools to combine the best of all worlds. If you’re someone who’s into coding or wants to get in coding, check out this video I made a couple of days back:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5S3FB7dgudg%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5S3FB7dgudg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5S3FB7dgudg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3bcb37440424109b43c51dc8f077f68/href">https://medium.com/media/a3bcb37440424109b43c51dc8f077f68/href</a></iframe><p>This is literally like 20% of the <a href="https://codedamn.com/">total platform</a>. The platform is 100% free of cost, ad free for now, no hidden ToS. Some companies are built around just the 20%, and I believe there is so much more to just provide a timeline based learning. You need resources, you need people, you need actual developers along your way to measure your success. You need to consume good content, and you need to keep in touch with latest trends because you don’t want to learn a lot of jQuery when <em>fetch</em>, <em>_ =&gt; do()</em>, <em>..args</em>, and stuff like that is already here.</p><p>I’m super pumped to help you guys in any way out. Please leave your comments and let me know how I can assist you. Way to go guys. Good luck!</p><p>Mehul</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4e160bfb89b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>