tag:blogger.com,1999:blog-33559871132316599852024-02-20T02:43:03.514-08:00 _Beginner 2 Computer ScienceSudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.comBlogger128125tag:blogger.com,1999:blog-3355987113231659985.post-8875110979799161732018-06-16T03:49:00.000-07:002018-06-17T09:41:11.697-07:00Serverless Architecture<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-size: 12pt;">In
simple words Serverless Architecture or Serverless computing is where developer
doesn't need to worry about managing a server, server management and capacity
planning decisions are completely hidden from developer.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://image.slidesharecdn.com/whentofaas-170314084555/95/serverless-when-to-faas-4-638.jpg?cb=1489481283" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="359" data-original-width="638" height="225" src="https://image.slidesharecdn.com/whentofaas-170314084555/95/serverless-when-to-faas-4-638.jpg?cb=1489481283" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">what is Serverless Architecture ?</td></tr>
</tbody></table>
<br>
</div></div><a href="https://beginer2cs.blogspot.com/2018/06/serverless-architecture.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Anonymoushttp://www.blogger.com/profile/02154199808544727378noreply@blogger.com4tag:blogger.com,1999:blog-3355987113231659985.post-89684792085046411852018-05-01T00:41:00.002-07:002018-05-01T00:51:41.343-07:00How to enable inbuilt Linux subsytem in Windows 10 <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
Windows 10 provide inbuilt Linux subsystem , lets see how to enable it in your System.<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://proxy.duckduckgo.com/iur/?f=1&image_host=http%3A%2F%2Fwww.omgubuntu.co.uk%2Fwp-content%2Fuploads%2F2017%2F05%2Flinux-distros-windows-1-1.jpg&u=https://www.omgubuntu.co.uk/wp-content/uploads/2017/05/linux-distros-windows-1-1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="533" data-original-width="800" height="266" src="https://proxy.duckduckgo.com/iur/?f=1&image_host=http%3A%2F%2Fwww.omgubuntu.co.uk%2Fwp-content%2Fuploads%2F2017%2F05%2Flinux-distros-windows-1-1.jpg&u=https://www.omgubuntu.co.uk/wp-content/uploads/2017/05/linux-distros-windows-1-1.jpg" width="400"></a></div>
<br>
<b>Step 1 : </b>Go to Windows update and change uses mode to Developer Mode <br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr_ien-axP3yi60VyOQ24zqnsbL9-Ws8SG-SgrpaC8C4eSxpyeOMr3_xvsnMy0903KW9y0AKWA-ljq9mRO9bLR5I_JAq4YzW8hzDjfQqlrNkrRpJo4QHCjjHxuY8nrwVGEYDeUgtR6Zhju/s1600/sc1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="768" data-original-width="1366" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr_ien-axP3yi60VyOQ24zqnsbL9-Ws8SG-SgrpaC8C4eSxpyeOMr3_xvsnMy0903KW9y0AKWA-ljq9mRO9bLR5I_JAq4YzW8hzDjfQqlrNkrRpJo4QHCjjHxuY8nrwVGEYDeUgtR6Zhju/s640/sc1.png" width="640"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">select developer Mode in Windows update </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div><a href="https://beginer2cs.blogspot.com/2018/05/how-to-enable-inbuilt-linux-subsytem-in.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Anonymoushttp://www.blogger.com/profile/04980641044341647717noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-16899557582348525062017-10-01T04:25:00.000-07:002017-10-01T04:25:20.730-07:00How to check Palindrome<div dir="ltr" style="text-align: left;" trbidi="on">
Check if a string is palindrome or not is one of most common question we encountered during our basic days.<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://static1.squarespace.com/static/50f81721e4b0a63b10745c06/t/52fb7ad6e4b0f874b619ff33/1392212695699/Palindrome%2B1%2Blowres.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="450" data-original-width="800" height="225" src="https://static1.squarespace.com/static/50f81721e4b0a63b10745c06/t/52fb7ad6e4b0f874b619ff33/1392212695699/Palindrome%2B1%2Blowres.jpg" width="400"></a></div>
<div>
<div>
<br></div>
</div>
<div>
Let's Solve this problem with a Naive but efficient approach in this case.</div>
<div>
<br></div>
<h4 style="text-align: left;">
<b class="">Pseudocode :</b></h4>
<div>
<ol style="text-align: left;">
<li><b>i=0, j=n</b></li>
<li><b>while i < j:</b></li>
<li><b> c</b>heck if i'th element is not equal to j'th</li>
<li> then return False </li>
<li> else i++,j--</li>
<li>loop end</li>
<li>return True</li>
</ol>
<div>
<br>
</div></div></div><a href="https://beginer2cs.blogspot.com/2017/10/how-to-check-palindrome.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com2Maddimadugu Road, Telangana 509201, India16.299051014581828 79.1015625-13.191617485418174 37.7929685 45.789719514581833 120.4101565tag:blogger.com,1999:blog-3355987113231659985.post-54454973613241190492016-06-27T05:28:00.002-07:002017-01-25T07:56:31.759-08:00When to use our own copy constructor while compiler already provides it<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<br></h2>
Actually compiler provided copy constructor copies all the values of members. So we are using a dynamic allocated member then only address of that member is copied in new object's member. It does not allocate new memory.<br>
<br>
<ol class="cpp" style="background: rgb(247, 247, 247); color: #acacac; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace, serif; font-size: 12px; line-height: 24px; margin: 0px; padding: 0px 0px 0px 55px;">
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="co2" style="color: #339900;">#include <iostream></span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="co2" style="color: #339900;">#include<cstring></span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="co2" style="color: #339900;">#include<cstdio></span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw2" style="color: blue;">using</span> <span class="kw2" style="color: blue;">namespace</span> std<span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw2" style="color: blue;">class</span> XYZ</div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">{</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw2" style="color: blue;">public</span><span class="sy4" style="color: teal;">:</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw4" style="color: blue;">char</span> <span class="sy2" style="color: #000040;">*</span>p<span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
XYZ<span class="br0" style="color: green;">(</span><span class="kw4" style="color: blue;">char</span> <span class="sy2" style="color: #000040;">*</span>name,<span class="kw4" style="color: blue;">int</span> l<span class="br0" style="color: green;">)</span><span class="br0" style="color: green;">{</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
p<span class="sy1" style="color: navy;">=</span><span class="kw3" style="color: #0000dd;">new</span> <span class="kw4" style="color: blue;">char</span><span class="br0" style="color: green;">[</span>l<span class="sy2" style="color: #000040;">+</span><span class="nu0" style="color: #0000dd;">1</span><span class="br0" style="color: green;">]</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw3" style="color: #0000dd;">strcpy</span><span class="br0" style="color: green;">(</span>p,name<span class="br0" style="color: green;">)</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
</div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">}</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">}</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
</div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw4" style="color: blue;">int</span> main<span class="br0" style="color: green;">(</span><span class="br0" style="color: green;">)</span> <span class="br0" style="color: green;">{</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
XYZ obj1<span class="br0" style="color: green;">(</span><span class="st0" style="color: red;">"str"</span>,<span class="nu0" style="color: #0000dd;">3</span><span class="br0" style="color: green;">)</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw3" style="color: #0000dd;">printf</span><span class="br0" style="color: green;">(</span><span class="st0" style="color: red;">"content of obj1.p is : %u<span class="es1" style="color: #000099; font-weight: bold;">\n</span>"</span>,obj1.<span class="me1" style="color: #007788;">p</span><span class="br0" style="color: green;">)</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
XYZ obj2<span class="sy1" style="color: navy;">=</span>obj1<span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw3" style="color: #0000dd;">printf</span><span class="br0" style="color: green;">(</span><span class="st0" style="color: red;">"content of obj2.p is : %u"</span>,obj2.<span class="me1" style="color: #007788;">p</span><span class="br0" style="color: green;">)</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background: rgb(248, 248, 248); border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">}</span></div>
</li>
</ol>
<div>
<span style="color: green; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;">So here content of member p of obj1 and obj2 is same which is base address of string str</span></span></div>
<div>
<span style="color: green; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;">Note that memory is allocated once and pointer to that memory is set for both objects. So default copy constructor only copying members value that is value of obj1.p ( which is address of string "str" ) is copied to obj2.p</span></span></div>
<div>
<span style="color: green; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;"></span></span><br>
</div></div><a href="https://beginer2cs.blogspot.com/2016/06/when-to-use-our-own-copy-constructor.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>vikashttp://www.blogger.com/profile/06427237125793283224noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-9924602154315226302016-06-25T08:19:00.000-07:002016-06-25T08:23:01.726-07:00Private Constructor Function and Singleton Pattern<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="height: 0px; text-align: left;">
</h4>
<div>
In C++ a constructor can be made private. But what is the use of private constructor ?<br />
<br />
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: "Times New Roman"; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
</div>
<br /></div>
<div>
<div>
Think that you want to create a class in such a way that only one object can be created for this class something called Singleton pattern in C++.</div>
<div>
Below is the program to do this.</div>
</div>
<div>
<br /></div>
<div>
<ol class="cpp" style="background: rgb(247, 247, 247); color: #acacac; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace, serif; font-size: 12px; line-height: 24px; margin: 0px; padding: 0px 0px 0px 55px;">
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="co2" style="color: #339900;">#include<bits/stdc++.h></span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw2" style="color: blue;">using</span> <span class="kw2" style="color: blue;">namespace</span> std<span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw2" style="color: blue;">class</span> ABC</div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">{</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw2" style="color: blue;">public</span><span class="sy4" style="color: teal;">:</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw4" style="color: blue;">int</span> t<span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw4" style="color: blue;">static</span> ABC creator<span class="br0" style="color: green;">(</span><span class="br0" style="color: green;">)</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">{</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw4" style="color: blue;">static</span> ABC x<span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw1" style="color: blue;">return</span> x<span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">}</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw2" style="color: blue;">private</span> <span class="sy4" style="color: teal;">:</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
ABC<span class="br0" style="color: green;">(</span><span class="br0" style="color: green;">)</span><span class="br0" style="color: green;">{</span> t<span class="sy1" style="color: navy;">=</span><span class="nu0" style="color: #0000dd;">10</span><span class="sy4" style="color: teal;">;</span><span class="br0" style="color: green;">}</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">}</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw4" style="color: blue;">int</span> main<span class="br0" style="color: green;">(</span><span class="br0" style="color: green;">)</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">{</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
ABC obj1<span class="sy1" style="color: navy;">=</span>ABC<span class="sy4" style="color: teal;">::</span><span class="me2" style="color: #007788;">creator</span><span class="br0" style="color: green;">(</span><span class="br0" style="color: green;">)</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="kw3" style="color: #0000dd;">cout</span><span class="sy1" style="color: navy;"><<</span><span class="st0" style="color: red;">" Value of t= "</span><span class="sy1" style="color: navy;"><<</span>obj1.<span class="me1" style="color: #007788;">t</span><span class="sy4" style="color: teal;">;</span></div>
</li>
<li class="li1" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de1" style="-webkit-user-select: text; background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="co1" style="color: #666666;">//ABC obj2=ABC::creator() returns same object</span></div>
</li>
<li class="li2" style="-webkit-user-select: none; background: rgb(255, 255, 255); margin: 0px 0px 0px -6px;"><div class="de2" style="-webkit-user-select: text; background: rgb(248, 248, 248); border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 1px; color: #333333; margin: 0px 0px 0px -7px; padding: 0px 8px; position: relative; vertical-align: top;">
<span class="br0" style="color: green;">}</span></div>
</li>
</ol>
<h4 style="text-align: left;">
<span style="color: blue; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;"><br /></span></span><span style="color: purple;">How it works?</span></h4>
</div>
<div>
<span style="font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;"></span></span><br />
<div>
<span style="font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;">Static function are class variable not object's so static function 'creator()' called using class_name::function_name.</span></span></div>
<span style="font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;">
</span></span>
<div>
<span style="font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;">Static object is created inside static function. So private constructor function is called which is a valid call since it is from inside of a member function. So obj1 is created and returned.</span></span></div>
<span style="font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , monospace , serif;"><span style="font-size: 12px; line-height: 24px;">
<div>
Next time when we call static function it does not create new object since object is declare as static so same will be returned.</div>
<div>
So only one object is created</div>
</span></span></div>
</div>
<div class="blogger-post-footer">by : UnBroken</div>vikashttp://www.blogger.com/profile/06427237125793283224noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-37418709728451850252016-03-16T11:26:00.000-07:002016-03-16T11:26:28.950-07:00Best way to download file in Mint/Ubuntu ..<div dir="ltr" style="text-align: left;" trbidi="on">
Linux (Debian/Mint/Ubuntu) provide really very powerful tools for lots of things. Download is a common thing that we use in daily life.<br>
Linux provide a very powerful command line tool that really enhance our download experience. <br>
It is very powerful and very convenient. Introducing to you <span style="color: red;"><b>"wget"</b></span> commond.<br>
<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTLvwuTuizcQquM3zUthke0pd4QBRjvQGIdeiAWwjLdBOfxAM4Di6KDNKNQR_UlIA4J2liyPf-Z_7V0UD-6ir0rpdnZwUd9HWt8B9oUEzFiv9rXeECi6WWU1FFMD1FFdmMGOitE9AOHyU/s1600/Screenshot+from+2016-03-16+23%253A32%253A48.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTLvwuTuizcQquM3zUthke0pd4QBRjvQGIdeiAWwjLdBOfxAM4Di6KDNKNQR_UlIA4J2liyPf-Z_7V0UD-6ir0rpdnZwUd9HWt8B9oUEzFiv9rXeECi6WWU1FFMD1FFdmMGOitE9AOHyU/s640/Screenshot+from+2016-03-16+23%253A32%253A48.png" width="640"></a></div>
<br>
</div><a href="https://beginer2cs.blogspot.com/2016/03/best-way-to-download-file-in-mintubuntu.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com2tag:blogger.com,1999:blog-3355987113231659985.post-60766942520233508942016-03-11T21:19:00.001-08:002016-03-11T21:19:46.255-08:00Quick Dive to data handeling and machine learning in Python<div dir="ltr" style="text-align: left;" trbidi="on">
<style type="text/css">
.highlight{background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .1em;padding:0em .5em;border-radius: 4px;}
.k{color: #338822; font-weight: bold;}
.kn{color: #338822; font-weight: bold;}
.mi{color: #000000;}
.o{color: #000000;}
.ow{color: #BA22FF; font-weight: bold;}
.nb{color: #338822;}
.n{color: #000000;}
.s{color: #cc2222;}
.se{color: #cc2222; font-weight: bold;}
.si{color: #C06688; font-weight: bold;}
.nn{color: #4D00FF; font-weight: bold;}
</style>
<br>
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="border-box-sizing" id="notebook" tabindex="-1">
<div class="container" id="notebook-container">
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<div id="Source-Identification-using-2-Class-of-image" style="text-align: left;">
This model show a quick way to apply different classification machine learning algorithm on data strored in CSV formate.</div>
<div id="Source-Identification-using-2-Class-of-image" style="text-align: left;">
Python provide very powerful tools like pandas, numpy, and sklearn. we exploit them a lot. </div>
<h1 id="Source-Identification-using-2-Class-of-image">
Source Identification using 2 Class of image<a class="anchor-link" href="https://www.blogger.com/blogger.g?blogID=3355987113231659985#Source-Identification-using-2-Class-of-image">¶</a></h1>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [72]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="kn">from</span> <span class="nn">sklearn.svm</span> <span class="kn">import</span> <span class="n">SVC</span>
<span class="kn">from</span> <span class="nn">sklearn.tree</span> <span class="kn">import</span> <span class="n">DecisionTreeClassifier</span>
<span class="kn">from</span> <span class="nn">sklearn.metrics</span> <span class="kn">import</span> <span class="n">accuracy_score</span>
<span class="kn">from</span> <span class="nn">sklearn.preprocessing</span> <span class="kn">import</span> <span class="n">normalize</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="kn">as</span> <span class="nn">pd</span>
<span class="c1"># matplotlib.pyplot as plt</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Understanding-Data">
Understanding Data<a class="anchor-link" href="https://www.blogger.com/blogger.g?blogID=3355987113231659985#Understanding-Data">¶</a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [2]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="n">sony</span><span class="o">=</span><span class="n">pd</span><span class="o">.</span><span class="n">read_csv</span><span class="p">(</span><span class="s2">"Sony_NONIQM.csv"</span><span class="p">)</span>
<span class="n">sony</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
73<br>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe"><thead>
<tr style="text-align: right;"><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th></tr>
</thead><tbody>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
</tbody></table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [3]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="n">nikon</span><span class="o">=</span><span class="n">pd</span><span class="o">.</span><span class="n">read_csv</span><span class="p">(</span><span class="s2">"Nikons_NONIQM.csv"</span><span class="p">)</span>
<span class="n">nikon</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">
Out[3]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th><th><br></th></tr>
</thead><tbody>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><th><br></th><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
</tbody></table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
<br>
</div></div></div></div></div></div></div><a href="https://beginer2cs.blogspot.com/2016/03/quick-dive-to-data-handeling-and.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-37977997952676653692016-03-11T20:34:00.000-08:002016-03-16T10:08:00.393-07:00Easiest way to create android supported hotspot in Linuxmint/Ubuntu/debian <div dir="ltr" style="text-align: left;" trbidi="on">
This approach doesn't require any additional tools. You can easily create access point that can be use by any mobile devices.<br>
<br>
Just fallow these simple steps:<br>
<br>
<ol style="text-align: left;">
<li>menu>preferences>network connections <div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWWNBiKsGFMFeLse7t_Z6ZeJIUFfhWHWS7Q92Sh-JrmeVTAuxhAY4sJuEOsPYUHRAv_MywPilAH8UP51iKJnLt9Q_3rHHbrJb3qWyZ45sBaLxD7Rh6PdaDAEDvbsVzth-botfItoU5QfM/s1600/Screenshot+from+2016-03-12+09%253A33%253A47.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="linux mint network connections" border="0" height="325" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWWNBiKsGFMFeLse7t_Z6ZeJIUFfhWHWS7Q92Sh-JrmeVTAuxhAY4sJuEOsPYUHRAv_MywPilAH8UP51iKJnLt9Q_3rHHbrJb3qWyZ45sBaLxD7Rh6PdaDAEDvbsVzth-botfItoU5QfM/s400/Screenshot+from+2016-03-12+09%253A33%253A47.png" width="400"></a></div>
</li>
</ol></div><a href="https://beginer2cs.blogspot.com/2016/03/easiest-way-to-create-android-supported.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-45937975758365529092016-01-30T01:14:00.000-08:002016-01-30T01:27:02.630-08:00Quick Python Pandas Basics <div dir="ltr" style="text-align: left;" trbidi="on">
<style type="text/css">
.highlight{background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .1em;padding:0em .5em;border-radius: 4px;}
.k{color: #338822; font-weight: bold;}
.kn{color: #338822; font-weight: bold;}
.mi{color: #000000;}
.o{color: #000000;}
.ow{color: #BA22FF; font-weight: bold;}
.nb{color: #338822;}
.n{color: #000000;}
.s{color: #cc2222;}
.se{color: #cc2222; font-weight: bold;}
.si{color: #C06688; font-weight: bold;}
.nn{color: #4D00FF; font-weight: bold;}
</style>
<br>
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Pandas-basics">
Lets Learn Pandas</h2>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [1]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="kn">import</span> <span class="nn">pandas</span> <span class="kn">as</span> <span class="nn">pd</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<br>
<h3>
Pandas series</h3>
<br>
pandas series is similar to numpy array, But it support lots of extra functionality like <b> Pandaseries.describe()</b>
<br>
Basic access is similar to numpy array, it support access by index( s[5] ) or slicing ( s[5:10] ).<br>
It also support vectorise operation and looping like numpy array.<br>
Implemented in C so it works very fast.<br>
<span style="color: red; font-size: large;"><br></span>
<span style="color: red; font-size: large;">Note :</span><span style="font-size: large;"> </span><span style="font-size: large;">Get Code for offline testing<span style="color: #0000ee;"><u> </u></span></span><a href="https://github.com/sudhanshuptl/Machine-Learning/blob/master/Data%20Analysis%20learning/Data_Analysis_3(pandas%20Basics).ipynb" style="font-size: x-large;" target="_blank">Github_Link</a><span style="font-size: large;"> or </span><a href="http://nbviewer.jupyter.org/github/sudhanshuptl/Machine-Learning/blob/master/Data%20Analysis%20learning/Data_Analysis_3%28pandas%20Basics%29.ipynb" style="font-size: x-large;" target="_blank">nbviewer.jupyter link</a><br>
<br>
<span style="color: #4c1130; font-size: large;"><a href="http://www.codecops.in/2016/01/basics-of-numpy-pandas.html" style="background-color: white;" target="_blank">Learn Basic of Numpy</a></span></div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="Benfits-of-Pandas-series">
Benfits of Pandas series<a class="anchor-link" href="https://www.blogger.com/blogger.g?blogID=3355987113231659985#Benfits-of-Pandas-series">¶</a></h3>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [8]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="n">s</span><span class="o">=</span><span class="n">pd</span><span class="o">.</span><span class="n">Series</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">])</span>
<span class="k">print</span> <span class="n">s</span><span class="o">.</span><span class="n">describe</span><span class="p">()</span>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt">
</div>
<div class="output_subarea output_stream output_stdout output_text">
<pre>count 5.000000
mean 4.000000
std 1.581139
min 2.000000
25% 3.000000
50% 4.000000
75% 5.000000
max 6.000000
dtype: float64
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<br>
</div></div></div></div><a href="https://beginer2cs.blogspot.com/2016/01/python-pandas-basics.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-7274856000240517392016-01-29T07:17:00.000-08:002016-01-30T00:08:02.966-08:00Basics of Numpy & Pandas<div dir="ltr" style="text-align: left;" trbidi="on">
<style type="text/css">
.highlight{background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .1em;padding:0em .5em;border-radius: 4px;}
.k{color: #338822; font-weight: bold;}
.kn{color: #338822; font-weight: bold;}
.mi{color: #000000;}
.o{color: #000000;}
.ow{color: #BA22FF; font-weight: bold;}
.nb{color: #338822;}
.n{color: #000000;}
.s{color: #cc2222;}
.se{color: #cc2222; font-weight: bold;}
.si{color: #C06688; font-weight: bold;}
.nn{color: #4D00FF; font-weight: bold;}
</style>
<br>
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Basics-of-NUmpy-&-Pandas">
<span style="font-family: inherit; font-size: large;"><span style="font-weight: normal;">Numpy and pandas are very popular packages used for data analysis. this post provide you quick guide to learn the basics of these. We assume you are familiar with vector operation . </span></span></h1>
<div style="text-align: left;">
<span style="font-family: inherit;"><span style="font-weight: normal;">Numpy is mostly written in C & pandas are written over numpy & also uses C programming language as core implementation So these two are fast as compare to general data structure provided with python.</span></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><span style="font-weight: normal;"><br></span></span></div>
<div>
<span style="font-family: inherit;">Numpy array is similar to python list but it contain all data of same data-type & it is much faster.</span></div>
<div>
<span style="font-family: inherit;">we can also treat numpy array as a vector.</span></div>
<div>
<span style="font-family: inherit;"><br></span></div>
<div>
<span style="font-family: inherit;">Pandas uses scalar instead of list or numpy array but we can also visualize it as numpy array with some advance functionalities. </span></div>
<h1 id="Basics-of-NUmpy-&-Pandas">
Example</h1>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
Numpy uses array whereas pandas used scaler </div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [2]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="Array-are-similar-to-python-list-,-but-it-all-element-must-be-of-same-data-type,-and-it-faster-than-list">
Array are similar to python list , but it all element must be of same data type, and it faster than list<a class="anchor-link" href="https://www.blogger.com/blogger.g?blogID=3355987113231659985#Array-are-similar-to-python-list-,-but-it-all-element-must-be-of-same-data-type,-and-it-faster-than-list">¶</a></h3>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [13]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="n">num</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">7</span><span class="p">,</span><span class="mi">23</span><span class="p">,</span><span class="mi">56</span><span class="p">,</span><span class="mi">23</span><span class="p">,</span><span class="mi">7</span><span class="p">,</span><span class="mi">23</span><span class="p">,</span><span class="mi">89</span><span class="p">,</span><span class="mi">43</span><span class="p">,</span><span class="mi">676</span><span class="p">,</span><span class="mi">43</span><span class="p">])</span>
<span class="n">num</span>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">
Out[13]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>array([ 3, 4, 2, 5, 7, 23, 56, 23, 7, 23, 89, 43, 676, 43])</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h4 id="Lets-see-some-of-functionality">
Lets see some of functionality<a class="anchor-link" href="https://www.blogger.com/blogger.g?blogID=3355987113231659985#Lets-see-some-of-functionality">¶</a></h4></div></div></div></div></div><a href="https://beginer2cs.blogspot.com/2016/01/basics-of-numpy-pandas.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-39861640832544280642016-01-29T06:54:00.000-08:002016-01-29T06:54:27.192-08:00Importing CSV File in Python<div dir="ltr" style="text-align: left;" trbidi="on">
<style type="text/css">
.highlight{background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .1em;padding:0em .5em;border-radius: 4px;}
.k{color: #338822; font-weight: bold;}
.kn{color: #338822; font-weight: bold;}
.mi{color: #000000;}
.o{color: #000000;}
.ow{color: #BA22FF; font-weight: bold;}
.nb{color: #338822;}
.n{color: #000000;}
.s{color: #cc2222;}
.se{color: #cc2222; font-weight: bold;}
.si{color: #C06688; font-weight: bold;}
.nn{color: #4D00FF; font-weight: bold;}
</style>
<br>
<div dir="ltr" style="text-align: left;" trbidi="on">
CSV file is one of most common used format we encounter. Let see few technique to efficiently import these data to python for better & efficient use.<br>
CSV is also known as comma separated format. you can easily write a code to import CSV data .<br>
But today we will see some of very efficient way to do so.<br>
<br>
Python provide few package like <b>CSV, unicodecsv, pandas </b>Thease packages help you to do your job.<br>
<br>
<ul style="text-align: left;">
<li><b>CSV :</b> package follow basic approach & slow , it reads data line by line & split.</li>
<li><b>unicodecsv :</b> Import data & create a list of dictionaries each data is associated with its attribute as key. So it coud be very usefull in many cases but this process is also slow</li>
<li><b>pandas :</b> This technique is very fast as compare to above two methods.</li>
</ul>
<div>
You can download & test in your computer using Ipython notebook [<a href="https://github.com/sudhanshuptl/Machine-Learning/tree/master/Data%20Analysis%20learning" target="_blank">Github_link</a>]</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="FUN-With-CSV-Files">
Example</h1>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [2]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="kn">import</span> <span class="nn">unicodecsv</span>
<span class="kn">import</span> <span class="nn">pprint</span>
<span class="kn">import</span> <span class="nn">csv</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [3]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="n">csv_file_name</span><span class="o">=</span><span class="s">"enrollments.csv"</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Json-Import-of-csv-file">
Json Import of csv file<a class="anchor-link" href="https://www.blogger.com/blogger.g?blogID=3355987113231659985#Json-Import-of-csv-file">¶</a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h4 id="Import-data-in-json-formate,-All-data-are-imported-as-string">
Import data in json formate, All data are imported as string<a class="anchor-link" href="https://www.blogger.com/blogger.g?blogID=3355987113231659985#Import-data-in-json-formate,-All-data-are-imported-as-string">¶</a></h4>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">
In [16]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2">
<pre><span class="n">enrolment</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">f</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">csv_file_name</span><span class="p">,</span><span class="s">'rb'</span><span class="p">)</span>
<span class="n">reader</span> <span class="o">=</span><span class="n">unicodecsv</span><span class="o">.</span><span class="n">DictReader</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
<span class="c">#reader is a itterater so loop is possible only once</span>
<span class="k">print</span> <span class="s">"type(reader) ="</span><span class="p">,</span><span class="n">reader</span>
<span class="c">#for each_row in reader:</span>
<span class="c"># enrolment.append(each_row)</span>
<span class="n">enrolment</span><span class="o">=</span><span class="nb">list</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> <span class="c">#shorthand for above two line</span>
<span class="c">#close file</span>
<span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">print</span> <span class="s">"Total no of row : "</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">enrolment</span><span class="p">),</span><span class="s">"</span><span class="se">\n\n</span><span class="s">"</span>
<span class="c">#print demo data</span>
<span class="n">pprint</span><span class="o">.</span><span class="n">pprint</span><span class="p">(</span><span class="n">enrolment</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt">
</div>
<div class="output_subarea output_stream output_stdout output_text">
<pre>type(reader) = <unicodecsv.py2.DictReader instance at 0x04A10A08>
Total no of row : 1640
{u'account_key': u'448',
u'cancel_date': u'2014-11-10',
u'days_to_cancel': u'5',
u'is_canceled': u'True',
u'is_udacity': u'True',
u'join_date': u'2014-11-05',
u'status': u'canceled'}
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<br>
<h2>
## Simple import</h2>
<br>
</div></div></div></div><a href="https://beginer2cs.blogspot.com/2016/01/importing-csv-file-in-python.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-27420051386418583662016-01-20T06:06:00.000-08:002016-01-20T06:09:34.068-08:00Pattern Search using Regular Expression in Python<div dir="ltr" style="text-align: left;" trbidi="on">
In our daily life we found lots of problem of pattern search. like find all mobile numbers, or emails etc from given web page or from any file.<br>
<br>
Writing manual code for that is not efficient and also very messy. Regular Expression is very popular technique used for pattern search (All compiler & interpreter use it ) & it is very easy to implement & it is very efficient .<br>
<br>
I suggest you to write a code for extracting all emails from a webpage without using regular expression & test it .<br>
Emails found on a webpage may follow some of these pattern like<br>
<br>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 233.75pt;" valign="top" width="312"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<o:p> abc_7@gmail.com</o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 233.75pt;" valign="top" width="312"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<o:p> abcd(at)hotmail.in</o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 233.75pt;" valign="top" width="312"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<o:p> abcd@@stanford.edu.org</o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 233.75pt;" valign="top" width="312"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<o:p> abcd@mnp(dot)com</o:p></div>
</td>
</tr>
</tbody></table>
<br>
</div><a href="https://beginer2cs.blogspot.com/2016/01/pattern-search-using-regular-expression.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-72742767279609500172015-11-10T01:56:00.001-08:002015-11-10T06:52:29.167-08:00Pong Game In python<div dir="ltr" style="text-align: left;" trbidi="on">
This is very easy if you are intermediate in python and good in basic physics and basic maths.<br>
You need to know basics of reflection, velocity, acceleration, and basics mathematics in order to calculate collision .When boundary of pong just touches wall or paddle are situation of collision. rest of thing is just basic python.<br>
<div class="separator" style="clear: both; text-align: center;">
<a alt="Pong game in Python" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGouCEw-ZrP3JMzx26x3UuVYlh7oPcd1eiQw4TK5l_-mayxr9_3bMeYl-dT9h51bjbjgCP4qeQOwH45XjG5RD7Mt6gtrEYgmBI7eHeOJ4n9vpwBnc_832JnJP6tH9KV_wWQ8Z0ZGGM-M4/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="368" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGouCEw-ZrP3JMzx26x3UuVYlh7oPcd1eiQw4TK5l_-mayxr9_3bMeYl-dT9h51bjbjgCP4qeQOwH45XjG5RD7Mt6gtrEYgmBI7eHeOJ4n9vpwBnc_832JnJP6tH9KV_wWQ8Z0ZGGM-M4/s640/Capture.PNG" width="640"></a></div>
<br>
We need to increase velocity of pong with time so we add some constant small acceleration that is being triggered after some small time interval . why small because if we use large acceleration or time then change in velocity will be sudden, so speed of pong increase suddenly.<br>
<br>
</div><a href="https://beginer2cs.blogspot.com/2015/11/pong-game-in-python.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com5tag:blogger.com,1999:blog-3355987113231659985.post-35207301914721009082015-11-07T10:28:00.000-08:002015-11-07T10:28:35.959-08:00Using SVM Classifier<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Support vector Machine </b>(SVM) is one of most famous machine learning tool for classification problem. This is supervised learning technique .<a href="https://en.wikipedia.org/wiki/Support_vector_machine" target="_blank">Read More</a><br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://38.media.tumblr.com/0e459c9df3dc85c301ae41db5e058cb8/tumblr_inline_n9xq5hiRsC1rmpjcz.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://38.media.tumblr.com/0e459c9df3dc85c301ae41db5e058cb8/tumblr_inline_n9xq5hiRsC1rmpjcz.jpg" height="292" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SVM Margin</td></tr>
</tbody></table>
we are going to see how to use SVM classifier in python.<br>
<br>
Our Demonstration uses <b>digit dataset</b> . This dataset uses 64 feature vector to identify handwritten digit [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] . It means this 64 feature extracted from Handwritten digit used to classify handwritten digit in 9 classes .<br>
<br>
So Again we gonna use <b>skilearn </b>Python Package .<br>
<br>
</div></div><a href="https://beginer2cs.blogspot.com/2015/11/using-svm-classifier.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-73732464153605671542015-11-06T06:24:00.000-08:002015-11-06T06:46:14.293-08:00Using Naive Bayes classifier<div dir="ltr" style="text-align: left;" trbidi="on">
This is most basic <b>classifier</b>, It uses <b>concept of probability</b> in order to predict the class of input feature data . <a href="https://en.wikipedia.org/wiki/Naive_Bayes_classifier" target="_blank">Read More</a><br>
<br>
We gonna see how to use <b>Naive Bayes Classifier</b> very easily using python.<br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4j23x__mZV0lKZ8FufNyC6Va-iwVVps-xWnwRjVV5SY5Cd7kbf-FKSLoSxIGdVKgQpKpdRpDwu9HgkBDssFcnQMxLJVHHrZ6KHuBX8SZdzf6UqzanQH_MU7tMRq5ng9XJdiEqk93Y9Jg/s1600/Bayes_rule.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Bayes rule" border="0" height="366" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4j23x__mZV0lKZ8FufNyC6Va-iwVVps-xWnwRjVV5SY5Cd7kbf-FKSLoSxIGdVKgQpKpdRpDwu9HgkBDssFcnQMxLJVHHrZ6KHuBX8SZdzf6UqzanQH_MU7tMRq5ng9XJdiEqk93Y9Jg/s640/Bayes_rule.png" width="640"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Bayes rule</td></tr>
</tbody></table>
<br>
<h3 style="text-align: left;">
Prerequisite:</h3>
<div>
<ul style="text-align: left;">
<li>Python 2</li>
<li>sklearn [Python Module]</li>
<li>Numpy [Python Module]</li>
</ul>
<div>
<br></div>
</div>
<div>
We are going to apply this algorithm on <b>Iris dataset</b> .</div>
<div>
<br>
</div></div><a href="https://beginer2cs.blogspot.com/2015/11/using-naive-bayes-classifier.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-27280718167472919482015-09-24T08:33:00.000-07:002015-09-24T08:33:11.539-07:00Python In Sort<div dir="ltr" style="text-align: left;" trbidi="on">
Python is one of most famous Programming Language. This is summary of python programming language for Quick Start to Python Programming .<br>
<br>
<b>{ Zoom or download picture} </b><br>
<br>
</div><a href="https://beginer2cs.blogspot.com/2015/09/python-in-sort.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com3tag:blogger.com,1999:blog-3355987113231659985.post-88524387551505000272015-09-19T01:17:00.000-07:002015-09-19T01:23:01.904-07:00Easieast Way to create Access Point Hotspot in Ubuntu 15.04<div dir="ltr" style="text-align: left;" trbidi="on">
Creating Hotspot in Ubuntu is easier task . But many people (beginners) find hard to cerate hotspot access point to connect other devices like Android phone,tablets etc.<br>
<br>
So , I gonna so you A graphical way To do it very easily.<br>
<br>
<br>
<ol style="text-align: left;">
<li>Download <b>kde-nm-connection-editor</b> (Plasma-nm) from Ubuntu Software center.<span style="font-size: large;"><b> <span style="color: red;"><a href="apt://plasma-nm">kde-nm-connection-editor</a></span></b><span style="color: red;"><a href="apt://plasma-nm"><u><span style="color: black;"><span style="font-size: small;"><u>. </u></span></span></u><span style="color: black;"><span style="font-size: small;">(you may not directly find it in software search so follow link given, or you may search and install <b>plasma-nm</b>)</span></span></a><u><span style="color: black;"><span style="font-size: small;"><u> </u></span></span></u></span><b><span style="color: red;"><a href="apt://plasma-nm"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuWJDfLg9cfTy4oVkLesd_lgohtp_Udv99o2m7-foo8fDkPGmvzHEVU0wEe0b5nnw4EHvjjRUhnowYC1O2q1Ai1aHl5s83KkAPKaZmwze_sJGXs3S-awmej0MiAoG-zMvpSlx-1xQ1Wy0/s1600/Screenshot+from+2015-09-19+12%253A22%253A48.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuWJDfLg9cfTy4oVkLesd_lgohtp_Udv99o2m7-foo8fDkPGmvzHEVU0wEe0b5nnw4EHvjjRUhnowYC1O2q1Ai1aHl5s83KkAPKaZmwze_sJGXs3S-awmej0MiAoG-zMvpSlx-1xQ1Wy0/s400/Screenshot+from+2015-09-19+12%253A22%253A48.png" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>kde-nm-connection-editor link</b><br>
<b></b><br>
</td></tr></tbody></table></a></span></b></span></li></ol></div><a href="https://beginer2cs.blogspot.com/2015/09/easieast-way-to-create-access-point.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-70428383944911910912015-09-18T23:35:00.000-07:002015-09-18T23:37:13.108-07:00Setup DropBox In Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
Dropbox is one of most famous cloud storage service. So we gonna setup dropbox in Ubuntu System.<br>
<br>
<div class="separator" style="clear: both; text-align: center;">
</div>
<ol style="text-align: left;">
<li>Go to Ubuntu software Center > Search for Dropbox and Install<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNjdVZE5Dkqyeb78QpQxTD7PXp9N88Jy_9O35sTXHa_JnCxugi43PQ-C1De9_jmpYrcTiel7fUlHsXXGjr6CVGz4cDzfemg1sbZrvrCHS4ZWCIzsRtHU_P73vXbOChpUF-qx-dqnEtrqU/s1600/Screenshot+from+2015-09-19+11%253A51%253A28.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="Dropbox ubuntu software center" border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNjdVZE5Dkqyeb78QpQxTD7PXp9N88Jy_9O35sTXHa_JnCxugi43PQ-C1De9_jmpYrcTiel7fUlHsXXGjr6CVGz4cDzfemg1sbZrvrCHS4ZWCIzsRtHU_P73vXbOChpUF-qx-dqnEtrqU/s400/Screenshot+from+2015-09-19+11%253A51%253A28.png" width="400"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Dropbox Ubuntu Software center<br>
<br>
</td></tr></tbody></table></li></ol></div><a href="https://beginer2cs.blogspot.com/2015/09/setup-dropbox-in-ubuntu.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-14925584258916725072015-09-13T10:07:00.001-07:002015-11-06T06:40:37.947-08:00Array Aptitude <div dir="ltr" style="text-align: left;" trbidi="on">
Divide array in two part such that sum of array left to partition index <b><span style="color: red;">i </span> </b>is equal to sum of array right to partition index <span style="color: red;"><b>i</b></span>.<br>
<br>
That is A[0]+A[1]...+A[i-1]=A[i+1]+....+A[n]<br>
<br>
This is slightly tricky question but very easy to solve and code ,if you find the trick.<br>
<br>
<h4 style="text-align: left;">
<b>Algorithm:</b></h4>
<ul style="text-align: left;">
<li>Find the cumulative sum at each index of array</li>
<li>loop through array and check A[i-1]==A[n]-A[i] , If condition Satisfy for any index i, means array can be partition in two group with this condition,So print "YES" else "NO"</li>
<li>Use special case if array has only 1 element then print YES</li>
<li>if array has only two element then print "NO"</li>
</ul>
<div>
</div></div><a href="https://beginer2cs.blogspot.com/2015/09/array-aptitude.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-73797522440909128122015-09-05T21:40:00.000-07:002015-09-05T21:41:44.029-07:00Finding First and Last occurrence in sorted list<div dir="ltr" style="text-align: left;" trbidi="on">
Finding first and last occurrence of given number in sorted list is a very easy problem and can easily solved by leaner search with worse case Time complexity <b>O(n) .</b><br>
But We can Achieve faster search of first and last occurrence of a number by exploiting sorted feature of list.<br>
We can search occurrence of any number in sorted list in<b> O(log(n)</b>) Time Complexity by using Binary search Algorithm.<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://code.scottshipp.com/wp-content/uploads/2014/02/binary_search.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://code.scottshipp.com/wp-content/uploads/2014/02/binary_search.png" height="241" width="640"></a></div>
<br>
</div><a href="https://beginer2cs.blogspot.com/2015/09/finding-first-and-last-occurrence-in.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-50547954962070195812015-08-29T03:28:00.000-07:002015-09-06T11:25:29.462-07:00Vigenere Cipher<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
A vigenere Cipher uses a different strategy to create the key stream. The key stream is repetition of initial key stream of length <b><i>m</i></b> where we have 1<=key<=26 .<br>
<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://51713941.weebly.com/uploads/1/4/7/7/14775176/8126246_orig.png?142" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://51713941.weebly.com/uploads/1/4/7/7/14775176/8126246_orig.png?142" height="640" width="640"></a></div>
<br>
</div></div><a href="https://beginer2cs.blogspot.com/2015/08/vigenere-cipher.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-89707534566905383112015-08-29T02:02:00.001-07:002015-09-06T11:38:54.590-07:00Auto Key Cipher<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
It is a very simple <b>poly alphabetic</b> cipher. In this cipher previous character of plain text used as key for encryption of next character using shift ( Caesar )cipher. And for encryption of first character of plain text we use predetermine value secretly agreed upon by both communicator.<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://image.slidesharecdn.com/3-150112222031-conversion-gate02/95/3traditional-symmetric-key-ciphers-12-638.jpg?cb=1421122971" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://image.slidesharecdn.com/3-150112222031-conversion-gate02/95/3traditional-symmetric-key-ciphers-12-638.jpg?cb=1421122971" height="300" width="400"></a></div>
<br>
</div></div><a href="https://beginer2cs.blogspot.com/2015/08/auto-key-cipher.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com5tag:blogger.com,1999:blog-3355987113231659985.post-20622362355787977122015-08-01T11:35:00.000-07:002015-08-10T03:16:17.751-07:00Quick Select -Finding K'th Largest<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Quick select is one of very popular algorithm used to find k'th largest element in a list. It can be use to find median or finding k'th smallest element etc.<br>
<br>
Finding K'th largest element looks easy , we just need to sort & get K'th largest . But here we are dealing with time so we need fastest way to do this<br>
<blockquote class="tr_bq">
<b> Time complexity of Quick Select (average case) =O(n)</b></blockquote>
Quick Select is basically modified version of Quick sort. In Quick Sort we need to sort all element but Quick select just want to know pivot value that divide array in given ratio.<br>
<br>
<blockquote class="tr_bq">
<b><span style="color: red; font-size: large;"><a href="http://www.codecops.in/2013/10/quick-sort.html" target="_blank">Quick sort</a> </span></b></blockquote>
let a example we have 10 different number in array & we want to find 3rd largest element.(we assume 0..9 index array) then in sorted array its position should be (10-3)th Index.<br>
<br>
</div></div><a href="https://beginer2cs.blogspot.com/2015/08/quick-select-finding-kth-largest.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-3355987113231659985.post-72872587768180460332015-07-23T14:02:00.000-07:002015-09-06T06:55:29.955-07:00Caesar Cipher<div dir="ltr" style="text-align: left;" trbidi="on">
A Caesar cipher (shift cipher) is one of the simplest encryption methods. It is a Substitution Cipher that involves replacing each letter of the secret message with a different letter of the alphabet which is a fixed number of positions further in the alphabet.<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://inventwithpython.com/chapter14_files/image002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="168" src="https://inventwithpython.com/chapter14_files/image002.jpg" width="400"></a></div>
<br>
Example : <span style="color: red;"><b>Apple</b></span> -------------Shift By 2----------> <span style="color: red;"><b>Crrng </b></span><br>
<br>
<span style="color: red;"><span style="color: black;">Now write a C++ program to Encrypt data using shift cypher .</span></span><span style="color: red;"><span style="color: black;"> </span></span><br>
<ul style="text-align: left;">
<li><span style="color: red;"><span style="color: black;">Take care that small letters encrypted to small letters and capital letters are encrypted to capital letters </span></span></li>
<li><span style="color: red;"><span style="color: black;">character except a...z and A...Z should not encripted</span></span></li>
<li><span style="color: red;"><span style="color: black;">keep in mind that shift key may be from 1 to large number. </span><b> </b></span></li>
</ul>
<br>
</div><a href="https://beginer2cs.blogspot.com/2015/07/caesar-cipher.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com0tag:blogger.com,1999:blog-3355987113231659985.post-86236697306970596022015-07-21T09:01:00.004-07:002015-07-21T09:01:33.835-07:00Check Panagram<div dir="ltr" style="text-align: left;" trbidi="on">
Pangrams are sentences constructed by using every letter of the alphabet at least once.<br>
<blockquote class="tr_bq">
Example : "The quick brown fox jumps over the lazy dog"</blockquote>
Write a program to check given sentence to paragraph is pangrams or not.<br>
<br>
Steps:<br>
<br>
<ol style="text-align: left;">
<li>create a list of all char a...z in small letters say list is <b>ls</b>.</li>
<li>convert given string to small letters.</li>
<li>Now chose char from given string one by one if that is found in <b>ls </b>then remove it from <b>ls.</b></li>
<li>Repeat step 3 until <b>ls</b> is empty of given string ends.</li>
<li>if <b>ls </b>is empty after step 4 then it is <b>pangrams else not pangrams.</b></li>
</ol>
<div>
<b></b></div></div><a href="https://beginer2cs.blogspot.com/2015/07/check-panagram.html#more">Read more »</a><div class="blogger-post-footer">by : UnBroken</div>Sudhanshuhttp://www.blogger.com/profile/06890505440408096989noreply@blogger.com1