<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-2885625373493323490</atom:id><lastBuildDate>Wed, 06 Nov 2024 02:56:21 +0000</lastBuildDate><category>Sorting</category><category>ASP.NET</category><category>RUBIK&#39;S CUBE</category><category>Root finding</category><category>COBOL</category><category>CODING</category><category>MOTIVATIONS</category><category>Typing</category><category>graph</category><category>.NET</category><category>C#</category><category>Geocoding</category><category>JSON</category><category>JavaScript</category><category>Memorization</category><category>Queue</category><category>Sql Server</category><category>Windows Service</category><category>bat file</category><title>BADKR</title><description>ASP.NET, Sql Server, COBOL, C#, JSON, Sorting, Root Finding, Geocoding, Memorization, Graph</description><link>http://badkr.blogspot.com/</link><managingEditor>noreply@blogger.com (Anonymous)</managingEditor><generator>Blogger</generator><openSearch:totalResults>54</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-7497402090758213705</guid><pubDate>Sun, 22 Mar 2015 03:53:00 +0000</pubDate><atom:updated>2015-03-21T20:53:19.510-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Windows Service</category><title>The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In my case, the windows service was working fine on Local, but while deploying on another machine. I created the service using SC commands which was done successfully, but on starting the service, I got this error.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution that worked for me:&lt;/b&gt;&lt;br /&gt;
1) On my local computer, cleared the data of &lt;b&gt;Debug and Releas&lt;/b&gt;e folders in both &lt;b&gt;bin and obj &lt;/b&gt;directories.&lt;br /&gt;
&lt;br /&gt;
2) Then deployed, created and started the service successfully.&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/03/the-service-on-local-computer-started.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-174873351142818427</guid><pubDate>Sat, 21 Mar 2015 18:53:00 +0000</pubDate><atom:updated>2015-03-21T11:53:03.652-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">bat file</category><title>Run multiple SQL scripts in order using a batch file</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Suppose, we have to run following sql files in the order:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;1) CREATE_TABLES.sql&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;2) TABLE_INSERTS.sql&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;3) CREATE_INDEXES.sql&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;4) CREATE_PROCEDURES.sql&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and suppose they are all present in the directory:&lt;br /&gt;
&lt;i style=&quot;background-color: cyan;&quot;&gt;&lt;b&gt;C:\Users\Arjun\Documents\SQL Server Management Studio\BATCheck&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, create a script say&amp;nbsp;&lt;b&gt;CREATE_DB.sql&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;SET NOCOUNT ON
GO

