<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ashwin Sharma P</title>
    <description>The latest articles on DEV Community by Ashwin Sharma P (@ashwinsharmap).</description>
    <link>https://dev.to/ashwinsharmap</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F424108%2F0fc86a24-e7da-4246-8a3c-c4ecb715d1c8.jpg</url>
      <title>DEV Community: Ashwin Sharma P</title>
      <link>https://dev.to/ashwinsharmap</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashwinsharmap"/>
    <language>en</language>
    <item>
      <title>SAP Basis snippets #7</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Mon, 16 Sep 2024 05:55:53 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/sap-basis-snippets-7-29h9</link>
      <guid>https://dev.to/ashwinsharmap/sap-basis-snippets-7-29h9</guid>
      <description>&lt;p&gt;Have you ever locked DDIC user and pondered how to unlock it? Well, today let’s see how we unlock DDIC user using sap* user.&lt;/p&gt;

&lt;p&gt;There exists a parameter &lt;strong&gt;login/no_automatic_user_sapstar&lt;/strong&gt; inside the default profile of your sap system. If it doesn’t exist, we need to add this parameter to perform what we are discussing today.&lt;/p&gt;

&lt;p&gt;In some cases, this parameter exists in instance profile too, depending on the system.&lt;/p&gt;

&lt;p&gt;This parameter may be set to either &lt;em&gt;1&lt;/em&gt; or &lt;em&gt;0&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;If it is set to &lt;em&gt;1&lt;/em&gt;, it means that we won’t be able to login to sap system using password pass of &lt;em&gt;sap*&lt;/em&gt; user.&lt;/p&gt;

&lt;p&gt;So now coming to the point, let’s say we locked the &lt;em&gt;DDIC&lt;/em&gt; user. To unlock it we are going to use &lt;em&gt;sap*&lt;/em&gt; user.&lt;/p&gt;

&lt;p&gt;The first step is to set the parameter &lt;strong&gt;login/no_automatic_user_sapstar = 0&lt;/strong&gt; in default profile. Set this parameter to zero in instance profile too, if this parameter exists.&lt;/p&gt;

&lt;p&gt;Next step is to delete the existing &lt;em&gt;sap*&lt;/em&gt; user in &lt;em&gt;usr02&lt;/em&gt; table.&lt;/p&gt;

&lt;p&gt;For this connect to SQL with system database as follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sqlplus "/as sysdba"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check if the &lt;em&gt;sap*&lt;/em&gt; user exists in the table we execute the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select * from &amp;lt;db_schema&amp;gt;.USR02 where MANDT='000' and BNAME='SAP*'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have to pass the required client to &lt;em&gt;MANDT&lt;/em&gt; parameter and &lt;em&gt;SAP*&lt;/em&gt; user to &lt;em&gt;BNAME&lt;/em&gt; parameter. Enter your database schema in place of &lt;em&gt;db_schema&lt;/em&gt; in the above command.&lt;/p&gt;

&lt;p&gt;Now we delete the &lt;em&gt;sap*&lt;/em&gt; user, if it exists, using the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;delete from &amp;lt;db_schema&amp;gt;.USR02 where MANDT='000' and BNAME='SAP*'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this confirm by again running the command;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select * from &amp;lt;db_schema&amp;gt;.USR02 where MANDT='000' and BNAME='SAP*'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you will be able to login to &lt;em&gt;sap*&lt;/em&gt; user using the password &lt;em&gt;pass&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Once logged in go to &lt;em&gt;su01&lt;/em&gt; t-code and reset the &lt;em&gt;DDIC&lt;/em&gt; user password, thereby unlocking it.&lt;/p&gt;

&lt;p&gt;Hope you found the post useful. Please keep an eye on this page for more such posts. Thank you!! 😊&lt;/p&gt;

</description>
      <category>sap</category>
      <category>sapbasis</category>
      <category>sapgui</category>
      <category>usermanagement</category>
    </item>
    <item>
      <title>SAP Basis snippets #6</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Mon, 20 May 2024 16:31:00 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/sap-basis-snippets-6-4p9c</link>
      <guid>https://dev.to/ashwinsharmap/sap-basis-snippets-6-4p9c</guid>
      <description>&lt;h2&gt;
  
  
  saplikey command
&lt;/h2&gt;

