<?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 deepak kathuria on Medium]]></title>
        <description><![CDATA[Stories by deepak kathuria on Medium]]></description>
        <link>https://medium.com/@deepakkathuria32?source=rss-10caf72763af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tBXSAom7rrMprsSnL4lcQg.jpeg</url>
            <title>Stories by deepak kathuria on Medium</title>
            <link>https://medium.com/@deepakkathuria32?source=rss-10caf72763af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 05:04:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@deepakkathuria32/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[EMACS AS TEXT EDITOR]]></title>
            <link>https://deepakkathuria32.medium.com/emacs-as-text-editor-7ebd53f722f1?source=rss-10caf72763af------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ebd53f722f1</guid>
            <category><![CDATA[emacs]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[editor]]></category>
            <dc:creator><![CDATA[deepak kathuria]]></dc:creator>
            <pubDate>Sun, 17 Oct 2021 15:14:16 GMT</pubDate>
            <atom:updated>2021-10-17T15:14:16.561Z</atom:updated>
            <content:encoded><![CDATA[<p>The Emacs editor is the very versatile and powerful editor and it understand a LISP which is commonly used language for artificial intelligence programming. It is one of the oldest programming languages still in relatively wide use.Lets take example let say we invent a new programming language and we want to code in this programming language using Emacs but as its a new language so Emacs does not know about it ,so we can write a small LISP program as package and we can load this package to Emacs as we know Emacs Understand LISP so after adding package to Emacs then Emacs can Understand our programming language we would not need to update its binary to be able to code in this programming language</p><p>Unlike the vi editor, the Emacs editor does not use an insert mode, and it is by default in editing mode, i.e., whatever you type will directly be written to the buffer, unless you manually enter command mode by using keyboard shortcuts.</p><pre>1.                sudo apt-get install emacs</pre><pre>2.                emacs</pre><pre>3                 emacs --version</pre><ul><li>1. to install emacs</li><li>2. to open emacs</li><li>3. to check emacs version</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*jIYF-lJeRu4QY1-UblymJA.png" /><figcaption>emacs open after typing emacs</figcaption></figure><pre>1.                        emacs new.txt</pre><pre>2.                        ctrl+x ctrl+f</pre><pre>3.                        ctrl+x s</pre><pre>4                         ctrl+x ctrl+s</pre><pre>5                         ctrl+s ctrl+w</pre><pre>6                         ctrl+x ctrl+c</pre><ol><li>It creates a file called new.txt if it doesn’t already exist</li><li>opens a file, asks for filename if it can’t find file it creates the file</li><li>save the file with prompt</li><li>save file without prompt</li><li>save file with different name it will asks for name(not work in me)</li><li>for quits emacs and asks for save</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*gPFyfktu6MUi1UXnX9VNgQ.png" /><figcaption>creted file with new.txt</figcaption></figure><p>Everytime you save a file, Emacs creates another file with the name “filename~” .This (~) file is the previous version of the file. It will be in the same dir. Also, Emacs auto-saves everything you type to a file with the name “#filename#”. If you quit Emacs without saving, you can see this auto-save file. I can show this with help of images</p><ol><li>I created file new (name of file ) with help of above command</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*oe_FCJapauxjMn2Or51-qw.png" /><figcaption>new(name of file)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*gLxgfkddnruZSZXaqDt6bQ.png" /><figcaption>terminal from which i am using emacs</figcaption></figure><p>2. I will quit from emacs and save the file using above commands and run ls in terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*_T3qMW5MuDu7c30-GXyaQg.png" /><figcaption>ls</figcaption></figure><p>3. Now I open same file and edit and then save the changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*VTuMe0QIOY3voQ2-YLJezQ.png" /><figcaption>edit the file with “bbbbbbb” and save changes</figcaption></figure><p>4. I quit the emacs and then do ls command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*hUtiyJgdeQpjxYNm_BYgng.png" /><figcaption>(new) -&gt; new version and (new~)-&gt;previous version</figcaption></figure><p><em>so ,everytime you save a file, Emacs creates another file with the name “filename~” which is previous version.</em></p><p>5. If you want to see difference between the two version the do</p><pre>diff &lt;filename&gt; &lt;filename2&gt;</pre><pre>diff new new~</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*gSU8ehBtR3NxmZN5udsEFw.png" /><figcaption>diff between two files</figcaption></figure><p>OTHER SCENARIO</p><p>1.In this now i created file called blob and i will exit withou saving from emacs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*-uWId_JfFleLOevK-RwafQ.png" /></figure><p>2. now do ls in terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*ShGNs8fY-gTFrPOPcbprxw.png" /><figcaption>#blob# auto save file created</figcaption></figure><p><strong><em>Emacs auto-saves everything you type to a file with the name “#filename#” if you save emacs without saving</em></strong></p><p>MORE COMMNADS</p><pre>1.                       Ctrl+k</pre><pre>2.                       ctrl+y</pre><pre>3.                      ctrl+space<br>                           |<br>4.                       ctrl+M w</pre><pre>5.                        ctrl+w</pre><pre>6.                        ctrl+a</pre><pre>7.                        ctrl+e</pre><pre>8.                        ctrl+/</pre><pre>9.                        esc+&gt;</pre><pre>10.                       esc+&lt;</pre><p>Saving a region involves hitting ctrl+space to start selecting ,and then hitting M-w or C-w to copy or cut it into the clipboard, and then hitting ctrl+y to paste it. If you don`t like the region you are selecting,hit ctrl+g.</p><p>“ctrl+a “ move cursor to the beginning of line</p><p>“ctrl+e” move cursor at the end of line</p><p>EXECUTION</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*4ddhDH6m0ARxULvGVVxkFQ.png" /><figcaption>file with cursor at e</figcaption></figure><p>ctrl+k</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*943TTAflngYNWr8s5tm_Kw.png" /><figcaption>ctrl+k delete word in 1 line after cursor</figcaption></figure><p>ctrl +y</p><p>i will just copy “ctrl+y” text in this blog and then paste using ctrl +y in my file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*JEOb7v_bUwfTp7vNUKGezg.png" /><figcaption>ctrl+y is my copying text</figcaption></figure><p>ctrl + space</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*5y2myjcfXCIxskkPJ3ikHw.png" /><figcaption>mark up activate i selected these 4 lines</figcaption></figure><p>ctrl+m w</p><p>for copying these 4 and to see output paste using ctrl +y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*N2Q9EzXn0n02lxbMmwK_ow.png" /><figcaption>paste 4 times selected using ctrl+ space(markup) copying using ctrl+m w and then paste using ctrl+y</figcaption></figure><p>ctrl+a</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*Xm_SHOe4UUoShX86CcWEdw.png" /><figcaption>my cursor is at the end</figcaption></figure><p>when i press ctrl+a cursor comes into beginning as shown</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*36OoEy4zl0qHE5tpP_qJ5w.png" /></figure><p>ctrl+e</p><p>it moves the cursor to the end of line</p><p>ctrl+/</p><p>it is like undo</p><p>esc+&gt; and esc+&lt;</p><p>is used for moving at the beginning and end of the file</p><blockquote><strong><em>SO THESE ARE SOME BASIC COMMANDS TO USE EMACS</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ebd53f722f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GNU SCREEN]]></title>
            <link>https://deepakkathuria32.medium.com/gnu-screen-c99e7a9b1b2e?source=rss-10caf72763af------2</link>
            <guid isPermaLink="false">https://medium.com/p/c99e7a9b1b2e</guid>
            <category><![CDATA[gnu-linux]]></category>
            <category><![CDATA[gnu]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[deepak kathuria]]></dc:creator>
            <pubDate>Sun, 17 Oct 2021 15:12:48 GMT</pubDate>
            <atom:updated>2021-10-17T15:12:48.307Z</atom:updated>
            <content:encoded><![CDATA[<p>GNU Screen Is A Terminal Multiplexer,Terminal Multiplexer Allow You To Keep Process Running Even If You Close The SSH Connection So For Example We Have Long Running Job We Have To Run Over Night And You Don’t Want To leave Your Machine “On” But You Are Running It On Remote Server So You Use Screen Concept Which is A Type Of Terminal Multiplexer. GNU screen Allow You To Run the Process Or Job Running In Background Even On Connection Closed .</p><p>Gnu Screen is Terminal Multiplexer That Can Be Used To Multiplex Several Virtual Consoles ,Allowing User to Access Multiple Login Session Inside Single Terminal Window.</p><p>COMMANDS</p><ol><li>To Enter Into Screen Session Just type “<strong>screen”</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*lR3jxFHc8IrQosYRxErlqw.png" /><figcaption>I am in screen and written simple hello world</figcaption></figure><p>2. To detach from screen type ctrl and a then d “<strong>ctrl+a -d”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*SKGgycqTeB0RTgIpLab2Fw.png" /><figcaption>detached from screen or move out from screen session</figcaption></figure><p>3. To list Out screen “<strong>screen -ls”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*o-bK2EdLsDkAkJk13DAibQ.png" /><figcaption>list of screens</figcaption></figure><p>4. Create Screen session with screen name “<strong>screen -S &lt;name of screen&gt;”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*hYl-Gzd7gQ_YgQsp_cRV-w.png" /><figcaption>screen session with name deepak is created</figcaption></figure><p>5. Resuming on screen with process id and name of screen “<strong>screen -r &lt;pid&gt;”</strong>and for name “<strong>screen -r &lt;name of screen&gt;”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*nNZeD8m7FAKzjWcjZyzZlg.png" /><figcaption>resuming to screen session or reattaching to screen session with name or pid</figcaption></figure><p>6. Remove Screen Session “<strong> screen -X -S &lt;pid or name&gt;</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*HD92acP1FQwmmNU6wXNRrw.png" /><figcaption>remove screen sessions</figcaption></figure><p>7. Create New Window in the screen “<strong>ctrl +a -c</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*dIS3CYmzHFTfF-z53NL_fg.png" /><figcaption>I have created 5 window in screen byb pressing ctrl+a -c</figcaption></figure><p>8. To move move forward and backward through window “<strong>ctrl +a -n</strong>” n is for next</p><p>“<strong>ctrl+a -p</strong>” for previous window</p><p>“<strong>ctrl+a 0</strong>” 0 represent window number</p><p><strong>“ctrl+a \”</strong> not work for me kill all windows in screen</p><p>“<strong>ctrl+a A</strong>” not work for me renaming window in screen</p><h3>GNU SCREEN TO KEEP PROCESS RUNNING WITHOUT LEAVING MACHINE ON OR CONNECTED</h3><p>PROBLEM WITHOUT SCREEN MULTIPLEXER</p><ol><li>I am logged In To My Server Using SSH In Two Terminal Both Using Same User Account And Using Same Remote Machine As Shown</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*7bR3F4GsEqDd8fmGohgP7Q.png" /><figcaption>TERMINAL 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*zZJsxIJb-1b_RORhpntSyw.png" /><figcaption>TERMINAL 2</figcaption></figure><p>2. Creating Python Script a.py In Terminal 1 As shown And Run This It will Take Too Much Time To Run As we are running 300 times hello world with time.sleep of 2 means 2 second break in each time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*2XfBdh38fBKd_L4yTcTdNg.png" /><figcaption>a.py</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*HIWOC9MRXs0swjDxpFcuyw.png" /><figcaption>a.py script running on terminal 1</figcaption></figure><p>With Running Terminal1 script We Go To 2nd terminal we Run ps command to see the “pid” of script running on remote server from terminal 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*5gKP0YJ3U71Irx7dY3wMmw.png" /><figcaption>pid =4375</figcaption></figure><p>Now with 1 terminal we disconnect or close the terminal 1 and again see the process which are running we saw that process is also terminated after losing or closing the connection as shown even we have connection with the same user with terminal 2 to same remote server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*EYDdfu7o4QbwwTgic4x05w.png" /><figcaption>we have no process running pid=4375</figcaption></figure><p><strong>THIS PROBLEM IS SOLVED USING SCREEN AS SHOWN</strong></p><p>Now We open terminal 1 and the login again with ssh and then we use screen to solve the problem</p><ol><li>After login type screen and then run python a.py in screen in terminal 1as shown</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*W3VABKFh0KmcgZdoKxIRrQ.png" /><figcaption>script is running in terminal 1 using screen</figcaption></figure><p>2. Now Again Check For Process id in Terminal 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*P7xgiVnxJ93MEyGlKyERQA.png" /><figcaption>pid=4540 which is running using screen in terminal 1</figcaption></figure><p>3. After Loosing the Connection from terminal 1 where screen is running and our a.py script is running and then again we check for process in terminal 2 and now we saw that process is still running .</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*P7xgiVnxJ93MEyGlKyERQA.png" /><figcaption>4540 still running after closing terminal 1 because we run the script in screen</figcaption></figure><p>4. After that go to terminal 1 again and login and then type</p><p>&lt;screen -r &gt;</p><p>It will shows that our script is running in the background So with the help of screen we can run processes in background even after closing the window or connection lost.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c99e7a9b1b2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DJANGO ORM PRACTISE QUESTIONS FOR INTERVIEWS]]></title>
            <link>https://deepakkathuria32.medium.com/django-orm-practise-questions-for-interviews-431572b03547?source=rss-10caf72763af------2</link>
            <guid isPermaLink="false">https://medium.com/p/431572b03547</guid>
            <dc:creator><![CDATA[deepak kathuria]]></dc:creator>
            <pubDate>Tue, 06 Jul 2021 18:24:20 GMT</pubDate>
            <atom:updated>2021-07-06T18:24:20.431Z</atom:updated>
            <content:encoded><![CDATA[<h4>VIDEO LINK : <a href="https://youtu.be/0SIro6_3PB0">https://youtu.be/0SIro6_3PB0</a></h4><p>Let Suppose We Have Model</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*YspUQ35ZZBR-kqEL-6HvPA.png" /></figure><p>If You Want To See How To Create Model Then You Should Go Through This Link</p><p><a href="https://deepakkathuria32.medium.com/1-create-virtual-environment-b889750b68e6">https://deepakkathuria32.medium.com/1-create-virtual-environment-b889750b68e6</a></p><p>After Creating Employee Model Go to Admin And Create 4,5 Emloyee With Name And Esal And Then We Go To Python Shell Import Our Model And Then Solve Questions On ORM</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*D5IsrAyLtbKtrozc60PCAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*c949q63B13wtWAtXd7R5Wg.png" /></figure><p>QUESTIONS</p><ol><li>Find Employee With The Highest Salary</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*inR4Th2MvNhAUtLGxdrZ9A.png" /><figcaption>1ST Method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*aQChzyJC20EICZyjde6p2A.png" /><figcaption>2ND Method</figcaption></figure><p>2. Calculate AVG Salary Of All Employee</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*jdj5lDcy_Fky8O-aENxs4w.png" /></figure><p>3. Find Employee Whose Salary is Greater Than 3000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*d_iNmUUo3jurVyT3JANcSQ.png" /></figure><p>4 .Find all Employee Whose Don’t Have Salary 3000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*M9JVSlhHq0OA5lhix88kGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*sccuYZw370Hz_rEX7ELzaA.png" /></figure><p>5. Find all Employee Whose Don’t Have Salary 3000 or 3500</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*XxmfaL0ku3qtGA7Sem9pUA.png" /></figure><p>6. Find all Employee Whose Salary 3000 or 3500</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*AH0-gqqZvqO3kuaO5OyRYA.png" /></figure><p>7.Find all Employee Whose Salary 3000 And Name Starts With j</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*2QOwf-8Tescwd1Y4y6WioA.png" /></figure><p>8. Change Salary of jaadu to 4000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*Zta1KVMFndeAX5QUjnQWDw.png" /><figcaption>1 indicate it has update 1 field</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=431572b03547" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HOW TO CREATE MODEL IN DJANGO AND THEN USE DJANGO ORM UPDATE QUERY]]></title>
            <link>https://deepakkathuria32.medium.com/how-to-create-model-in-django-and-then-use-django-orm-update-query-a46702edd1e9?source=rss-10caf72763af------2</link>
            <guid isPermaLink="false">https://medium.com/p/a46702edd1e9</guid>
            <dc:creator><![CDATA[deepak kathuria]]></dc:creator>
            <pubDate>Tue, 06 Jul 2021 18:23:40 GMT</pubDate>
            <atom:updated>2021-07-06T18:23:40.708Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>HOW TO CREATE MODEL IN DJANGO AND THEN USE DJANGO ORM UPDATE QUERY</strong></p><p>YouTube Link : <a href="https://www.youtube.com/watch?v=OjQLjb09cXc&amp;t=389s">https://www.youtube.com/watch?v=OjQLjb09cXc&amp;t=389s</a></p><h3>1. Create Virtual Environment</h3><p>a. virtualenv &lt;virtualenvironment name&gt;</p><p>b. cd &lt;virtualenvironment name&gt;</p><p>c. source bin/activate</p><p>d. pip install django</p><h3>2. Create Django Project And App</h3><p>a. django-admin startproject &lt;projectname&gt;</p><p>b. cd &lt;projectname&gt;</p><p>c. python manage.py migrate</p><p>d. python manage.py createsuperuser</p><p>e. python manage.py startapp &lt;appname&gt;(for ex in my case my app name is “testapp”)</p><h3>3. Create Model In Django Project And Register In Admin File</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*iD4XNDL_ewbYmwuJnUqEYg.png" /><figcaption>Models.py</figcaption></figure><h3>4. Admin File</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*BNtwXR18lYwPQacmlbImfQ.png" /><figcaption>Admin.py</figcaption></figure><h3>5. Go To Admin And Create Student With Name ,Age ,Rollno</h3><h3>6. Go To Python Shell</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*3D4JTRKiET_rNIfnyxxBfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*MSh_RCXrwP4R69QOmpEDVw.png" /><figcaption>Update all student age to 12</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*sJKOXm7FGjp_BAkadSrfjQ.png" /><figcaption>Update student whose roll no =12 updated their name to deepak</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a46702edd1e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>