&lt;span style=&quot;background-color: yellow;&quot;&gt;PRINT &#39;CREATING DATABASE&#39;
IF EXISTS (SELECT 1 FROM SYS.DATABASES WHERE NAME = &#39;HELLODB&#39;)
DROP DATABASE HELLODB
GO
CREATE DATABASE HELLODB
GO&lt;/span&gt;

USE HELLODB
GO
:On Error exit

:r &quot;C:\Users\Arjun\Documents\SQL Server Management Studio\BATCheck\CREATE_TABLES.sql&quot;
:r &quot;C:\Users\Arjun\Documents\SQL Server Management Studio\BATCheck\TABLE_INSERTS.sql&quot;
:r &quot;C:\Users\Arjun\Documents\SQL Server Management Studio\BATCheck\CREATE_INDEXES.sql&quot;
:r &quot;C:\Users\Arjun\Documents\SQL Server Management Studio\BATCheck\CREATE_PROCEDURES.sql&quot;

PRINT &#39;DATABASE CREATE IS COMPLETE&#39;
GO

&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
If &lt;b&gt;HELLODB&lt;/b&gt;&amp;nbsp;already exists and you don&#39;t want to drop it, then remove the highlighted code above.&lt;br /&gt;
&lt;br /&gt;
Now, create a new file, add the following code and save as &lt;b&gt;demo.bat&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
if &lt;b&gt;HELLODB&lt;/b&gt;&amp;nbsp;already exists:&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;xml&quot; name=&quot;code&quot;&gt;SQLCMD -E -d HELLODB -i &quot;C:\Users\Arjun\Documents\SQL Server Management Studio\BATCheck\create_db.sql&quot;
PAUSE
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
if&amp;nbsp;&lt;b&gt;HELLODB&lt;/b&gt;&amp;nbsp;does not exist:&lt;br /&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;SQLCMD -E -d master -i &quot;C:\Users\Arjun\Documents\SQL Server Management Studio\BATCheck\create_db.sql&quot;
PAUSE&lt;/pre&gt;
&lt;br /&gt;
Now, double click the &lt;b&gt;demo.bat&lt;/b&gt;&amp;nbsp;file and all the sql scripts will get executed.&lt;/div&gt;
&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/03/run-multiple-sql-scripts-in-order-using.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-6160122300202403421</guid><pubDate>Sat, 21 Mar 2015 03:49:00 +0000</pubDate><atom:updated>2015-03-21T13:48:00.276-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><title>How to create, start, stop and delete a Windows Service using SC commands</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1) First go to the directory where the Windows Service executable (.exe file) is present.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY4MPlqREdb1_A3QXKdiCMNZY9ynRJ7E4gP9o2clfns8F1b2qD7arZ7yEw8GCG2gLLFTNYbpWLJFpSuK1G5Qm-kznXvY9KimXmziUQJpZfN90FDWUMklEbVsXfxvE9lD7rTpodYXtetpQ/s1600/1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY4MPlqREdb1_A3QXKdiCMNZY9ynRJ7E4gP9o2clfns8F1b2qD7arZ7yEw8GCG2gLLFTNYbpWLJFpSuK1G5Qm-kznXvY9KimXmziUQJpZfN90FDWUMklEbVsXfxvE9lD7rTpodYXtetpQ/s1600/1.PNG&quot; height=&quot;129&quot; title=&quot;Path of Windows Service Executable&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
2) Open Command Prompt.&lt;br /&gt;
&lt;br /&gt;
3) To create service, enter the following command:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;sc create DemoServiceName binpath= &quot;C:\Users\Arjun\Documents\Visual Studio 2013\Projects\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe&quot;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
where, &amp;nbsp;&lt;b&gt;DemoServiceName &lt;/b&gt;= name of the windows service&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoYep-SOLbb097aFLojQjnJ-CwpWey5LhwmirUW96C6mU9Ns6D4UH4DtVzY8CxIEEYa2BM-_ykKVy2nvm3QTxiKuMVlgtxYoQdH1bOLe6Rh7L5vma_iHX3OsApIWCV__Lfwa8bC81o3i0/s1600/2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoYep-SOLbb097aFLojQjnJ-CwpWey5LhwmirUW96C6mU9Ns6D4UH4DtVzY8CxIEEYa2BM-_ykKVy2nvm3QTxiKuMVlgtxYoQdH1bOLe6Rh7L5vma_iHX3OsApIWCV__Lfwa8bC81o3i0/s1600/2.PNG&quot; height=&quot;130&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
4) Click Start button, type &lt;b&gt;services.msc&lt;/b&gt;&amp;nbsp;and hit enter. You can see the service&amp;nbsp;&lt;b&gt;DemoServiceName &amp;nbsp;&lt;/b&gt;in the list.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilPdo71LFq0CL1vMHeDzRmNNlDasxSyWze_IEeRsL3rDdl8wgzF0CoTw4iaJoTqhuOufMfPQWKxhNcc4iY7SqFI5dds3ZLLqMiVEyoHQ9oiKDDogCzX245AjB_mkQruOlLwSKhPPHV17Q/s1600/7.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilPdo71LFq0CL1vMHeDzRmNNlDasxSyWze_IEeRsL3rDdl8wgzF0CoTw4iaJoTqhuOufMfPQWKxhNcc4iY7SqFI5dds3ZLLqMiVEyoHQ9oiKDDogCzX245AjB_mkQruOlLwSKhPPHV17Q/s1600/7.PNG&quot; height=&quot;154&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
5) To start service, enter the following command :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;sc start DemoServiceName&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlNVFoBRCb_JTyDnUjnQAnK4EZh_LqLpKaxBFSihW3B_5ethl4k1JrGdfyisYkEtFuBi9LmvLMXkNpet-LTGJufFqpZ6sioc6g2CkHLuJYaRBaRqis21svg_vVLHxvaIJus1Ngh_yY44M/s1600/3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlNVFoBRCb_JTyDnUjnQAnK4EZh_LqLpKaxBFSihW3B_5ethl4k1JrGdfyisYkEtFuBi9LmvLMXkNpet-LTGJufFqpZ6sioc6g2CkHLuJYaRBaRqis21svg_vVLHxvaIJus1Ngh_yY44M/s1600/3.PNG&quot; height=&quot;214&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
6) To stopservice, enter the following command :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;sc stop DemoServiceName&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdLA9Y3IJFuIr8IePqT03VWU1jkteeT6L1G59dUlxkLW1O3JCb2utI6UO-vQFpzorSW7AAUNLSlTpfki3MeBg0s06vwiyZSYdHXAQtVO__11hiri9bC4UZeDuKRe0QbIc56wJFufjbawo/s1600/4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdLA9Y3IJFuIr8IePqT03VWU1jkteeT6L1G59dUlxkLW1O3JCb2utI6UO-vQFpzorSW7AAUNLSlTpfki3MeBg0s06vwiyZSYdHXAQtVO__11hiri9bC4UZeDuKRe0QbIc56wJFufjbawo/s1600/4.PNG&quot; height=&quot;184&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
7) To delete service, enter the following command :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;sc delete DemoServiceName&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8y5vM8j7-0Kdm4x11IwT1evD3aMNLfGSOkMHP93AsIHXwM7JWBzqs70RuHb2WXYwYcjodrJ5-7CXKeK-dSGZYhHJq3x_GidDCdHV3IS4g2LpBalgV8r4A4zHQWvN_jfs4B9g13wMjbS4/s1600/5.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8y5vM8j7-0Kdm4x11IwT1evD3aMNLfGSOkMHP93AsIHXwM7JWBzqs70RuHb2WXYwYcjodrJ5-7CXKeK-dSGZYhHJq3x_GidDCdHV3IS4g2LpBalgV8r4A4zHQWvN_jfs4B9g13wMjbS4/s1600/5.PNG&quot; height=&quot;110&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/03/how-to-create-start-stop-and-delete.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY4MPlqREdb1_A3QXKdiCMNZY9ynRJ7E4gP9o2clfns8F1b2qD7arZ7yEw8GCG2gLLFTNYbpWLJFpSuK1G5Qm-kznXvY9KimXmziUQJpZfN90FDWUMklEbVsXfxvE9lD7rTpodYXtetpQ/s72-c/1.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-4530683469036804217</guid><pubDate>Mon, 26 Jan 2015 14:15:00 +0000</pubDate><atom:updated>2015-01-26T06:15:16.517-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">COBOL</category><title>warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] in COBOL</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I recently installed Open-COBOL in Ubuntu. I wrote a program &lt;b&gt;helloworld.cbl&lt;/b&gt;&amp;nbsp;and compiled it using command:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;cobc -free -x -o helloworld helloworld.cbl&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
After compiling the code, I got a bunch of warnings all of which looks like:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
To get rid of the warnings, compile the code using command:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;background-color: yellow;&quot;&gt;cobc -free -x -O -o helloworld helloworld.cbl&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/01/warning-dereferencing-type-punned.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-2658656246983712256</guid><pubDate>Thu, 22 Jan 2015 07:18:00 +0000</pubDate><atom:updated>2015-01-24T08:27:39.312-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">COBOL</category><title>Error: syntax error, unexpected &quot;end of file&quot; in COBOL</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;u style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/u&gt;
&lt;u style=&quot;font-weight: bold;&quot;&gt;Key Point:&lt;/u&gt;&lt;br /&gt;
Each line should end with CRLF (&lt;a href=&quot;http://en.wikipedia.org/wiki/Carriage_return&quot; target=&quot;_blank&quot;&gt;Carriage Return&lt;/a&gt; + &lt;a href=&quot;http://en.wikipedia.org/wiki/Newline&quot; target=&quot;_blank&quot;&gt;Line Feed&lt;/a&gt;). It means each line should end with &#39;&lt;span style=&quot;background-color: yellow;&quot;&gt;\r\n&lt;/span&gt;&#39;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
To get rid of the error, copy-paste the code in &lt;b&gt;Notepad++&lt;/b&gt;&amp;nbsp;and do the following steps:&lt;br /&gt;
&lt;br /&gt;
1) Replace &#39;&lt;span style=&quot;background-color: yellow;&quot;&gt;\n&lt;/span&gt;&#39; with &#39;&#39; (blank).&lt;br /&gt;
2) Replace &#39;&lt;span style=&quot;background-color: yellow;&quot;&gt;\r&lt;/span&gt;&#39; with &#39;&lt;span style=&quot;background-color: yellow;&quot;&gt;\r\n&lt;/span&gt;&#39;&lt;br /&gt;
3) Go to the last line and hit &lt;b&gt;Enter&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/01/error-syntax-error-unexpected-end-of.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-1701807489434360370</guid><pubDate>Tue, 13 Jan 2015 18:25:00 +0000</pubDate><atom:updated>2015-01-24T08:33:14.666-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><title>Select Default Option in DropDownList on PageLoad in ASP.Net using jQuery</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;DemoGrid.Default&quot; %&amp;gt;

