<?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 Aditi Anand on Medium]]></title>
        <description><![CDATA[Stories by Aditi Anand on Medium]]></description>
        <link>https://medium.com/@anand.aditi5?source=rss-8b895f27c45c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ouxtsQG2hCprVOedi-_bhA.jpeg</url>
            <title>Stories by Aditi Anand on Medium</title>
            <link>https://medium.com/@anand.aditi5?source=rss-8b895f27c45c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 22:00:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anand.aditi5/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[f.read() — Notebook File vs. Python File]]></title>
            <link>https://medium.com/@anand.aditi5/f-read-notebook-file-vs-python-file-dd7b70ffde06?source=rss-8b895f27c45c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd7b70ffde06</guid>
            <category><![CDATA[filereader]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <dc:creator><![CDATA[Aditi Anand]]></dc:creator>
            <pubDate>Tue, 07 Jul 2020 10:46:19 GMT</pubDate>
            <atom:updated>2020-07-08T14:33:56.949Z</atom:updated>
            <content:encoded><![CDATA[<h3>f.read() — Notebook File vs. Python File</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NdfjGII2c--1fY36" /><figcaption>Photo by <a href="https://unsplash.com/@hiteshchoudhary?utm_source=medium&amp;utm_medium=referral">Hitesh Choudhary</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A few days back, I developed an <strong>interactive search interface<em> </em></strong>on a <strong>Jupyter Notebook </strong>that looks for nearby places of a national site using the <strong>MapQuest API</strong>.<strong><em> </em></strong>It was yesterday when I thought to test the same script as a python file on the <strong>command line</strong>. Therefore, I downloaded the script as .py from Jupyter and executed the same.</p><h4>😲 <strong>Oops, an error occurred !!!</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*TOGPcq99UBp_Xl3ZyY6MqQ.png" /></figure><blockquote>Before digging into this error, let me brief you on what exactly I was doing where this occurred.</blockquote><p>While working on Jupyter, there was a notebook file <em>(apikeyfile.ipynb)</em> having a single line API_KEY = xxxxxxxxxxxxxxxxxxxxxxxxxxxx which I was reading from the main script to extract the API key using the below code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e08e8cc35970d6c723b0133ce303c01/href">https://medium.com/media/8e08e8cc35970d6c723b0133ce303c01/href</a></iframe><p>That API key was required for the request parameters of the MapQuest API.</p><blockquote>Now, coming back to the error logs...</blockquote><p>When I executed the main script as python (.py) on the command line, an exception was thrown at the line containing json.loads() method where it was trying to fetch the API key from the downloaded apikeyfile.py file. The exception occurs when the JSON encoded data passed in its parameter is either empty or not in the form of JSON.</p><h4>🔎 Root Cause</h4><p>As<strong> f.read() </strong>gave below output on reading the notebook file <em>(apikeyfile.ipynb).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*xaKVEx_IITQpV71gBMUcuw.png" /></figure><p>And below on reading the python file <em>(apikeyfile.py)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*dHmPlYe2-ikGKpK_ECcn5A.png" /></figure><p>Hence, the correct code that would extract the API key from the python file <em>(apikeyfile.py) </em>is as shown below in place of the code snippet as provided earlier.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95670d92a7216d76be24cf2d225aaa09/href">https://medium.com/media/95670d92a7216d76be24cf2d225aaa09/href</a></iframe><blockquote><strong>Why are there so many lines behind a single line of a .ipynb file?</strong></blockquote><blockquote>Jupyter notebook files are simple JSON documents, containing text, source code, rich media output, and metadata where each segment of the document is stored in a cell.</blockquote><p>For quite some time, I struggled to get to the root cause of this issue. Besides, on the internet also I could not find the exact reason for my problem. Therefore, I thought to share my learning on a bigger platform so that it might help at least the beginners in Python.</p><h4>Conclusion</h4><p>Always be careful while reading a notebook and a python file.</p><p>Thanks for reading and feel free to relay your comments in the response section. You may try reading some of my other pieces if you liked this one.</p><ul><li><a href="https://medium.com/@anand.aditi5/java-14-features-c0bd6d23d46b">A quick glance at Java 14 features</a></li><li><a href="https://medium.com/@anand.aditi5/cross-site-request-forgery-csrf-an-attack-we-must-be-aware-of-9e4d87b1944b">Cross-Site Request Forgery(CSRF) — an attack we must be aware of</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd7b70ffde06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross-Site Request Forgery(CSRF) — an attack we must be aware of]]></title>
            <link>https://medium.com/@anand.aditi5/cross-site-request-forgery-csrf-an-attack-we-must-be-aware-of-9e4d87b1944b?source=rss-8b895f27c45c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e4d87b1944b</guid>
            <category><![CDATA[session-id]]></category>
            <category><![CDATA[samesite]]></category>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[csrf]]></category>
            <category><![CDATA[cookies]]></category>
            <dc:creator><![CDATA[Aditi Anand]]></dc:creator>
            <pubDate>Sat, 04 Jul 2020 09:15:16 GMT</pubDate>
            <atom:updated>2020-07-05T08:23:52.461Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cross-Site Request Forgery(CSRF) — an attack we must be aware of</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fixnohSZkGuRmn18EUsZxQ.jpeg" /></figure><p>So, you might be looking for a definition of Cross-Site Request Forgery here with some piece of code to eliminate this attack.</p><p>😎 Well, what I am thinking today is to go a bit off the track and try to share the idea about how this forgery looks like in the real world:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*CO5OpRnmUnzNRp82_xnssg.png" /></figure><p>🤓 Let me now brief you with the essence of the above flow chart:</p><p>😕 When a system is not able to distinguish between a legitimate request <em>(the one which was yet to be sent after the user logged into the banking website in the above example)</em> and a forged one<em> (which was sent to the banking website from the malicious website in the above example)</em>, know that the system is vulnerable to Cross-Site Request Forgery(CSRF) attacks.</p><h4>🕵️‍♀️ Do you know why this happens?</h4><p>The session id saved in the cookie is used by the attacker in a modified request causing a fraudulent transaction.</p><h4>🚫 How can this be prevented?</h4><p>Now that we know cookies are getting used for a CSRF attack, let’s have a look at how to prevent it. A relatively newer method that has come up these days is — <strong><em>SameSite flag in cookies. </em></strong>The session cookie used to identify a valid user when flagged with a SameSite attribute, it allows only a request that originates from the same domain.</p><p><em>We can set the flag in three ways:</em></p><ul><li>SameSite=Strict</li><li>SameSite=Lax</li><li>SameSite=None; Secure</li></ul><p>So, to start with, if the SameSite attribute is set as Strict, the third party would be restricted for both a GET and a POST request because the strict cookie will never be sent along that request. However, this could negatively impact the browser’s experience as even for navigation purpose, we are not able to fetch the contents from another domain.</p><p>💻Set-Cookie: type=1; SameSite=Strict</p><p>Now, talking about the default value of SameSite in the latest versions of browsers which is Lax, the third party would not be restricted for a GET request but as this is the default behavior, the developer must keep in mind to design the website to have only the top-level navigations in the GET requests.</p><p>💻Set-Cookie: type=1; SameSite=Lax</p><p>Lastly, when we set the value to None, along with mentioningSecure, we deliberately intend the cookie to be sent along with all types of requests by a secured third party.</p><p>💻Set-Cookie: type=1; SameSite=None; Secure</p><h4>Let’s drill further</h4><p>Below, I am embedding a YouTube video on the SameSite Cookies. If we inspect the elements of this video here, it is an iframe where Medium is the first party and its source YouTube is a third party.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGPz7onXjP_4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGPz7onXjP_4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGPz7onXjP_4%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/d056db4d286afb47bb4b9ab6d5f6328b/href">https://medium.com/media/d056db4d286afb47bb4b9ab6d5f6328b/href</a></iframe><p>Have a look at the below image that shows the network calls when this page with an embedded media is loaded. You can see the YouTube URL in the RequestURL followed by the RequestMethod which is a GET request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bh917WyCHCYfqexQkV5ZiQ.png" /></figure><p>This could not have been possible if the SameSite attribute’s value is set as Strict. However, for both Lax and None values, this would work. The reason for it to working for Lax is that because this is a GET request which is allowed in case of Lax and for None is because the YouTube URL is a secured one using the HTTPS protocol which would not be restricted as we have the Secure keyword along with the value of SameSite as None.</p><p>Below are the images which confirm the above-mentioned case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wg68hrA62IXXg0b-Oi16jw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyPSDK5oDQD8RNQ61pEAKw.png" /></figure><h4>Thank You</h4><p>Thank you for reading. I hope the flow chart and the Chrome DevTools screenshots helped in understanding the CSRF attacks and their prevention better.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e4d87b1944b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A quick glance at Java 14 features]]></title>
            <link>https://medium.com/@anand.aditi5/java-14-features-c0bd6d23d46b?source=rss-8b895f27c45c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0bd6d23d46b</guid>
            <category><![CDATA[java-14-features]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Aditi Anand]]></dc:creator>
            <pubDate>Wed, 01 Jul 2020 08:51:22 GMT</pubDate>
            <atom:updated>2020-07-20T19:14:09.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TWZtniBGqfFeYBnE" /><figcaption>Photo by <a href="https://unsplash.com/@maximilianweisbecker?utm_source=medium&amp;utm_medium=referral">Maximilian Weisbecker</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Below is the list of Java 14 features we are going to walk through today:</p><ol><li>Switch Expressions</li><li>Pattern matching for instanceof</li><li>Helpful NullPointerException</li><li>Records</li><li>Text Blocks</li></ol><h3><strong>Switch Expressions</strong></h3><p>For switch expressions, lambda expressions incorporating:</p><ul><li>no fall-through (break not required anymore after each case)</li><li>comma-separated multiple labels introduced in Java 12 as a preview</li><li>yield with a returning statement introduced in Java 13 as a preview</li></ul><p>holds a permanent status from Java 14 onwards.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4808db083c65efc48c44b7d759785bcc/href">https://medium.com/media/4808db083c65efc48c44b7d759785bcc/href</a></iframe><h3>Pattern matching for instanceof (Preview)</h3><p>This preview feature eliminates the requirement of explicit cast done after the conditional instanceof checks to operate on that object.</p><p>Before Java 14:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a6443ed404437fc4dcd8c4ac2a103756/href">https://medium.com/media/a6443ed404437fc4dcd8c4ac2a103756/href</a></iframe><p>After Java 14:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47db37feac80e84fba6c060c958ef295/href">https://medium.com/media/47db37feac80e84fba6c060c958ef295/href</a></iframe><h3><strong>Helpful NullPointerExceptions</strong></h3><p>NullPointerExpection involves a lot of debugging to find the root cause when we look at the application logs. To ease this problem, Java 14 has introduced more informative diagnostics with the exception thrown.</p><p>If we are getting location as null from below code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec9618fe5507a7169e2946b742dd1900/href">https://medium.com/media/ec9618fe5507a7169e2946b742dd1900/href</a></iframe><p>The NPE thrown from Java 14 onwards is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d81b609fa1884c5983640036a0528a49/href">https://medium.com/media/d81b609fa1884c5983640036a0528a49/href</a></iframe><h3><strong>Records (Preview)</strong></h3><p>This preview feature makes the code concise wherein if the intent of the class is clear then on declaring the record as below we do not have to worry about writing various components of the class like the constructor, getter methods, toString(), hashCode() and equals() method.</p><p>Some additional facts:</p><ul><li>Fields of the record class are implicitly final.</li><li>The constructor generated in the class is called a canonical constructor.</li><li>On compilation of a record, we will get a new class, java.lang.Record acting as a supertype for the record class.</li><li>The java.lang.Record class cannot be directly extended.</li><li>We can use public API and canonical constructor to serialize and deserialize records.</li><li>The serialVersionUID of a record class is 0L unless it is explicitly declared.</li><li>The requirement for matching serialVersionUID values is also waived for record classes.</li></ul><p>Below is a brief code snippet to understand the concept better where we have the syntax to declare records:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8bab8eb0e5f4ada4f511dc63a8a4c010/href">https://medium.com/media/8bab8eb0e5f4ada4f511dc63a8a4c010/href</a></iframe><p>On compiling with a preview flag:</p><pre>javac --enable-preview -source 14 FXOrder.java</pre><p>we will be able to examine the class file with javap (showing only methods and their signatures below)</p><pre>$ javap FXOrder.class<br>Compiled from &quot;FXOrder.java&quot;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/975a97967e4633328ab13f2fa27ffa5b/href">https://medium.com/media/975a97967e4633328ab13f2fa27ffa5b/href</a></iframe><h3><strong>Text Blocks (Second Preview)</strong></h3><p>Text blocks introduced in Java 13 as preview remain there in Java 14 with a couple of tweaks:</p><ul><li>\s escape sequence, adding a single space</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5757d72c1ddfacff1e4959959486bec9/href">https://medium.com/media/5757d72c1ddfacff1e4959959486bec9/href</a></iframe><ul><li>\ backslash, suppressing the new line character at the end of the line as per Java 13 preview of text block</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8256cba9018809f2089f388f6519e79/href">https://medium.com/media/c8256cba9018809f2089f388f6519e79/href</a></iframe><p>That’s it for this one — thanks for reading.</p><p><em>Originally published at </em><a href="https://www.slideshare.net/bhanuanand10/java-14-features"><em>https://www.slideshare.net/bhanuanand10/java-14-features</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0bd6d23d46b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Head Seek Operation - criteria behind the columnar database]]></title>
            <link>https://medium.com/@anand.aditi5/head-seek-operation-criteria-behind-the-columnar-database-f08debadd79?source=rss-8b895f27c45c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f08debadd79</guid>
            <category><![CDATA[columnar-databases]]></category>
            <category><![CDATA[data-storage]]></category>
            <category><![CDATA[data-search]]></category>
            <category><![CDATA[hard-disk]]></category>
            <category><![CDATA[seek-time]]></category>
            <dc:creator><![CDATA[Aditi Anand]]></dc:creator>
            <pubDate>Wed, 01 Jul 2020 05:29:48 GMT</pubDate>
            <atom:updated>2020-07-01T05:32:04.624Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHZjK1xE9gUU6DN-le0oWA.jpeg" /></figure><p>The magnetic disk is divided into platters which are further divided into tracks and sectors. It stores information magnetically on spinning platters and the read/write head is moved around to find the data that the users request.</p><p>The seek time is how long it takes for the head on the actuator arm of the rotating hard drive to locate the appropriate track to write or load the information. Typically, a hard drive’s average seek time is calculated by approximating how long it takes to look for data over one-third of the hard drive’s tracks.</p><p>Head Seek operation is expensive in disks due to the mechanical movement required. The less the heads have to move, the faster the drive performs. If data is kept closer together, it minimizes the seek time, thus the system can deliver that data faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/209/1*F5lRv6Xm0nmLU4wBTjD60w.jpeg" /></figure><p><em>Current rotating hard disk drives have an average head seek time of approximately 9 ms. However, the first moving-head hard disk drive (IBM 305) had a seek time of about 600 ms.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f08debadd79" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>