&lt;p&gt;To run saplikey command, switch to &lt;code&gt;&amp;lt;sid&amp;gt;adm&lt;/code&gt; user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;su - &amp;lt;sid&amp;gt;adm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The saplikey command follows the below syntax.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;saplikey pf=&amp;lt;profile&amp;gt; [trace=&amp;lt;level&amp;gt;] &amp;lt;command&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here in &lt;code&gt;&amp;lt;profile&amp;gt;&lt;/code&gt; we give our instance profile path.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;command&amp;gt;&lt;/code&gt; parameter takes the below listed values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-help&lt;/code&gt; =&amp;gt;&lt;/strong&gt; displays the usage text&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-version&lt;/code&gt; =&amp;gt;&lt;/strong&gt; displays the version of the license key library&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-get&lt;/code&gt; =&amp;gt;&lt;/strong&gt; displays system information along with hardware key&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-number&lt;/code&gt; =&amp;gt;&lt;/strong&gt; fetches installation number&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-install &amp;lt;filename&amp;gt;&lt;/code&gt; =&amp;gt;&lt;/strong&gt; Install permanent license keys from a file&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-show&lt;/code&gt; =&amp;gt;&lt;/strong&gt; Display all installed license keys&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-temp &amp;lt;product&amp;gt;&lt;/code&gt; =&amp;gt;&lt;/strong&gt; Creates a temporary license key for the given product&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-delete &amp;lt;SID&amp;gt; &amp;lt;HW Key&amp;gt; &amp;lt;product&amp;gt;&lt;/code&gt; =&amp;gt;&lt;/strong&gt; deletes license keys&lt;/p&gt;

&lt;p&gt;So, to get the hardware key of a system, use the get command as follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;saplikey pf=&amp;lt;instance profile path&amp;gt; -get 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To list out existing licenses (both valid and invalid) in a system, we use the show command. (NOTE: Here the hardware keys for which the licenses are generated would be displayed. So, the hardware key here and the one obtained from -get command will differ if the license is invalid).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;saplikey pf=&amp;lt;instance profile path&amp;gt; -show
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deleting an existing license is done as given below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;saplikey pf=&amp;lt;instance profile path&amp;gt; -delete &amp;lt;SID&amp;gt; &amp;lt;Hardware key&amp;gt; &amp;lt;Product mentioned in license key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install a new license, we first login to SAP marketplace. Then go to license keys option. Then generate and download the required license.&lt;/p&gt;

