<?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>Technology Space </title>
	<atom:link href="http://dotnetdlr.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dotnetdlr.com</link>
	<description>Beware! this space is for only techie geeks!</description>
	<lastBuildDate>Thu, 25 Apr 2013 11:52:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Get information about network ports and applications listening to ports</title>
		<link>http://dotnetdlr.com/2013/04/get-information-about-network-ports-and-applications-listening-to-ports/</link>
		<comments>http://dotnetdlr.com/2013/04/get-information-about-network-ports-and-applications-listening-to-ports/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 11:52:21 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://dotnetdlr.com/?p=1495</guid>
		<description><![CDATA[<p>I am working on wcf and some socket programming applications where sometimes I need to know about port informations like which applications are using which ports or which ports are being used. There are some inbuilt commands on windows operating &#8230; <a href="http://dotnetdlr.com/2013/04/get-information-about-network-ports-and-applications-listening-to-ports/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2013/04/get-information-about-network-ports-and-applications-listening-to-ports/">Get information about network ports and applications listening to ports</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p>I am working on wcf and some socket programming applications where sometimes I need to know about port informations like which applications are using which ports or which ports are being used.</p>
<p>There are some inbuilt commands on windows operating systems. Let’s  discuss this now.</p>
<p><b>Command</b></p>
<p><b><i>Netstat</i></b></p>
<p>It displays protocol statistics and current tcp/ip network connections.</p>
<p>Some of common commands are:</p>
<p><b>Displays all connections and listening ports.</b></p>
<p><b>Netstat  -a </b></p>
<blockquote><p>Active Connections</p>
<p>Proto  Local Address          Foreign Address        State</p>
<p>TCP    0.0.0.0:135            &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    0.0.0.0:445            &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    0.0.0.0:3389           &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    0.0.0.0:49152          &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    0.0.0.0:49153          &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    0.0.0.0:49154          &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    0.0.0.0:49155          &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    0.0.0.0:49186          &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    10.194.48.90:139       &lt;machinename&gt;:0        LISTENING</p>
<p>TCP    10.194.48.90:49271     syswsa1-s2:http        CLOSE_WAIT</p>
<p>TCP    10.194.48.90:49272     syslnc1-dk2:5061       ESTABLISHED</p>
<p>TCP    10.194.48.90:49322     sysfil3-s1:microsoft-ds  ESTABLISHED</p>
</blockquote>
<p><b>Display Address and Port in numerical form</b></p>
<p><b>Netstat  -n</b></p>
<blockquote>
<p>Active Connections</p>
<p>&nbsp;</p>
<p>Proto  Local Address               Foreign Address        State</p>
<p>TCP    10.194.48.90:49271     195.24.3.235:80        CLOSE_WAIT</p>
<p>TCP    10.194.48.90:49272     10.1.4.219:5061        ESTABLISHED</p>
<p>TCP    10.194.48.90:49322     10.1.3.126:445         ESTABLISHED</p>
<p>TCP    10.194.48.90:49330     192.168.8.113:62119    ESTABLISHED</p>
<p>TCP    10.194.48.90:49350     192.168.8.113:62119    ESTABLISHED</p>
<p>TCP    10.194.48.90:49360     195.24.3.235:80        CLOSE_WAIT</p>
<p>TCP    10.194.48.90:49363     192.168.8.113:62119    ESTABLISHED</p>
<p>TCP    10.194.48.90:49368     10.1.3.148:10972       ESTABLISHED</p>
<p>TCP    10.194.48.90:54568     172.31.254.123:3389    ESTABLISHED</p>
<p>TCP    10.194.48.90:54952     172.31.254.123:445     ESTABLISHED</p>
<p>TCP    10.194.48.90:55132     172.31.254.136:445     ESTABLISHED</p>
<p>TCP    10.194.48.90:57593     10.194.1.187:8080      ESTABLISHED</p>
<p>TCP    10.194.48.90:60242     195.24.3.234:80        ESTABLISHED</p>
<p>TCP    10.194.48.90:60455     10.66.8.13:445         ESTABLISHED</p>
</blockquote>
<p><b>Display process Id associated with each connection</b></p>
<p><b>Netstat  -o</b></p>
<blockquote><p>
Active Connections</p>
<p>Proto  Local Address          Foreign Address        State           PID</p>
<p>TCP    10.194.48.90:49271     syswsa1-s2:http        CLOSE_WAIT      3188</p>
<p>TCP    10.194.48.90:49272     syslnc1-dk2:5061       ESTABLISHED     3188</p>
<p>TCP    10.194.48.90:49322     sysfil3-s1:microsoft-ds  ESTABLISHED     4</p>
<p>TCP    10.194.48.90:49330     malcasdk:62119         ESTABLISHED     4580</p>
<p>TCP    10.194.48.90:49350     malcasdk:62119         ESTABLISHED     4084</p>
<p>TCP    10.194.48.90:49360     syswsa1-s2:http        CLOSE_WAIT      4084</p>
<p>TCP    10.194.48.90:49363     malcasdk:62119         ESTABLISHED     4084</p>
<p>TCP    10.194.48.90:49368     malmb5-s2:10972        ESTABLISHED     4084</p>
<p>TCP    10.194.48.90:54568     tst12svc01:ms-wbt-server  ESTABLISHED     5940</p>
<p>TCP    10.194.48.90:54952     tst12svc01:microsoft-ds  ESTABLISHED     4</p>
</blockquote>
<p><b>Display processId along with its state in numerical form</b></p>
<p><b>Netstat  -aon</b></p>
<blockquote><p>
Active Connections</p>
<p>Proto  Local Address          Foreign Address        State           PID</p>
<p>TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       872</p>
<p>TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4</p>
<p>TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING       1116</p>
<p>TCP    0.0.0.0:49152          0.0.0.0:0              LISTENING       520</p>
<p>TCP    0.0.0.0:49153          0.0.0.0:0              LISTENING       136</p>
<p>TCP    0.0.0.0:49154          0.0.0.0:0              LISTENING       460</p>
<p>TCP    0.0.0.0:49155          0.0.0.0:0              LISTENING       604</p>
<p>TCP    0.0.0.0:49186          0.0.0.0:0              LISTENING       588</p>
<p>TCP    10.194.48.90:139       0.0.0.0:0              LISTENING       4</p>
<p>TCP    10.194.48.90:49271     195.24.3.235:80        CLOSE_WAIT      3188</p>
<p>TCP    10.194.48.90:49272     10.1.4.219:5061        ESTABLISHED     3188</p>
<p>TCP    10.194.48.90:49322     10.1.3.126:445         ESTABLISHED     4</p>
<p>TCP    10.194.48.90:49330     192.168.8.113:62119    ESTABLISHED     4580</p>
<p>TCP    10.194.48.90:49350     192.168.8.113:62119    ESTABLISHED     4084</p>
<p>TCP    10.194.48.90:49360     195.24.3.235:80        CLOSE_WAIT      4084</p>
<p>TCP    10.194.48.90:49363     192.168.8.113:62119    ESTABLISHED     4084
</p></blockquote>
<p><b>Mapping ProcessId with name</b></p>
<p>PID can be find in task manager. If PID column is not visible then you can add column through View menu -&gt; select columns.</p>
<p><a href="http://dotnetdlr.com/wp-content/uploads/2013/04/img1.png"><img class="alignnone size-full wp-image-1496" alt="img1" src="http://dotnetdlr.com/wp-content/uploads/2013/04/img1.png" width="646" height="322" /></a></p>
<p><b>Specific port search</b></p>
<p><b>You can search status for specific port like </b></p>
<p>Netstat -o -n –a | findstr 0.0:80</p>
<p>The post <a href="http://dotnetdlr.com/2013/04/get-information-about-network-ports-and-applications-listening-to-ports/">Get information about network ports and applications listening to ports</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2013/04/get-information-about-network-ports-and-applications-listening-to-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NoSql (It’s “Not only SQL” not “No to Sql”)</title>
		<link>http://dotnetdlr.com/2013/01/nosql-its-not-only-sql-not-no-to-sql/</link>
		<comments>http://dotnetdlr.com/2013/01/nosql-its-not-only-sql-not-no-to-sql/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 11:00:08 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[NoSql]]></category>
		<category><![CDATA[CAP]]></category>
		<category><![CDATA[nosql]]></category>

		<guid isPermaLink="false">https://neerajkaushik1980.wordpress.com/?p=1425</guid>
		<description><![CDATA[<p>This is my first post on NoSql database technologies. There have been drastic changes in database technologies over the few years. Increase in user’s requests, high availability of applications, real time performance forced to think on different database technologies. We &#8230; <a href="http://dotnetdlr.com/2013/01/nosql-its-not-only-sql-not-no-to-sql/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2013/01/nosql-its-not-only-sql-not-no-to-sql/">NoSql (It’s “Not only SQL” not “No to Sql”)</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p>This is my first post on NoSql database technologies. There have been drastic changes in database technologies over the few years. Increase in user’s requests, <a class="zem_slink" title="High availability" href="http://www.symantec.com/high-availability" target="_blank" rel="symantec">high availability</a> of applications, real time performance forced to think on different database technologies. We have traditional <a class="zem_slink" title="Relational database management system" href="http://en.wikipedia.org/wiki/Relational_database_management_system" target="_blank" rel="wikipedia">RDBMS</a>, memory and NoSql databases available in market to suffice particular business needs. Here I’ll illustrate some of key aspects of NoSql databases like what is NoSql, why we need it, advantages and disadvantages of NoSql.</p>
<h4><span style="color:#000000;">What is <a class="zem_slink" title="NoSQL" href="http://en.wikipedia.org/wiki/NoSQL" target="_blank" rel="wikipedia">NoSql Movement</a>?</span></h4>
<p align="justify">It’s a different way of thinking in database technologies. It is unlike relational database management system where we have tables, procedures, functions, normalization concepts. NoSql databases are not built primarily on tables and don’t use sql for manipulation or querying database.</p>
<p align="justify">NoSql databases have specific purpose to achieve, that means NoSql database might not support all the features like in relational databases.</p>
<p><strong>NoSql databases are based on</strong> <a href="http://saxovm42:90/http:/en.wikipedia.org/wiki/CAP_theorem"><b>CAP</b> Theorem.</a></p>
<ul>
<li>
<div align="justify"><strong>Consistency</strong>: Most of the applications or services attempt to provide strong consistent data. Interactions with applications/services are expected to behave in transactional manner ie. Operation should be atomic (succeed or failure entirely), uncommitted transactions should be isolated from each other and transaction once committed should be permanent.</div>
</li>
<li>
<div align="justify"><strong>Availability</strong>: Load on services /applications are increasing and eventually services should be highly available to users. Every request should be succeed.</div>
</li>
<li>
<div align="justify"><strong>Partition tolerant:</strong> Your services should provide some amount of fault tolerance in case of crash, failure or heavy load. It is important that in case of these circumstances your services should still perform as expected. Partition tolerant is one of desirable property of service. Services can serve request from multiple nodes</div>
</li>
</ul>
<h4><span style="color:#333333;">Why NoSql?</span></h4>
<p align="justify">Since NoSql databases are using for specific purpose. They are normally using for huge data where performance matters. Relational database systems are hard to scale out in case of write operation. We can load balance database servers by replicating on multiple servers, in this case read operation can be load balance but write operation needs consistency across multiple servers. Writes can be scaled only by partitioning the data. This affects reads as distributed joins are usually slow and hard to implement. We can support increase in no. of users or requests by scaling up relational databases which means we need more hardware support, licensing, increase in costs etc.</p>
<p align="justify"><a class="zem_slink" title="Relational database" href="http://en.wikipedia.org/wiki/Relational_database" target="_blank" rel="wikipedia">Relational databases</a> are not good option on heavy load which are doing read and write operations simultaneously like Facebook, Google, Amazon, Twitter etc.</p>
<p align="justify">A NoSQL implementation, on the other hand, can scale out, i.e. distribute the database load across more servers.</p>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2013/01/clip_image002.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;" title="clip_image002" alt="clip_image002" src="http://neerajkaushik1980.files.wordpress.com/2013/01/clip_image002_thumb.jpg" width="581" height="266" border="0" /></a></p>
<p><i>Source: </i><a href="http://www.couchbase.com/why-nosql/nosql-database"><i>Couchbase.com</i></a><i> </i></p>
<p><b>Common characteristic in NoSql databases</b></p>
<p align="justify"><strong>· </strong><strong>Aggregating</strong> (supported by column databases): Aggregation usage to calculate aggregated values like Count, Max, Avg, Min etc. Some of NoSql provides support for aggregation framework which have inbuilt aggregation of values. Approach in column databases is to store values in columns instead rows (de-normalized data). This kind of data mainly used in data analytics and business intelligence. Google’s BigTable and Apache’s Cassandra supports some feature of column databases.</p>
<p align="justify"><strong>· </strong><strong>Relationships</strong> (support by graph databases): A graph database uses graph structures with nodes, edges and properties. Every element contains a direct pointer to adjacent element; in this case it doesn’t need to lookup indexes or scanning whole data. Graph databases are mostly use in relational or social data where elements are connected. Eg. Neo4j, BigData, <a class="zem_slink" title="OrientDB" href="http://www.orientechnologies.com" target="_blank" rel="homepage">OrientDB</a>.</p>
<p>&nbsp;</p>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2013/01/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;" title="image" alt="image" src="http://neerajkaushik1980.files.wordpress.com/2013/01/image_thumb.png" width="429" height="305" border="0" /></a></p>
<p><i>Source: </i><a href="http://en.wikipedia.org/wiki/Graph_database"><i>wikipaedia</i></a><i></i></p>
<p>&nbsp;</p>
<p align="justify"><strong>· </strong><b>Document based</b>. Document databases are considered by many as the next logical step from simple key-/value-stores to slightly more complex and meaningful data structures as they at least allow encapsulating key-/value-pairs in documents. Eg. <a class="zem_slink" title="CouchDB" href="http://couchdb.apache.org/" target="_blank" rel="homepage">CouchDb</a>, <a class="zem_slink" title="MongoDB" href="http://www.mongodb.org/display/DOCS/Home" target="_blank" rel="homepage">MongoDb</a>.</p>
<p><b>Mapping of document based db vs relational db</b></p>
<p>&nbsp;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="271"><b>Document Based Databases</b></td>
<td valign="top" width="271"><b>Relational databases</b></td>
</tr>
<tr>
<td valign="top" width="271">Collections</td>
<td valign="top" width="271">Table</td>
</tr>
<tr>
<td valign="top" width="271">Document</td>
<td valign="top" width="271">Row</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>· </strong><strong>Key- Value Store: </strong>Values are stored as simply key-value pairs. Values only stored like blob object and doesn’t care about data content. Eg. Dynamo DB, <a class="zem_slink" title="LevelDB" href="http://code.google.com/p/leveldb/" target="_blank" rel="homepage">LevelDB</a>, RaptorDB.</p>
<p align="justify"><strong>· </strong><strong>Databases <a class="zem_slink" title="Scalability" href="http://en.wikipedia.org/wiki/Scalability" target="_blank" rel="wikipedia">Scale out</a>:</strong> When the load increases on databases, database administrators were scaling up tradition databases by increasing hardware, buying bigger databases- instead of scale out i.e. distributing databases on multiple nodes /servers to balance load. Because of increase in transactions rates and availability requirements and availability of databases on cloud or virtual machine, scaling out is not economic pain in increasing cost anymore.</p>
<p align="justify">On the other hand, NoSql databases can scale out by distributing on multiple servers. NoSQL databases typically use clusters of cheap <a href="http://www.itbusinessedge.com/topics/show.aspx?t=566">commodity servers</a> to manage the exploding and transaction volumes.  The result is that the cost per gigabyte or transaction/second for NoSQL can be many times less than the cost for RDBMS, allowing you to store and process more data at a much lower price;</p>
<p align="justify">Now question here is why scaling out in RDBMS is hard to implement. Traditional databases support <a href="http://en.wikipedia.org/wiki/ACID">ACID</a> properties that guarantee that database transactions are processed reliably. A transaction can have write operations for multiple records, so to keep consistency across multiple nodes is slow and complex process, because multiple servers would need to communicate back and forth to keep data integrity and synchronize transactions while preventing deadlock. On the other hand NoSql databases supports single record transaction and data is partitioned on multiple nodes to process transactions fast.</p>
<p align="justify"><strong>· </strong><b>Auto Sharding (Elasticity)</b>: NoSql databases support automatic data sharding (horizontal partitioning of data), where database breaks down into smaller chunks (called shard) and can be shared across distributed servers or cluster. This feature provides faster responses to transactions and data requests.</p>
<p>&nbsp;</p>
<p><strong>· </strong><b>Data Replication:</b> Most of NoSql supports data-replication like relational databases to support same data-availability across distributed servers.</p>
<p>&nbsp;</p>
<p align="justify"><strong>· </strong><b>No schema required (Flexible data model)</b>: Data can be inserted in a NoSQL DB without first defining a rigid database schema. The format of the data being inserted can be changed at any time, without application disruption. This provides greater application flexibility, which ultimately delivers significant business flexibility.</p>
<p>&nbsp;</p>
<p align="justify"><strong>· </strong><b>Caching:</b> Most of NoSql databases supports integrated caching to support low latency and high throughput. This behavior is contrast with traditional database management systems where it needs separate configuration or development to support.</p>
<h4><span style="color:#000000;">Challenges of No-SQL</span></h4>
<p>Till now we have seen significant advantages of NoSql over RDBMS, however there are many challenges to implement NoSql.</p>
<p align="justify"><strong>Maturity:</strong> Most of the NoSql databases are in open source or in pre-production stage. In this case it might be risk to adopt these databases on enterprise level. For small business or use case it might be better to consider. On the other hand RDBMS databases are matured, providing many features and having good documentations or resources.</p>
<p align="justify"><strong>Support:</strong> Most of RDBMS are not open source that means they come with commitment and assurance in case of failure. They are reliable products and properly tested. Most of NoSql databases are open source and not widely adopted by organizations. It is very hard to get effective support from open sources databases. Some of NoSql databases created by small startups for specific needs, not for global reach.</p>
<p align="justify"><strong>Tools:</strong> RDBMS databases have lot of tools to monitor databases, queries analyzing, optimizations, performance profiling, analytics and Business Intelligence. Objective of NoSql databases are to minimize use of admin tools which has not achieved fully yet, still there are certain things which need skills and tools to monitor database activities.</p>
<h4><span style="color:#000000;">When to consider NoSql</span></h4>
<p>Following are some of indicators you can consider while choosing NoSql database for your application:</p>
<p><strong>·</strong> If your application needs high performance databases.</p>
<p>· Need less or zero administration of databases.</p>
<p>· You want flexible data model. Minor of major changes should not impact whole system.</p>
<p>· Application that needs less complex transactions.</p>
<p>· High availability.</p>
<p>· Not or less consideration on Business Intelligence and analytics.</p>
<h4><span style="color:#000000;">References:</span></h4>
<p>· <a href="http://nosql-database.org/">http://nosql-database.org/</a></p>
<p>· <a href="http://www.couchbase.com">http://www.couchbase.com</a></p>
<p>· <a href="http://www.mongodb.org">www.mongodb.org</a></p>
<p>· http://en.wikipedia.org/wiki/Nosql</p>
<div class="zemanta-pixie" style="margin-top:10px;height:15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border:none;float:right;" alt="Enhanced by Zemanta" src="http://img.zemanta.com/zemified_e.png?x-id=88b99721-a5e0-4a34-92cf-e27454022670" /></a></div>
<p>The post <a href="http://dotnetdlr.com/2013/01/nosql-its-not-only-sql-not-no-to-sql/">NoSql (It’s “Not only SQL” not “No to Sql”)</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2013/01/nosql-its-not-only-sql-not-no-to-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>General tips: How to run Visual Studio as administrator always</title>
		<link>http://dotnetdlr.com/2012/11/general-tips-how-to-run-visual-studio-as-administrator-always/</link>
		<comments>http://dotnetdlr.com/2012/11/general-tips-how-to-run-visual-studio-as-administrator-always/#comments</comments>
		<pubDate>Wed, 28 Nov 2012 13:29:02 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[VSTS]]></category>
		<category><![CDATA[visual-studio]]></category>
		<category><![CDATA[VSTS2010]]></category>
		<category><![CDATA[VSTS2012]]></category>

		<guid isPermaLink="false">http://dotnetdlr.com/?p=733</guid>
		<description><![CDATA[<p>Some times it is needed to run visual studio as administrator for system level activities like if you want to setup IIS virtual directory in your visual studio project, To setup IIS settings etc. If you want to run visual &#8230; <a href="http://dotnetdlr.com/2012/11/general-tips-how-to-run-visual-studio-as-administrator-always/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/11/general-tips-how-to-run-visual-studio-as-administrator-always/">General tips: How to run Visual Studio as administrator always</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Some times it is needed to run visual studio as administrator for system level activities like if you want to setup IIS virtual directory in your visual studio project, To setup IIS settings etc.</p>
<p>If you want to run visual studio as administrator once, you can right click devenv.exe and select &#8220;Run As Administrator&#8221;.</p>
<p>
<a href="http://neerajkaushik1980.files.wordpress.com/2012/11/iis-setting.png"><img class="alignleft size-full wp-image-734" title="IIS Setting" alt="" src="http://neerajkaushik1980.files.wordpress.com/2012/11/iis-setting.png" height="366" width="595" /></a>
</p>
<p></p>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2012/11/runasadmin1.png"><img src="http://neerajkaushik1980.files.wordpress.com/2012/11/runasadmin1.png" alt="" title="RunAsAdmin" width="541" height="366" /></a></p>
<p>
	But sometimes there are requirement to run visual studio always as admin then you can set privilege level to administrator. Here are the steps:
</p>
<p>Step 1 : Goto to executable of Visual studio IDE in &#8220;C:Program Files(x86)Microsoft Visual Studio 9.0Common7IDE&#8221;, Right click on devenv.exe -&gt; Properties -&gt; Compatibility-&gt; And Select &#8220;Run as Administrator&#8221; check box.</p>
<p>You will also need to setup for visual studio launcher.</p>
<p>Step 2: Go to executable of Visual Studio Launcher on &#8220;C:Program Files (x86)Common Filesmicrosoft sharedMSEnvVsLauncher.exe&#8221; and follow same steps like step 1.</p>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2012/11/vsrunasadmin.png"><img src="http://neerajkaushik1980.files.wordpress.com/2012/11/vsrunasadmin.png" alt="" title="VSRunAsAdmin" width="423" height="538" class="alignleft size-full wp-image-736" /></a></p>
<p>The post <a href="http://dotnetdlr.com/2012/11/general-tips-how-to-run-visual-studio-as-administrator-always/">General tips: How to run Visual Studio as administrator always</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/11/general-tips-how-to-run-visual-studio-as-administrator-always/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Colorize negative number using jquery in html table</title>
		<link>http://dotnetdlr.com/2012/10/colorize-negative-number-using-jquery-in-html-table/</link>
		<comments>http://dotnetdlr.com/2012/10/colorize-negative-number-using-jquery-in-html-table/#comments</comments>
		<pubDate>Wed, 31 Oct 2012 09:53:14 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[filter function]]></category>

		<guid isPermaLink="false">http://dotnetdlr.com/?p=725</guid>
		<description><![CDATA[<p>Recently I was working on creating reports for clients on web portal. We are developing web portabl in asp.net MVC3 and using jquery utility functions. One of the UI requirement was to colorize negative numbers. I can implement in server &#8230; <a href="http://dotnetdlr.com/2012/10/colorize-negative-number-using-jquery-in-html-table/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/10/colorize-negative-number-using-jquery-in-html-table/">Colorize negative number using jquery in html table</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Recently I was working on creating reports for clients on web portal. We are developing web portabl in asp.net MVC3 and using jquery utility functions.</p>
<p>One of the UI requirement was to colorize negative numbers. I can implement in server side in chtml pages but it would not be generic for all pages. So I decided to use jquery functions to do this task.</p>
<p>This is my html page:</p>
<p>&lt;table class=&#8221;list&#8221;&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Date&lt;/td&gt;<br />
&lt;td class=&#8221;right&#8221;&gt;Amount&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;2012-05-01&lt;/td&gt;<br />
&lt;td class=&#8221;right&#8221;&gt;-5.156&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;2012-05-01&lt;/td&gt;<br />
&lt;td class=&#8221;right&#8221;&gt;-8.25&lt;/td&gt;<br />
&lt;/tr&gt;</p>
<p>&lt;tr&gt;<br />
&lt;td&gt;2012-05-01&lt;/td&gt;<br />
&lt;td class=&#8221;right&#8221;&gt;55.45&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;​</p>
<table class="list">
<tbody>
<tr>
<td>Date</td>
<td class="right">Amount</td>
</tr>
<tr>
<td>2012-05-01</td>
<td class="right">-5.156</td>
</tr>
<tr>
<td>2012-05-01</td>
<td class="right">-8.25</td>
</tr>
<tr>
<td>2012-05-01</td>
<td class="right">55.45</td>
</tr>
</tbody>
</table>
<p>​</p>
<p><strong>Java Script</strong><br />
<strong>On Dom Ready</strong></p>
<p><code>$(function(){</code></p>
<p>$(&#8220;td.right&#8221;).filter(function() {<br />
return $.trim($(this).text()).indexOf(&#8220;-&#8221;) == 0;<br />
}).addClass(&#8220;negative&#8221;)​;<br />
});</p>
<p><strong>Css</strong><br />
<code>.right<br />
{<br />
text-align:right;<br />
}<br />
.left<br />
{<br />
text-align:left;<br />
}<br />
.negative<br />
{<br />
color:red;<br />
text-align:right;<br />
}</code><br />
.list<br />
{<br />
border: 1px solid;<br />
}<br />
.row<br />
{<br />
border: 1px solid;<br />
}</p>
<p>Jquery filter function applied on td element which has class name &#8220;right&#8221;. this function find index of &#8216;-&#8217; and if it on first place it will return true. In case of true, css class &#8220;negative&#8221; will be applied to td tag.</p>
<p>we can also use contains functions to applied color.</p>
<p><code>$("td.right"):contains('-').addClass("negative");</code></p>
<p>Problem with this approach is it will apply negative class to any value which contains &#8216;-&#8217; on any place.</p>
<p>You can see live example at JFiddle.</p>
<p><a href="http://jsfiddle.net/neerajkaushik_123/AwCqz/3/" target="_blank">http://jsfiddle.net/neerajkaushik_123/AwCqz/3/</a></p>
<p>The post <a href="http://dotnetdlr.com/2012/10/colorize-negative-number-using-jquery-in-html-table/">Colorize negative number using jquery in html table</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/10/colorize-negative-number-using-jquery-in-html-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Default Application Domains in CLR</title>
		<link>http://dotnetdlr.com/2012/10/default-application-domains-in-clr-2/</link>
		<comments>http://dotnetdlr.com/2012/10/default-application-domains-in-clr-2/#comments</comments>
		<pubDate>Fri, 12 Oct 2012 18:31:06 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[appdomains]]></category>
		<category><![CDATA[CLR]]></category>
		<category><![CDATA[outofmemoryexception]]></category>
		<category><![CDATA[StackOverFlowExceptions]]></category>

		<guid isPermaLink="false">https://neerajkaushik1980.wordpress.com/?p=721</guid>
		<description><![CDATA[<p>&#160; When CLR loads first to execute managed code, it creates 3 application domains.&#160; System and Shared domains are singleton for each CLR. &#160; Application Domains &#160; System Domain It creates and Shared and default application Domains. It Loads Mscorlib.dll &#8230; <a href="http://dotnetdlr.com/2012/10/default-application-domains-in-clr-2/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/10/default-application-domains-in-clr-2/">Default Application Domains in CLR</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<h5>&#160;</h5>
<h5><font style="font-weight:normal;">When CLR loads first to execute managed code, it creates 3 application domains.&#160; System and Shared domains are singleton for each CLR.</font></h5>
<p>&#160;</p>
<h2>Application Domains</h2>
<h3>&#160;</h3>
<h3>System Domain</h3>
<ul>
<ul>
<li>It creates and Shared and default application Domains. </li>
<li>It Loads Mscorlib.dll (class library for system namespace) into shared domain. </li>
<li>
<div align="justify">Creation of default Exception instances (<strong>OutOfMemoryException, StackOverFlowException and FatalExecutionException</strong>): the reason to create these exceptions in advance is that in case of above exceptions to be raise system needs to creates instance and memory, but say if it is outofmemory exception then there will be no space to instantiate exception instance. </div>
</li>
<li>It keeps track all the domains in the process and manage them by loading or unloading AppDomains. </li>
</ul>
<p>   <strong><br />
<h3>Shared Domain</h3>
<p>&#160;</p>
<p>   </strong>
<ul>
<li>It contains mscorlib.dll </li>
<li>It contains basic system types like class, array, struct etc. </li>
</ul>
<h3>Default Domain</h3>
<p>&#160;</p>
<li>It contains user code and resources for only this app domain. </li>
<li>Name of default domain is name of executable. </li>
</ul>
<p>&#160;</p>
<p>&#160;</p>
<p>Reference: <a href="http://msdn.microsoft.com/en-us/magazine/cc163791.aspx#S1">http://msdn.microsoft.com/en-us/magazine/cc163791.aspx#S1</a></p>
<p>The post <a href="http://dotnetdlr.com/2012/10/default-application-domains-in-clr-2/">Default Application Domains in CLR</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/10/default-application-domains-in-clr-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming languages and contribution of Mathematics : An overview</title>
		<link>http://dotnetdlr.com/2012/09/programming-languages-and-contribution-of-mathematics-an-overview/</link>
		<comments>http://dotnetdlr.com/2012/09/programming-languages-and-contribution-of-mathematics-an-overview/#comments</comments>
		<pubDate>Sat, 22 Sep 2012 08:03:43 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[main]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Discrete Mathematics]]></category>

		<guid isPermaLink="false">http://dotnetdlr.com/?p=715</guid>
		<description><![CDATA[<p>Application of Discrete Mathematics in Computer Science Discrete Mathematics play a vital role in software Development in Computer science . Almost ever program is based on some Mathematical Model . To explore the application of Discrete mathematics in computer science &#8230; <a href="http://dotnetdlr.com/2012/09/programming-languages-and-contribution-of-mathematics-an-overview/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/09/programming-languages-and-contribution-of-mathematics-an-overview/">Programming languages and contribution of Mathematics : An overview</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p align="center"><strong>Application of Discrete Mathematics in Computer Science</strong></p>
<p>Discrete Mathematics play a vital role in software Development in Computer science . Almost ever program is based on some Mathematical Model . To explore the application of Discrete mathematics in computer science let us begin from the evolution of computer languages and how mathematics played important role in the evolution of computer languages .</p>
<p><strong>Programming languages and contribution of Mathematics : An overview</strong></p>
<p>Here, we will not explore the history of programming languages in detail but we will only focus on those parts which are concerned and connected to our topic. Computers are electronic devices which are made of registers ,logics &amp; gates etc. All the electronic devices can only understand the ON and OFF logic. Mathematics fertilized logic with the mathematical logic operations and number system. Despite the complex hardware the computer systems operates on a very rudimentary level .10 symbol number system(0,1,2,&#8230;9) is too complicated for the computer system to process. At the logic level a computer can understand only two states i.e. ON logic and OFF logic. The ON state is represented by Binary 1 and OFF state is represented by Binary 0.In modern computers the most basic unit of information is a BIT (0 or 1).A processor reads some sequence of Bits and then Performs some binary operation on them. The information which is processed by processor generates some output. There are lot of abstractions involved the whole process.<em>(abstractions like conversion of user input to binary information, than processing the information in the processor and then again converting the processor&#8217;s binary output to human readable format).</em></p>
<p>All the programming languages which are developed till now are Greatly influenced by Mathematics. we can say that the evolution of computer and programming is made possible only due to Mathematics and Mathematical Logic involved in it . Mathematical logic is a subfield of mathematics with close connections to the foundations of mathematics and theoretical computer Science .each and every assignment statements, subroutines, conditional statements, iteration, etc everything follows some mathematical Logic which is rooted from low level binary logic to high level computational logic.</p>
<p>The history of  Binary number system also known as BASE-2-NUMBER is very interesting and worth reading. evidence proves that binary numbers were used in India prior to around 5th–2nd centuries, more than 1500 years before their discovery in the west. The source of this discovery is a text of music by Pingala named &#8220;Chhandahshastra&#8221; meaning science of meters. Pingala developed mathematical concepts for describing prosody(poem), and in doing so he presented the first known description of a binary number system. The modern Binary numbers were discovered in the west by German mathematician Gottfried Leibniz in 1695 (Suggested Reading <em>Leibniz G., Explication de l&#8217;Arithmétique</em> <em>Binaire,</em> <em>Die Mathematische Schriften, ed. C. Gerhardt, Berlin 1879, vol.7, p.223;)</em>. Let&#8217;s not Deviate focus from our topic .</p>
<p>In 1940&#8242;s with the invention of first electronic computer ,the first recognizable programming languages came into existence which is basically a low level assemble language. The Limited speed and limited memory capacity forced Programmers to write hand tuned assemble language programs. These assembly languages includes are very complex instructions. Even the programming of simple task is difficult and complex in assemble languages. These languages generally have binary information which needs to be converted into hex decimal codes to make it more Human Readable.</p>
<p>Between 1943-1945 Konrad Zuse proposed a programming language Plankalkül which is described for engineering purposes. It was the first high-level non-von Neumann programming language to be designed for a computer, Plankalkül was not published at that time due to the circumstances(2nd world war). In 1948 Zuse published a paper about the <strong>Plankalkül </strong>in the &#8220;Archiv der Mathematik&#8221; but still did not attract much feedback (Paper : for a long time to come programming a computer would only be thought of as programming with machine code). Plankalkül has drawn comparisons to APL(name after the book : A Programming Language) and relational algebra. It includes assignment statements, subroutines, conditional statements, iteration, floating point arithmetic, arrays, hierarchical record structures, assertions, exception handling, and other advanced features such as goal-directed execution. Plankalkül used Logical notation which was proposed in <strong>Begriffsschrift</strong> ( &#8221;concept-script&#8221;) a book on logic by Gottlob Frege, published in 1879. The Begriffsschrift was arguably the most important publication in logic since Aristotle founded the subject. The work of Plankalkül was influenced by Heinz Rutishauser. Heinz Rutishauser (30 January 1918 in Weinfelden, Switzerland &#8211; 10 November 1970 in Zürich) was a Swiss mathematician and a pioneer of modern numerical mathematics and computer science.</p>
<p>Between 1950 to 1957 lot of different programming languages <em>like ARITH-MATIC, MATH-MATIC, MATRIX_MATH, FLOW-MATIC, etc</em> are proposed <em>.( Check the programming language timeline at </em><em><a href="http://en.wikipedia.org/wiki/Timeline_of_programming_languages">http://en.wikipedia.org/wiki/Timeline_of_programming_languages</a>)</em></p>
<p>In 1957 Fortran-I was introduced which is developed by IBM at their campus in south San Jose, California for scientific and engineering applications. In 1954-1955 FORTRAN concept was introduced. The Name FORTRAN is derived from The IBM <em>Mathematical <strong>For</strong>mula <strong>Tran</strong>slating System.</em> It is one of the most popular languages in the area of high-performance computing  and is the language used for programs that benchmark and rank the world&#8217;s fastest supercomputers. A significant improvement in programming languages and new programming languages which came overtime put more abstractions on internal design of programming and the mathematics involved in it.</p>
<p>Later in  1957 Noam Chomsky published a book Syntactic Structures  in which he developed the idea that each sentence in a language has two levels of representation — <em>a deep structure and a surface structure.</em> In 1959 Noam Chomsky introduced the <strong>mathematical Structure of a Grammar</strong>. This mathematical structure seeded all the modern programming languages.</p>
<p>In the summary written by<strong> ROBERT W. FLOYD</strong> in his paper <strong>The Syntax of Programming Languages-A Survey</strong> says</p>
<p><em>&#8221; </em><em>The syntactic rules for many programming languages have been expressed by formal grammars, generally variants of phrase-structure grammars. The syntactic analysis essential to translation of programming languages can be done entirely mechanically for such languages. Major problems remain in rendering analyzers efficient in use of space and time and in finding fully satisfactory formal grammars for present and future programming languages. &#8220;</em></p>
<p>References and Suggested Readings :</p>
<ol>
<li><a href="http://home.ica.net/~roymanju/Binary.htm">http://home.ica.net/~roymanju/Binary.htm</a></li>
<li><a href="http://www.leibniz-translations.com/binary.htm">http://www.leibniz-translations.com/binary.htm</a></li>
<li><a href="http://en.wikipedia.org/wiki/Begriffsschrift">http://en.wikipedia.org/wiki/Begriffsschrift</a></li>
<li><a href="http://en.wikipedia.org/wiki/Plankalk%C3%BCl">http://en.wikipedia.org/wiki/Plankalk%C3%BCl</a></li>
<li><a href="http://www.zib.de/zuse/Inhalt/Programme/Plankalkuel/Plankalkuel-Report/Plankalkuel-Report.htm">http://www.zib.de/zuse/Inhalt/Programme/Plankalkuel/Plankalkuel-Report/Plankalkuel-Report.htm</a></li>
<li><a href="http://en.wikipedia.org/wiki/Heinz_Rutishauser">http://en.wikipedia.org/wiki/Heinz_Rutishauser</a></li>
<li><a href="http://www.jsoftware.com/papers/APL.htm">http://www.jsoftware.com/papers/APL.htm</a></li>
<li>http://www.win.tue.nl/~mvdbrand/courses/seminar/0809/papers/Floyd.pdf</li>
<li><a href="http://en.wikipedia.org/wiki/Fortran">http://en.wikipedia.org/wiki/Fortran</a></li>
<li><a href="http://en.wikipedia.org/wiki/Timeline_of_programming_languages">http://en.wikipedia.org/wiki/Timeline_of_programming_languages</a></li>
<li><a href="http://www.tutorialsdownload.com/application-of-discrete-mathematics-in-computer-science/">http://www.tutorialsdownload.com/application-of-discrete-mathematics-in-computer-science/</a></li>
</ol>
<p>The post <a href="http://dotnetdlr.com/2012/09/programming-languages-and-contribution-of-mathematics-an-overview/">Programming languages and contribution of Mathematics : An overview</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/09/programming-languages-and-contribution-of-mathematics-an-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup connection on SSL with FIX server</title>
		<link>http://dotnetdlr.com/2012/08/setup-connection-on-ssl-with-fix-server/</link>
		<comments>http://dotnetdlr.com/2012/08/setup-connection-on-ssl-with-fix-server/#comments</comments>
		<pubDate>Tue, 28 Aug 2012 00:43:00 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[FIX]]></category>
		<category><![CDATA[QuickFix]]></category>
		<category><![CDATA[QuickFix/n]]></category>
		<category><![CDATA[SSL setup]]></category>
		<category><![CDATA[stunnel]]></category>

		<guid isPermaLink="false">https://neerajkaushik1980.wordpress.com/?p=707</guid>
		<description><![CDATA[<p>&#160; Some broker support SSL to send message to FIX server. QuickFix engine does not have support for SSL. Some commercial QuickFix engine support it eg. OnixS ultra low latency .NET FIX Engine. &#160; Here I am give example how &#8230; <a href="http://dotnetdlr.com/2012/08/setup-connection-on-ssl-with-fix-server/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/08/setup-connection-on-ssl-with-fix-server/">Setup connection on SSL with FIX server</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p align="justify">&#160;</p>
<p align="justify">Some broker support SSL to send message to FIX server. QuickFix engine does not have support for SSL. Some commercial QuickFix engine support it eg. <a href="http://www.onixs.biz/net-fix-engine.html" target="_blank">OnixS ultra low latency .NET FIX Engine</a>.</p>
<p align="justify">&#160;</p>
<p align="justify">Here I am give example how we can connect to FIX server on SSL.</p>
<p align="justify">We can install third party network proxy software which can route calls on SSL. We can&#160; <a href="http://www.onixs.biz/net-fix-engine.html" target="_blank"><strong>Stunnel</strong></a> program to support it. It can be used to add SSL functionality to commonly used in daemons like POP2, POP3, and IMAP servers without any changes in the programs&#8217; code.</p>
<p align="justify"><strong>QuickFIX Configuration in Stunnel</strong></p>
<p align="justify"><strong></strong></p>
<p align="justify"><strong>Add following entry to Stunel.conf config file to connect with FIX Server</strong></p>
<blockquote><p align="justify">;it can be any name</p>
<p>[FIXSERVER]     <br />client = yes      <br />accept = 127.0.0.1:3500      <br />connect=&lt;FIXSERVER Address&gt;: &lt;PORT&gt;</p>
</blockquote>
<p>&#160;</p>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2012/08/image3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://neerajkaushik1980.files.wordpress.com/2012/08/image_thumb3.png" width="512" height="292" /></a></p>
<p>&#160;</p>
<p>You can change listening port to any free port on local machine.</p>
<p>&#160;</p>
<p><strong>Change in QuickFix config File</strong></p>
<blockquote><p>[default]     <br />PersistMessages=Y      <br />ConnectionType=initiator      <br />UseDataDictionary=Y</p>
<p>[SESSION]     <br />ConnectionType=initiator      <br />FileStorePath=store      <br />FileLogPath=fixlog      <br />BeginString=FIXT.1.1      <br />DefaultApplVerID=FIX.5.0</p>
<p>TransportDataDictionary=FIXT.1.1.xml</p>
<p>AppDataDictionary=FIX50.xml     <br />SenderCompID=ABC      <br />TargetCompID=FIXSERVER      <br />SocketConnectHost=127.0.0.1      <br />SocketConnectPort=3500      <br />HeartBtInt=20      <br />ReconnectInterval=30      <br />ResetOnLogon=Y      <br />ResetOnLogout=Y      <br />ResetOnDisconnect=Y</p>
</blockquote>
<p>&#160;</p>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2012/08/image4.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://neerajkaushik1980.files.wordpress.com/2012/08/image_thumb4.png" width="354" height="334" /></a></p>
<p>&#160;</p>
<p>I hope, it will help you.</p>
<p>The post <a href="http://dotnetdlr.com/2012/08/setup-connection-on-ssl-with-fix-server/">Setup connection on SSL with FIX server</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/08/setup-connection-on-ssl-with-fix-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Implementation of FIX messages for Fix 5.0 sp2 and FIXT1.1 specification</title>
		<link>http://dotnetdlr.com/2012/08/implementation-of-fix-messages-for-fix-5-0-sp2-and-fixt1-1-specification/</link>
		<comments>http://dotnetdlr.com/2012/08/implementation-of-fix-messages-for-fix-5-0-sp2-and-fixt1-1-specification/#comments</comments>
		<pubDate>Mon, 27 Aug 2012 14:57:44 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[FIX]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[FIX5.0sp2]]></category>
		<category><![CDATA[FIXT1.1]]></category>
		<category><![CDATA[QuickFix/n]]></category>

		<guid isPermaLink="false">https://neerajkaushik1980.wordpress.com/?p=699</guid>
		<description><![CDATA[<p>&#160; This post will demonstrate how to connect with FIX5.0 server and FIXT1.1 specification and uses of QuickFix/n (native .net FIX engine). Introduction With this release of FIX protocol version 5.0, a new Transport Independence framework (TI) introduced which separates &#8230; <a href="http://dotnetdlr.com/2012/08/implementation-of-fix-messages-for-fix-5-0-sp2-and-fixt1-1-specification/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/08/implementation-of-fix-messages-for-fix-5-0-sp2-and-fixt1-1-specification/">Implementation of FIX messages for Fix 5.0 sp2 and FIXT1.1 specification</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p>This post will demonstrate how to connect with FIX5.0 server and FIXT1.1 specification and uses of QuickFix/n (native .net FIX engine).</p>
<p><strong>Introduction</strong></p>
<p>With this release of FIX protocol version 5.0, a new Transport Independence framework (TI) introduced which separates the FIX Session Protocol from the FIX Application Protocol. This gives freedom to send message across different messaging technologies like MSMQ, message bus etc.</p>
<p align="justify">Because of different versions of transport and application protocol, we will have to explicitly defines settings in config file.</p>
<p><strong>TransportDataDictionary</strong> is used for defining transport protocol version eg. FIXT.1.1.xml</p>
<p><strong>AppDataDictionary</strong> is used for defining data dictionary for FIX application protocol version eg. FIX50.xml</p>
<p>You can read more about FIXT1.1 and FIX 5.0 Sp2 specification on <a href="http://fixprotocol.org" target="_blank">fixprotocol.org</a>.</p>
<p><a href="http://fixprotocol.org/specifications/FIXT.1.1">http://fixprotocol.org/specifications/FIXT.1.1</a></p>
<p><a href="http://fixprotocol.org/specifications/FIX.5.0">http://fixprotocol.org/specifications/FIX.5.0</a></p>
<p>&nbsp;</p>
<p><strong>QuickFix/N</strong></p>
<p align="justify">To demonstrate implementation of FIX 5.0 sp2, I’ll use open source FIX engine for .net (QuickFix/N) which is one of open source engine in native .net code.  Code for quickfix.net is available on <a href="https://github.com/connamara/quickfixn" target="_blank">github</a> and primarily contributed by <a href="http://www.connamara.com/" target="_blank">Connamara System’s</a> developers. These guys are doing commendable job.</p>
<p>&nbsp;</p>
<p><strong>Implementation</strong></p>
<p><strong>FixInitiator</strong></p>
<p align="justify">This is client application which will connect with FIX server to send and receive FIX messages. I am demonstrating implementation of MarketDataRequest and its responses (MarketDataSnapshot &amp; MarketDataIncrementalRefresh).</p>
<p>&nbsp;</p>
<p><strong>Start with Configuration</strong></p>
<p>First we create configuration file for initiator.</p>
<blockquote><p>[default]<br />
PersistMessages=Y<br />
ConnectionType=initiator<br />
UseDataDictionary=Y</p>
<p>[SESSION]<br />
ConnectionType=initiator<br />
FileStorePath=store<br />
FileLogPath=fixlog<br />
BeginString=FIXT.1.1<br />
DefaultApplVerID=FIX.5.0</p>
<p>TransportDataDictionary=FIXT.1.1.xml</p>
<p>AppDataDictionary=FIX50.xml<br />
SenderCompID=ABC<br />
TargetCompID=FIXSERVER<br />
SocketConnectHost=127.0.0.1<br />
SocketConnectPort=3500<br />
HeartBtInt=20<br />
ReconnectInterval=30<br />
ResetOnLogon=Y<br />
ResetOnLogout=Y<br />
ResetOnDisconnect=Y</p></blockquote>
<p>&nbsp;</p>
<p>*Note- AppDataDictionary is for application protocol eg. FIX 5.0 and TransportDataDictionary is for transport protocol.</p>
<p>You can read more about configuration <a href="http://quickfixn.org/tutorial/configuration" target="_blank">here</a>.</p>
<p><strong>Create Application Class</strong></p>
<p>Before starting with implementation you would need to have quickFix.dll which is available of github  at<a href="https://github.com/connamara/quickfixn">https://github.com/connamara/quickfixn</a></p>
<p>&nbsp;</p>
<p>To connect with FIX session, you will have to implement QuickFix.Application interface.</p>
<blockquote><p>public interface Application<br />
{<br />
void FromAdmin(Message message, SessionID sessionID);<br />
void FromApp(Message message, SessionID sessionID);<br />
void OnCreate(SessionID sessionID);<br />
void OnLogon(SessionID sessionID);<br />
void OnLogout(SessionID sessionID);<br />
void ToAdmin(Message message, SessionID sessionID);<br />
void ToApp(Message message, SessionID sessionId);<br />
}</p></blockquote>
<p>I create one class named FixClient50Sp2 which implements interface and inherit base class for message cracking and getting message events.</p>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2012/08/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" alt="image" src="http://neerajkaushik1980.files.wordpress.com/2012/08/image_thumb2.png" width="211" height="435" border="0" /></a></p>
<p>&nbsp;</p>
<p><strong>FIX Application Setup</strong></p>
<p>&nbsp;</p>
<p><strong>Setting up Initiator</strong></p>
<blockquote><p>// FIX app settings and related<br />
var settings = new SessionSettings(&#8220;C:\initiator.cfg&#8221;);</p>
<p>// FIX application setup<br />
MessageStoreFactory storeFactory = new FileStoreFactory(settings);<br />
LogFactory logFactory = new FileLogFactory(settings);<br />
_client = new FixClient50Sp2(settings);</p>
<p>IInitiator initiator = new SocketInitiator(_client, storeFactory, settings, logFactory);<br />
_client.Initiator = initiator;</p></blockquote>
<p>&nbsp;</p>
<p><strong>*</strong> _client is instance of class FixClient50Sp2.</p>
<p><strong>Starting Initiator</strong></p>
<blockquote><p>_client.Start();</p></blockquote>
<p>&nbsp;</p>
<p><strong>Implementation of QuickFix.Application Interface methods</strong></p>
<blockquote><p>/// &lt;summary&gt;<br />
/// every inbound admin level message will pass through this method,<br />
/// such as heartbeats, logons, and logouts.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;message&#8221;&gt;&lt;/param&gt;<br />
/// &lt;param name=&#8221;sessionId&#8221;&gt;&lt;/param&gt;<br />
public void FromAdmin(Message message, SessionID sessionId)<br />
{<br />
Log(message.ToString());<br />
}</p>
<p>/// &lt;summary&gt;<br />
/// every inbound application level message will pass through this method,<br />
/// such as orders, executions, secutiry definitions, and market data.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;message&#8221;&gt;&lt;/param&gt;<br />
/// &lt;param name=&#8221;sessionID&#8221;&gt;&lt;/param&gt;<br />
public void FromApp(Message message, SessionID sessionID)<br />
{<br />
Trace.WriteLine(&#8220;## FromApp: &#8221; + message);</p>
<p>Crack(message, sessionID);<br />
}</p>
<p>/// &lt;summary&gt;<br />
/// this method is called whenever a new session is created.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;sessionID&#8221;&gt;&lt;/param&gt;<br />
public void OnCreate(SessionID sessionID)<br />
{<br />
if (OnProgress != null)<br />
Log(string.Format(&#8220;Session {0} created&#8221;, sessionID));<br />
}</p>
<p>/// &lt;summary&gt;<br />
/// notifies when a successful logon has completed.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;sessionID&#8221;&gt;&lt;/param&gt;<br />
public void OnLogon(SessionID sessionID)<br />
{<br />
ActiveSessionId = sessionID;<br />
Trace.WriteLine(String.Format(&#8220;==OnLogon: {0}==&#8221;, ActiveSessionId));</p>
<p>if (LogonEvent != null)<br />
LogonEvent();<br />
}</p>
<p>/// &lt;summary&gt;<br />
/// notifies when a session is offline &#8211; either from<br />
/// an exchange of logout messages or network connectivity loss.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;sessionID&#8221;&gt;&lt;/param&gt;<br />
public void OnLogout(SessionID sessionID)<br />
{<br />
// not sure how ActiveSessionID could ever be null, but it happened.<br />
string a = (ActiveSessionId == null) ? &#8220;null&#8221; : ActiveSessionId.ToString();<br />
Trace.WriteLine(String.Format(&#8220;==OnLogout: {0}==&#8221;, a));</p>
<p>if (LogoutEvent != null)<br />
LogoutEvent();<br />
}</p>
<p>/// &lt;summary&gt;<br />
/// all outbound admin level messages pass through this callback.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;message&#8221;&gt;&lt;/param&gt;<br />
/// &lt;param name=&#8221;sessionID&#8221;&gt;&lt;/param&gt;<br />
public void ToAdmin(Message message, SessionID sessionID)<br />
{<br />
Log(&#8220;To Admin : &#8221; + message);<br />
}</p>
<p>/// &lt;summary&gt;<br />
/// all outbound application level messages pass through this callback before they are sent.<br />
/// If a tag needs to be added to every outgoing message, this is a good place to do that.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;message&#8221;&gt;&lt;/param&gt;<br />
/// &lt;param name=&#8221;sessionId&#8221;&gt;&lt;/param&gt;<br />
public void ToApp(Message message, SessionID sessionId)<br />
{<br />
Log(&#8220;To App : &#8221; + message);<br />
}</p></blockquote>
<blockquote><p>&nbsp;</p></blockquote>
<p>&nbsp;</p>
<p><strong>Callback to Subscription</strong></p>
<blockquote><p>public void OnMessage(MarketDataIncrementalRefresh message, SessionID session)<br />
{<br />
var noMdEntries = message.NoMDEntries;<br />
var listOfMdEntries = noMdEntries.getValue();<br />
//message.GetGroup(1, noMdEntries);<br />
var group = new MarketDataIncrementalRefresh.NoMDEntriesGroup();</p>
<p>Group gr = message.GetGroup(1, group);</p>
<p>string sym = message.MDReqID.getValue();</p>
<p>var price = new MarketPrice();</p>
<p>for (int i = 1; i &lt;= listOfMdEntries; i++)<br />
{<br />
group = (MarketDataIncrementalRefresh.NoMDEntriesGroup)message.GetGroup(i, group);</p>
<p>price.Symbol = group.Symbol.getValue();</p>
<p>MDEntryType mdentrytype = group.MDEntryType;</p>
<p>if (mdentrytype.getValue() == &#8217;0&#8242;) //bid<br />
{<br />
decimal px = group.MDEntryPx.getValue();<br />
price.Bid = px;<br />
}<br />
else if (mdentrytype.getValue() == &#8217;1&#8242;) //offer<br />
{<br />
decimal px = group.MDEntryPx.getValue();<br />
price.Offer = px;<br />
}</p>
<p>price.Date = Constants.AdjustedCurrentUTCDate.ToString(&#8220;yyyyMMdd&#8221;);<br />
price.Time = group.MDEntryTime.ToString();<br />
}</p>
<p>if (OnMarketDataIncrementalRefresh != null)<br />
{<br />
OnMarketDataIncrementalRefresh(price);<br />
}<br />
}</p>
<p>&nbsp;</p></blockquote>
<p>Code can be found at <a href="https://github.com/neerajkaushik123/Fix50Sp2SampleApp.git" target="_blank">github</a>.</p>
<p>&nbsp;</p>
<p><a title="https://github.com/neerajkaushik123/Fix50Sp2SampleApp.git" href="https://github.com/neerajkaushik123/Fix50Sp2SampleApp.git">https://github.com/neerajkaushik123/Fix50Sp2SampleApp.git</a></p>
<p>The post <a href="http://dotnetdlr.com/2012/08/implementation-of-fix-messages-for-fix-5-0-sp2-and-fixt1-1-specification/">Implementation of FIX messages for Fix 5.0 sp2 and FIXT1.1 specification</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/08/implementation-of-fix-messages-for-fix-5-0-sp2-and-fixt1-1-specification/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Arithmetic Expression Calculator</title>
		<link>http://dotnetdlr.com/2012/08/arithmetic-expression-calculator/</link>
		<comments>http://dotnetdlr.com/2012/08/arithmetic-expression-calculator/#comments</comments>
		<pubDate>Thu, 02 Aug 2012 06:19:41 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Expression Calculator]]></category>
		<category><![CDATA[Expression-tree]]></category>

		<guid isPermaLink="false">https://neerajkaushik1980.wordpress.com/?p=693</guid>
		<description><![CDATA[<p>&#160; This post describes implementation of arithmetic expression calculator in C#. I have below specification in the form of Backus–Naur Form expression. It is mainly used to define syntax of languages in compiler design world. You can read more about &#8230; <a href="http://dotnetdlr.com/2012/08/arithmetic-expression-calculator/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/08/arithmetic-expression-calculator/">Arithmetic Expression Calculator</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p>&#160;</p>
<p>This post describes implementation of arithmetic expression calculator in C#.</p>
<p>I have below specification in the form of Backus–Naur Form expression. It is mainly used to define syntax of languages in compiler design world. You can read more about it on <a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form" target="_blank">wikipedia</a>.</p>
<p>There are certain readymade solutions are available to calculate expressions.&#160; Microsoft also introduced Expression tree through which we can compile complex expressions using Lambda expressions</p>
<p>Basically this expression is defining arithmetic calculation with some validations. Following defines list of validations and rule.</p>
<ul>
<li>Expression should contain arithmetic operations and operands only. </li>
<li>Expression can only have +, -, * operators. </li>
<li>Numbers can be negative or positive. </li>
<li>Decimals numbers can have “.” as decimal. </li>
<li>Digits should be non zero. </li>
</ul>
<ul><strong>Expression Example</strong></ul>
<blockquote><p>cmd::= expression* signed_decimal</p>
<p>expresion::= signed_decimal &#8216; &#8216;* operator &#8216; &#8216;* eg. 2.3 * + * 2.3</p>
<p>operator::= &#8216;+&#8217; | &#8216;-&#8217; | &#8216;*&#8217;</p>
<p>signed_decimal::= &#8216;-&#8217;? decimal_number</p>
<p>decimal_number::= digits | digits ‘.’ digits</p>
<p>digits::= &#8217;0&#8242; | non_zero_digit digits*</p>
<p>non_zero_digit::= &#8217;1&#8242;|&#8217;2&#8242;|&#8217;3&#8242;|&#8217;4&#8242;|&#8217;5&#8242;|&#8217;6&#8242;|&#8217;7&#8242;|&#8217;8&#8242;|&#8217;9&#8242;</p>
</blockquote>
<p><strong>Let’s start Implementation</strong></p>
<p>Here I’ll take simple approach to evaluate this expression without use of .Net Expression Tree with possible failure and pass test cases. I tried to put relevant comments in code itself to make it self explanatory.</p>
<p><strong></strong></p>
<p><strong>&#160;</strong></p>
<pre class="brush:csharp">using System;
using System.Linq;
using NUnit.Framework;

namespace Calculator
{
    /// <summary>
    /// Basic calc engine for handling +, -, * operations.
    /// </summary>
    public class CalcEngine
    {

        char[] operatorList = new char[3] { '+', '-', '*' };

        /// <summary>
        /// Calculate arithmatic Expression
        /// </summary>
        /// 
        /// 
        public decimal Calculate(string expression)
        {
            foreach (var oper in operatorList)
            {
                if (expression.Contains(oper))
                {
                    var parts = expression.Split(oper);
                    int i = 1;
                    decimal result = Calculate(parts[0].Trim());

                    while (i &lt; parts.Length)
                    {
                        switch (oper)
                        {
                            case '+':
                                result += Calculate(parts[i].Trim());
                                break;
                            case '-':
                                result -= Calculate(parts[i].Trim());
                                break;
                            case '*':
                                result *= Calculate(parts[i].Trim());
                                break;
                        }
                        i++;
                    }
                    return result;
                }

            }
            decimal value = 0;
   //Note: we can also use decimal.Parse and can catch exception in catch block 
   but it is expensive task to wait for system exception
   //better to use TryParse and then throw custom exception
   if (expression.Trim().Length &gt; 0 &amp;&amp; 
         !decimal.TryParse(expression, System.Globalization.NumberStyles.Float, 
	  System.Globalization.CultureInfo.InvariantCulture, out value))
            {
                throw new FormatException(&quot;Expression is wrong! 
			Please removed un-allowed charactersn 
			please follow following validations:n&quot; +
                    &quot;Expression should contain arithmetic operations
			 and operands only n&quot; +
                    &quot;Expression can only have +, -, * operators n&quot; +
                    &quot;Numbers can be negative or positive n&quot; +
                    &quot;. as decimal point&quot;);
            }

            return value;
        }

    }</pre>
<p><strong>Unit Tests</strong></p>
<pre class="brush:csharp">[TestFixture]
    public class CalcEngineTest
    {
        CalcEngine engine;

        [Setup]
        public void Setup()
        {
            engine = new CalcEngine();
        }

        [Test]
        [ExpectedException(typeof(FormatException))]
        public void TestValidationFailur_Nondigit()
        {
            Assert.AreEqual(-14, engine.Calculate(&quot;1+2+3-4d&quot;));
        }

        [Test]
        [ExpectedException(typeof(FormatException))]
        public void TestValidationFailure_NonDecimalNotation()
        {
            Assert.AreEqual(0, engine.Calculate(&quot;1+2+3,4&quot;));
        }

        [Test]
        public void TestBlankStringShouldZero()
        {
            Assert.AreEqual(0, engine.Calculate(&quot; &quot;));


        }


        [Test]
        public void TestMultiplication()
        {
            Assert.AreEqual(60, engine.Calculate(&quot;5*6*2&quot;));

            Assert.AreEqual(469.929812m, engine.Calculate(&quot;5.5*2.456*34.789&quot;));
        }

        [Test]
        public void TestSubtraction()
        {

            Assert.AreEqual(45, engine.Calculate(&quot;100-35-20&quot;));

            Assert.AreEqual(469.929812m, engine.Calculate(&quot;5.5*2.456*34.789&quot;));
        }


    [Test]
    public void TestSummation()
    {
    CalcEngine engine = new CalcEngine();
    Assert.AreEqual(10, engine.Calculate(&quot;1+2+3+4&quot;));
    Assert.AreEqual(20.20m, engine.Calculate(&quot;1.4+4.5+8.90+5.4&quot;));
    Assert.AreEqual(20 + 20, engine.Calculate(&quot;20+20&quot;));
    }

 [Test]
 public void TestAdd_Multiply_Subtraction()
 {
  Assert.AreEqual(-5563.4541m, 
		engine.Calculate(&quot;-2*4.5+3+30-20*278.9+30.5459-40&quot;));
  Assert.AreEqual(-5563.4541m, 
		engine.Calculate(&quot;-2*4.5+3+30-20*278.9+30.5459-40&quot;));
 }
    [Test]
    public void TestDecimalNumberWithoutOperators()
    {
       Assert.AreEqual(4.5m, engine.Calculate(&quot;4.5&quot;));
     }
  }
}</pre>
<p>The post <a href="http://dotnetdlr.com/2012/08/arithmetic-expression-calculator/">Arithmetic Expression Calculator</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/08/arithmetic-expression-calculator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRUD operations using KnockOutJS and Asp.Net MVC3</title>
		<link>http://dotnetdlr.com/2012/08/crud-operations-using-knockoutjs-and-asp-net-mvc3/</link>
		<comments>http://dotnetdlr.com/2012/08/crud-operations-using-knockoutjs-and-asp-net-mvc3/#comments</comments>
		<pubDate>Wed, 01 Aug 2012 17:37:51 +0000</pubDate>
		<dc:creator>NeerajKaushik</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[KnockoutJs]]></category>
		<category><![CDATA[asp.net mvc3]]></category>
		<category><![CDATA[Knockoutjs]]></category>

		<guid isPermaLink="false">https://neerajkaushik1980.wordpress.com/?p=682</guid>
		<description><![CDATA[<p>&#160; In last posts about knockoutJs, I gave examples of Search, Binding server side model to KnockoutJs ViewModel. I’ll discuss today about sending data back to server so that we can do server side operations. I would like to present &#8230; <a href="http://dotnetdlr.com/2012/08/crud-operations-using-knockoutjs-and-asp-net-mvc3/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://dotnetdlr.com/2012/08/crud-operations-using-knockoutjs-and-asp-net-mvc3/">CRUD operations using KnockOutJS and Asp.Net MVC3</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></description>
				<content:encoded><![CDATA[<p>&#160;</p>
<p>In last posts about knockoutJs, I gave examples of Search, Binding server side model to KnockoutJs ViewModel. I’ll discuss today about sending data back to server so that we can do server side operations. I would like to present it doing CRUD operations for Account entity.</p>
<p>Account entity has AccountId, Name and AccountBalance.</p>
<p>I start with creating Controller’a action methods Search and Update. </p>
<p><strong>Search</strong> method expects search criteria to search records and send back to client in json format.</p>
<p><strong>Update</strong> method expects accountid, name etc to from client to do server side operations and send back updated values to client in json format.</p>
<p><strong>Controller Class</strong></p>
<p><strong>AccountController</strong></p>
<p>&#160;</p>
<pre class="brush:csharp"> public class AccountController : Controller
    {
        public ActionResult Index()
        {
            return View(&quot;Account&quot;);
        }

        /// <summary>
        /// Search Method
        /// </summary>
        public JsonResult Search(string SearchCriteria)
        {
            //Temporary Code
            //todo: can write actual search functionality
            Random rnd = new Random();

            return Json(new { AccountId = 1, Name = &quot;test&quot;, 
			Balance = rnd.NextDouble() * 93.244d });
        }

        /// <summary>
        /// Save method
        /// </summary>
       public JsonResult Update(int AccountId, string Name)
        {
            ////Temporary Code
            //todo: can write actual update code
            Random rnd = new Random();

            return Json(new { AccountId = AccountId, Name = &quot;test&quot;, 
		Balance = rnd.NextDouble() * 93.244d });
        }

    }</pre>
<p><strong>View </strong></p>
<p>In view file( Account.cshtml) html controls are bind with viewmodel fields with data-bind attribute.</p>
<p>&#160;</p>
<pre class="brush:html">@{<br />&#160;&#160;&#160; ViewBag.Title = &quot;Account&quot;;<br />&#160;&#160;&#160; Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;<br />}<br />@section Scripts {<br />&#160;&#160;&#160; &lt;script type=&quot;text/javascript&quot; src=&quot;../../Scripts/Account.js&quot;&gt;&lt;/script&gt;<br />}
<p>&lt;div id=&quot;search&quot;&gt;<br />&#160;&#160;&#160; Search By AccountId &lt;input type=&quot;text&quot; data-bind=&quot;value:SearchCriteria&quot; /&gt;<br />&#160; &lt;p&gt;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;input type=&quot;button&quot; id='btnSearch' title=&quot;Search&quot; value=&quot;Search&quot; /&gt;&lt;/p&gt;<br />&lt;/div&gt;</p>
<p>&lt;div&gt;<br />&#160;&#160;&#160; &lt;p&gt;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AccountId:&lt;input type=&quot;text&quot; data-bind=&quot;value:AccountId&quot; /&gt;&lt;/p&gt;<br />&#160;&#160;&#160; &lt;p&gt;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Account Name&lt;input type=&quot;text&quot; data-bind=&quot;value:Name&quot; /&gt;&lt;/p&gt;<br />&#160;&#160;&#160; &lt;p&gt;<br />&#160;&#160;&#160;&#160;&#160;&#160; Balance&lt;input type=&quot;text&quot; data-bind=&quot;value:Balance&quot; /&gt;&lt;/p&gt;<br />&#160;&#160;&#160; &lt;p&gt;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;input type=&quot;button&quot; id='btnSave' title=&quot;Save&quot; value=&quot;Update&quot; /&gt;&lt;/p&gt;<br />&lt;/div&gt;<br /></p></pre>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2012/08/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://neerajkaushik1980.files.wordpress.com/2012/08/image_thumb.png" width="363" height="288" /></a></p>
<p><strong>Account.Js </strong></p>
<p>We initialize viewModel that is using as knockoutjs viewmodel.</p>
<p>AccountViewModel contains properties AccountId, Name, Balance and two methods Search and Update.</p>
<p><strong>Search Method:</strong>&#160; It sends self.SearchCriteria value in ajax request to call controller action method ie. Search.</p>
<p><strong>Response: </strong>an object with AccountId, Name and Balance is returning from server and knockoutjs view model&#8217;s properties are further setting up from response.</p>
<p>As view model&#8217;s properties are observable in nature here, therefore html controls bind to these values will automatically display changed values.</p>
<p><strong>Update Method: </strong>This method sends Ajax request to server (controller action method). Input parameters are from viewmodel ie. AccountId and Name. Similarly we can create Delete,Add method to delete and Add records respectively.</p>
<p><strong></strong></p>
<blockquote>
<p>var accountmodel;</p>
<p>$(document).ready(function () {</p>
<p>&#160;&#160;&#160; //initializing viewmodel<br />
    <br />&#160;&#160;&#160; accountmodel = new viewModel(); </p>
<p>&#160;&#160;&#160; //binding for ko </p>
<p>&#160;&#160;&#160; ko.applyBindings(accountmodel); </p>
<p>&#160;&#160;&#160; //bind event </p>
<p>&#160;&#160;&#160; $(&quot;#btnSearch&quot;).click({ handler: accountmodel.Search }); </p>
<p>&#160;&#160;&#160; $(&quot;#btnSave&quot;).click({ handler: accountmodel.Update });</p>
<p>
    <br />});</p>
<p>function viewModel() {<br />
    <br />&#160;&#160;&#160; var self = this;</p>
<p>&#160;&#160;&#160; self.AccountId = ko.observable(&#8221;);<br />
    <br />&#160;&#160;&#160; self.Name = ko.observable(&#8221;); </p>
<p>&#160;&#160;&#160; self.Balance = ko.observable(null); </p>
<p>&#160;&#160;&#160; self.SearchCriteria = ko.observable(&#8221;);</p>
<p>&#160;&#160;&#160; self.Search = function () {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax({<br />
    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: &quot;Account/Search&quot;, </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: { SearchCriteria: self.SearchCriteria }, </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type: &quot;POST&quot;, </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function (response) { </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.AccountId(response.AccountId); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.Name(response.Name); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }); </p>
<p>&#160;&#160;&#160; };</p>
<p>&#160;&#160;&#160; self.Update = function () {<br />
    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax({ </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: &quot;Account/Update&quot;, </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: { AccountId: self.AccountId, Name: self.Name }, </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type: &quot;POST&quot;, </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function (response) { </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.AccountId(response.AccountId); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.Name(response.Name); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.Balance(response.Balance); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
<p>&#160;&#160;&#160; }<br />
    <br />};</p>
</blockquote>
<p><a href="http://neerajkaushik1980.files.wordpress.com/2012/08/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://neerajkaushik1980.files.wordpress.com/2012/08/image_thumb1.png" width="585" height="452" /></a></p>
<p>You can find code <a href="http://sdrv.ms/MROFi9" target="_blank">here</a>.</p>
<p>The post <a href="http://dotnetdlr.com/2012/08/crud-operations-using-knockoutjs-and-asp-net-mvc3/">CRUD operations using KnockOutJS and Asp.Net MVC3</a> appeared first on <a href="http://dotnetdlr.com">Technology Space </a>.</p>]]></content:encoded>
			<wfw:commentRss>http://dotnetdlr.com/2012/08/crud-operations-using-knockoutjs-and-asp-net-mvc3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