&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head runat=&quot;server&quot;&amp;gt;
    &amp;lt;script src=&quot;Scripts/jquery-1.11.2.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
        &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
            $(document).ready(function () {
                $(&quot;select#DropDownList1 option&quot;).filter(function () {
                    return $(this).val() == &quot;0&quot;;
                }).prop(&#39;selected&#39;, true);
            });
        &amp;lt;/script&amp;gt;

        &amp;lt;div&amp;gt;
            &amp;lt;asp:DropDownList ID=&quot;DropDownList1&quot; runat=&quot;server&quot;&amp;gt;
                &amp;lt;asp:ListItem Value=&quot;0&quot;&amp;gt;Select&amp;lt;/asp:ListItem&amp;gt;
            &amp;lt;/asp:DropDownList&amp;gt;
            &amp;lt;asp:Button runat=&quot;server&quot; Text=&quot;dummy&quot; /&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/01/select-default-option-in-dropdownlist.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-685264116834658966</guid><pubDate>Tue, 13 Jan 2015 17:34:00 +0000</pubDate><atom:updated>2015-01-24T08:32:22.210-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><title>Clear Multiple Textboxes in ASP.Net on Button Click</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;DemoGrid.Default&quot; %&amp;gt;

&amp;lt;!DOCTYPE html&amp;gt;

&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head runat=&quot;server&quot;&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
        &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
            function Clear() {
                var txts = document.getElementsByClassName(&#39;txts&#39;);

                for (var i = 0; i &amp;lt; txts.length; i++)
                    txts[i].value = &#39;&#39;;

                return false;
            }
        &amp;lt;/script&amp;gt;

        &amp;lt;div&amp;gt;
            &amp;lt;asp:TextBox ID=&quot;txt1&quot; runat=&quot;server&quot; CssClass=&quot;txts&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;
            &amp;lt;asp:TextBox ID=&quot;txt2&quot; runat=&quot;server&quot; CssClass=&quot;txts&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;
            &amp;lt;asp:TextBox ID=&quot;txt3&quot; runat=&quot;server&quot; CssClass=&quot;txts&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;
            &amp;lt;asp:TextBox ID=&quot;txt4&quot; runat=&quot;server&quot; CssClass=&quot;txts&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;

            &amp;lt;input type=&quot;button&quot; name=&quot;name&quot; value=&quot; Clear&quot; onclick=&quot;Clear();&quot; /&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/01/clear-multiple-textboxes-in-aspnet-on.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-3059893794876858344</guid><pubDate>Tue, 13 Jan 2015 17:30:00 +0000</pubDate><atom:updated>2015-01-24T08:36:16.077-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><title>Enable-Disable a Panel using Javascript in ASP.NET</title><description>
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;DemoGrid.Default&quot; %&amp;gt;

&amp;lt;!DOCTYPE html&amp;gt;

&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head runat=&quot;server&quot;&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
        &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
            function Enable() {
                var controls = document.getElementById(&quot;&amp;lt;%=mypanel.ClientID%&amp;gt;&quot;).getElementsByTagName(&quot;input&quot;);

                for (var i = 0; i &amp;lt; controls.length; i++) {
                    controls[i].disabled = false;
                }
            }

            function Disable() {
                var controls = document.getElementById(&quot;&amp;lt;%=mypanel.ClientID%&amp;gt;&quot;).getElementsByTagName(&quot;input&quot;);

                for (var i = 0; i &amp;lt; controls.length; i++) {
                        controls[i].disabled = true;
                }
            }
        &amp;lt;/script&amp;gt;
            &amp;lt;asp:Panel ID=&quot;mypanel&quot; runat=&quot;server&quot;&amp;gt;
                &amp;lt;asp:TextBox runat=&quot;server&quot; /&amp;gt;
                &amp;lt;asp:TextBox runat=&quot;server&quot; /&amp;gt;
                &amp;lt;asp:CheckBox Text=&quot;text&quot; runat=&quot;server&quot; /&amp;gt;
                &amp;lt;asp:Button runat=&quot;server&quot; Text=&quot;Dummy&quot; /&amp;gt;
            &amp;lt;/asp:Panel&amp;gt;
            &amp;lt;input type=&quot;button&quot; name=&quot;name&quot; value=&quot; Disable&quot; onclick=&quot;Disable();&quot; /&amp;gt;
            &amp;lt;input type=&quot;button&quot; name=&quot;name&quot; value=&quot; Enable&quot; onclick=&quot;Enable();&quot; /&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/01/enable-disalbe-panel-using-javascript.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-2077097059498080485</guid><pubDate>Mon, 05 Jan 2015 18:46:00 +0000</pubDate><atom:updated>2015-01-24T08:40:55.789-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sql Server</category><title>Cannot login to Sql Server using Windows Authentication</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
I had the same problem. When I tried to login the Sql Server with Windows Authentication, following error message was displayed :
&lt;br /&gt;
&lt;div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiQxYms9fDI53WSHpa8ErV611dluVy2y3ZGtA9c0U46L9o4aVoTLbyHGHgtNTqoe_FfJxym6vpl251-xHEnLqoQPIlsjSolo1xa011kB29_lB9JRHUEUR2ZOO1BG_eLMRgwnonapKPHAE/s1600/error.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiQxYms9fDI53WSHpa8ErV611dluVy2y3ZGtA9c0U46L9o4aVoTLbyHGHgtNTqoe_FfJxym6vpl251-xHEnLqoQPIlsjSolo1xa011kB29_lB9JRHUEUR2ZOO1BG_eLMRgwnonapKPHAE/s1600/error.PNG&quot; height=&quot;228&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Finally, I got rid of this error as follows :&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
1) Open &lt;b&gt;Sql Server Configuration Manager.&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
2) Click &lt;b&gt;Sql Server Services&lt;/b&gt;, you will see a service with service type &lt;b&gt;SQL Server&lt;/b&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsTpegFBAT43mhksIdNWMlU_Y7PsDTdMzNmYTc0MAeyfSGG46sEYHdzIoB59P0e-XMyjvd9Ea-aK-rIxwkE_XZVHnqNKfM4oFuM2h4PWoxMgwCsRkP6EYIX3FZg5z1g5qZCdGjDHPBKxI/s1600/sql_server_config_manager.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsTpegFBAT43mhksIdNWMlU_Y7PsDTdMzNmYTc0MAeyfSGG46sEYHdzIoB59P0e-XMyjvd9Ea-aK-rIxwkE_XZVHnqNKfM4oFuM2h4PWoxMgwCsRkP6EYIX3FZg5z1g5qZCdGjDHPBKxI/s1600/sql_server_config_manager.PNG&quot; height=&quot;126&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
3) Double-click the service with type &lt;b&gt;SQL Server&lt;/b&gt;, a popup window will appear.&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
4) Click the &lt;b&gt;Service&lt;/b&gt;&amp;nbsp;tab and set the &lt;b&gt;Start Mode&lt;/b&gt; as &lt;b&gt;Automatic.&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRlqzs2R0lA9XuYA4n2fFa8xe_qoa-bbxPuedTBz7lBWDu7v3aLU-6LtZqDGoEzSnG73aUMEp2uhcxQuzmx3InbdUgeguF52Dnui6uDHOy6JiiB9dR05z4pJNU0QmtRNIQOKpRNzaoG_c/s1600/sql_service.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRlqzs2R0lA9XuYA4n2fFa8xe_qoa-bbxPuedTBz7lBWDu7v3aLU-6LtZqDGoEzSnG73aUMEp2uhcxQuzmx3InbdUgeguF52Dnui6uDHOy6JiiB9dR05z4pJNU0QmtRNIQOKpRNzaoG_c/s1600/sql_service.PNG&quot; height=&quot;400&quot; width=&quot;336&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
5) Now, click the &lt;b&gt;Log On&lt;/b&gt;&amp;nbsp;tab, &amp;nbsp;and click &lt;b&gt;Start&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfJGSg3t3VOzKR0ivncEd98M1GYRciQQ0ZH7gogEhUOafrgV7RubQDqOnmVtf8fH1Fmbp7Bv-w0DG0WIeInml9hECymGmXjOI1vxMPO8peQJs2tyNkvIPwHjc9T33nNK3szsvjYbk0GSU/s1600/sql_logon.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfJGSg3t3VOzKR0ivncEd98M1GYRciQQ0ZH7gogEhUOafrgV7RubQDqOnmVtf8fH1Fmbp7Bv-w0DG0WIeInml9hECymGmXjOI1vxMPO8peQJs2tyNkvIPwHjc9T33nNK3szsvjYbk0GSU/s1600/sql_logon.PNG&quot; height=&quot;400&quot; width=&quot;338&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
6) Click &lt;b&gt;Apply, &lt;/b&gt;then click &lt;b&gt;OK.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
7) Now, try to login in Sql Server using Windows Authentication. This method worked for me and may help you as well.&lt;/div&gt;
&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2015/01/cannot-login-to-sql-server-using.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiQxYms9fDI53WSHpa8ErV611dluVy2y3ZGtA9c0U46L9o4aVoTLbyHGHgtNTqoe_FfJxym6vpl251-xHEnLqoQPIlsjSolo1xa011kB29_lB9JRHUEUR2ZOO1BG_eLMRgwnonapKPHAE/s72-c/error.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-1782742413400078766</guid><pubDate>Mon, 22 Dec 2014 08:47:00 +0000</pubDate><atom:updated>2014-12-22T00:48:13.660-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Geocoding</category><title>Geocoding and Reverse Geocoding using JavaScript</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;geocoding.js&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function initialize(lat, lng, address){
     var latlng = new google.maps.LatLng(lat, lng)
     var mapOptions = {
         center: latlng,
         zoom: 4
     };
       
     var map = new google.maps.Map(document.getElementById(&quot;myMap&quot;), mapOptions);
       
     var marker = new google.maps.Marker({
          position: latlng,
          title: address,
         map: map,
       draggable: true
     });
    
     var infotext = address + &#39;&lt;hr /&gt;
&#39; + &#39;Latitude: &#39;+lat+&#39;
Longitude: &#39;+lng;
     var infowindow = new google.maps.InfoWindow();
     infowindow.setContent(infotext);
     infowindow.setPosition(new google.maps.LatLng(lat, lng));
     infowindow.open(map);
}
       