&lt;p&gt;Place the downloaded file in any path in the host (Here for example we placed it under &lt;code&gt;/usr/sap/&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Then use &lt;strong&gt;saplikey&lt;/strong&gt; install command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;saplikey pf=&amp;lt;profile&amp;gt; -install /usr/sap/license.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sap</category>
      <category>sapbasis</category>
      <category>saplikey</category>
      <category>license</category>
    </item>
    <item>
      <title>SAP Basis snippets #5</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Mon, 13 May 2024 02:30:00 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/sap-basis-snippets-5-41ca</link>
      <guid>https://dev.to/ashwinsharmap/sap-basis-snippets-5-41ca</guid>
      <description>&lt;h2&gt;
  
  
  Installing license via telnet
&lt;/h2&gt;

&lt;p&gt;Today we will see the steps to install license using telnet.&lt;/p&gt;

&lt;p&gt;Login to telnet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;telnet localhost 5&amp;lt;instance no.&amp;gt;08
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It asks for your username and password. Give your java administrator username and password.&lt;/p&gt;

&lt;p&gt;Now type the below command to add the licensing menu.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add licensing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To know the hardware id of your sap system, give the below command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mshardwareid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The below command displays the SID.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mssystemid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Download the license .txt file and place it in your host.&lt;/p&gt;

&lt;p&gt;To install a license, we use the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;install_license -file &amp;lt;path where the license file is placed&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The below command lists out the installed licenses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LIST_LICENSES
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For deleting we use the command &lt;strong&gt;delete_license&lt;/strong&gt;. But we have to pass an additional parameter along with this.&lt;/p&gt;

&lt;p&gt;To delete all the licenses, we use the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;delete_license -all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To delete a license of particular index as returned by &lt;strong&gt;LIST_LICENSES&lt;/strong&gt; command, we use the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;delete_license &amp;lt;index number&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sap</category>
      <category>sapbasis</category>
      <category>telnet</category>
      <category>license</category>
    </item>
    <item>
      <title>SAP Basis snippets #4</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Mon, 06 May 2024 15:21:00 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/sap-basis-snippets-4-3kbh</link>
      <guid>https://dev.to/ashwinsharmap/sap-basis-snippets-4-3kbh</guid>
      <description>&lt;h2&gt;
  
  
  Sybase DB start/stop commands
&lt;/h2&gt;

&lt;p&gt;First switch to the &lt;code&gt;syb&amp;lt;sid&amp;gt;&lt;/code&gt; user&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;su - syb&amp;lt;sid&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logon to the isql interface&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;isql -U &amp;lt;username&amp;gt; -P &amp;lt;password -S &amp;lt;SID&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To stop the sybase db, use the below command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shutdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Execute ‘go’ after ‘shutdown’ command, which completes the execution of the latter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To start the Sybase DB, we run &lt;strong&gt;startserver -f RUN_SID&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For this we need to go to the location of the &lt;strong&gt;RUN_SID&lt;/strong&gt; file, which is generally present in &lt;code&gt;/sybase/&amp;lt;SID&amp;gt;/ASE*/install/&lt;/code&gt; path.&lt;/p&gt;

&lt;p&gt;Once inside this directory, run the below commands as &lt;code&gt;syb&amp;lt;SID&amp;gt;&lt;/code&gt; user&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;startserver -f RUN_SID

startserver -f RUN_SID_BS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sap</category>
      <category>sapbasis</category>
      <category>database</category>
      <category>sybase</category>
    </item>
    <item>
      <title>SAP Basis snippets #3</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Mon, 29 Apr 2024 13:45:00 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/sap-basis-snippets-3-2cap</link>
      <guid>https://dev.to/ashwinsharmap/sap-basis-snippets-3-2cap</guid>
      <description>&lt;h2&gt;
  
  
  Start/Stop commands for MaxDB
&lt;/h2&gt;

&lt;p&gt;First switch to the &lt;code&gt;sqd&amp;lt;sid&amp;gt;&lt;/code&gt; user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;su - sqd&amp;lt;sid&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then logon to database manager command line interface&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dbmcli -d &amp;lt;SID&amp;gt; -u &amp;lt;username&amp;gt;,&amp;lt;password&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once logged in to dbmcli using your details, execute the below commands.&lt;/p&gt;

&lt;p&gt;Stop command 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db_offline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start command 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db_online
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check db state 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db_state
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sap</category>
      <category>sapbasis</category>
      <category>maxdb</category>
      <category>database</category>
    </item>
    <item>
      <title>SAP Basis Snippets #2</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Mon, 22 Apr 2024 01:30:00 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/sap-basis-snippets-2-4i97</link>
      <guid>https://dev.to/ashwinsharmap/sap-basis-snippets-2-4i97</guid>
      <description>&lt;h2&gt;
  
  
  Start and stop commands for Hana database
&lt;/h2&gt;

&lt;p&gt;First login to &lt;code&gt;&amp;lt;sid&amp;gt;adm&lt;/code&gt; user of hana database&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;su  - &amp;lt;sid&amp;gt;adm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Execute the below command&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HDB start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This executes the HDB program in path &lt;code&gt;/usr/sap/&amp;lt;SID&amp;gt;/HDB&amp;lt;instance no.&amp;gt;/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The below command for stopping also uses same HDB program&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HDB stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One more program that can be used for start/stop of Hana DB is the sapcontrol program located in the path &lt;code&gt;/usr/sap/hostctrl/exe/&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The start command is as follows&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sapcontrol -nr &amp;lt;instance no.&amp;gt; -function Start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The stop command is as given below&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sapcontrol -nr &amp;lt;instance no.&amp;gt; -function Stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sap</category>
      <category>sapbasis</category>
      <category>hana</category>
      <category>saphana</category>
    </item>
    <item>
      <title>SAP Basis snippets #1</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Sun, 14 Apr 2024 12:30:39 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/sap-basis-snippets-1-3oma</link>
      <guid>https://dev.to/ashwinsharmap/sap-basis-snippets-1-3oma</guid>
      <description>&lt;h2&gt;
  
  
  DB2 database operations
&lt;/h2&gt;

&lt;p&gt;In this post let’s look at some of the basic db2 database commands.&lt;/p&gt;

&lt;p&gt;• Logging into database&lt;/p&gt;

&lt;p&gt;&lt;code&gt;su - db2&amp;lt;sid&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;All the below commands need to be executed as db2 user&lt;/p&gt;

&lt;p&gt;• Checking db2 status&lt;/p&gt;

&lt;p&gt;&lt;code&gt;db2pd -&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;• Starting db2&lt;/p&gt;

&lt;p&gt;db2start&lt;/p&gt;

&lt;p&gt;• Stopping db2&lt;/p&gt;

&lt;p&gt;&lt;code&gt;db2stop&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;• Check the installed db2 version and the path&lt;/p&gt;

&lt;p&gt;&lt;code&gt;db2ls&lt;/code&gt;&lt;/p&gt;

</description>
      <category>sap</category>
      <category>sapbasis</category>
      <category>database</category>
      <category>db2</category>
    </item>
    <item>
      <title>Linux file permissions</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Mon, 05 Dec 2022 17:13:11 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/linux-file-permissions-4ff</link>
      <guid>https://dev.to/ashwinsharmap/linux-file-permissions-4ff</guid>
      <description>&lt;p&gt;Every file/directory has three types of owners in Linux. The permissions for each of these 3 owners is represented in Numeric (group of octal representation) or symbolic representation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Symbolic Notation
&lt;/h3&gt;

&lt;p&gt;The Linux permissions are symbolically denoted similar to something like &lt;strong&gt;-rwxrw-w--&lt;/strong&gt; or &lt;strong&gt;drw-rw-rwx&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhnifg61n1impg6fswmtd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhnifg61n1impg6fswmtd.jpg" alt="Image description" width="800" height="755"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here in symbolic notation, the first letter will either be a ‘&lt;strong&gt;d&lt;/strong&gt;’ or &lt;strong&gt;-&lt;/strong&gt; (blank). Here a ‘&lt;strong&gt;d&lt;/strong&gt;’ means, it is a directory and &lt;strong&gt;-&lt;/strong&gt; means it is a file or it is not a directory. Next coming to the notations ‘&lt;strong&gt;r&lt;/strong&gt;’, ‘&lt;strong&gt;w&lt;/strong&gt;’, and ‘&lt;strong&gt;x&lt;/strong&gt;’. ‘&lt;strong&gt;r&lt;/strong&gt;’ represents the permission to read a file or directory. ‘&lt;strong&gt;w&lt;/strong&gt;’ represents the write permission on a file/directory. ‘&lt;strong&gt;x&lt;/strong&gt;’ implies the execute permission on a file/directory.&lt;/p&gt;

&lt;p&gt;The next three places after the ‘&lt;strong&gt;d&lt;/strong&gt;’ bit is for user permission, here &lt;strong&gt;rwx&lt;/strong&gt; is given in order to represent the user has read, write and execute permission. If the user is not given either one or more of these permissions, then it is simply represented by a &lt;strong&gt;-&lt;/strong&gt; (dash). Similarly for group permissions, the next three bits are used, where the permission assigned are represented by the respective letters and a dash is used for the unassigned permissions. Same goes for the other permissions which are represented by the last three bits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Octal notation
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64e1570ptk135bs2vjqw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64e1570ptk135bs2vjqw.jpg" alt="Image description" width="800" height="1064"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Four numbers are used for the purpose of providing the permissions for a file or directory. The first of these four numbers is reserved for assigning the special permissions, which we will look into in the special file permissions section of this article. The second number is for assigning the user permissions. The third number is for assigning the group permissions and the fourth number is for assigning the other permissions.&lt;/p&gt;

&lt;p&gt;Here each permission is assigned based on the weight calculated after examining their symbolic notation. In &lt;strong&gt;rwx&lt;/strong&gt;, ‘&lt;strong&gt;r&lt;/strong&gt;’ is considered as having weight 4, ‘&lt;strong&gt;w&lt;/strong&gt;’ has weight 2 and ‘&lt;strong&gt;x&lt;/strong&gt;’ has weight 1. So these weights are added up to form an Octal notation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For example:&lt;br&gt;
&lt;strong&gt;chmod 4777 filename&lt;/strong&gt; denotes &lt;strong&gt;-rwsrwxrwx&lt;/strong&gt;, here only setuid special permission is set. Also this is a file so the first bit is &lt;strong&gt;-&lt;/strong&gt;.&lt;br&gt;
&lt;strong&gt;chmod 7757 directoryname&lt;/strong&gt; denotes &lt;strong&gt;drwsrwsrwt&lt;/strong&gt;, where all the special permissions are set. Since this is a directory, first bit is &lt;strong&gt;d&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Special file permissions
&lt;/h3&gt;

&lt;p&gt;There are 3 types of special permissions in Linux.&lt;/p&gt;

&lt;p&gt;When these permissions are assigned, the user who runs the file or directory assumes the role of the owner of that particular file or directory.&lt;/p&gt;

&lt;p&gt;The three special permissions are setuid (Set User id), setgid (Set group id) and sticky bit.&lt;/p&gt;

&lt;h4&gt;
  
  
  setuid permission:
&lt;/h4&gt;

&lt;p&gt;Set user identification when set, gives the user who runs an operation on that particular file or directory the powers of the owner of that file or directory. i.e., when this special permission is set, the user who runs an operation, indirectly performs the operation as the owner of that file or directory.&lt;/p&gt;

&lt;h4&gt;
  
  
  setgid permission:
&lt;/h4&gt;

&lt;p&gt;When this special permission is set, the user who runs any operation on a directory or file gets the same privileges of the owner of that directory or file.&lt;/p&gt;

&lt;h4&gt;
  
  
  Sticky bit:
&lt;/h4&gt;

&lt;p&gt;This special permission is used to prevent unauthorized users from deleting a file or directory. By setting sticky bit, the files or directory can be deleted only by the owner of that file or directory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting the special permissions using symbolic representation
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;For assigning&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(i) setuid:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;chmod u+s filename/directoryname&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;(ii) setgid:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;chmod g+s filename/directoryname&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;(iii) sticky bit:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;chmod +t filename/directoryname&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;For removing&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(i) setuid:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;chmod u-s filename/directoryname&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;(ii) setgid:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;chmod g-s filename/directoryname&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;(iii) sticky bit:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;chmod -t filename/directoryname&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  How to set special bits using numeric notation
&lt;/h3&gt;

&lt;p&gt;The special permissions setuid, setgid and sticky bit are denoted as 4,2 and 1 respectively in octal notation representation. So, in the reserved first bit of numeric notation, we give 7 (4+2+1) if we want to give all the special permission to a directory or file. For removing all the special permissions, just give the first number of numeric notation as zero. For removing certain special permissions, just leave out their weights (4,2, or 1) from the first number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt;&lt;br&gt;
The setuid, setgid and sticky bit permission are of no use if the executable bit (&lt;strong&gt;x&lt;/strong&gt;) is not set in the respective user, group or other permissions. We can identify when the executable bit is not set, as the set bit will be denoted by upper case ‘&lt;strong&gt;S&lt;/strong&gt;’ and sticky bit will be denoted as upper case ‘&lt;strong&gt;T&lt;/strong&gt;’. When the respective executable bits are set, the setuid, setgid permissions are represented by lower case ‘&lt;strong&gt;s&lt;/strong&gt;’ and sticky bit is represented by lowercase ‘&lt;strong&gt;t&lt;/strong&gt;’ and this time, the special permissions work.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;PS: This is just a short post of my learnings. So there may not be in depth information of the topic. Will be adding to it as and when I learn more.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Steps in Building a Machine Learning Project</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Sat, 23 Jan 2021 16:56:02 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/steps-in-building-a-machine-learning-project-3o7m</link>
      <guid>https://dev.to/ashwinsharmap/steps-in-building-a-machine-learning-project-3o7m</guid>
      <description>&lt;p&gt;In this post, we will be discussing the basic steps in building a machine learning project. The process of building an ML project includes collecting the dataset, cleaning it, processing the data, training and testing of the model and deploying it. All the steps are explained briefly below.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Data collection&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Data collection is the first step in developing any machine learning model. The source and type of data play an important role in determining whether the upcoming steps will be easy or complex. If we acquire data with less missing values, with only the most important features which determine the output and less ambiguous data, it would be easy for us to process it in the further steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Data cleaning&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In data cleaning, we check for any missing values, duplicate rows, features that don't have a high influence on the output and other unwanted values. The relations between the remaining input and output features are studied through plots and graphs. We remove these unnecessary data and make our dataset clean. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Data preprocessing&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Preprocessing of data means to find a suitable measure to bring the input features into a common standard like mean, median, mode etc. The categorical features if any should be encoded to numerical values. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Model Training&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;After the data is cleaned and processed, now we split the dataset into train data and test data. The training data is used to train the model while the test data is used to test how much our model performs and calculate its accuracy scores. In most cases, this ratio is taken as 70:30 or 80:20. It all depends on the use case. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Evaluation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Here in this step, the test data is fed into the already trained model. The efficiency of our model is determined through the scores we obtain at the output. There are various parameters like accuracy, F1-score, r2 score etc. which determines how much accurate is our model.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Deployment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This is the final stage in a Machine Learning project. Once our model meets the standard set by us, it is time to deploy them. There are various platforms like Heroku, Netlify etc. which may be chosen as per the requirement of our project.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;So that is it for this post. Hope you learnt something new out of it. Thank you for reading.&lt;/em&gt;😊&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>process</category>
    </item>
    <item>
      <title>any() and all() in Python</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Thu, 07 Jan 2021 17:33:58 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/any-and-all-in-python-42e3</link>
      <guid>https://dev.to/ashwinsharmap/any-and-all-in-python-42e3</guid>
      <description>&lt;p&gt;In this post, we will be looking into any() and all() functions in Python. &lt;br&gt;
First, let us discuss the any() function.&lt;/p&gt;
&lt;h3&gt;
  
  
  👉&lt;strong&gt;any()&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The any() function takes an iterable as an argument : &lt;strong&gt;any(iterable)&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;The iterable can be a list, tuple or dictionary.&lt;/p&gt;

&lt;p&gt;The any() function returns 'True' if any element in the iterable is true. &lt;/p&gt;

&lt;p&gt;However, it returns 'False' if the iterable passed to the function is empty.&lt;/p&gt;

&lt;p&gt;This function is similar to the code block below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def any(iterable):
    for element in iterable:
        if element:
            return True
    return False  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below is an example of using any for returning 'True' for numbers greater than 3. &lt;/p&gt;

&lt;p&gt;Here we have used list comprehension to keep the code simple.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list=[2,3,4,5,6,7]
print(any([num&amp;gt;3 for num in list]))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The output is 'True' as 4,5,6 and 7 are greater than 3.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Next, we look into the all() function.&lt;/p&gt;

&lt;h3&gt;
  
  
  👉&lt;strong&gt;all()&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The all() function also takes an iterable as an argument: &lt;strong&gt;all(iterable)&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;all() function returns 'True' only if all the items in the iterable are true.&lt;/p&gt;

&lt;p&gt;Even if one item is false, it returns 'False'. However, if the iterable is empty, it returns 'True'.&lt;/p&gt;

&lt;p&gt;all() function is similar to the code block below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def all(iterable):
    for element in iterable:
        if not element:
            return False
    return True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below is an example of using any for returning True for numbers greater than 3.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list=[1,2,3,3]
print(all([num&amp;gt;3 for num in list]))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The output is False as no number is greater than 3 in the provided list.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;In dictionaries, both all() and any() functions to check the key for returning True or False and not the values.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>functions</category>
    </item>
    <item>
      <title>What is Logistic Regression</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Fri, 25 Dec 2020 11:22:57 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/what-is-logistic-regression-3oog</link>
      <guid>https://dev.to/ashwinsharmap/what-is-logistic-regression-3oog</guid>
      <description>&lt;p&gt;As you may be knowing Logistic Regression is a Machine Learning algorithm. It is used for binary classification problems. We also have multiclass logistic regression, where we basically re-run the binary classification multiple times.&lt;/p&gt;

&lt;p&gt;It is a linear algorithm with a non-linear transform at the output. The input values are combined linearly using weights to predict the output value. The output value which is being modelled is a binary value rather than a numeric value.&lt;/p&gt;

&lt;p&gt;Suppose we have the results of a set of students, where the criteria for passing is that the student should score 50% or more. Else the student is classified as failed.&lt;/p&gt;

&lt;p&gt;We can classify this problem statement using linear regression. But if our data contains some outliers in the test data, it will affect the orientation of the best fit line.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;br&gt;
Outliers are the points that are apart from the usual group of points. These points can have a strong influence on the orientation of the best fit line.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So we go on with Logistic regression for such use cases.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd94lnpkvtxiqm1zejd3h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd94lnpkvtxiqm1zejd3h.png" alt="Alt Text" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Sigmoid Function&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A sigmoid function is a function which limits the value of the output in the range between 0 and 1. The graph and the equation of the sigmoid function are given as follows.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fprw71ah1kftrh7qhc3ar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fprw71ah1kftrh7qhc3ar.png" alt="Alt Text" width="800" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftx18we6rc5ykt17u92pq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftx18we6rc5ykt17u92pq.png" alt="Alt Text" width="264" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The value x in the equation is the cost function we calculate using the output and weights. The sigmoid function makes sure that the output value is classified in between 0 and 1 for any large value of x.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Cost Function&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The cost function in the case of logistic regression is given by&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F020zk2ml0yjf6wvi0hos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F020zk2ml0yjf6wvi0hos.png" alt="Alt Text" width="280" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It should be maximum for correct classification to happen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Suppose passing students are considered as positive output &amp;amp; failed students as negative output. Also, if the points classified above the classifying plane is taken as positive and those below the line are taken as negative. i.e., the value of weight Wi. &lt;/li&gt;
&lt;li&gt;The cost function is determined by the product of these two and hence if the point is correctly classified, the cost function will be positive and if it is incorrectly classified, the cost function will become negative. &lt;/li&gt;
&lt;li&gt;So we have to make sure that we have considered the desired weight value, to make sure that the points are correctly classified. &lt;/li&gt;
&lt;li&gt;Hence by looking at the cost function, we can say that whether a particular entry is correctly classified or not.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope you found this post useful. 😊😊&lt;/p&gt;

&lt;p&gt;You can find me on &lt;a href="https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fembeds.hashnode.com%2F&amp;amp;ref_src=twsrc%5Etfw&amp;amp;region=follow_link&amp;amp;screen_name=ashwinsharmap&amp;amp;tw_p=followbutton"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>regression</category>
      <category>logisticregression</category>
    </item>
    <item>
      <title>Say no to these algorithms in practice</title>
      <dc:creator>Ashwin Sharma P</dc:creator>
      <pubDate>Sun, 06 Dec 2020 15:46:00 +0000</pubDate>
      <link>https://dev.to/ashwinsharmap/say-no-to-these-algorithms-in-practice-3pid</link>
      <guid>https://dev.to/ashwinsharmap/say-no-to-these-algorithms-in-practice-3pid</guid>
      <description>&lt;p&gt;So here we will be discussing briefly Bogosort and Bogobogosort, which are two inefficient algorithms.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; These are just for educational purposes. Never use these in real-life applications. ☠☠&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Bogosort:
&lt;/h3&gt;

&lt;p&gt;Bogosort first checks whether the list is already sorted. It checks over the entire list by checking if the adjacent pair is correctly ordered. If it is not in order, then it shuffles all the list in random order and again starts over. This process goes on till the list is sorted.&lt;/p&gt;

&lt;p&gt;When we get into the time complexity of this algorithm, we get to know why it is an inefficient algorithm.&lt;/p&gt;

&lt;p&gt;The logic of Bogsort is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random
from random import shuffle
def sequence_sorted(data):
    return (data[i]&amp;lt;=data[i+1] for i in range (len(data)-1))

def bogosort(data):
    while not sequence_sorted(data):
        shuffle(data)
    return data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The best-case time complexity is achieved when the list or sequence is already sorted. Best case complexity is &lt;strong&gt;O(n)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The average case complexity is &lt;strong&gt;O(n*n!)=O((n+1)!)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The worst case is when the list takes forever to get sorted. We have no guarantee that this algorithm will return a sorted output as it randomly shuffles all the entries each time.&lt;br&gt;
The worst-case time complexity is &lt;strong&gt;O(∞)&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bogobogosort:
&lt;/h3&gt;

&lt;p&gt;We also have an algorithm called Bogobogosort, which checks the first 2 elements of the list and bogosorts them. In the next round, it checks the first 3 elements and bogosorts them and this process continues till it reaches the end. If it finds that the list is not in order, it starts the process again by bogosorting the first 2 elements.&lt;/p&gt;

&lt;p&gt;The average time complexity of this algorithm is &lt;strong&gt;O(N! * 1! * 2! * 3! * .... * N!)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hope you learnt some new concepts. Thank you for reading.😊&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>sortingalgorithms</category>
      <category>bogosort</category>
      <category>bogobogosort</category>
    </item>
  </channel>
</rss>
