<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Lacuna Blog</title>
	<atom:link href="https://www.thelacunablog.com/feed" rel="self" type="application/rss+xml" />
	<link>https://www.thelacunablog.com</link>
	<description>Computer Tips and Tutorials</description>
	<lastBuildDate>Fri, 10 May 2019 21:32:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.7.6</generator>
	<item>
		<title>SCP between two remote servers using Paramiko in Python</title>
		<link>https://www.thelacunablog.com/scp-between-two-remote-servers-using-paramiko-in-python.html</link>
					<comments>https://www.thelacunablog.com/scp-between-two-remote-servers-using-paramiko-in-python.html#respond</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Fri, 10 May 2019 21:32:13 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://www.thelacunablog.com/?p=9481</guid>

					<description><![CDATA[<p>Paramiko is a python library that allows you to make SSH connections. Useful when you want to automate things as you can easily ssh into remote server from your local computer. The code down below will let you ssh to a remote server via Paramiko and then SCP files from that server to some other [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/scp-between-two-remote-servers-using-paramiko-in-python.html">SCP between two remote servers using Paramiko in Python</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<!--themify_builder_content-->
<div id="themify_builder_content-9481" data-postid="9481" class="themify_builder_content themify_builder_content-9481 themify_builder tf_clear">
    </div>
<!--/themify_builder_content-->


<p>Paramiko is a python library that allows you to make SSH connections. Useful when you want to automate things as you can easily ssh into remote server from your local computer. </p>



<p>The code down below will let you ssh to a remote server via Paramiko and then SCP files from that server to some other remote server ie. copying/transferring files from one remote server to another remote server. </p>



<p>Here&#8217;s what it does:</p>



<ul><li>SSH to remote-server-1</li><li>Execute a psql command to export entries as a CSV file on the server</li><li>SCP that generated file to remote-server-2</li><li>Remove the generated file from remote-server-1 once its successfully copied.</li></ul>



<pre class="wp-block-code"><code>import paramiko
from scp import SCPClient
from paramiko_expect import SSHClientInteraction
remote_server_1 = "remote-server-1.com"
remote_server_1_username = "ssh_username"
remote_server_1_password = "ssh_password"
remote_server_2 = "remote-server-2.com"
remote_server_2_username = "ssh_username2"
remote_server_2_password = "ssh_password2"
p = paramiko.SSHClient()
p.set_missing_host_key_policy(paramiko.AutoAddPolicy())
filename = 'filename_whatever'
export = "psql -U username database -c 'COPY (SELECT * FROM some_table WHERE id=1) TO " + filename + ".csv" +" With CSV HEADER;'"
p.connect(remote_server_1, port=22, username=remote_server_1_username, password=remote_server_1_password)
stdin, stdout, stderr = p.exec_command(export) # executes psql command once connected
stdin.write("psql_passwordn") # password for psql user
print("Entering")
stdin.flush()
status = stdout.channel.recv_exit_status() # wait till file has been exported
if (status==0): # if successful in generating file scp it to remote server
   print("Copying..")
   stdin_, stdout_, stderr_ = p.exec_command("expect -c 'spawn scp ./" + filename + ".csv " + remote_server_2_username + "@" + remote_server_2 + ":~;expect password;send &#92;"" + remote_server_2_password + "&#92;r&#92;";interact'", get_pty=True)
   status_ = stdout_.channel.recv_exit_status()
   stdin_, stdout_, stderr_ = p.exec_command('rm ' + str(filename) + '.csv') #remove file after copying
   status_ = stdout_.channel.recv_exit_status()
   print("Done: ", str(filename))
else:
   print("Error")
   print(stderr.readlines())
p.close()</code></pre>



<p>Here we are copying files from remote_server_1 to remote_server_2. We ssh into remote_server_1 and then with the help of paramiko&#8217;s exec_command method, execute the terminal command to log into psql and generate a file (ie. whatever&#8217;s in &#8216;export&#8217; variable). Once we execute the psql command, it will ask for password of the user.  We provide the password by writing it to the stdin: <em>stdin.write(&#8220;psql_passwordn&#8221;)</em>. </p>



<p>We then wait until the command has finished executing: <em>stdout.channel.recv_exit_status()</em>. If the execution was successful (ie <em>status == 0</em>), we execute another command to copy the file to remote_server_2. This command may look complex, but all we are doing here is <a rel="noreferrer noopener" aria-label="executing scp with the help of expect (opens in a new tab)" href="https://www.thelacunablog.com/passing-password-to-scp-with-expect-single-line.html" target="_blank">executing scp with the help of expect</a>. Then we finally delete the file from remote_server_1:<em> p.exec_command(&#8216;rm &#8216; + str(ids) + &#8216;.csv&#8217;) .</em></p>



<p>Hope this was helpful!</p><p>The post <a rel="nofollow" href="https://www.thelacunablog.com/scp-between-two-remote-servers-using-paramiko-in-python.html">SCP between two remote servers using Paramiko in Python</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/scp-between-two-remote-servers-using-paramiko-in-python.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Passing Password to SCP with expect (single line)</title>
		<link>https://www.thelacunablog.com/passing-password-to-scp-with-expect-single-line.html</link>
					<comments>https://www.thelacunablog.com/passing-password-to-scp-with-expect-single-line.html#comments</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Mon, 08 Apr 2019 01:59:08 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<guid isPermaLink="false">https://www.thelacunablog.com/?p=9450</guid>

					<description><![CDATA[<p>scp is used to perform secure copy between different hosts. By default, scp doesn&#8217;t let you pass password as a parameter. For instance, for mysql, I can do something like: mysql -uusername -ppassword and login without having to give username and password input separately. That is very helpful while scripting or automating things because that&#8217;s [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/passing-password-to-scp-with-expect-single-line.html">Passing Password to SCP with expect (single line)</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>scp is used to perform secure copy between different hosts. </p>



<p>By default, scp doesn&#8217;t let you pass password as a parameter. For instance, for mysql, I can do something like: mysql -uusername -ppassword and login without having to give username and password input separately. That is very helpful while scripting or automating things because that&#8217;s one less case to handle. </p>



<p>So how do you pass password as parameter in scp? You cannot. At least not using scp on its own. The best method I could find is by using <a rel="noreferrer noopener" aria-label="expect (opens in a new tab)" href="https://en.wikipedia.org/wiki/Expect" target="_blank">expect</a>.</p>



<p>expect is a scripting language used to deal with scripts/programs that require user interaction. Here we&#8217;re going to use expect to start scp (with spawn) and send password as our response without any interaction from our end &#8212; all in a single line.</p>



<pre class="wp-block-preformatted">expect -c 'spawn scp ./path/to/source/filename user@server.com:~/path/to/destination;expect password;send "serverpass&#92;r";interact'</pre>



<p>That&#8217;s it. Obviously, <strong>./path/to/source/filename.csv</strong> is the path to your file that you are trying to copy (source file), <strong>/path/to/destination</strong> is the path where you are trying to copy it to on a remote host (destination directory), destination remote host here is <strong>user@server.com</strong>, and <strong>serverpass </strong>is the password of the destination host.</p>



<p>You may need to install expect if its not already installed:</p>



<ul><li>apt-get install expect</li><li>yum install expect</li></ul>



<p></p>

<!--themify_builder_content-->
<div id="themify_builder_content-9450" data-postid="9450" class="themify_builder_content themify_builder_content-9450 themify_builder tf_clear">
    </div>
<!--/themify_builder_content--><p>The post <a rel="nofollow" href="https://www.thelacunablog.com/passing-password-to-scp-with-expect-single-line.html">Passing Password to SCP with expect (single line)</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/passing-password-to-scp-with-expect-single-line.html/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How To Detect Foreground Application in Android?</title>
		<link>https://www.thelacunablog.com/detect-foreground-application-android.html</link>
					<comments>https://www.thelacunablog.com/detect-foreground-application-android.html#respond</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Sun, 14 Oct 2018 05:54:06 +0000</pubDate>
				<category><![CDATA[Dev & Design]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[accessibilityservice]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[research]]></category>
		<guid isPermaLink="false">https://www.thelacunablog.com/?p=9420</guid>

					<description><![CDATA[<p><img width="1736" height="758" src="https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM.png" class="attachment-full size-full wp-post-image" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM.png 1736w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-300x131.png 300w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-768x335.png 768w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-1030x450.png 1030w" sizes="(max-width: 1736px) 100vw, 1736px" /></p>
<p>What do you do when you want to track whether a particular application has been launched on Android? METHOD 1: POLLING TASK LIST REGULARLY Unless the application that you want to monitor gives specific broadcast intents when it launches, the only way is to regularly poll the running task list and get the topmost activity [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/detect-foreground-application-android.html">How To Detect Foreground Application in Android?</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1736" height="758" src="https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM.png" class="attachment-full size-full wp-post-image" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM.png 1736w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-300x131.png 300w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-768x335.png 768w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-1030x450.png 1030w" sizes="(max-width: 1736px) 100vw, 1736px" /></p><p>What do you do when you want to track whether a particular application has been launched on Android?</p>
<p><strong>METHOD 1: POLLING TASK LIST REGULARLY</strong></p>
<hr />
<p>Unless the application that you want to monitor gives specific broadcast intents when it launches, the only way is to regularly poll the running task list and get the topmost activity off of that list &#8212; that would be the foreground app. So, you could, in theory, have a background service running every 5 seconds, polling the running task list in order to achieve this. (Remember 5 seconds is too low and Alarm Manager is probably not the right thing for it as 1: its not exact timing based and 2: system will move things around for timers less than 1 minute &#8212; so your alarm won&#8217;t be launched that often all the time.)</p>
<p>In your activity, you could create the following method to create a 1 minute timer with AlarmManager. This would create a broadcast intent. Don&#8217;t forget to call the method!</p>
<pre class="lang:java decode:true " title="alarm">  private void setAlarm(){
  private static final long timeInMillis = TimeUnit.MINUTES.toMillis(1);
        AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(this, MyAlarm.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
        alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), timeInMillis, pendingIntent);
    }</pre>
<p>Now, you would create a MyAlarm broadcast receiver such that when the AlarmManager fires the broadcast intent every 1 minute, you will catch it on your receiver and process it. Note that you will need to declare the broadcast receiver on the manifest file.</p>
<pre class="lang:java decode:true" title="broadcast receiver">public class MyAlarm extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
      // code to check the task list.
        }
    }
}
</pre>
<p>We have the code for the repeated 1 minute call setup! Next, we put together the code to check the task list.</p>
<pre class="lang:java decode:true" title="topPackage">String topPackageName = null;
        if (android.os.Build.VERSION.SDK_INT &lt; android.os.Build.VERSION_CODES.LOLLIPOP) {
            ActivityManager am = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);
            ActivityManager.RunningTaskInfo foregroundTaskInfo = am.getRunningTasks(1).get(0);
            topPackageName = foregroundTaskInfo.topActivity.getPackageName();
        }else{
            UsageStatsManager usage = (UsageStatsManager) this.getSystemService(Context.USAGE_STATS_SERVICE);
            long time = System.currentTimeMillis();
            List&lt;UsageStats&gt; stats = usage.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000*1000, time);
            if (stats != null) {
                SortedMap&lt;Long, UsageStats&gt; runningTask = new TreeMap&lt;Long,UsageStats&gt;();
                for (UsageStats usageStats : stats) {
                    runningTask.put(usageStats.getLastTimeUsed(), usageStats);
                }
                if (runningTask.isEmpty()) {
                    topPackageName="None";
                }
                topPackageName =  runningTask.get(runningTask.lastKey()).getPackageName();
            }
        }
        Log.e("Task List", "Current App in foreground is: " + topPackageName);</pre>
<p>Put the code above in the onReceive method of the MyAlarm broadcast receiver that we created earlier and that&#8217;s all setup.</p>
<p>You will need to add the following permissions to the manifest file.</p>
<pre class="lang:default decode:true">&lt;uses-permission android:name="android.permission.GET_TASKS" /&gt;
&lt;uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions"/&gt;</pre>
<p>Downside to this method is that it does not seem to work 100% of the time. I noticed that sometimes it would return launcher as the foreground app even though there&#8217;s Chrome running on the top. So, use it with caution. The next method although very reliable, cannot be used if you&#8217;re going to put your app on PlayStore.  :)</p>
<p><strong>METHOD 2: USING ACCESSIBILITY SERVICE</strong></p>
<hr />
<p>Like I mentioned above, you won&#8217;t be able to go very far with this method if you&#8217;re trying to put your app on Play Store. This is because this method makes use of AccessibilityService, a service that&#8217;s meant to be used by Accessibility related applications only. So we are kind of misusing it. But, depending on your use case, this might still be useful to you!</p>
<p><img width="1736" height="758" class="aligncenter size-full wp-image-9423" src="//www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM.png" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM.png 1736w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-300x131.png 300w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-768x335.png 768w, https://www.thelacunablog.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-14-at-1.46.07-AM-1030x450.png 1030w" sizes="(max-width: 1736px) 100vw, 1736px" /></p>
<p>What are we doing? We are using AccessiblityService to listen to a particular event i.e. WINDOW_STATE_CHANGED event. So whenever a window state change occurs on the phone, our Service will get a callback or sort of a broadcast. We can then narrow down to the application&#8217;s package name, and see which application is on the foreground. That means we won&#8217;t need to poll the task list regularly like in Method 1.</p>
<p>The method is explained in detail <a href="https://stackoverflow.com/questions/3873659/android-how-can-i-get-the-current-foreground-activity-from-a-service/27642535#27642535" target="_blank" rel="noopener">over here on StackOverflow</a>.</p>
<p>Thank you!</p>
<p><em>PS. None of the codes above were originally written by me. They have been put together by copying off of StackOverflow and other websites.</em></p>
<!--themify_builder_content-->
<div id="themify_builder_content-9420" data-postid="9420" class="themify_builder_content themify_builder_content-9420 themify_builder tf_clear">
    </div>
<!--/themify_builder_content--><p>The post <a rel="nofollow" href="https://www.thelacunablog.com/detect-foreground-application-android.html">How To Detect Foreground Application in Android?</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/detect-foreground-application-android.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Make An Online Code Compiler?</title>
		<link>https://www.thelacunablog.com/make-online-code-compiler.html</link>
					<comments>https://www.thelacunablog.com/make-online-code-compiler.html#comments</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Sun, 08 Oct 2017 19:29:32 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<category><![CDATA[code compiler]]></category>
		<category><![CDATA[code judge]]></category>
		<guid isPermaLink="false">https://www.thelacunablog.com/?p=9409</guid>

					<description><![CDATA[<p>An online code compiler emulates the terminal on the web allowing you to type terminal commands, your code etc. and compile them there and then as you&#8217;d normally do on your computer. Basically, there&#8217;s a terminal backend on the virtual machine/container that exposes the terminal on the web using one of the several libraries. Inherently, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/make-online-code-compiler.html">How To Make An Online Code Compiler?</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>An online code compiler emulates the terminal on the web allowing you to type terminal commands, your code etc. and compile them there and then as you&#8217;d normally do on your computer. Basically, there&#8217;s a terminal backend on the virtual machine/container that exposes the terminal on the web using one of the several libraries. Inherently, both sides communicate using websocket. The traditional model of web communication does not work in this situation since you need something that allows two-way interactive communication (mostly, to handle the standard input &#8212; &#8216;stdin&#8217;).</p>
<p>Have you thought about why most of the online compilers do not allow you to give input? I mean, there are online compilers that allow you to type your code and run it, but they don&#8217;t accept input thereafter. Suppose you made a C program that accepts input from user. You can compile &amp; run it online. But, you won&#8217;t be able to pass it input when it asks for one because the online compilers restrict you to do so.</p>
<p>Why? Because they don&#8217;t use websocket. If you don&#8217;t use websocket, the only way to achieve something like this is to regularly poll the program to see if its waiting for the standard input. If it is, then you&#8217;ll send a response to the web user asking for the input that the program is waiting for. But that&#8217;s easier said than done, because polling is not at all efficient, and secondly, its complex to write it. The other reason online compilers do not allow input is related with security.</p>
<p>Websocket is meant for interactive duplex communication. And there are already libraries that help you  emulate the whole terminal over on the web via websocket. That means you just show the whole terminal to the user and then the python script, or c code or whatever the user wanted to compile, would be compiled and ran on the same terminal. User would be able to interact with it and enter the input as well &#8212; problem solved!</p>
<p>What about security? Wouldn&#8217;t users have access of a terminal session that could possibly bring down the VPS/Virtual machine and wreck havoc (Remember we&#8217;re just exposing the terminal on the web, but it IS RUNNING on the VPS/Virtual Machine actually &#8212; that means the users have access to a terminal session of the virtual machine) ? Yes, that is what happens if you don&#8217;t get smart about it.</p>
<p>A simple way to avoid the problem is to use a sandbox. Meaning, you don&#8217;t expose the actual terminal. You expose a terminal that is run inside a sandbox. So whatever the user does on the exposed terminal will have no impact whatsoever on the system that is outside the sandbox, and better yet, the sandbox programs already restrict the user from doing a lot of actions on terminal. For example, the sandbox program I have used called Firejail not only has a lot of restrictions in place, but also allows users to add their own restrictions.</p>
<p>So here&#8217;s how I&#8217;ve structured the project:</p>
<ul>
<li>Using Ace editor, the user can type the codes.</li>
<li>When he clicks on RUN, the code gets saved on the virtual machine. I&#8217;ve used REST API for this purpose, but using websocket for this would be better &#8212; websocket is comparatively faster than REST (in this case).</li>
<li>Then, a terminal session is initiated inside a sandbox (firejail). It is exposed to the web via terminado.</li>
<li>The initiated terminal session is not bash, but restricted bash aka rbash. Rbash has already many built in restrictions in place. For example, it does not allow you to type &#8216;/&#8217; or change directory (&#8216;cd&#8217;). I did this just to make it extra secure &#8212; a restricted bash inside a sandbox that is already restricted.</li>
<li>There&#8217;s a unique terminal for every user. So, when a user quits, the sandbox also gets shut down.</li>
<li>As it is with nginx, the user is automatically disconnected / connection is halted if there&#8217;s no activity for ~30 seconds i.e. Terminal exits in case of no activity for 30 seconds.</li>
<li>With the help of cron job, I&#8217;ve set in further two restrictions: terminal session is closed after 10 minutes and any program running longer than 1 minute in the terminal is killed automatically (to handle programs taking too much memory because of infinite loops etc.).</li>
<li>I&#8217;ve used monit, a system monitoring utility to monitor resource/memory usage of the application and restart the API, Nginx, and the major application in case the usage exceeds a sudden threshold. This is required in case the resources are hogged when there are several users online compiling at the same time.</li>
</ul>
<p>&nbsp;</p>
<p>I am thinking of writing a more detailed step-by-step guide on how to make an online code compiler/code judge &#8212; I may eventually write an eBook for it since it is a lot to be covered in a blog post. I&#8217;ll of course share the news here if I ever get around to it. :)</p>
<p>For now, you can find the code for the program here: <a href="https://github.com/sknepal/webcompiler" target="_blank" rel="noopener noreferrer">https://github.com/sknepal/webcompiler</a>.</p>
<p>PS. Wrote the post on a single sitting; so please try to ignore the shortcomings you see. :P</p>
<p>&nbsp;</p>
<!--themify_builder_content-->
<div id="themify_builder_content-9409" data-postid="9409" class="themify_builder_content themify_builder_content-9409 themify_builder tf_clear">
    </div>
<!--/themify_builder_content-->
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/make-online-code-compiler.html">How To Make An Online Code Compiler?</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/make-online-code-compiler.html/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>For The Love of Fractals</title>
		<link>https://www.thelacunablog.com/for-the-love-of-fractals.html</link>
					<comments>https://www.thelacunablog.com/for-the-love-of-fractals.html#comments</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Tue, 02 May 2017 06:23:47 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<category><![CDATA[fractals]]></category>
		<category><![CDATA[mandelbrot]]></category>
		<category><![CDATA[matlab]]></category>
		<guid isPermaLink="false">http://www.thelacunablog.com/?p=9324</guid>

					<description><![CDATA[<p><img width="1320" height="1010" src="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM.png" class="attachment-full size-full wp-post-image" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM.png 1320w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-300x230.png 300w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-768x588.png 768w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-1030x788.png 1030w" sizes="(max-width: 1320px) 100vw, 1320px" /></p>
<p>I have been lurking around /r/FractalPorn so much that I finally decided to put my love for Fractals down on words. These structures are hauntingly beautiful and on this post, I want to share their beauty with you. Although not as technical as previous posts, it should be interesting nonetheless. A fractal is a never-ending pattern. Fractals are infinitely complex [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/for-the-love-of-fractals.html">For The Love of Fractals</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="1320" height="1010" src="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM.png" class="attachment-full size-full wp-post-image" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM.png 1320w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-300x230.png 300w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-768x588.png 768w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-1030x788.png 1030w" sizes="(max-width: 1320px) 100vw, 1320px" /></p><p>I have been lurking around <a href="http://reddit.com/r/fractalporn" target="_blank" rel="noopener noreferrer">/r/FractalPorn</a> so much that I finally decided to put my love for Fractals down on words. These structures are hauntingly beautiful and on this post, I want to share their beauty with you. Although not as technical as previous posts, it should be interesting nonetheless.</p>
<blockquote><p>A fractal is a never-ending pattern. Fractals are infinitely complex patterns that are self-similar across different scales. They are created by repeating a simple process over and over in an ongoing feedback loop. Driven by recursion, fractals are images of dynamic systems – the pictures of Chaos. &#8211; <a href="http://fractalfoundation.org" target="_blank" rel="noopener noreferrer">fractalfoundation.org</a></p></blockquote>
<p>We will go about making our own Mandelbrot Set, which is one of the easiest and most famous fractals. Here&#8217;s a beautiful example of a realtime Mandelbrot Fractal zoomer: <a href="http://jblang.github.io/XaoSjs/" target="_blank" rel="noopener noreferrer">http://jblang.github.io/XaoSjs/</a>. Left click on an area to zoom-in and right click to zoom-out. You can see that the fractal is infinitely detailed.  Our implementation would not be as advanced; it would just display a static image.</p>
<p>Mandelbrot Set is a set of complex numbers c for which the function <strong>z</strong>=<strong>z<sup>2 </sup>+ c</strong> does not diverge. The idea is simple: we just need to perform iteration over a function. In the formula  <strong>z</strong>=<strong>z<sup>2 </sup>+ c</strong>, both <strong>z</strong> and <strong>c</strong> are complex numbers. We begin the iteration with <strong>z</strong> set to 0 i.e. 0+0i. <strong>c</strong> is a constant and remains the same throughout the process, whereas <strong>z</strong>&#8216;s value is updated with every iteration.</p>
<p>We run the iteration for, say, a 100 times. Then, the value of <strong>z</strong> changes throughout the 100 iterations. If the value goes beyond a set limit, then we know it has diverged, whereas if it does not leave the set limit even after performing those 100 iterations, then it is said to have converged (for that 100 iterations).</p>
<p>Let,</p>
<p><strong>z</strong> = (a +bi) and <strong>c</strong> = (d+ei)</p>
<p>Then,</p>
<p><strong>z<sup>2</sup></strong> = (a<sup>2</sup>-b<sup>2</sup>) + (2ab)i</p>
<p><strong>z<sup>2 </sup>+ c</strong> =  (a<sup>2</sup>-b<sup>2</sup>) + (2ab)i + (d+e)i = (a<sup>2</sup>-b<sup>2</sup>+d) + (2ab + e)i</p>
<div class="_NId"><strong><strong>Let us do an example iteration. </strong></strong></div>
<div class="_NId">Here, initially, <strong>z</strong> = 0+0i and <strong>c</strong> = 2+2i.</div>
<div class="_NId">We have in first iteration, a = 0, b=0, since c is constant for all iterations, we have d=2 and e=2 for all iterations.</div>
<div class="_NId"></div>
<table style="height: 279px;" width="607">
<tbody>
<tr>
<td width="126">Iteration</td>
<td width="118">Real (a)</td>
<td width="128">Imaginary (b)</td>
<td width="114">New Z ie. (a<sup>2</sup>-b<sup>2</sup>+d) + (2ab + e)i</td>
<td width="114">Magnitude / Absolute value i.e. sqrt(a<sup>2</sup>+b<sup>2</sup>)</td>
</tr>
<tr>
<td width="126">1</td>
<td width="118">0</td>
<td width="128">0</td>
<td width="114">0+0i</td>
<td width="114">0</td>
</tr>
<tr>
<td width="126">2</td>
<td width="118">2</td>
<td width="128">2</td>
<td width="114">2+10i</td>
<td width="114">2.83</td>
</tr>
<tr>
<td width="126">3</td>
<td width="118">2</td>
<td width="128">10</td>
<td width="114">-94+42i</td>
<td width="114">10.19</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>We now need to do the same thing that we did above for a range of complex values <strong>c</strong>. We start with a xy plane that represents the real components on the x axis and the imaginary components on the y axis. Then, we take a particular point on the plane, say (1+1i), test it for convergence, just like we did above. In order to do that, first of all it is assumed to be constant for the iteration period and then perform a iteration, say 100 times, starting with <strong>z</strong> set to 0. Then we compare the absolute value with our threshold each time and if its beyond the threshold then we say it has diverged. We then choose another point in the plane, say, (1+2i) and do the same for it . In this way we test for convergence of complex number <strong>c</strong> that is within the xy plane.</p>
<p>Now you should be beginning to get an idea as to how the fractal is visualized. In each of those xy values that we tested, if c converged, then we could give it one value, and if it diverged we could give it another value (read: 1 if converges, 0 if diverges or vice versa). How do we make it colorful, though?</p>
<p>In order to make the fractal colorful, we will store in an array the exact iteration count it took for the absolute value to grow beyond our chosen threshold. Then finally we will plot that array. Remember that any point in the plotted array is a complex number which has its real component on the x-axis, and the imaginary component on the y-axis. We&#8217;re plotting a complex number on the plane.</p>
<pre class="lang:matlab decode:true">close all;
clear all;
clc;
xvals = linspace(-0.10, -0.90, 1000); %x axis plane size
yvals = linspace(-0.03, -0.69, 1000); %y axis plane size
xlength = length(xvals); % length of the real component
ylength = length(yvals); % length of the imaginary component
fractal = zeros(xlength, ylength); % the final image array
                        % to store the iteration count
                        % that results in color

                        
for i=1:xlength 
    for j=1:ylength % iterate through the components
        x = xvals(i); % pick a real value
        y = yvals(j); % pick an imaginary value
        complex_no = complex(x, y); % create a complex number
        fractal(i,j)=mbrot(complex_no,100);
                    % and check it for convergence/divergence
    end
end


image(fractal.') % show the fractal. the ' transposes the array
    % without it the image will display sideways
    % so its just for convenience
colormap(winter)

function itercount = mbrot(complex_no, max)
    z = complex(0,0); % initialize z = 0+0i
    for itercount=1:max % iterate till max no of iterations
        z = (z*z)+complex_no; % z squared + c
        if abs(z) &gt; 4 % if absolute value is greater than 4
            break % exit loop else continue till you reach 
                  % the max no. of iterations
        end       % then return the iterations reached
                   % in case the z diverges, then iteration
                  % count will be less than max
                  % whereas if it does not diverage, iteration
                  % count will be equal to max.
    end
end

</pre>
<p>I have commented the code to make it as descriptive as possible. Here are some of the fractals produced from the above code. You can try it out yourself by changing the <strong>xvals</strong>, <strong>yvals</strong> and <strong>max</strong> number of iterations. For a more detailed study into Mandelbrots, you can read the book <em>Make your own Mandelbrot</em> by Tariq Rashid. I have shamelessly borrowed several concepts from the book. ;)</p>
<p>Maybe next time, we will look into how Julia sets (another fractal) relate to Mandelbrots.</p>
<p><strong>PS.</strong> Don&#8217;t forget to go through this article: <a href="http://www.bbc.com/news/magazine-11564766" target="_blank" rel="noopener noreferrer"><em>How Mandelbrot&#8217;s fractals changed the world</em></a></p>
<p><img width="1320" height="1010" class="aligncenter size-full wp-image-9336" src="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM.png" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM.png 1320w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-300x230.png 300w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-768x588.png 768w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.43.15-AM-1030x788.png 1030w" sizes="(max-width: 1320px) 100vw, 1320px" /> <img width="1274" height="974" class="aligncenter size-full wp-image-9337" src="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.54.29-AM.png" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.54.29-AM.png 1274w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.54.29-AM-300x229.png 300w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.54.29-AM-768x587.png 768w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-11.54.29-AM-1030x787.png 1030w" sizes="(max-width: 1274px) 100vw, 1274px" /></p>
<p><img width="1328" height="984" class="aligncenter size-full wp-image-9339" src="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-12.06.49-PM.png" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-12.06.49-PM.png 1328w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-12.06.49-PM-300x222.png 300w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-12.06.49-PM-768x569.png 768w, https://www.thelacunablog.com/wp-content/uploads/2017/05/Screen-Shot-2017-05-02-at-12.06.49-PM-1030x763.png 1030w" sizes="(max-width: 1328px) 100vw, 1328px" /></p>
<!--themify_builder_content-->
<div id="themify_builder_content-9324" data-postid="9324" class="themify_builder_content themify_builder_content-9324 themify_builder tf_clear">
    </div>
<!--/themify_builder_content-->
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/for-the-love-of-fractals.html">For The Love of Fractals</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/for-the-love-of-fractals.html/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>MOOCs for BSc CSIT</title>
		<link>https://www.thelacunablog.com/mooc-bsc-csit.html</link>
					<comments>https://www.thelacunablog.com/mooc-bsc-csit.html#comments</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Fri, 24 Mar 2017 18:05:29 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<category><![CDATA[bsc csit]]></category>
		<category><![CDATA[mooc]]></category>
		<guid isPermaLink="false">http://www.thelacunablog.com/?p=9306</guid>

					<description><![CDATA[<p><img width="346" height="346" src="https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc.png" class="attachment-full size-full wp-post-image" alt="MOOC" srcset="https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc.png 346w, https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc-80x80.png 80w, https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc-300x300.png 300w" sizes="(max-width: 346px) 100vw, 346px" /></p>
<p>I&#8217;m pursuing a Bachelors in Science, Computer Science and Information Technology (BSc. CSIT) in Nepal. About fourth semester in, I realized I could not just rely on what I was taught in the class. For one, I didn&#8217;t understand what the teachers said. They made things complex than it was absolutely necessary and obviously not [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/mooc-bsc-csit.html">MOOCs for BSc CSIT</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="346" height="346" src="https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc.png" class="attachment-full size-full wp-post-image" alt="MOOC" srcset="https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc.png 346w, https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc-80x80.png 80w, https://www.thelacunablog.com/wp-content/uploads/2017/03/bva-mooc-300x300.png 300w" sizes="(max-width: 346px) 100vw, 346px" /></p><p style="text-align: justify;">I&#8217;m pursuing a Bachelors in Science, Computer Science and Information Technology (BSc. CSIT) in Nepal. About fourth semester in, I realized I could not just rely on what I was taught in the class. For one, I didn&#8217;t understand what the teachers said. They made things complex than it was absolutely necessary and obviously not all of them were qualified in the subject matter. I prefer learning from videos than from texts, so I started looking for MOOCs.</p>
<p style="text-align: justify;">This is a list of MOOCs that I followed during my four year study of BSc. CSIT (although I started following MOOCs since fourth semester only). As of the moment of writing this, I am in seventh semester so this list is in no way comprehensive or complete, for that matter. It&#8217;s just something I hope would help you along the way just like it helped me.</p>
<h2 style="text-align: justify;"><span style="text-decoration: underline;"><strong>Fourth Semester</strong></span></h2>
<ul style="text-align: justify;">
<li><strong>Theory of Computation</strong>: Jeffrey Ullman, the author of the textbook recommended for the course, hosted an excellent MOOC on Coursera in 2012 that covered most of the topics mentioned on CSIT syllabus. It is not available on Coursera now, but you can <a href="https://www.youtube.com/playlist?list=PL82C4B8475CAC3F95" target="_blank">watch it on YouTube</a>. Another one you might find worth watching (especially for the latter parts in the syllabus) is by Prof. Harry Porter (no kidding): <a href="https://www.youtube.com/watch?v=TOsMcgIK95k&amp;list=PLbtzT1TYeoMjNOGEiaRmm_vMIwUAidnQz" target="_blank">Theory of Computation</a>.</li>
</ul>
<ul style="text-align: justify;">
<li><strong>Database Mangement System</strong>: Available via NPTEL Open Online Course (NOC), this series on <a href="https://www.youtube.com/watch?v=bGyHqvQW6JY&amp;list=PLRFPL_aa_SLVjQn93cUGZaKZVGr_80vYv" target="_blank">Fundamentals of Database Systems</a>, taught by Prof. Arnab Bhattacharya of IIT Kanpur, closely relates to our syllabus.</li>
</ul>
<ul style="text-align: justify;">
<li><strong>Computer Graphics</strong>: I followed <a href="https://www.youtube.com/watch?v=fwzYuhduME4&amp;list=PL338D19C40D6D1732" target="_blank">Prof. Sukhendu Das&#8217; (IIT Madras) lectures</a>. It covers most of the things, but you&#8217;ll also need to refer to books/notes (I&#8217;ll mention a neat trick for it down below).</li>
</ul>
<h2 style="text-align: justify;"><span style="text-decoration: underline;"><strong>Fifth Semester</strong></span></h2>
<ul style="text-align: justify;">
<li style="text-align: justify;"><strong>Computer Networks</strong>: I followed the Computer Networks MOOC which was hosted by Prof. David Wetherall (University of Washington). It was an awesome course where the professor even shared the advances in the current networking technologies, which even my college&#8217;s professor didn&#8217;t know of, and was not mentioned on the textbooks either. One of the reasons why I love MOOCs. Unfortunately, the course is no longer available on Coursera and I couldn&#8217;t find it on YouTube.  I was able to find it preserved by the Archive Team. But, you&#8217;ll need to download a huge archive (44G to be exact :O ) to view it. Here&#8217;s the gist file that contains the download link and the related slug name: <a href="https://gist.github.com/mihaitodor/b0d8c8dd824ab936c057508edec377ad" target="_blank">https://gist.github.com/mihaitodor/b0d8c8dd824ab936c057508edec377ad</a>. Search for &#8220;Computer Networks&#8221; and download the archive that is linked just above it.</li>
</ul>
<ul style="text-align: justify;">
<li style="text-align: justify;"><strong>Design and Analysis of Algorithms</strong>: One of my friends suggested me the NPTEL MOOC hosted by Madhavan Mukund (Chennai Mathematical Institute). It&#8217;s very easy to understand and very thorough. I&#8217;d recommend it to anyone. It was available on YouTube as a Playlist. But seems like they&#8217;ve changed the videos to unlisted status, so now you need to go through their site&#8217;s <a href="http://nptel.ac.in/courses/106106131/1" target="_blank">course listing</a>.</li>
</ul>
<ul style="text-align: justify;">
<li style="text-align: justify;"><strong>Neural Networks</strong>: This course is very vast. I mean, it covers a lot of grounds that are not at all introductory. Our teacher claimed that it is better suited for graduates. You can find several resources to learn Neural Network on the web. Nonetheless, the best ones include the well renowned <a href="https://www.coursera.org/learn/machine-learning" target="_blank">course on Machine Learning</a> taught by Prof. Andrew Ng. If you like, you can follow it up with Prof. Geoffrey Hinton&#8217;s <a href="https://www.coursera.org/learn/neural-networks" target="_blank">course</a>. For a practical introduction, I highly recommend you to go through the book <em>Make Your Own Neural Network</em> by Tariq Rashid.</li>
</ul>
<ul style="text-align: justify;">
<li style="text-align: justify;"><strong>Cryptography</strong>: There are a few courses on Cryptography on Coursera: <a href="https://www.coursera.org/learn/crypto" target="_blank">Course 1</a>, <a href="https://www.coursera.org/learn/cryptography" target="_blank">Course 2</a>. I followed these selectively, because I found many of the videos difficult to understand.</li>
</ul>
<h2 style="text-align: justify;"><span style="text-decoration: underline;"><strong>Sixth Semester</strong></span></h2>
<ul style="text-align: justify;">
<li style="text-align: justify;"><strong>Real Time System</strong>: It is one of those subjects that you just can&#8217; t get enough of. Just kidding. Real Time System was hated by most of my friends, and I did too. Until I came across an MOOC, that is. It made life easier. Although it doesn&#8217;t cover everything on our syllabus, it certainly makes most of the things understandable. Do not completely depend on it, as it does not cover things in as detail as the book does, and the later chapters are not even mentioned. But, it does make it easy to understand the basic concepts so that you can follow what&#8217;s being said on the book. <a href="https://www.coursera.org/learn/real-time-systems" target="_blank">The course is available on Coursera</a>.</li>
</ul>
<ul style="text-align: justify;">
<li style="text-align: justify;"><strong>Compiler Design and Construction</strong>: <a href="https://www.youtube.com/playlist?list=PLFB9EC7B8FE963EB8" target="_blank">Prof. Alex Aiken&#8217;s MOOC</a> is very thorough and understandable. But, the semantic analysis part differs from the one in our syllabus. So, I had to follow it up with <a href="https://www.youtube.com/playlist?list=PLTb2sbh_QCQb_8GIkpfUXPmHLPsO5sAfQ" target="_blank">lectures by Sarfaraz Masood</a>. However, these videos are quite fast and may not be suitable for someone who hasn&#8217;t gone through the text already.</li>
</ul>
<h2 style="text-align: justify;"><span style="text-decoration: underline;"><strong>How &amp; Where to get Notes?</strong></span></h2>
<p style="text-align: justify;">Sure there are several sites where you can get notes. But, what I usually do is, I google. As you know, most of the part of our course is lifted off of Indian courses. So, I usually look up for Indian notes as well. Faadooengineers is a site with study materials for Indian students, and the forum is where users post their notes and study materials. So, what you can do to search for notes is, go to Google and search for: &#8220;site:Faadooengineers.com <em>subject notes</em>&#8220;. Obviously, you will need to replace <em>subject</em> with the name of the subject whose notes you&#8217;re searching. You might need to register before you are able to download the attached files. I have found some useful notes this way. I even saw one of my teachers downloading lecture contents from the site.</p>
<p style="text-align: justify;">Bonus 1: <a href="https://github.com/CSIT-GUIDE" target="_blank">Notes of every semester</a>.</p>
<p style="text-align: justify;">Bonus 2: <a href="https://flair16.herokuapp.com" target="_blank">List of final year projects</a>.</p>
<!--themify_builder_content-->
<div id="themify_builder_content-9306" data-postid="9306" class="themify_builder_content themify_builder_content-9306 themify_builder tf_clear">
    </div>
<!--/themify_builder_content-->
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/mooc-bsc-csit.html">MOOCs for BSc CSIT</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/mooc-bsc-csit.html/feed</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
		<item>
		<title>Breaking a simple text based CAPTCHA</title>
		<link>https://www.thelacunablog.com/breaking-text-based-captcha.html</link>
					<comments>https://www.thelacunablog.com/breaking-text-based-captcha.html#comments</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Tue, 27 Dec 2016 11:03:43 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[neural network]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://www.thelacunablog.com/?p=9265</guid>

					<description><![CDATA[<p><img width="666" height="648" src="https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM.png" class="attachment-full size-full wp-post-image" alt="Neural Network Results" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM.png 666w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM-300x292.png 300w" sizes="(max-width: 666px) 100vw, 666px" /></p>
<p>It took me about a week of my Dashain vacation to make this simple captcha breaker (5 days to be exact). I had been reading Image Processing in my CS undergrad for some time then, and wanted to put my skills to use, although, I must admit, its not as overly complicated or full of image processing bits as [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/breaking-text-based-captcha.html">Breaking a simple text based CAPTCHA</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="666" height="648" src="https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM.png" class="attachment-full size-full wp-post-image" alt="Neural Network Results" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM.png 666w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM-300x292.png 300w" sizes="(max-width: 666px) 100vw, 666px" /></p><p style="text-align: justify;">It took me about a week of my <a href="https://en.wikipedia.org/wiki/Dashain" target="_blank">Dashain</a> vacation to make this simple captcha breaker (5 days to be exact). I had been reading Image Processing in my CS undergrad for some time then, and wanted to put my skills to use, although, I must admit, its not as overly complicated or full of image processing bits as I&#8217;d have likely enjoyed. I had only learned the basics when I started doing this. If I were to do it now, I would have definitely done it differently.</p>
<p style="text-align: justify;">I decoded a simple text based CAPTCHA with an acceptable level of accuracy (acceptable to me, that is). I did not generate any CAPTCHA for the purpose, but instead used a live website to grab the CAPTCHAs from. A now-defunct WordPress plugin called <a href="https://github.com/wp-plugins/captcha-on-login" target="_blank">Captcha on Login</a> generated these CAPTCHAs, and the plugin is still used by several websites.</p>
<p style="text-align: justify;">With the help of the selenium module, I put together a Python script to take screenshot of the website whenever the CAPTCHA was shown, and then simply crop the image to fit to the CAPTCHA and save it to my local disk. In this way, I prepared a training and testing set for my Neural Network which I was going to use for recognizing the letters.</p>
<p style="text-align: justify;">The reason I called it a simple text based CAPTCHA is because, all the characters have a uniform color, they are not connected, and the characters have a constant font. The background color is also uniform although completely different from the color of the characters, and there are no distortions, rotations etc. That means, a lot of the hardwork that goes into identifying text locations, and extracting characters from the background was unnecessary. I only needed to focus on segmentation, and its not difficult either, given that the characters are not connected, and the background and text color is clearly separable.</p>
<p style="text-align: justify;"><img width="160" height="60" class="size-full wp-image-9266 aligncenter" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/captcha2.jpeg" alt="Original Captcha" /></p>
<p style="text-align: justify;"><img width="160" height="60" class="size-full wp-image-9267 aligncenter" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/captcha2.gif" alt="Grayed CAPTCHA" /></p>
<p style="text-align: justify;">The first image is what the CAPTCHA looks like. It&#8217;s easier to work with grayscale image than it is with a colored image. So, I converted it into a grayscaled version, which you can see on the second image. Most of the work has been accomplished by using the pillow imaging library in Python.</p>
<p style="text-align: justify;">How did I do it? First, I converted it to a GIF image so that the available colors are reduced to 256 (GIF supports 8 bits per pixel, that means, the maximum number of colors a frame can use is 256). Then, as you can see, the characters have clearly a distinct color from the background. So, I made a color histogram of the now converted image, and then chose a pixel that is moderately common. In the above CAPTCHA, orange color (i.e. the background) is the most common. Using the color histogram, I tried to take a guess at the character&#8217;s pixel (i.e. Red colored pixel) since all the characters in every CAPTCHA had red color. Then, I made a new image the same size as the first image with a white background, and then went through the first image, looking for the pixel of the color that I had chosen earlier, then when I found that pixel, I marked the pixel on the same position on the second image as black. I continued this until I had correctly chosen the pixels for red color. Turns out, anything below 52 would give me just the characters from the original image. And so, I could successfully convert the original CAPTCHA with background to a binarized image.</p>
<p style="text-align: justify;">The next and major step is segmentation. The neural network would only be able to recognize one character at a time. That means, I need to feed one character&#8217;s image at a time. The grayscale image that we now have, needs to be divided into separate images for each characters that it contains, and that is done with the help of vertical slicing.</p>
<p style="text-align: justify;">This is actually pretty easy in this case because the characters are not connected at all. If they were, I&#8217;d have to put more effort into untangling them. But, in this case, I can keep track of where each character starts and ends and just extract that part.</p>
<p style="text-align: justify;"><img width="160" height="60" class="aligncenter size-full wp-image-9270" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/segmented.gif" alt="Segmentation" /></p>
<p style="text-align: justify;">The way I have done that is iterate through the column of the image first and then through each of the rows in that column. I then check for the value of the pixel at that row and column, and if it is 255, I know that it is background. If it is not 255, however, I know that I&#8217;m inside a character, and I mark the value of the current column as the starting location. I keep on iterating until I find out the immediate next column where all of the rows have a pixel value of 255, which means that the column only contains the white background. And then I mark that column as the end location for that character.</p>
<p style="text-align: justify;"><img class="aligncenter wp-image-9271 size-full" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.40.37-PM.png" alt="Start and End points" width="894" height="58" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.40.37-PM.png 894w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.40.37-PM-300x19.png 300w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.40.37-PM-768x50.png 768w" sizes="(max-width: 894px) 100vw, 894px" /></p>
<p style="text-align: justify;">In this way, I build an array with starting and ending point for each of the characters. The problem with this however, is that, sometimes there are gaps in the pixels i.e. some characters might miss a pixel or two because earlier when we converted the image to grayscale, we only chose to blacken the pixels that were under 52, so some of the pixels will be missed. So, I added a check to make sure that the new character is indeed a new character, and not the gaps between the pixels of the same character. If the difference between the end location and start location is greater than 5 then I took it as a new character otherwise, I assumed it to belong to the same character. I then cropped the image using the starting and ending point of each of the characters.</p>
<p style="text-align: justify;">This is what I would have done differently had I done it today. Instead of such a naive assumption of the pixel distance, I would have just used gaussian blur, morphological processing such as erosion and dilation or line thickening to tackle this issue. Unfortunately, when I did this, I was yet to learn about all these things. So, one thing you can do to improve this approach, and maybe increase accuracy, is to try these out rather than my naive assumption way.</p>
<p style="text-align: justify; padding-left: 90px;"> <img width="60" height="60" class=" wp-image-9274 alignleft" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/5f0ca4eda36a90254e32dcbd941bb2a5.gif" alt="5f0ca4eda36a90254e32dcbd941bb2a5" /> <img width="60" height="60" class="size-medium wp-image-9275 alignleft" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/1303e258523c8db41e1892af8c542ef9.gif" alt="1303e258523c8db41e1892af8c542ef9" /><img width="60" height="60" class="size-full wp-image-9273 alignleft" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/2e1dde0d3d968933d8d2562409829a40.gif" alt="2e1dde0d3d968933d8d2562409829a40" /> <img width="60" height="60" class="size-medium wp-image-9276 alignleft" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/e3ebc11a76756ad4de619cbb13c80f29.gif" alt="e3ebc11a76756ad4de619cbb13c80f29" /> <img width="60" height="60" class="size-medium wp-image-9277 alignleft" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/ecf0ec7a257705766578acb5acf3cd75.gif" alt="ecf0ec7a257705766578acb5acf3cd75" /></p>
<p>&nbsp;</p>
<p>Since the Neural Network expected a uniform input, I created images of 60&#215;60 dimension with white background, and placed the cropped image of each of the characters in the middle of that image. So, each cropped character was saved with a dimension of 60&#215;60 in the middle of a white background. And thus, all of the characters were successfully segmented.</p>
<p style="text-align: justify;">Now the only part left is to train the Neural Network. Each of the segmented characters were saved into their respective directories identified by their number in serial order (starting with 0, 1, 2, &#8230;, 9 for digits, 10, 11, 12, &#8230;, 35 for alphabets, and 36, 37, 38, &#8230;, 61 for capital alphabets). Some of the digits and alphabets were not used in the CAPTCHA, so some of the folders turned out to be empty.</p>
<p style="text-align: justify;"><img class="aligncenter wp-image-9272 size-full" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.44.41-PM.png" alt="Training Set" width="1944" height="1058" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.44.41-PM.png 1944w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.44.41-PM-300x163.png 300w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.44.41-PM-768x418.png 768w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-2.44.41-PM-1030x561.png 1030w" sizes="(max-width: 1944px) 100vw, 1944px" /></p>
<p style="text-align: justify;">The neural network is implemented <a href="http://www.thelacunablog.com/devnagari-digit-recognition-neural-network.html" target="_blank">the same way as it has been before</a>. Using 3600 input nodes, 2700 hidden nodes, 62 output nodes, and a learning rate of 0.005 gave me the best result. Just a single run did not give me satisfactory result, so I trained the neural network by epoch for about 30 runs. With a training set of 1350 samples, and a test set of 50 samples, it was able to recognize characters with a 90% accuracy. In the end, the CAPTCHA breaker was tested with 200 CAPTCHAs and it recognized almost 80% of it &#8212; and that includes the process of reading the image, converting it to grayscale, segmenting each characters, feeding the extracted characters to the neural network in order to recognize it, and then concatenating the outputs of the neural networks together. I also tried using <a href="https://github.com/tesseract-ocr" target="_blank">Tesseract</a> directly on the CAPTCHA, and it gave me a 25% accuracy.</p>
<p style="text-align: justify;"><img class="aligncenter wp-image-9291 size-medium" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM-300x292.png" alt="Neural Network Results" width="300" height="292" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM-300x292.png 300w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Screen-Shot-2016-12-27-at-3.00.40-PM.png 666w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p style="text-align: justify;">As I&#8217;ve mentioned before, it was a simple CAPTCHA, and I broke it with such minimal effort that it should be a lesson not to roll your own CAPTCHA. Everyone should be using <a href="https://www.google.com/recaptcha/" target="_blank">reCAPTCHA</a>. Now go ahead, look for sites that have weak CAPTCHAs and try breaking them. <a href="https://login.gearbest.com/m-users-a-sign.htm?type=1" target="_blank">Here&#8217;s one</a> for you to try out your skills.</p>
<p style="text-align: justify;">All the codes and the dataset are available on my <a href="https://github.com/sknepal/decoding_CAPTCHA" target="_blank">GitHub Repository</a>. For your convenience:</p>
<ul>
<li style="text-align: justify;"><a href="https://github.com/sknepal/decoding_CAPTCHA/blob/master/grabbing_CAPTCHA.py" target="_blank">Code to grab CAPTCHA from the website</a></li>
<li style="text-align: justify;"><a href="https://github.com/sknepal/decoding_CAPTCHA/blob/master/dataset.py" target="_blank">Code to prepare the CSV dataset for the characters</a></li>
<li style="text-align: justify;"><a href="https://github.com/sknepal/decoding_CAPTCHA/blob/master/neuralnet.py" target="_blank">Code to train the Neural Network</a></li>
<li style="text-align: justify;"><a href="https://github.com/sknepal/decoding_CAPTCHA/blob/master/Captcha%20Breaker.ipynb" target="_blank">Code for the main program</a> (i.e. read, segment, resize, feed into Neural Network, and concatenate output)</li>
<li style="text-align: justify;">Training set for the segmented characters: <a href="https://github.com/sknepal/decoding_CAPTCHA/tree/master/cat-train" target="_blank">Actual Images</a> | <a href="https://github.com/sknepal/decoding_CAPTCHA/blob/master/train.csv" target="_blank">CSV File</a></li>
<li style="text-align: justify;">Testing set for the segmented characters  : <a href="https://github.com/sknepal/decoding_CAPTCHA/tree/master/cat-test" target="_blank">Actual Images</a> | <a href="https://github.com/sknepal/decoding_CAPTCHA/blob/master/test.csv" target="_blank">CSV File</a></li>
<li style="text-align: justify;">Testing set for the whole CAPTCHA           : <a href="https://github.com/sknepal/decoding_CAPTCHA/tree/master/testcaptcha" target="_blank">Actual Images</a></li>
</ul>
<p style="text-align: justify;"><strong>Next challenge</strong>:</p>
<p style="text-align: justify;">Hidden Markov Models.</p>
<!--themify_builder_content-->
<div id="themify_builder_content-9265" data-postid="9265" class="themify_builder_content themify_builder_content-9265 themify_builder tf_clear">
    </div>
<!--/themify_builder_content-->
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/breaking-text-based-captcha.html">Breaking a simple text based CAPTCHA</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/breaking-text-based-captcha.html/feed</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Handwritten Devanagari Digit Recognition using Neural Network</title>
		<link>https://www.thelacunablog.com/devnagari-digit-recognition-neural-network.html</link>
					<comments>https://www.thelacunablog.com/devnagari-digit-recognition-neural-network.html#respond</comments>
		
		<dc:creator><![CDATA[Subigya Nepal]]></dc:creator>
		<pubDate>Wed, 14 Dec 2016 16:46:00 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[neural network]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://www.thelacunablog.com/?p=9219</guid>

					<description><![CDATA[<p><img width="640" height="400" src="https://www.thelacunablog.com/wp-content/uploads/2016/12/640px-Neural_network.svg_.png" class="attachment-full size-full wp-post-image" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/640px-Neural_network.svg_.png 640w, https://www.thelacunablog.com/wp-content/uploads/2016/12/640px-Neural_network.svg_-300x188.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<p>Neural Network was one of the electives available during my 5th semester, and knowing that it was available, I was certain that I wanted to study it over any other electives. But, unfortunately (or fortunately), my college, as it is with many other colleges of Nepal, made it a compulsion to take Cryptography as the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/devnagari-digit-recognition-neural-network.html">Handwritten Devanagari Digit Recognition using Neural Network</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img width="640" height="400" src="https://www.thelacunablog.com/wp-content/uploads/2016/12/640px-Neural_network.svg_.png" class="attachment-full size-full wp-post-image" alt="" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/640px-Neural_network.svg_.png 640w, https://www.thelacunablog.com/wp-content/uploads/2016/12/640px-Neural_network.svg_-300x188.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></p><p style="text-align: justify;">Neural Network was one of the electives available during my 5th semester, and knowing that it was available, I was certain that I wanted to study it over any other electives. But, unfortunately (or fortunately), my college, as it is with many other colleges of Nepal, made it a compulsion to take Cryptography as the elective subject. I, obviously, wanted to study Neural Net and could not convince the college on teaching ANN instead of Cryptography. I was left with no choice but to study both, which I did. A few of us studied both the subjects as an elective. Since the teacher was not available during the weekdays, we took classes on every weekend for 3 hours each. So, there were no holidays for us, for 4 months, I think.</p>
<p style="text-align: justify;">When it came time to study, I enjoyed Cryptography more than I enjoyed Neural Network. I&#8217;d say, this is in part due to the course content, as well as the teacher&#8217;s ability to make the class interesting. Anyway, as the teacher put it, we had to implement the &#8220;hello world&#8221; problem of Neural Network as a class project. Meaning, handwritten digit recognition using MNIST dataset. I followed a great practical introductory  book that helped me understand and implement it, which I will share just in a moment.</p>
<p style="text-align: justify;">Having tried out the MNIST dataset, I decided I should give Nepali handwritten digit recognition a shot too. Looking around, I found a dataset provided by Computer Vision Research Group, Nepal. It contains both the devanagari letters and digits. I chose to work on just the digits. Since reading the images one by one and doing the computation would have been restrictive, I extracted the pixels from all the images and stored them in a CSV file. That way, its easier to feed the pixels into the neural net, and also to share the dataset among enthusiastic readers who would want to try it out themselves.</p>
<p style="text-align: justify;">All the images of the digits in the original dataset were used. In total, 1700 examples of each digit was used to create a training set and 300 examples of each digit was used to create a testing set.</p>
<p style="text-align: justify;">In the CSV file, the first value in the row is the actual value of the image, ie. the digit it represents, and the other values are its pixels. All the images in the dataset are of 32&#215;32 dimension, so in total there are 1025 values (or columns) for each images including the first value which is the digit the image represents. The new dataset was then shuffled in order to avoid the occurrence of same kinds of examples one after another, which could lead to an inefficient learning.</p>
<p style="text-align: justify;"><strong>Dataset </strong></p>
<p style="text-align: justify;">You can <a href="http://www.thelacunablog.com/devanagari-handwritten-character-dataset.html" target="_blank">learn more about the dataset and download it from here</a>.</p>
<p style="text-align: justify;"><strong>Neural Network</strong></p>
<p style="text-align: justify;">Now that we have pre-processed the existing raw images in order to create a dataset that is easy to work with, we have a training set and a testing set.</p>
<p style="text-align: justify;">Our Neural network will consist of 3 layers: an input, hidden and output layer. The number of these are governed by our data. Since we have 1024 pixel values for each images, there will be 1024 input nodes. Similarly, since our output needs to be one of the 10 digits (0 to 9), that means we will have 10 output nodes. Whichever node has the highest value will be the output of the network. However, the science of hidden layer is not quite clear, and what is done here is rather a simple guess at choosing the number of hidden layers. It is expected to be less than the input layer, and a value of 300 has been chosen. The learning rate is also chosen without any scientific reason whatsoever, at 0.3.</p>
<p><img width="300" height="143" class="size-medium wp-image-9259 aligncenter" src="http://www.thelacunablog.com/wp-content/uploads/2016/12/Multi-Layer_Neural_Network-Vector-Blank.svg_-300x143.png" alt="Multilayer Neural Network" srcset="https://www.thelacunablog.com/wp-content/uploads/2016/12/Multi-Layer_Neural_Network-Vector-Blank.svg_-300x143.png 300w, https://www.thelacunablog.com/wp-content/uploads/2016/12/Multi-Layer_Neural_Network-Vector-Blank.svg_.png 500w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<h6 style="text-align: right;">By Offnfopt [<a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY-SA 3.0</a>]</h6>
<p style="text-align: justify;">Signals are transferred from input layer to next layer by multiplying the matrix of weight values and inputs. The weights are chosen randomly between -0.5 and +0.5. The output of this multiplication is the combined moderated signal into the hidden layer.</p>
<p style="text-align: justify;">We have used sigmoid function as an activation function. The combined moderated signal is passed to the sigmoid function, 1/ (1 + e<sup>-x </sup>), which squashes the input and gives an output for the layer. The same process is repeated between hidden and output layer.</p>
<p style="text-align: justify;">The final output of the network is compared with the expected output in order to calculate the error. We can compute the error in the output layer by simply subtracting its output to the expected output. But, to learn the error in the hidden layer, we have to propagate the error backwards i.e. we need to split the errors according to the weight of the contributing links. This can be obtained by multiplying the matrix of weights of hidden layer to output layer and the error of the output layer.</p>
<p style="text-align: justify;">Once we have the error, we need to update the link weights according to the error. We use gradient descent algorithm to refine the weights so that we can minimize our cost function.</p>
<p style="text-align: justify;"><strong>Output</strong></p>
<p style="text-align: justify;">An accuracy of about 95%.</p>
<p style="text-align: justify;"><strong>Code</strong></p>
<p style="text-align: justify;">Available on my GitHub: <a href="https://github.com/sknepal/devanagari_digit_recognition" target="_blank">https://github.com/sknepal/devanagari_digit_recognition</a></p>
<p style="text-align: justify;">If all these seemed foreign to you, I strongly recommend you to read this book called <i>Make Your Own Neural Network </i>by Tariq Rashid. The python implementation of the Neural network on GitHub is based on the book.</p>
<p style="text-align: justify;"><strong>Next Challenge</strong></p>
<p style="text-align: justify;"><a href="http://www.thelacunablog.com/breaking-text-based-captcha.html" target="_blank">Breaking a simple text captcha. </a></p>
<!--themify_builder_content-->
<div id="themify_builder_content-9219" data-postid="9219" class="themify_builder_content themify_builder_content-9219 themify_builder tf_clear">
    </div>
<!--/themify_builder_content-->
<p>The post <a rel="nofollow" href="https://www.thelacunablog.com/devnagari-digit-recognition-neural-network.html">Handwritten Devanagari Digit Recognition using Neural Network</a> appeared first on <a rel="nofollow" href="https://www.thelacunablog.com">The Lacuna Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.thelacunablog.com/devnagari-digit-recognition-neural-network.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