function getLatLng(){
     var address = document.getElementById(&quot;txtAddress&quot;).value;
     var geocoder = new google.maps.Geocoder();
    geocoder.geocode({ &#39;address&#39;: address }, function(results, status){
         if (status == google.maps.GeocoderStatus.OK){
           var longaddress = results[0].address_components[0].long_name;
            initialize(results[0].geometry.location.lat(), results[0].geometry.location.lng(), longaddress);
         }
         else{
            alert(&#39;Geocode error: &#39; + status);
         }
     });
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;reverseGeocoding.js&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function getAddress(lat, lng){
    var geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(lat, lng);
    geocoder.geocode({ &#39;latLng&#39;: latlng }, function(results, status){
    if (status == google.maps.GeocoderStatus.OK){
        if (results[1]){
            var address = results[1].formatted_address;
            alert(address);
        }
         else{
            alert(&quot;No results found&quot;);
         }
    }
    else {
        alert(&quot;Geocoder failed due to: &quot; + status);
    }
    });
}
    
function getLocation() {
    var x = document.getElementById(&quot;btnGetAddress&quot;);
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    }
    else { 
        x.innerHTML = &quot;Geolocation is not supported by this browser.&quot;;
    }
}

function showPosition(position) {
   getAddress(position.coords.latitude, position.coords.longitude)
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;default.html&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;

&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Search Location&amp;lt;/title&amp;gt;
  &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&lt;span style=&quot;background-color: yellow;&quot;&gt;Styles/myStyle.css&lt;/span&gt;&quot; /&amp;gt;
  &amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://maps.googleapis.com/maps/api/js?key=&quot;&amp;gt;
&amp;lt;/script&amp;gt;
  &amp;lt;script type=&quot;text/javascript&quot; src=&quot;&lt;span style=&quot;background-color: yellow;&quot;&gt;Scripts/geocoding.js&lt;/span&gt;&quot;&amp;gt;
&amp;lt;/script&amp;gt;
  &amp;lt;script type=&quot;text/javascript&quot; src=&quot;&lt;span style=&quot;background-color: yellow;&quot;&gt;Scripts/reverseGeocoding.js&lt;/span&gt;&quot;&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body onload=&quot;initialize(28.4990296, 77.06971279999993, &#39;Nagarro Software&#39;)&quot;&amp;gt;
  &amp;lt;div style=&quot;width:1350px&quot;&amp;gt;
    &amp;lt;div id=&quot;header&quot; style=&quot;background-color:#FFA500;&quot;&amp;gt;
      &amp;lt;h1 style=&quot;margin-bottom:0;&quot;&amp;gt;&amp;lt;/h1&amp;gt;

      &amp;lt;center&amp;gt;
        &amp;lt;h1 style=&quot;margin-bottom:0;&quot;&amp;gt;Location Provider&amp;lt;/h1&amp;gt;
      &amp;lt;/center&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;div id=&quot;left-column&quot; style=
    &quot;background-color:#FFD700;height:540px;width:155px;float:left;&quot;&amp;gt;
      &amp;lt;a href=&quot;default.html&quot;&amp;gt;Geocoding&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;a href=&quot;#&quot; onclick=&quot;getLocation()&quot;&amp;gt;Reverse Geocoding&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;div id=&quot;content&quot; style=&quot;background-color:#EEEEEE;float:left;style=&quot; width:=&quot;&quot;
    height:=&quot;&quot;&amp;gt;
      &amp;lt;div style=&quot;width:500px;&quot;&amp;gt;
        &amp;lt;input id=&quot;txtAddress&quot; type=&quot;text&quot; class=&quot;textbox&quot; placeholder=
        &quot;Enter address here...&quot; /&amp;gt; &amp;lt;input id=&quot;btnGetLatLng&quot; type=&quot;button&quot; class=&quot;button&quot;
        value=&quot;Submit&quot; onclick=&quot;getLatLng();&quot; /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div id=&quot;myMap&quot; style=&quot;width: 1160px; height: 505px;&quot;&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;div id=&quot;footer&quot; style=&quot;background-color:#FFA500;clear:both;text-align:center;&quot;&amp;gt;
      © Arjun sunel
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;myStyle.css&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;css&quot; name=&quot;code&quot;&gt;body
{
 background-color: gray;
}

input.button
{
 background-color: blue;
 color:white;
 font-family: &quot;Segoe UI&quot;;
 border: 0px none;
 font-size: 100%;
 height: 2.142em;
 min-width: 6em;
 width:150px
}

input.textbox
{
 border: 1px solid #BABABA;
 color: #212121;
 font-family: &quot;Segoe UI&quot;;
 font-size: 100%;
 padding: 4px 8px;
 width:325px;
 height:22px;
 z-index: 6
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2014/12/geocoding-and-reverse-geocoding-using.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-3667854275297267381</guid><pubDate>Mon, 22 Dec 2014 05:25:00 +0000</pubDate><atom:updated>2014-12-21T21:25:57.657-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Typing</category><title>How to type Reverse Alphabet in less than 2 seconds?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I used the exact same method to type the alphabets in reverse order as explained in &lt;a href=&quot;http://badkr.blogspot.in/2014/12/how-to-type-english-alphabet-in-less.html#more&quot; target=&quot;_blank&quot;&gt;this &lt;/a&gt;post. It got me the timing of &lt;span style=&quot;color: red;&quot;&gt;1.73 seconds&lt;/span&gt;.&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2014/12/how-to-type-reverse-alphabet-in-less.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-669230845876808851</guid><pubDate>Thu, 18 Dec 2014 07:09:00 +0000</pubDate><atom:updated>2014-12-17T23:09:05.728-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Root finding</category><title>Find root using Halley&#39;s Method</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;

#define F(x) (x*x - x -6)
#define F_PRIME(x) (2*x - 1)
#define F_DOUBLE_PRIME(x) (2)
#define MAX_ITER 100

float Halley(float x0)
{
    int iter = 0;
    float x1;
    
    while(iter &amp;lt; MAX_ITER)
    {
        x1 = x0 - (2 * F(x0) * F_PRIME(x0)) / (2 * F_PRIME(x0) * F_PRIME(x0) - F(x0) * F_DOUBLE_PRIME(x0));
        x0 = x1;
        iter++;
    }
    return x0;
}

int main()
{
    printf(&quot;Finding root of a continuous function using Newton&#39;s method.\n&quot;);
    
    float x0 = 1;
    printf(&quot;Root of the given function is : %f\n&quot;, Halley(x0));
    return 0;
}
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/find-root-using-halleys-method.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-6036949631363907657</guid><pubDate>Thu, 18 Dec 2014 06:51:00 +0000</pubDate><atom:updated>2014-12-17T22:51:56.968-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Root finding</category><title>Find root using Newton&#39;s method</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;

#define F(x) (x*x - 4)
#define FPrime(x) (2*x)
#define MAX_ITER 100

float Newton(float x0)
{
    int iter = 0;
    float x1;
    
    while(iter &amp;lt; MAX_ITER)
    {
        x1 = x0 - F(x0)/FPrime(x0);
        x0 = x1;
        iter++;
    }
    return x0;
}

int main()
{
    printf(&quot;Finding root of a continuous function using Newton&#39;s method.\n&quot;);
    
    float x0 = 1;
    printf(&quot;Root of the given function is : %f\n&quot;, Newton(x0));
    return 0;
}
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/find-root-using-newtons-method.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-7362132925404208305</guid><pubDate>Wed, 17 Dec 2014 11:51:00 +0000</pubDate><atom:updated>2014-12-17T03:51:55.864-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Root finding</category><title>Find root using False Position Method</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
#include&amp;lt;math.h&gt;

#define F(x) ((2*x)+1)
#define ERROR 0.00001
#define MAX_ITER 1000

float FalsePosition(float a, float b)
{   
    float c;
    int iter = 0;
    do
    {
        c = b - F(b) * (b - a) / (F(b) - F(a));

        printf(&quot;F(a): %f, F(b) : %f, F(c) : %f, a: %f, b : %f, c : %f\n&quot;, F(a), F(b), F(c), a, b, c);

        if((F(c) &gt; 0 &amp;&amp; F(a) &gt; 0) || (F(c) &amp;lt; 0 &amp;&amp; F(a) &amp;lt; 0))
        {
            a = c;
        }
        else
        {
            b=c;
        }

        iter++;
    }
    while(fabsf(F(c)) &gt; ERROR &amp;&amp; iter &amp;lt; MAX_ITER);
    return c;
}

int main()
{
    float a = -2.5;
    float b = 2.5;

    printf(&quot;Finding root in the interval [%f, %f]\n&quot;, a, b);

    if((F(a)&gt;0 &amp;&amp; F(b)&gt;0) || (F(a)&amp;lt;0 &amp;&amp; F(b)&amp;lt;0))
    {
        printf(&quot;No root lie in the interval [%f, %f]&quot;, a, b);
    }
    else
    {
        printf(&quot;The root is : %f\n&quot;, FalsePosition(a, b));
    }

    return 0;
}
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/find-root-using-false-position-method.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-7717609461271319252</guid><pubDate>Wed, 17 Dec 2014 09:47:00 +0000</pubDate><atom:updated>2014-12-17T03:22:33.496-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Root finding</category><title>Find root using Bisection Method</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
#include&amp;lt;math.h&gt;

#define F(x) ((2*x)+1)
#define ERROR 0.00001

float Bisection(float a, float b)
{ 
 float mid;
 do
 {
  mid = (a+b)/2;
  printf(&quot;F(a): %f, F(b) : %f, F(mid) : %f\n&quot;, F(a), F(b), F(mid));

  if((F(mid)&gt;0 &amp;&amp; F(a)&gt;0) || (F(mid)&amp;lt;0 &amp;&amp; F(a)&amp;lt;0))
  {
   a = mid;
  }
  else
  {
   b = mid;
  }
  
  
 } while(fabsf(F(mid)) &gt; ERROR);
 
 return a;
}

int main()
{
 float a = -2.5;
 float b = 2.5;
 
 printf(&quot;Finding root in the interval [%f, %f]\n&quot;, a, b);
 
 if((F(a)&gt;0 &amp;&amp; F(b)&gt;0) || (F(a)&amp;lt;0 &amp;&amp; F(b)&amp;lt;0))
 {
  printf(&quot;No root lie in the interval [%f, %f]&quot;, a, b);
 }
 else
 {
  printf(&quot;The root is : %f\n&quot;, Bisection(a, b));
 }
 
 return 0;
}

&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2014/12/find-root-using-bisection-method.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-8047453866083626745</guid><pubDate>Wed, 17 Dec 2014 05:21:00 +0000</pubDate><atom:updated>2014-12-16T21:46:45.510-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">graph</category><title>Find MinCut of a Graph using networkx</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;python&quot; name=&quot;code&quot;&gt;
&#39;&#39;&#39;
* Implemented by Arjun sunel.
&#39;&#39;&#39;
#Program to find min-cut of a graph using Karger&#39;s Algorithm having running time O(n*n*n*n*logn)
import networkx as nx, random, matplotlib.pyplot as plt
def main():
 G =nx.MultiGraph()     #defining graph
 G.add_edges_from([(1,2),(2,3),(3,4),(4,2),(4,5) , (6,7), ( 7,8) , ( 8,5) , (1,3) , (6,5) , (9, 10) , (10,1) , (9, 1), (5,1) , (5, 11) , (7,5) , (8, 6)  , (10 , 3) , (9, 3) , (11, 7)])  #adding edges
 min_cut(G)  #prints min cut of G        #K = nx.gnm_random_graph(10 , 40) ---&gt; used for creating a random graph
 nx.draw(G)   #plots graph G
 plt.show()   #to show graph
 
def min_cut(G):  #min-cut function
 u= (G.order())**2 # number of iterations required to ensure that we will get a min-cut
 List=Cut(G)  #initialized List to a Cut of G
 while u&gt;0:   #while loop starts
  if len(Cut(G))&amp;lt;len(List): #comparing current and previous cut&#39;s lengths to get minimum of them
   List=Cut(G) 
  u=u-1
 print &quot;min_cut is :&quot;, List   #prints min cut
 
def Cut(G):   #function to find a cut of G
 H = nx.MultiGraph()  #declared H and I as multigraphs
 for a,b in G.edges_iter():  # &quot;for loop&quot; for assigning &quot;edges&quot; as &quot;weights&quot; to each edge
  H.add_edge(a,b,weight= (a,b)) 
  
 while H.order()&gt;2: # while loop  until number of nodes becomes 2
  (a,b,d)=random.choice(H.edges(data=True)) #randomly selected edge    

  for e  in H.edges():
   if    e== ( a , b ) : H.remove_edge(a,b )   #removing randomly selected edge

  for i in H.neighbors(b):    #adding and deleting edges during combining two nodes
   j=len(H.get_edge_data(b,i))
   while j&gt;0: 
    H.add_edge( a ,  i  ,  weight=  H.get_edge_data(b,i)[j-1][&#39;weight&#39;]   )
    j=j-1
   H.remove_edge(b,i)
  H.remove_node(b)  #while loop ends
  
 cut=[]
 for e in H.edges(data = True):
  cut.append(e[2][&#39;weight&#39;]) 
 return cut     #returns a cut of the graph
 
if __name__ == &#39;__main__&#39;:
    main()      #calls the main function

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/find-mincut-of-graph-using-networkx.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-1366657603267462514</guid><pubDate>Mon, 15 Dec 2014 09:19:00 +0000</pubDate><atom:updated>2014-12-16T21:15:08.740-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Recursive BubbleSort for Array of Structures</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include &amp;lt;stdio.h&gt;
#include &amp;lt;stdlib.h&gt;
#include &amp;lt;string.h&gt;

// enumeration denoting sort type
enum CompareDataType
{
    cmpStringType = 1,
    cmpIntType = 2
};

// Employee structure
struct Employee
{
    char *name;
    int age;
};

// Method to swap two structures by reference.
void Swap(struct Employee *first, struct Employee *second)
{
    struct Employee temp = *first;
    *first = *second;
    *second = temp;
}


int IsLessThan(struct Employee *first, struct Employee* second, enum CompareDataType cmpType)
{
    int res = 0;
    switch (cmpType)
    {
        case cmpStringType:
            res = strcmp(first-&gt;name, second-&gt;name);
            break;
            
        case cmpIntType:
            res = first-&gt;age &lt; second-&gt;age ? -1 : (second-&gt;age &lt; first-&gt;age);
            break;
            
        default:
            fprintf(stderr, &quot;Invalid sort comparison type\n&quot;);
            exit(EXIT_FAILURE);
    }
    return res;
}

// Bubble Sort Method
void BubbleSort(struct Employee array[], int size, enum CompareDataType cmpType)
{
    int i, swapped = 0;
    
    if(size &lt;= 1)
        return;
    
    for(i = 0; i &lt; size - 1; i++)
    {
        if (IsLessThan(array+i, array+i+1, cmpType) &gt; 0)
        {
            Swap(&amp;array[i], &amp;array[i + 1]);
            swapped = 1;
        }
    }
    
    if (swapped)
        BubbleSort(array, size-1, cmpType);
}

// Entry point of the program
int main()
{
    struct Employee array[] = {{&quot;John&quot;, 45}, {&quot;Mary&quot;, 23}, {&quot;Celina&quot;, 79}, {&quot;Mike&quot;, 41}};
    int arraySize = 4;
    int index;
    
    printf(&quot;Before Sorting : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
    {
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    }
    
    printf(&quot;\n&quot;);
    
    BubbleSort(array, arraySize, cmpStringType);
    printf(&quot;After Sorting by name : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    
    printf(&quot;\n&quot;);
    
    BubbleSort(array, arraySize, cmpIntType);
    printf(&quot;After Sorting by age : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    
    printf(&quot;\n&quot;);       
    return 0;
}
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/recursive-bubblesort-for-array-of_15.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-1514143194217224627</guid><pubDate>Mon, 15 Dec 2014 07:04:00 +0000</pubDate><atom:updated>2014-12-16T21:22:24.208-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">graph</category><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Recursive BubbleSort for Array of Strings</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
#include&amp;lt;string.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// Method to swap two strings by reference.
void Swap(char **first, char **second)
{
 char *temp = *first;
 *first = *second;
 *second = temp;
}

// Bubble Sort Method
void BubbleSort(char *array[], int size, int swapped)
{
 int i;
 
 if(swapped == 0 || size == 0)
    {
        return;
    }
 
 for(i = 0; i &lt; size - 1; i++)
 {
  swapped = 0;

  if(strcmp(array[i], array[i+1]) &gt; 0)
  {
   Swap(&amp;array[i], &amp;array[i + 1]);
   swapped = 1;
  }
 }
 
 BubbleSort(array, size-1, swapped);
}

// Entry point of the program
int main()
{
 char* array[] = {&quot;dog&quot;, &quot;dose&quot;, &quot;apple&quot;, &quot;baby&quot;, &quot;den&quot;, &quot;deck&quot;};
 int arraySize = 6;
 int index;

 printf(&quot;Before Sorting : \n&quot;);
 for(index = 0; index &lt; arraySize; index++)
 {
  printf(&quot;%s &quot;, array[index]);
 }  

 printf(&quot;\n&quot;);
 
 int swapped = 1;
 
 BubbleSort(array, arraySize, swapped);
 printf(&quot;After Sorting : \n&quot;);
 for(index = 0; index &lt; arraySize; index++)
 {
  printf(&quot;%s &quot;, array[index]);
 } 
 
 printf(&quot;\n&quot;);
 return 0;
}
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/recursive-bubblesort-for-array-of_5.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-2911862785828867783</guid><pubDate>Mon, 15 Dec 2014 06:57:00 +0000</pubDate><atom:updated>2014-12-16T21:15:28.042-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Recursive BubbleSort for Array of Characters</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// Method to swap two characters by reference.
void Swap(char *first, char *second)
{
 char temp = *first;
 *first = *second;
 *second = temp;
}

// Bubble Sort Method
void BubbleSort(char array[], int size, int swapped)
{
    if(swapped == 0 || size == 0)
    {
        return;
    }
    
 int i;
 for(i = 0; i &lt; size - 1; i++)
 {
  swapped = 0;
 
  if( array[i] &gt; array[i + 1] )
  {
   Swap(&amp;array[i], &amp;array[i + 1]);
   swapped = 1;
  }
 }
 
    BubbleSort(array, size-1, swapped);
}

// Entry point of the program
int main()
{
 char array[] = {&#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;b&#39;};
 int arraySize = 4;
 int index;
  
 printf(&quot;Before sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%c &quot;, array[index]);
 } 
 
 int swapped = 1;
 
 BubbleSort(array, arraySize, swapped);

 printf(&quot;\nAfter sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%c &quot;, array[index]);
 } 

 printf(&quot;\n&quot;);
}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/recursive-bubblesort-for-array-of_14.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-5944692225271301951</guid><pubDate>Mon, 15 Dec 2014 06:54:00 +0000</pubDate><atom:updated>2014-12-16T21:15:38.814-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Recursive BubbleSort for Array of Integers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// Method to swap two integers by reference.
void Swap(int *first, int *second)
{
 int temp = *first;
 *first = *second;
 *second = temp;
}

// Bubble Sort Method
void BubbleSort(int array[], int size, int swapped)
{
    if(swapped == 0 || size == 0)
    {
        return;
    }
    
 int i;
 for(i = 0; i &lt; size - 1; i++)
 {
  swapped = 0;
 
  if( array[i] &gt; array[i + 1] )
  {
   Swap(&amp;array[i], &amp;array[i + 1]);
   swapped = 1;
  }
 }
 
    BubbleSort(array, size-1, swapped);
}

// Entry point of the program
int main()
{
 int array[] = {5, -12, 14, 7};
 int arraySize = 4;
 int index;
  
 printf(&quot;Before sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%d &quot;, array[index]);
 } 
 
 int swapped = 1;
 
 BubbleSort(array, arraySize, swapped);

 printf(&quot;\nAfter sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%d &quot;, array[index]);
 } 
 
 printf(&quot;\n&quot;);
}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/recursive-bubblesort-for-array-of.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-7089768090770228728</guid><pubDate>Mon, 15 Dec 2014 06:37:00 +0000</pubDate><atom:updated>2014-12-16T21:15:46.732-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Iterative InsertionSort for Array of Structures</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;stdlib.h&amp;gt;
#include&amp;lt;string.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// enumeration denoting sort type
enum CompareDataType
{
    cmpStringType = 1,
    cmpIntType = 2
};

// Employee structure
struct Employee
{
    char *name;
    int age;
};

// Method to swap two structures by reference.
void Swap(struct Employee *first, struct Employee *second)
{
    struct Employee temp = *first;
    *first = *second;
    *second = temp;
}


int IsLessThan(struct Employee *first, struct Employee* second, enum CompareDataType cmpType)
{
    int res = 0;
    switch (cmpType)
    {
        case cmpStringType:
            res = strcmp(first-&gt;name, second-&gt;name);
            break;
            
        case cmpIntType:
            res = first-&gt;age &lt; second-&gt;age ? -1 : (second-&gt;age &lt; first-&gt;age);
            break;
            
        default:
            fprintf(stderr, &quot;Invalid sort comparison type\n&quot;);
            exit(EXIT_FAILURE);
    }
    return res;
}

// Insertion Sort Method
void InsertionSort(struct Employee array[], int size, enum CompareDataType cmpType)
{
 int i, j;
 struct Employee curElement;
 
 for(i = 1; i &lt; size; i++)
 {
     curElement = array[i];
  j = i - 1;
  while(j &gt;=0 &amp;&amp; (IsLessThan(array+j, &amp;curElement, cmpType) &gt; 0))
  {
   Swap(&amp;array[j+1], &amp;array[j]);
   j--;
  }
  
  array[j+1] = curElement;
 }
}

// Entry point of the program
int main()
{
    struct Employee array[] = {{&quot;John&quot;, 45}, {&quot;Mary&quot;, 23}, {&quot;Celina&quot;, 79}, {&quot;Mike&quot;, 41}};
    int arraySize = 4;
    int index;
    
    printf(&quot;Before Sorting : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
    {
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    }
    
    printf(&quot;\n&quot;);
    
    InsertionSort(array, arraySize, cmpStringType);
    printf(&quot;After Sorting by name : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    
    printf(&quot;\n&quot;);
    
    InsertionSort(array, arraySize, cmpIntType);
    printf(&quot;After Sorting by age : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    
    printf(&quot;\n&quot;);       
    return 0;
}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/iterative-insertionsort-for-array-of_31.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-2641494284457448526</guid><pubDate>Mon, 15 Dec 2014 06:36:00 +0000</pubDate><atom:updated>2014-12-16T21:15:56.779-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Iterative InsertionSort for Array of Strings</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
#include&amp;lt;string.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// Method to swap two strings by reference.
void Swap(char **first, char **second)
{
 char *temp = *first;
 *first = *second;
 *second = temp;
}

// Insertion Sort Method
void InsertionSort(char *array[], int size)
{
 int i, j;
 char *curElement;
 
 for(i = 1; i &lt; size; i++)
 {
  curElement = array[i];
  
  j = i - 1;
  while(j &gt;=0 &amp;&amp; strcmp(array[j], curElement) &gt; 0)
  {
   Swap(&amp;array[j+1], &amp;array[j]);
   j--;
  }
  
  array[j+1] = curElement;
 }
}

// Entry point of the program
int main()
{
 char* array[] = {&quot;dog&quot;, &quot;dose&quot;, &quot;apple&quot;, &quot;baby&quot;, &quot;den&quot;, &quot;deck&quot;};
 int arraySize = 6;
 int index;

 printf(&quot;Before Sorting : \n&quot;);
 for(index = 0; index &lt; arraySize; index++)
 {
  printf(&quot;%s &quot;, array[index]);
 }  

 printf(&quot;\n&quot;);
 
 InsertionSort(array, arraySize);
 printf(&quot;After Sorting : \n&quot;);
 for(index = 0; index &lt; arraySize; index++)
 {
  printf(&quot;%s &quot;, array[index]);
 } 
 
 printf(&quot;\n&quot;);
 return 0;
}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://badkr.blogspot.com/2014/12/iterative-insertionsort-for-array-of_43.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-4148723896085396857</guid><pubDate>Mon, 15 Dec 2014 06:35:00 +0000</pubDate><atom:updated>2014-12-16T21:16:08.811-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Iterative InsertionSort for Array of Integers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// Method to swap two integers by reference.
void Swap(int *first, int *second)
{
 int temp = *first;
 *first = *second;
 *second = temp;
}

// Insertion Sort Method
void InsertionSort(int array[], int size)
{
 int i, j, curElement;
 
 for(i = 1; i &lt; size; i++)
 {
  curElement = array[i];
  
  j = i - 1;
  while(j &gt;=0 &amp;&amp; array[j] &gt; curElement)
  {
   Swap(&amp;array[j+1], &amp;array[j]);
   j--;
  }
  
  array[j+1] = curElement;
 }
}

// Entry point of the program
int main()
{
 int array[] = {5, -12, 14, 7};
 int arraySize = 4;
 int index;
  
 printf(&quot;Before sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%d &quot;, array[index]);
 } 
 
 InsertionSort(array, arraySize);

 printf(&quot;\nAfter sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%d &quot;, array[index]);
 } 
 
 printf(&quot;\n&quot;);
}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/iterative-insertionsort-for-array-of_14.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-4617784729522417419</guid><pubDate>Mon, 15 Dec 2014 06:33:00 +0000</pubDate><atom:updated>2014-12-16T21:16:21.721-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Iterative InsertionSort for Array of Characters</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// Method to swap two characters by reference.
void Swap(char *first, char *second)
{
 char temp = *first;
 *first = *second;
 *second = temp;
}

// Insertion Sort Method
void InsertionSort(char array[], int size)
{
 int i, j, curElement;
 
 for(i = 1; i &lt; size; i++)
 {
  curElement = array[i];
  
  j = i - 1;
  while(j &gt;=0 &amp;&amp; array[j] &gt; curElement)
  {
   Swap(&amp;array[j+1], &amp;array[j]);
   j--;
  }
  
  array[j+1] = curElement;
 }
}

// Entry point of the program
int main()
{
 char array[] = {&#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;b&#39;};
 int arraySize = 4;
 int index;
  
 printf(&quot;Before sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%c &quot;, array[index]);
 } 
 
 InsertionSort(array, arraySize);

 printf(&quot;\nAfter sorting : \n&quot;);
 for(index = 0; index &lt;= arraySize - 1; index++)
 {
  printf(&quot;%c &quot;, array[index]);
 } 

 printf(&quot;\n&quot;);
}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/iterative-insertionsort-for-array-of.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2885625373493323490.post-7873852932342556871</guid><pubDate>Mon, 15 Dec 2014 06:31:00 +0000</pubDate><atom:updated>2014-12-16T21:16:35.171-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sorting</category><title>Iterative BubbleSort for Array of Structures</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c&quot; name=&quot;code&quot;&gt;
#include&amp;lt;stdio.h&gt;
#include&amp;lt;stdlib.h&gt;
#include&amp;lt;string.h&gt;
/*
* Implemented by Arjun Sunel.
*/

// enumeration denoting sort type
enum CompareDataType
{
    cmpStringType = 1,
    cmpIntType = 2
};

// Employee structure
struct Employee
{
    char *name;
    int age;
};

// Method to swap two structures by reference.
void Swap(struct Employee *first, struct Employee *second)
{
    struct Employee temp = *first;
    *first = *second;
    *second = temp;
}


int IsLessThan(struct Employee *first, struct Employee* second, enum CompareDataType cmpType)
{
    int res = 0;
    switch (cmpType)
    {
        case cmpStringType:
            res = strcmp(first-&gt;name, second-&gt;name);
            break;
            
        case cmpIntType:
            res = first-&gt;age &lt; second-&gt;age ? -1 : (second-&gt;age &lt; first-&gt;age);
            break;
            
        default:
            fprintf(stderr, &quot;Invalid sort comparison type\n&quot;);
            exit(EXIT_FAILURE);
    }
    return res;
}

// Bubble Sort Method
void BubbleSort(struct Employee array[], int size, enum CompareDataType cmpType)
{
 int i, j;
 int swapped = 1;
 
 for(i = 0; swapped &amp;&amp; i &lt; size - 1; i++)
 {
  swapped = 0;
  for(j = 0; j &lt; size - 1 - i; j++)
  {
  if(IsLessThan(array+j, array+j+1, cmpType) &gt; 0)
   {
    Swap(&amp;array[j], &amp;array[j + 1]);
    swapped = 1;
   }
  }
 }
}

// Entry point of the program
int main()
{
    struct Employee array[] = {{&quot;John&quot;, 45}, {&quot;Mary&quot;, 23}, {&quot;Celina&quot;, 79}, {&quot;Mike&quot;, 41}};
    int arraySize = 4;
    int index;
    
    printf(&quot;Before Sorting : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
    {
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    }
    
    printf(&quot;\n&quot;);
    
    BubbleSort(array, arraySize, cmpStringType);
    printf(&quot;After Sorting by name : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    
    printf(&quot;\n&quot;);
    
    BubbleSort(array, arraySize, cmpIntType);
    printf(&quot;After Sorting by age : \n&quot;);
    for(index = 0; index &lt; arraySize; index++)
        printf(&quot;(%s, %d) &quot;, array[index].name, array[index].age);
    
    printf(&quot;\n&quot;);       
    return 0;
}


&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://badkr.blogspot.com/2014/12/iterative-bubblesort-for-array-of_3.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item></channel></rss>