<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6277654023607323021</id><updated>2012-01-25T23:28:11.003+01:00</updated><category term='enterprise architect'/><category term='Factory Design Pattern'/><category term='64-Bit'/><category term='documentation'/><category term='html5'/><category term='news'/><category term='togaf 9.1'/><category term='performance monitor'/><category term='enterprise architecture'/><category term='naming convention'/><category term='soa'/><category term='ping'/><category term='architecture board'/><category term='bug tracking'/><category term='nunit'/><category term='wcf. msmq'/><category term='c#'/><category term='encryption'/><category term='Liskov&apos;s Substitution Principle'/><category term='sha-2'/><category term='FTP'/><category term='Backup tool'/><category term='openNETCF'/><category term='web service'/><category term='Dependency Inversion Principle'/><category term='keyboard'/><category term='architecture governance'/><category term='.net'/><category term='performance'/><category term='windows mobile'/><category term='wmic'/><category term='jshelper'/><category term='try-catch'/><category term='xml'/><category term='linq'/><category term='visualsvn server'/><category term='certificates'/><category term='mysql'/><category term='hashtable'/><category term='iis7'/><category term='security'/><category term='dictionary collection'/><category term='css3'/><category term='mock and stub'/><category term='.NET Framework'/><category term='IIS'/><category term='visual studio'/><category term='Design Principle'/><category term='iPhone'/><category term='touch screen keyboard'/><category term='dns'/><category term='Open Closed Principle'/><category term='html'/><category term='unit testing'/><category term='asp.net'/><category term='benchmarking'/><category term='ubuntu'/><category term='architecture'/><category term='rhino'/><category term='GPRS'/><category term='Interface Segregation Principle'/><category term='json'/><category term='sha-1'/><category term='svn'/><category term='subversion'/><category term='Kindle'/><category term='32-Bit'/><category term='wiki'/><category term='smtp'/><category term='x.509'/><category term='javascript'/><category term='cache'/><category term='Single Responsibility Pattern'/><category term='paging'/><category term='x86'/><category term='return value'/><category term='win32_bios'/><category term='open group'/><category term='mime type'/><category term='csharp'/><category term='sharepoint'/><category term='.NET compact framework'/><category term='Network Monitor'/><category term='plugin'/><category term='togaf'/><category term='bios serial number'/><category term='test driven development'/><category term='source control'/><category term='casting'/><category term='firewall'/><category term='performance counter'/><category term='async'/><category term='usability'/><category term='wcf'/><category term='system.net.networkinformation'/><category term='Memento Design Pattern'/><category term='web clip icon'/><category term='ajax'/><category term='Host Header Name'/><category term='static'/><category term='tips-trick'/><category term='flv'/><category term='system.net'/><category term='fluent interface'/><category term='constructor'/><category term='null'/><category term='private'/><category term='technical debt'/><category term='jquery'/><category term='client-side'/><category term='architecture governance framework'/><category term='Design Pattern'/><category term='exception'/><category term='project management'/><category term='iPad'/><category term='md5'/><category term='wmi'/><category term='system.management'/><category term='The Dude'/><title type='text'>the art of software development</title><subtitle type='html'>{ Serkan Karaarslan - Software Engineer &amp;amp; Architect }</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.technolatte.net/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default?start-index=101&amp;max-results=100'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>102</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-3275159073334508133</id><published>2012-01-17T17:06:00.000+01:00</published><updated>2012-01-17T17:08:09.394+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sha-1'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='sha-2'/><category scheme='http://www.blogger.com/atom/ns#' term='md5'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><title type='text'>Client Side Encryption Techniques</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/HTTP_Secure"&gt;HTTPS&lt;/a&gt; is the obvious solution to build secure connection between client and server. Unfortunately, it may not the answer to all web applications. For some reasons, you cannot afford &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;SSL&lt;/a&gt; or it's not necessary to use it. Anyway, even if you don't have SSL you can still provide security one level up. Because of that most of users use same password for all online web applications, their accounts are vulnerable. Same password might be used for online banking and any simple web forums. If I capture a password used in a forum web site I'm able to use same password to access the victim's online banking account. For that reason, you have to be more careful when you connect public wireless network.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-t9bPAti5ebU/TxSv9_LE7qI/AAAAAAAAAf8/YU5SVjgNicg/s1600/client-side-encryption.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-t9bPAti5ebU/TxSv9_LE7qI/AAAAAAAAAf8/YU5SVjgNicg/s1600/client-side-encryption.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;client side encryption&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It's always possible to listen and monitor the network and capture packages which is sent and received between client and server. If your client's password is sent in a plain text to your server, it can be captured easily by listening your client's network. In order to protect your client's password you can use &lt;a href="http://en.wikipedia.org/wiki/MD5"&gt;MD5&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/SHA-1"&gt;SHA-1&lt;/a&gt;, and &lt;a href="http://en.wikipedia.org/wiki/SHA-2"&gt;SHA-2&lt;/a&gt; which are cryptographic hash functions. On client side, you can encrypt your client's password then send it to the server to validate. On server side, passwords must be stored in your database &amp;nbsp;by using cryptographic hash functions to match two encrypted strings; one of them sent by client and another stored on database. Because, when it's encrypted by&amp;nbsp;cryptographic hash functions&amp;nbsp;it cannot be decrypted into the original string. This solution is called one-way encryption.&lt;br /&gt;&lt;br /&gt;As I said, this doesn't provide&amp;nbsp;comprehensive safe environment. But it protects password in plain text to be seen by watchers who listen your client's network.&lt;br /&gt;&lt;br /&gt;Here you can find open source project written in javascript to encrypt plain text by using&amp;nbsp;cryptographic hash functions.&lt;br /&gt;&lt;a href="http://code.google.com/p/crypto-js/"&gt;http://code.google.com/p/crypto-js/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-3275159073334508133?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/3275159073334508133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=3275159073334508133' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3275159073334508133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3275159073334508133'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2012/01/client-side-encryption-techniques.html' title='Client Side Encryption Techniques'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-t9bPAti5ebU/TxSv9_LE7qI/AAAAAAAAAf8/YU5SVjgNicg/s72-c/client-side-encryption.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-968332780829141860</id><published>2012-01-05T22:51:00.000+01:00</published><updated>2012-01-05T22:51:09.696+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='architecture governance framework'/><category scheme='http://www.blogger.com/atom/ns#' term='architecture governance'/><category scheme='http://www.blogger.com/atom/ns#' term='togaf'/><category scheme='http://www.blogger.com/atom/ns#' term='architecture board'/><category scheme='http://www.blogger.com/atom/ns#' term='architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='enterprise architecture'/><title type='text'>TOGAF Architecture Governance</title><content type='html'>Architecture Governance is scrutiny and crucial activity to have successful implementation in any organization. In TOGAF, Architecture Governance is executed in Phase G- Implementation Governance. By applying Architecture Governance you can cover the management and control of all aspects of the development and evolution architectures. Governance is essentially about ensuring that business is conducted properly. It's about guidance and effective and equitable usage of resources to ensure sustainability of an organization's strategic objectives.&amp;nbsp;If your organization is not large you don't have to apply all Architecture Governance Framework and methodologies.&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div&gt;Architecture Governance can include the following as distinct domains with their own disciplines and processes:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Corporate Governance&lt;/li&gt;&lt;li&gt;Technology Governance&lt;/li&gt;&lt;li&gt;IT Governance&lt;/li&gt;&lt;li&gt;Architecture Governance&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Remember that each of these domains may exist at multiple geographic levels which are global, regional and local.&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Architecture Board&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Architecture Boards is the main point for successful architecture governance. Architecture Board should represent the key stakeholders and contains of a group of executives who are responsible for the review of the architecture. &amp;nbsp;Architecture Board is the sponsor of the architecture within the enterprise but Architecture Board needs support from executive levels. In most organizations, CIO is the first person who is in the Architecture Board. As an Enterprise Architecture, you shouldn't overlook company's board of directors. They are responsible for and have significant impact on the business vision, objectives and strategies. Because, nowadays, IT is the core of any business and shouldn't be thought without another.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What about the size of Architecture Board&lt;/b&gt;&lt;br /&gt;According to TOGAF, Architecture Board includes four or five permanent members. I wrote permanent members because sometimes they might not find enough time to attend the architecture review meeting or review the ongoing architecture. In order to keep architecture governance running you are able to find a way how to rotate the members of Architecture Board to senior managers.&amp;nbsp;After the work of Architecture Board is reviewed by executive sponsors, remember to update the Architecture Compliance review process.&lt;br /&gt;&lt;br /&gt;If the organization is large Architecture Board can be separated into three levels :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Local&lt;/li&gt;&lt;li&gt;Regional&lt;/li&gt;&lt;li&gt;Global&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Each board should be identified with responsibilities, decision making capabilities and authority limits.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;When do you need to set up the Architecture Board?&lt;/b&gt;&lt;br /&gt;According to TOGAF there are a few reason to establish the Architecture Board :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If organization employees a new CIO&lt;/li&gt;&lt;li&gt;If your company is being merged or acquire a company&lt;/li&gt;&lt;li&gt;If your organization decides to change current forms of computing&amp;nbsp;&lt;/li&gt;&lt;li&gt;If IT doesn't fulfill or meet business needs&lt;/li&gt;&lt;li&gt;If your organization decides to apply a new enterprise architecture program&lt;/li&gt;&lt;li&gt;If your organization's business changes significantly or business&amp;nbsp;grows&amp;nbsp;rapidly&lt;/li&gt;&lt;li&gt;Requirements for complex, cross-functional solutions&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;In which ADM phase do you set up the Architecture Board?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Architecture Board should be defined at the beginning of the enterprise architecture. In TOGAF, this is preliminary phase. In preliminary phase, as an enterprise architect you should specify Architecture Board with support framework to provide business process and architecture governance through enterprise architecture.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;What are the expectations from Architecture Board?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;In TOGAF Architecture Framework, the responsibilities of Architecture Board have to be achieved are written below:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Consistency between sub-architectures&lt;/li&gt;&lt;li&gt;Identifying re-usable components&lt;/li&gt;&lt;li&gt;Flexibility of enterprise architecture&lt;/li&gt;&lt;ul&gt;&lt;li&gt;to meet changing business needs&lt;/li&gt;&lt;li&gt;to leverage new technologies&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Enforcement of Architecture Compliance&lt;/li&gt;&lt;li&gt;Improving the maturity levels of architecture&lt;/li&gt;&lt;li&gt;Ensuring that the discipline of architecture-based development is adopted&lt;/li&gt;&lt;li&gt;Providing the basis for all decision-making with regard to changes to the architectures&lt;/li&gt;&lt;li&gt;Supporting a visible escalation capability for out-of bounds decisions&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Further responsibilities from an operational perspective should include:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;All aspects of monitoring and control of the Architecture Contract&lt;/li&gt;&lt;li&gt;Meeting on a regular basis&amp;nbsp;&lt;/li&gt;&lt;li&gt;Ensuring the effective and consistent management and implementation of the architectures&lt;/li&gt;&lt;li&gt;Resolving ambiguities, issues, or conflicts that have been escalated&lt;/li&gt;&lt;li&gt;Providing advice, guidance, and information&lt;/li&gt;&lt;li&gt;Ensuring compliance with the architectures, and granting dispensations that are in keeping with the technology strategy and objectives&lt;/li&gt;&lt;li&gt;Considering policy (schedule, Service Level Agreements (SLA), etc.) changes where similar dispensations are requested and granted; new form of service requirement&lt;/li&gt;&lt;li&gt;Ensuring that all information relevant to the implementation of the Architecture Contract is published under controlled conditions and made available to authorized parties&lt;/li&gt;&lt;li&gt;Validation of reported service levels, cost savings, etc.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;From a governance perspective, the Architecture Board is also responsible for:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The production of usable governance material and activities&lt;/li&gt;&lt;li&gt;Providing a mechanism for the formal acceptance and approval of architecture through consensus and authorized publication&lt;/li&gt;&lt;li&gt;Providing a fundamental control mechanism for ensuring the effective implementation of the architecture&lt;/li&gt;&lt;li&gt;Establishing and maintaining the link between the implementation of the architecture, the architectural strategy and objectives embodied in the enterprise architecture, and the strategic objectives of the business&lt;/li&gt;&lt;li&gt;Identifying divergence from the architecture and planning activities for realignment through dispensations or policy updates&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;Architecture Governance Framework&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Architecture Governance needs to be supported by an Architecture Framework. In TOGAF, Architecture Framework has 2 sections which are &lt;b&gt;Conceptual Structure&lt;/b&gt; and &lt;b&gt;Organizational Structure.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Conceptual&amp;nbsp;Structure : &lt;/b&gt;Context, Process and Content are fundamental to the support of the architecture governance initiative. It's possible to add new governance material without&amp;nbsp;excessively impacting the processes. As you see the figure below, Architecture Governance Framework is part of Enterprise Continuum. While executing the processes you can use different type of content. This gives you flexibility to implement proven methods.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/50_concepts.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="303" src="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/50_concepts.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Conceptual Structure&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;u&gt;Policy Management and take-on&lt;/u&gt;: In this process all kind of documents, contracts and supporting information are collected to ensure that they are managed and audited.&lt;/li&gt;&lt;li&gt;&lt;u&gt;Compliance&lt;/u&gt;: SLAs, OLAs, standards and regulatory requirements will be implemented on an ongoing basis to be sure stability, conformance, and performance monitoring.&lt;/li&gt;&lt;li&gt;&lt;u&gt;Dispensation&lt;/u&gt;: It's always possible that a compliance assessment might be rejected. If it happens there is an alternate route is provided through dispensations. Time which is not indefinite is given to set of identified service and operational criteria to meet service and operational levels.&lt;/li&gt;&lt;li&gt;&lt;u&gt;Monitoring and Reporting&lt;/u&gt;: It's required to ensure that operational and service components are managed against an agreed set of criteria.&lt;/li&gt;&lt;li&gt;&lt;u&gt;Business Control&lt;/u&gt;: It's used to make certain compliance with the organization's business policies.&lt;/li&gt;&lt;li&gt;&lt;u&gt;Environment Management&lt;/u&gt;: In order to make sure that repository-based environment supports architecture governance framework effectively.&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;&lt;br /&gt;Organizational Structure : &lt;/b&gt;Architecture Governance is the approach to ensure enterprise architectures and &amp;nbsp;any other architectures are managed. In order to do that it's necessary to have the proper organizational structure. In the figure below, you can see main part of the organizational structure elements.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/50_org.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="322" src="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/50_org.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Organizational Structure&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;There are three main areas of architecture management.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Develop&lt;/li&gt;&lt;li&gt;Implement&lt;/li&gt;&lt;li&gt;Deploy&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;One or more groups in organization is responsible for each main area. As you see the below of the Organizational Structure figure, Enterprise Continuum support all major areas with artifacts.&lt;/div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Architecture Compliance&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Essential point of view of Architecture Governance is to ensure each project in organization is finished in compliance with architecture contracts. In term of TOGAF it's called Architecture Compliance. Terminology usage in TOGAF about Architecture Compliance is explained below:&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/48_conformance.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/48_conformance.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Levels of Architecture Compliance&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;Architecture Compliance Review Process&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;Architecture Compliance Review is needed to understand the level of Architecture Compliance. As follows, Architecture Compliance Review Process is explained by TOGAF. The main purpose of the process is to create an assessment report of the architecture. In this process, people in organization collaborates to produce assessment report which is prominent to review and define the level of architecture compliance. The report shows that how the architecture is implemented to address the business requirements. The level of architecture compliance is explained in TOGAF. You are free to customize it in accordance with your organization.&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/48_review.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="334" src="http://pubs.opengroup.org/architecture/togaf9-doc/arch/Figures/48_review.png" width="640" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Architecture Compliance Review Process&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Below, you can find 12 steps of Architecture Compliance Review Process and the roles which takes responsibility in each step.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Request Architecture Review: Anyone with an interest in or responsibility for the business area.&lt;/li&gt;&lt;li&gt;Identify responsible part of organization and project principals: Architecture review coordinator&lt;/li&gt;&lt;li&gt;Identify lead enterprise architect and other architects: Architecture review coordinator&lt;/li&gt;&lt;li&gt;Determine scope of review:Architecture review coordinator&lt;/li&gt;&lt;li&gt;Tailor checklists:Lead Enterprise Architect&lt;/li&gt;&lt;li&gt;Schedule architecture review meeting:Architecture review coordinator with collaboration of lead enterprise architect.&lt;/li&gt;&lt;li&gt;Interview project principles:Lead enterprise architect and/or architect, project leader, and customers&lt;/li&gt;&lt;li&gt;Analyzed completed checklists:Lead enterprise architect&lt;/li&gt;&lt;li&gt;Prepare architecture compliance review report: Lead enterprise architect&lt;/li&gt;&lt;li&gt;Present review findings: Lead enterprise architect&lt;/li&gt;&lt;li&gt;Accept review and sign-off: Architecture board and customer&lt;/li&gt;&lt;li&gt;Send assessment report/summary to architecture review coordinator: Lead enterprise architect&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;b&gt;What are the Roles in Architecture Compliance Review Process?&lt;/b&gt;&lt;br /&gt;Above, there are a few roles mentioned in Architecture Compliance Review Process. You can find the responsibilities of each roles as listed below:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Architecture Board&lt;/b&gt;: To ensure that IT architectures are consistent and support overall business needs.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Project Leader&lt;/b&gt;: Responsible for the whole project&lt;/li&gt;&lt;li&gt;&lt;b&gt;Architecture Review coordinator&lt;/b&gt;&amp;nbsp;: To administer the whole architecture development and review process&lt;/li&gt;&lt;li&gt;&lt;b&gt;Lead Enterprise Architect&lt;/b&gt;: To ensure that the architecture is technically coherent and future-proof.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Architect&lt;/b&gt;: One of the Lead Enterprise Architect's technical assistant.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Customer&lt;/b&gt;: To ensure that business requirements are clearly expressed and understood.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Business Domain &amp;nbsp;Expert&lt;/b&gt;: To ensure that the process to satisfy the business requirements are justified and understood.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Project Principals&lt;/b&gt;: To ensure that the architects have a sufficiently detailed understanding of the customer department's processes. They can provide input to the business domain expert or to the architects.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-968332780829141860?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/968332780829141860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=968332780829141860' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/968332780829141860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/968332780829141860'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/12/togaf-architecture-governance.html' title='TOGAF Architecture Governance'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-3608988779435889909</id><published>2011-12-28T11:23:00.000+01:00</published><updated>2011-12-28T11:23:47.008+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='async'/><category scheme='http://www.blogger.com/atom/ns#' term='paging'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Async Paging Plug-in by Javascript</title><content type='html'>In our project, I created a &amp;nbsp;web control to handle paging on server side. In server side code, data is retrieved from a datasource (it might be database) then generate valid HTML output and write into a web page. But what if you need to call &amp;nbsp;server side code&amp;nbsp;asynchronously&amp;nbsp;to retrieve data by javascript. You have to deal with paging by using client side code which is javascript.&lt;br /&gt;&lt;br /&gt;After that, I decided to create nice and easy use client-side HTML control to manage paging by only pure javascript without jQuery. This doesn't mean I don't like jQuery. I'm using it a lot. But for this plug-in jQuery is not needed.&lt;br /&gt;&lt;br /&gt;When you use Aysnc Paging control you'll see that data type is not important. It might be JSON, XML or simple Array. &lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-DbK2Q9i-_yE/TvrYo9NUxnI/AAAAAAAAAek/fATGkeP2cmU/s1600/asynpaging-screenshot.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="228" src="http://1.bp.blogspot.com/-DbK2Q9i-_yE/TvrYo9NUxnI/AAAAAAAAAek/fATGkeP2cmU/s320/asynpaging-screenshot.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;First and foremost I thought implementing Async Paging plug-in and modifying its layout must be easy for developers. The only thing you have to do is initializing some values such as records count, an HTML element id where you want to generate and display it. As follows, you can find the code excerpt about how to initialize Async Paging Plug-in.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;asyncPaging.init("paging", &lt;span style="color: #38761d;"&gt;// element id where paging is drawn&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;data.length, &lt;span style="color: #38761d;"&gt;// total record&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;10, &lt;span style="color: #38761d;"&gt;// represents how many items are displayed in each list&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;1); &lt;span style="color: #38761d;"&gt;// current page number&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.technolatte.net/AsyncPaging/Demo/index.htm"&gt;For Demo&lt;/a&gt;&lt;br /&gt;&lt;a href="http://code.technolatte.net/AsyncPaging/default.htm"&gt;For Implementation&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-3608988779435889909?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/3608988779435889909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=3608988779435889909' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3608988779435889909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3608988779435889909'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/12/async-paging-plug-in-by-javascript.html' title='Async Paging Plug-in by Javascript'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-DbK2Q9i-_yE/TvrYo9NUxnI/AAAAAAAAAek/fATGkeP2cmU/s72-c/asynpaging-screenshot.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-428018895037385051</id><published>2011-12-05T11:47:00.001+01:00</published><updated>2011-12-05T12:07:53.467+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='open group'/><category scheme='http://www.blogger.com/atom/ns#' term='togaf 9.1'/><category scheme='http://www.blogger.com/atom/ns#' term='togaf'/><category scheme='http://www.blogger.com/atom/ns#' term='enterprise architect'/><title type='text'>What's new in TOGAF 9.1?</title><content type='html'>&lt;a href="http://pubs.opengroup.org/architecture/togaf9-doc/arch/index.html"&gt;TOGAF version 9.1&lt;/a&gt; was released in the beginning of&amp;nbsp;December. In this version, there are some changes which are clarifications, consistency and some additional details in some chapter where needed. Here you can find the some changes I found it important:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The Document Categorization Model has been removed&lt;/li&gt;&lt;li&gt;The usage &amp;nbsp;of the terms &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;application &lt;/span&gt;versus &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;system &lt;/span&gt;have been reviewed and made consistent.&lt;/li&gt;&lt;li&gt;The objectives sections of the ADM phases have been reworked and remove &amp;nbsp;techniques and list of steps to emphasize actual objectives.&lt;/li&gt;&lt;li&gt;The artifacts which can be used in each ADM phases were added at the end of ADM phases. But in Part IV, chapter 35, Architectural Artifacts remained.&lt;/li&gt;&lt;li&gt;The Phase E and F descriptions have been reworked to match the level of detail in other ADM phases.&lt;/li&gt;&lt;li&gt;The uses of terminology for Transition Architecture / Roadmap / Implementation Strategy have been clarified and made consistent.&lt;/li&gt;&lt;li&gt;The description of Architecture Principles now divides into two types only - Enterprise and Architecture - whereas before they called out IT Principles separately. IT principles are now seen as just part of Enterprise Architecture.&lt;/li&gt;&lt;li&gt;Corrections have been made to metamodel diagrams and applied to aspects of the metamodel.&lt;/li&gt;&lt;li&gt;The terms &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;artifacts &lt;/span&gt;versus &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;viewpoint &lt;/span&gt;have been clarified and made consistent.&lt;/li&gt;&lt;li&gt;Some of the artifacts have been renamed to better reflect usage:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;System/Data matrix becomes Application/Data matrix&amp;nbsp;&lt;/li&gt;&lt;li&gt;Class diagram has been replaced with Conceptual Data diagram and Logical Data&amp;nbsp;diagram&amp;nbsp;&lt;/li&gt;&lt;li&gt;System/Organization matrix becomes Application/Organization matrix&lt;/li&gt;&lt;li&gt;Role/System matrix becomes Role/Application matrix&amp;nbsp;&lt;/li&gt;&lt;li&gt;System/Function matrix becomes Application/Function matrix&lt;/li&gt;&lt;li&gt;Process/System Realization diagram becomes Process/Application Realization diagram&amp;nbsp;&lt;/li&gt;&lt;li&gt;System Use-Case diagram becomes Application Use-Case diagram&amp;nbsp;&lt;/li&gt;&lt;li&gt;System/Technology matrix becomes Application/Technology matrix&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;The relationship of the Enterprise Repository to the Architecture Repository is clarified in Part&amp;nbsp;V, Chapter 41&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;For more information about changes I recommend to read whole official document written by Open Group.&lt;/div&gt;&lt;div&gt;&lt;a href="http://pubs.opengroup.org/architecture/togaf9-doc/arch/chap04.html"&gt;http://pubs.opengroup.org/architecture/togaf9-doc/arch/chap04.html&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-428018895037385051?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/428018895037385051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=428018895037385051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/428018895037385051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/428018895037385051'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/12/whats-new-in-togaf-91.html' title='What&apos;s new in TOGAF 9.1?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4950987277152793599</id><published>2011-10-27T13:58:00.000+02:00</published><updated>2011-10-27T13:58:14.072+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='exception'/><category scheme='http://www.blogger.com/atom/ns#' term='try-catch'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='return value'/><title type='text'>Guideline for Returning Value From a Method</title><content type='html'>There are two different scenarios when you return an object from &amp;nbsp;a method. If everything goes well, you get what you expect.&amp;nbsp;If not, in my opinion, there are 3 different approaches:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Return null&lt;/li&gt;&lt;li&gt;Return concrete object with default properties&lt;/li&gt;&lt;li&gt;Throw a &lt;span class="Apple-style-span" style="background-color: #f4cccc;"&gt;&lt;span class="Apple-style-span"&gt;meaningful&lt;/span&gt; &lt;/span&gt;exception&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;For example. You have product id to be passed to a method (&lt;i&gt;GetById&lt;/i&gt;) to retrieve concrete Product object.&amp;nbsp;If Product is found on your database-resource, &lt;i&gt;GetById()&lt;/i&gt; returns a Product object which is not null. This is best case scenario.&lt;br /&gt;&lt;br /&gt;What if Product is not found or parameters are wrong, what should &lt;i&gt;GetById()&lt;/i&gt; method return? &lt;b&gt;null &lt;/b&gt;or concrete &lt;b&gt;Product object whose properties have default value&amp;nbsp;&lt;/b&gt;or a &lt;b&gt;meaningful exception&lt;/b&gt;. Let's see all 3 approaches' advantages and disadvantages.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Bz2ngs7FaaI/Tqk_rzjul8I/AAAAAAAAAb4/xYSAMDbOQQ8/s1600/returnvaluefrommethod.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="254" src="http://4.bp.blogspot.com/-Bz2ngs7FaaI/Tqk_rzjul8I/AAAAAAAAAb4/xYSAMDbOQQ8/s320/returnvaluefrommethod.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Returning null&lt;/b&gt;&lt;br /&gt;When I asked my colleagues and my friends, most of all they prefer this approach, returning null. But I have concerns about it.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Disadvantages&lt;/u&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Everywhere on your code you have to check whether returning object is null.&amp;nbsp;&lt;/li&gt;&lt;li&gt;It's always possible to forget to check if object is null. It causes runtime error.&lt;/li&gt;&lt;li&gt;Code file might be full of if statements. It makes code unreadable and dirty.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Returning concrete object which is not null but whose properties have default value&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Disadvantages:&lt;/u&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You're always doubt about to know if record is really found on database-resource.&lt;/li&gt;&lt;li&gt;You may miss a serious problem.&lt;/li&gt;&lt;li&gt;You might need to check unique id of the concrete object (for instance product id) to make sure returning value is valid. However it's useless. Every object doesn't need to have unique id. Beside that, it's as same solution as checking null object.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Throw a meaningful exception&lt;/b&gt;&lt;br /&gt;Throwing a meaningful exception is my&amp;nbsp;favorite&amp;nbsp;solution. By applying this practice, you eliminate all disadvantages above.&amp;nbsp;But it comes with its own disadvantages which are manageble.&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&lt;u&gt;Advantages :&lt;/u&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You can exactly know what the problem is.&lt;/li&gt;&lt;li&gt;You don't have to return an magic number to identify the result. Such as, 1 is ok, 2 is parameters are missing, 3 is object not found.&lt;/li&gt;&lt;li&gt;You don't have to check if object is null. Throw the exception to up-level. Your try-catch block on up-level decides how to react.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;u&gt;Disadvantages :&lt;/u&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You need to manage exceptions properly. Some exceptions doesn't need to be logged or shown to end user.&lt;/li&gt;&lt;li&gt;You might need to have custom exception classes to identify exact problem. For instance, instead of throwing object is null exception, &amp;nbsp;you might need to use &lt;span class="Apple-style-span" style="background-color: #f4cccc;"&gt;ProductNotFound &lt;/span&gt;exception class.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;Sample Code&lt;span class="Apple-style-span" style="font-size: large;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;You can find sample code guideline about returning meaningful value from a method. Please focus on code between row number 29 - 44.&lt;br /&gt;&lt;br /&gt;In Main method I created an int array to test all possibilities. In catch block you can decide what you want. You might need to continue the process or stop to run the code and exit the application or show error message to end user.&lt;br /&gt;&lt;br /&gt;Id = 1; the method returns a Product object which is not null. It's the best case.&lt;br /&gt;Id = 6; the method throws ProductNotFound exception.&lt;br /&gt;Id = -5 and Id = 0; the method throws ArgumentOutOfRangeException.&lt;br /&gt;&lt;br /&gt;As you see the place where I invoke &lt;i&gt;GetById()&lt;/i&gt; method, I don't check whether object is null. All validations and strategies are handled in &lt;i&gt;GetById()&lt;/i&gt; method which is in business layer.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ProductRepository&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; List&amp;lt;Product&amp;gt; Products;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ProductRepository()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        Products = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Product&amp;gt; {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;            &lt;span class="kwrd"&gt;new&lt;/span&gt; Product { Id = 1, Name = &lt;span class="str"&gt;"harddisk"&lt;/span&gt; },&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;            &lt;span class="kwrd"&gt;new&lt;/span&gt; Product { Id = 2, Name = &lt;span class="str"&gt;"mouse"&lt;/span&gt; },&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;            &lt;span class="kwrd"&gt;new&lt;/span&gt; Product { Id = 3, Name = &lt;span class="str"&gt;"keyboard"&lt;/span&gt; },&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;            &lt;span class="kwrd"&gt;new&lt;/span&gt; Product { Id = 4, Name= &lt;span class="str"&gt;"speaker"&lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        };&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; Product GetById(&lt;span class="kwrd"&gt;int&lt;/span&gt; id)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; Products.SingleOrDefault(x =&amp;gt; x.Id == id);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ProductManager&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; ProductRepository repository;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ProductManager() &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        repository = &lt;span class="kwrd"&gt;new&lt;/span&gt; ProductRepository();    &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; Product GetById(&lt;span class="kwrd"&gt;int&lt;/span&gt; id)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        &lt;span class="rem"&gt;// validate input&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (id &amp;lt; 1)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ArgumentOutOfRangeException(&lt;span class="str"&gt;"id="&lt;/span&gt; + id);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;        &lt;span class="rem"&gt;// run exact code&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        Product result = repository.GetById(id);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        &lt;span class="rem"&gt;// validate result&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (result == &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ProductNotFound(&lt;span class="str"&gt;"id="&lt;/span&gt;+id+&lt;span class="str"&gt;" not found"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; result;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ProductNotFound : Exception &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; customMessage;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ProductNotFound(&lt;span class="kwrd"&gt;string&lt;/span&gt; message) &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;        customMessage = message;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ProductNotFound() { }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Message&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;        get&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;base&lt;/span&gt;.Message + &lt;span class="str"&gt;" "&lt;/span&gt; + customMessage;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Product&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt;[] ids = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;[] { 1, 6, -5, 0 };&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; errorCount = 0;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;        ProductManager manager = &lt;span class="kwrd"&gt;new&lt;/span&gt; ProductManager();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; item &lt;span class="kwrd"&gt;in&lt;/span&gt; ids)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;        {    &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;            &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;                Product product = manager.GetById(item);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;            &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;                errorCount++;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;                Console.WriteLine(ex.Message);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  91:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  92:  &lt;/span&gt;        Console.WriteLine(&lt;span class="str"&gt;"Error Count : "&lt;/span&gt; + errorCount);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  93:  &lt;/span&gt;        Console.Read();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  94:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  95:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4950987277152793599?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4950987277152793599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4950987277152793599' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4950987277152793599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4950987277152793599'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/10/guideline-for-returning-value-from.html' title='Guideline for Returning Value From a Method'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-Bz2ngs7FaaI/Tqk_rzjul8I/AAAAAAAAAb4/xYSAMDbOQQ8/s72-c/returnvaluefrommethod.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2240494410693562927</id><published>2011-10-14T14:55:00.001+02:00</published><updated>2011-10-14T15:02:36.368+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='visualsvn server'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><category scheme='http://www.blogger.com/atom/ns#' term='source control'/><title type='text'>Using Subversion on Windows Server via HTTP</title><content type='html'>On my&lt;a href="http://www.technolatte.net/2011/09/simple-backup-tool.html"&gt; previous post&lt;/a&gt;, I mentioned about &amp;nbsp;our new development server which is hosted on windows server 2003 and serves via http. For our development environment subversion was chosen as a source control tool. Although our products mostly depends on microsoft platform and technologies, we didn't choose visual source safe. Actually, we've been using subversion as a source control tool on our local network. We were able to access the source by using standard file access protocol on windows OS environment.&lt;br /&gt;&lt;br /&gt;I've never experienced in installing and configuring subversion by using http protocol on windows server. While I was browsing I came across &lt;a href="http://www.visualsvn.com/server/licensing/"&gt;VisualSVN Server&lt;/a&gt;&amp;nbsp;whose standard edition is free. So I thought it's worth to try it. It's really easy installation process than I expected.&lt;br /&gt;&lt;br /&gt;I'll explain my experience while installing and configuring new source control which is http-based subversion server.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Installation&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Repositories : &lt;/b&gt;This is used to define the place where your source code is stored.&lt;br /&gt;&lt;b&gt;Server Port : &lt;/b&gt;It specified the TCP/IP port which will be used by VisualSVN Server. Please make sure that port number shouldn't be used by any other application. If your port number you selected is used by any application, you can type different port number. Because of that we use teamviewer whose default port is 80, we needed to select different port number.&lt;br /&gt;&lt;b&gt;Authentication: &lt;/b&gt;In our case, we choose &lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;Subversion Authentication&lt;/span&gt;. So we created new accounts in Subversion and assign them to the projects in repositories. I explain how you can manage authentication on this post below.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-brvNTXWa6mA/TpglTyZkbyI/AAAAAAAAAbc/Zef1gS7Cd7E/s1600/server-config-screen.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="246" src="http://4.bp.blogspot.com/-brvNTXWa6mA/TpglTyZkbyI/AAAAAAAAAbc/Zef1gS7Cd7E/s320/server-config-screen.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;After filling in all settings you can click Next and then wait for installation result.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Now it's time to create new repositories.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Repository Layout&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I chose the layout recommended by&lt;a href="http://www.visualsvn.com/support/topic/00017/"&gt; VisualSVN Server&lt;/a&gt;. In this layout, Repository contains project that contains three main folders which are :&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;branches &lt;/b&gt;: it's temp folder to contain copy of trunk folder in order to test some functionalities of the project. It's like&amp;nbsp;laboratory.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;tags &lt;/b&gt;: it's used to store versions of officially deliverable applications.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;trunk &lt;/b&gt;: it includes main development branch.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;If you need more different strategies about repository layout &amp;nbsp;I recommend the link below:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://www.visualsvn.com/support/svnbook/reposadmin/planning/"&gt;http://www.visualsvn.com/support/svnbook/reposadmin/planning/&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-jx8UD1789P0/Tpgs12aOtxI/AAAAAAAAAbk/dynVmdkpEBk/s1600/repository_layout.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-jx8UD1789P0/Tpgs12aOtxI/AAAAAAAAAbk/dynVmdkpEBk/s1600/repository_layout.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Screenshot above shows an example of a repository layout.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;i&gt;main &lt;/i&gt;and &lt;i&gt;sandbox &lt;/i&gt;are repositories while &lt;i&gt;application1&lt;/i&gt;, &lt;i&gt;application2&lt;/i&gt;, &lt;i&gt;library1&lt;/i&gt;, &lt;i&gt;library2 &lt;/i&gt;represent projects.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;VisualSVN Server Authorization&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Creating users and assigning them to projects is really easy. Beside that you can create a group then put users inside the group. Finally you can assign group to a project. You are able to define read/write permission for each user or group.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;To know more and detailed information about authorization you can visit the page written below :&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://www.visualsvn.com/support/topic/00033/"&gt;http://www.visualsvn.com/support/topic/00033/&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;If you did everything properly, you can reach your source control via http-based subversion server.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="background-color: #6fa8dc;"&gt;http://dev.example.com:{port number}/svn/{your respository}&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2240494410693562927?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2240494410693562927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2240494410693562927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2240494410693562927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2240494410693562927'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/10/using-subversion-on-windows-server-via.html' title='Using Subversion on Windows Server via HTTP'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-brvNTXWa6mA/TpglTyZkbyI/AAAAAAAAAbc/Zef1gS7Cd7E/s72-c/server-config-screen.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4251200539073481149</id><published>2011-09-07T22:01:00.000+02:00</published><updated>2011-09-07T22:07:06.518+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FTP'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='Backup tool'/><title type='text'>Simple Backup Tool</title><content type='html'>Because of that we separated our development server and put it to another network, we needed to apply different backup solutions. Before that, I used &lt;a href="http://en.wikipedia.org/wiki/XCOPY"&gt;xcopy &lt;/a&gt;to move all folders to another server in same network environment for backup daily. It worked perfectly. But we had to find a solution to &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;compress &lt;/span&gt;all source and &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;upload &lt;/span&gt;them to another server via &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;FTP&lt;/span&gt;. This should be &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;automated&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Needles to say how backup solution is important. Just read the&amp;nbsp;cartoon below.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-agKX7lMToSY/TmfKUfmUoGI/AAAAAAAAAbQ/bVXAMtOnn0U/s1600/back_up_plan_panhandlers_671605.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-agKX7lMToSY/TmfKUfmUoGI/AAAAAAAAAbQ/bVXAMtOnn0U/s1600/back_up_plan_panhandlers_671605.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I decided to develop a simple console application tool called &lt;b&gt;&lt;a href="http://code.technolatte.net/SimpleBackup/default.htm"&gt;Simple Backup&lt;/a&gt;&lt;/b&gt; &amp;nbsp;to compress folders I need to backup and upload them to another server via &lt;a href="http://en.wikipedia.org/wiki/File_Transfer_Protocol"&gt;FTP&lt;/a&gt;. With this tool I'm able to set &lt;span class="Apple-style-span" style="background-color: #9fc5e8;"&gt;password &lt;/span&gt;to folders which are compressed. The only thing I have to do to &lt;span class="Apple-style-span" style="background-color: #9fc5e8;"&gt;set some configurations and define folders&lt;/span&gt; to be compressed and uploaded. That's the way I called it &lt;b&gt;&lt;a href="http://code.technolatte.net/SimpleBackup/default.htm"&gt;Simple Backup&lt;/a&gt;&lt;/b&gt; tool which was built by using &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=21"&gt;.NET Framework 3.5&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In order to use &lt;b&gt;&lt;a href="http://code.technolatte.net/SimpleBackup/default.htm"&gt;Simple Backup&lt;/a&gt;&lt;/b&gt; tool you need &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=21"&gt;.NET Framework 3.5&lt;/a&gt; or &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=17718"&gt;higher &lt;/a&gt;installed in your pc or server&lt;br /&gt;&lt;br /&gt;Please &lt;a href="http://code.technolatte.net/SimpleBackup/default.htm"&gt;click &lt;/a&gt;to read how to use &lt;b&gt;&lt;a href="http://code.technolatte.net/SimpleBackup/default.htm"&gt;Simple Backup&lt;/a&gt; &lt;/b&gt;tool and implement to your solutions.&lt;br /&gt;&lt;br /&gt;You can &lt;a href="http://code.technolatte.net/SimpleBackup/SimpleBackup-1.0.rar"&gt;download &lt;/a&gt;&lt;a href="http://code.technolatte.net/SimpleBackup/default.htm"&gt;&lt;b&gt;Simple Backup&lt;/b&gt;&lt;/a&gt; tool and use it immediately.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4251200539073481149?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4251200539073481149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4251200539073481149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4251200539073481149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4251200539073481149'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/09/simple-backup-tool.html' title='Simple Backup Tool'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-agKX7lMToSY/TmfKUfmUoGI/AAAAAAAAAbQ/bVXAMtOnn0U/s72-c/back_up_plan_panhandlers_671605.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-3488454888307884147</id><published>2011-08-19T17:00:00.000+02:00</published><updated>2011-12-28T14:57:35.014+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Factory Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><title type='text'>Factory Method Design Pattern</title><content type='html'>&lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Factory Method pattern deals with the problem of creating objects. In this pattern, there are subclasses which are responsible for deciding which class to instantiate.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I will explain a few terms,&amp;nbsp;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;cited from&amp;nbsp;&lt;a href="http://www.dofactory.com/Patterns/PatternFactory.aspx"&gt;http://www.dofactory.com/Patterns/PatternFactory.aspx&lt;/a&gt;&lt;/span&gt;&lt;/i&gt;, &amp;nbsp;to conceive the structure easily before digging in the pattern.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;&lt;b&gt;Product&lt;/b&gt; &lt;/span&gt;: defines the interface of objects the factory method creates&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Concrete Product&lt;/span&gt;&lt;/b&gt; : implements the Product interface&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Creator&lt;/span&gt;&lt;/b&gt; : Declares the factory method, which returns an object of type Product. Creator may also define a default implementation of the factory method that returns a default Concrete Product object. It may also call the factory method to create a Product object&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Concrete Creator&lt;/span&gt;&lt;/b&gt; : overrides the factory method to return an instance of a concrete product.&lt;br /&gt;&lt;br /&gt;There are some reasons to choose Factory Method :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If developer doesn't know which classes should be instantiated before execute business logic purpose.&lt;/li&gt;&lt;li&gt;If class constructor has complex statements.&lt;/li&gt;&lt;li&gt;You can apply dependency injection by using Factory Method pattern.&amp;nbsp;&lt;/li&gt;&lt;li&gt;It helps to build Test Driven Design.&lt;/li&gt;&lt;li&gt;You can easily prevent to misuse "Concrete" classes.&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-qoXzELhq4tE/Tk5fKpCSi8I/AAAAAAAAAao/ZfwYjELT_mM/s1600/factorymethoddesignpattern.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-qoXzELhq4tE/Tk5fKpCSi8I/AAAAAAAAAao/ZfwYjELT_mM/s1600/factorymethoddesignpattern.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To show an example of Factory Method Pattern I used &lt;span style="color: #990000;"&gt;Database &lt;/span&gt;product which was implemented by &lt;span style="color: #990000;"&gt;MSSQL &lt;/span&gt;concrete product and &lt;span style="color: #990000;"&gt;Oracle &lt;/span&gt;concrete product. &lt;span style="color: #990000;"&gt;DatabaseFactory &lt;/span&gt;creator is responsible for return an object of &lt;span style="color: #990000;"&gt;Database &lt;/span&gt;product. In addition, &lt;span style="color: #990000;"&gt;MSSQLDatabaseFactory &lt;/span&gt;and &amp;nbsp;&lt;span style="color: #990000;"&gt;OracleDatabaseFactory &lt;/span&gt;override factory method ,in this example&lt;span style="color: #e69138;"&gt; Create()&lt;/span&gt; method, and return an instance of&lt;span class="Apple-style-span" style="color: #0b5394;"&gt; &lt;/span&gt;&lt;span style="color: #990000;"&gt;MSSQL &lt;/span&gt;or &lt;span style="color: #990000;"&gt;Oracle &lt;/span&gt;concrete product.&lt;br /&gt;&lt;br /&gt;Lets look at the example below :&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="rem"&gt;// product&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Database&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OpenConnection();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="rem"&gt;// concrete product&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;internal&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MSSQL : Database&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; MSSQL() { }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; MSSQL Create() { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; MSSQL(); }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OpenConnection()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        Console.WriteLine(&lt;span class="str"&gt;"MSSQL Database connection is ready"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&lt;span class="rem"&gt;// concrete product&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&lt;span class="kwrd"&gt;internal&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Oracle : Database&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; Oracle() { }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Oracle Create() { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Oracle(); }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OpenConnection()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        Console.WriteLine(&lt;span class="str"&gt;"Oracle Database connection is ready"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&lt;span class="rem"&gt;// creator&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DatabaseFactory&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Run()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        Database database = Create();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        database.OpenConnection();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; Database Create();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;&lt;span class="rem"&gt;// concrete factory&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MSSQLDatabaseFactory : DatabaseFactory&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; Database Create()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; MSSQL.Create();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;&lt;span class="rem"&gt;// concrete factory&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; OracleDatabaseFactory : DatabaseFactory&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; Database Create()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; Oracle.Create();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;/pre&gt;&lt;/div&gt;&lt;b&gt;at line 8,20 :&lt;/b&gt; Classes are marked as &lt;b&gt;&lt;span class="Apple-style-span" style="color: #b45f06;"&gt;internal&lt;/span&gt;&lt;/b&gt; to prevent using outside of same assembly. So that client is not able to use c&lt;u&gt;oncrete product&lt;/u&gt;. It's not required for Factory Method Pattern. But it's worth to encapsulate and hinder improper use. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;at line 10, 22 :&lt;/b&gt; &lt;u&gt;Constructors have private access specify&lt;/u&gt; in order to not allow instantiate concrete products by using new keyword. Instead, there are public static method called &lt;span class="Apple-style-span" style="color: #741b47;"&gt;Create()&lt;/span&gt; which returns concrete product.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;at line 46,55 :&lt;/b&gt; &lt;span style="color: #e69138;"&gt;Create()&lt;/span&gt; abstract method of &lt;span class="Apple-style-span" style="background-color: white; color: #990000;"&gt;DatabaseFactory &lt;/span&gt;is&amp;nbsp;overridden&amp;nbsp;and implement statements to return concrete product.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;at line 34 :&lt;/b&gt; It has all business logic and perform business logic according to concrete product type. &lt;span style="color: #990000;"&gt;DatabaseFactory &lt;/span&gt;class doesn't know anything about concrete product. So we can easily create an fake object to write unit tests without invoking concrete product. It gives us to apply test driven development and provide dependency injection. &lt;br /&gt;&lt;br /&gt;As you see it's also really easy to expand and add new concrete product for instance &lt;i&gt;MySQL&lt;/i&gt;. You can implement MySQL database provider without modifying Creator (DatabaseFactory) and other Concrete Products (MSSQLDatabase or OracleDatabase). This solution reduces to make mistakes. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Using Factory Method Pattern : &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{   &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    DatabaseFactory factory = &lt;span class="kwrd"&gt;new&lt;/span&gt; MSSQLDatabaseFactory();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    factory.Run();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    factory = &lt;span class="kwrd"&gt;new&lt;/span&gt; OracleDatabaseFactory();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    factory.Run();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    Console.ReadKey();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;at line 3, 6 :&lt;/b&gt; factory object doesn't have any information concrete products. &lt;br /&gt;&lt;b&gt;at line 4,7 :&lt;/b&gt; &lt;span style="color: #e69138;"&gt;Run()&lt;/span&gt; method is invoked to perform database operations.&lt;br /&gt;&lt;br /&gt;If you try to instantiate concrete product, &lt;span style="color: #990000;"&gt;MSSQL &lt;/span&gt;or &lt;span style="color: #990000;"&gt;Oracle&lt;/span&gt;, your project cannot be compiled. Because you don't have access to concrete products which are marked as internal.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;output is : &lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;MSSQL Database connection is ready&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;Oracle Database connection is ready&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-3488454888307884147?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/3488454888307884147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=3488454888307884147' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3488454888307884147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3488454888307884147'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/08/factory-method-design-pattern.html' title='Factory Method Design Pattern'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-qoXzELhq4tE/Tk5fKpCSi8I/AAAAAAAAAao/ZfwYjELT_mM/s72-c/factorymethoddesignpattern.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2486496558889385541</id><published>2011-08-17T22:12:00.002+02:00</published><updated>2011-08-19T15:12:03.260+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Memento Design Pattern'/><title type='text'>Memento Design Pattern</title><content type='html'>Memento design pattern is the one of the behavioral design patterns. &lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;It's used to keep internal state information of an object without violating encapsulation in order to restore the object into initial state when needed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For instance, user changed some information of a product. But user realized that there is some mistake and it's needed to rollback. Previous state of product object should be holded. So that, user can easily restore prior product information.&lt;br /&gt;&lt;br /&gt;In memento design pattern there are 3 elements which are &lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Originator&lt;/span&gt;&lt;/b&gt;, &lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Memento &lt;/span&gt;&lt;/b&gt;and &lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Caretaker &lt;/span&gt;&lt;/b&gt;class. &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Originator &lt;/span&gt;class is the actual class containing some properties; &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Memento &lt;/span&gt;is used to keep values of &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Originator &lt;/span&gt;object; and &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Caretaker &lt;/span&gt;includes &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Memento &lt;/span&gt;class and take care to keep internal state of &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Originator &lt;/span&gt;objects' values.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-IBvzTZ1Bu7E/TkvMS-6-9KI/AAAAAAAAAak/HXRfx-oAOCM/s1600/mementodesignpattern.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-IBvzTZ1Bu7E/TkvMS-6-9KI/AAAAAAAAAak/HXRfx-oAOCM/s1600/mementodesignpattern.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Here I took an example to show how you can implement memento design pattern into your system. We have &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Configuration &lt;/span&gt;class which represents &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Originator&lt;/span&gt;, &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;ConfigurationMemory &lt;/span&gt;class plays &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Caretaker &lt;/span&gt;role and finally &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;ConfigurationMemento &lt;/span&gt;class has properties to hold values of &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Originator &lt;/span&gt;class.&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IConfiguration&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; IP { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; ServerName { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; PoolSize { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="rem"&gt;// Originator &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Configuration : IConfiguration&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{ &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; IP { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ServerName { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; PoolSize { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ConfigurationMemento SaveState() &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ConfigurationMemento(&lt;span class="kwrd"&gt;this&lt;/span&gt;.IP, &lt;span class="kwrd"&gt;this&lt;/span&gt;.ServerName, &lt;span class="kwrd"&gt;this&lt;/span&gt;.PoolSize);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; RestoreState(ConfigurationMemento memento) &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.IP = memento.IP;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.ServerName = memento.ServerName;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.PoolSize = memento.PoolSize;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&lt;span class="rem"&gt;// Caretaker&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ConfigurationMemory&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; ConfigurationMemento memento;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ConfigurationMemento Get()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; memento;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Set(ConfigurationMemento memento)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;       &lt;span class="kwrd"&gt;this&lt;/span&gt;.memento = memento;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;&lt;span class="rem"&gt;// Memento&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ConfigurationMemento : IConfiguration&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; IP { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ServerName { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; PoolSize { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ConfigurationMemento(&lt;span class="kwrd"&gt;string&lt;/span&gt; ip, &lt;span class="kwrd"&gt;string&lt;/span&gt; serverName, &lt;span class="kwrd"&gt;int&lt;/span&gt; poolSize)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.IP = ip;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.ServerName = serverName;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.PoolSize = poolSize;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Implementation Memento Design Pattern : &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    Configuration config = &lt;span class="kwrd"&gt;new&lt;/span&gt; Configuration();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    config.IP = &lt;span class="str"&gt;"10.10.10.11"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    config.ServerName = &lt;span class="str"&gt;"WebServer01"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    config.PoolSize = 15;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    Display(config);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    ConfigurationMemory memory = &lt;span class="kwrd"&gt;new&lt;/span&gt; ConfigurationMemory();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    memory.Set(config.SaveState());&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    config.IP = &lt;span class="str"&gt;"10.0.10.12"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    config.ServerName = &lt;span class="str"&gt;"WebServer02"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    config.PoolSize = 25;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    Display(config);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    config.RestoreState(memory.Get());&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    Display(config);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Display(IConfiguration config)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    Console.WriteLine(config.IP);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    Console.WriteLine(config.ServerName);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    Console.WriteLine(config.PoolSize);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    Console.WriteLine();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;As you see client never access &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Memento &lt;/span&gt;object (&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;ConfigurationMemento&lt;/span&gt;). Client can only interact with &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Memento &lt;/span&gt;object through the &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Caretaker &lt;/span&gt;class (&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;ConfigurationMemory&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;At line 11 :&lt;/b&gt; &lt;span class="Apple-style-span" style="color: #741b47;"&gt;SaveState()&lt;/span&gt; method is invoked and the return value is used as a parameter passed to &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Set()&lt;/span&gt; method of &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;ConfigurationMemory &lt;/span&gt;object to hold current state of &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Configuration &lt;/span&gt;object.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;At line 13-15 :&lt;/b&gt; Values of &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Configuration &lt;/span&gt;object are changed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;At line 18 :&lt;/b&gt; &lt;span class="Apple-style-span" style="color: #741b47;"&gt;RestoreState()&lt;/span&gt; method is called and former state value of &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Configuration &lt;/span&gt;object is passed to the method in order to set old values to &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Configuration &lt;/span&gt;object.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Output should be : &lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;10.10.10.11&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;WebServer01&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;15&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;10.0.10.12&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;WebServer02&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;25&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;10.10.10.11&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;WebServer01&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;15&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2486496558889385541?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2486496558889385541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2486496558889385541' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2486496558889385541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2486496558889385541'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/08/memento-design-pattern.html' title='Memento Design Pattern'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-IBvzTZ1Bu7E/TkvMS-6-9KI/AAAAAAAAAak/HXRfx-oAOCM/s72-c/mementodesignpattern.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1684651934745020835</id><published>2011-08-03T22:53:00.003+02:00</published><updated>2011-08-19T17:23:57.442+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='fluent interface'/><title type='text'>Fluent Interface Implementation in Javascript</title><content type='html'>I mentioned&amp;nbsp;&amp;nbsp;&lt;a href="http://www.technolatte.net/2011/08/fluent-interface-implementation-in-c.html"&gt;Fluent Interface in &amp;nbsp;C#&lt;/a&gt;&amp;nbsp;&amp;nbsp; in my previous entry. You can design your classes in JavaScript in the same way.&lt;br /&gt;&lt;br /&gt;Most popular example of Fluent Interface in JavaScript is &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt;. I think this is the best reason why &lt;a href="http://jquery.com/"&gt;jQuery &lt;/a&gt;is widely chosen to other JavaScript frameworks. In &lt;a href="http://jquery.com/"&gt;jQuery &lt;/a&gt;you can easily call methods in same line. It's readable and easy to comprehend what code does.&lt;br /&gt;&lt;br /&gt;Following code example shows how to design your javascript classes to provide fluent interface technique. If you look at carefully, in each method&amp;nbsp;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;this &lt;/span&gt;keyword which represents current instance of the class is returned.&lt;br /&gt;&lt;br /&gt;It's the same class design example of &lt;u style="background-color: white;"&gt;Car &lt;/u&gt;in &lt;a href="http://www.technolatte.net/2011/08/fluent-interface-implementation-in-c.html"&gt;previous entry&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;var Car = function () {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    var Color, EngineType;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.setColor = function (color) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Color = color;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.setEngineType = function (engineType) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.EngineType = engineType;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.StartUp = function () {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        alert(&lt;span class="str"&gt;"Started up"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.DriveTo = function (direction) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        alert(&lt;span class="str"&gt;"Driving to "&lt;/span&gt; + direction);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.SetSpeed = function (speed) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        alert(speed + &lt;span class="str"&gt;" km per hour"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.PullOver = function () {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        alert(&lt;span class="str"&gt;"Pulled over"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;function initCar() {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    car = &lt;span class="kwrd"&gt;new&lt;/span&gt; Car();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    car.setColor(&lt;span class="str"&gt;"Black"&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;                .setEngineType(&lt;span class="str"&gt;"Diesel"&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;                .StartUp().DriveTo(&lt;span class="str"&gt;"south"&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;                .SetSpeed(90).PullOver();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;    document.getElementById(&lt;span class="str"&gt;"result"&lt;/span&gt;).innerText = &lt;span class="str"&gt;"color of the car is "&lt;/span&gt; + &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;                car.Color + &lt;span class="str"&gt;" and engine type is "&lt;/span&gt; + car.EngineType;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;At line 34; I created instance of &lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;Car &lt;/span&gt;class&lt;br /&gt;At line 35; I called methods in order to set values and run the statements in them.&lt;br /&gt;At line 40; I wrote the values of property of Car instance class on page.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Output &lt;/b&gt;:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;color of the car is Black and engine type is Diesel&amp;nbsp;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1684651934745020835?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1684651934745020835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1684651934745020835' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1684651934745020835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1684651934745020835'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/08/fluent-interface-implementation-in.html' title='Fluent Interface Implementation in Javascript'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1436624777568857305</id><published>2011-08-02T20:23:00.002+02:00</published><updated>2011-08-19T17:24:39.898+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fluent interface'/><category scheme='http://www.blogger.com/atom/ns#' term='csharp'/><title type='text'>Fluent Interface Implementation in C#</title><content type='html'>&lt;a href="http://martinfowler.com/"&gt;Martin Fowler&lt;/a&gt; is the first person who mentioned about &lt;a href="http://martinfowler.com/bliki/FluentInterface.html"&gt;Fluent Interface&lt;/a&gt; term at the end of 2005. It's an implementation of an object oriented API which helps developers provide readable and concise code. At first sight, it looks like method chain technique. But it entails more than just method chaining.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://ayende.com/blog"&gt;Rhino Mocks&lt;/a&gt; is the best example of using Fluent Interface before LINQ in .NET environment. Actually it's really easy to implement this technique by using C#. Please look at the Car Example written below.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Code Example :&lt;/b&gt;&lt;br /&gt;In this example I used &lt;u&gt;Car &lt;/u&gt;class derived from&amp;nbsp;&lt;u&gt;ICar &lt;/u&gt;interface.&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ICar&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    ICar SetColor(&lt;span class="kwrd"&gt;string&lt;/span&gt; color);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    ICar SetEngineType(&lt;span class="kwrd"&gt;string&lt;/span&gt; engineType);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    ICar StartUp();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    ICar DriveTo(&lt;span class="kwrd"&gt;string&lt;/span&gt; direction);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    ICar SetSpeed(&lt;span class="kwrd"&gt;int&lt;/span&gt; speed);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    ICar PullOver();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;sealed&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Car : ICar&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; color;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; engineType;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; Car() {}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; ICar New()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Car();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ICar SetColor(&lt;span class="kwrd"&gt;string&lt;/span&gt; color) &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.color = color;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ICar SetEngineType(&lt;span class="kwrd"&gt;string&lt;/span&gt; engineType)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.engineType = engineType;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ICar StartUp() &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        Console.WriteLine(&lt;span class="str"&gt;"Started Up"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ICar DriveTo(&lt;span class="kwrd"&gt;string&lt;/span&gt; direction) &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;        Console.WriteLine(&lt;span class="str"&gt;"Driving to "&lt;/span&gt; + direction);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ICar SetSpeed(&lt;span class="kwrd"&gt;int&lt;/span&gt; speed) &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;        Console.WriteLine(speed + &lt;span class="str"&gt;"km per hour"&lt;/span&gt;) ;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ICar PullOver() &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;        Console.WriteLine(&lt;span class="str"&gt;"Pulled over"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;At Line 16, I used &lt;a href="http://www.technolatte.net/2011/07/private-and-static-constructors-in-c.html"&gt;private constructor&lt;/a&gt;&amp;nbsp;in order to&amp;nbsp;&lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;prevent instantiate&amp;nbsp;Car class&lt;/span&gt;.&lt;br /&gt;At Line 18, &lt;i&gt;New()&lt;/i&gt; method is used and marked as &lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;static&lt;/span&gt;&lt;br /&gt;At Line 20, I created a new instance of Car class.&lt;br /&gt;&lt;br /&gt;As you see all methods in Car class return &lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;ICar&amp;nbsp;&lt;/span&gt;interface to provide chain reaction.&lt;br /&gt;&lt;br /&gt;Using Car class in Main Method&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    ICar car = Car.New()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        .SetColor(&lt;span class="str"&gt;"Red"&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        .SetEngineType(&lt;span class="str"&gt;"Diesel"&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        .StartUp()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        .DriveTo(&lt;span class="str"&gt;"north"&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        .SetSpeed(120)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        .PullOver();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    Console.Read();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;At line 3; I'm able to set all properties and call methods in one statement. It's fairly easy to design, read and brief.&lt;br /&gt;&lt;br /&gt;The disadvantage of this technique is difficult to debug. Because in Visual Studio it's not easy to put break point for each method calling.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Code Example : ConnectionString&lt;/b&gt;&lt;br /&gt;The following code example is much more realistic than the example above. In this code snippet contains &lt;u&gt;IConnectionString&lt;/u&gt; interface and &lt;u&gt;ConnectionString &lt;/u&gt;class inherits from &lt;u&gt;IConnectionString&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IConnectionString&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    IConnectionString SetServer(&lt;span class="kwrd"&gt;string&lt;/span&gt; server);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    IConnectionString SetDatabase(&lt;span class="kwrd"&gt;string&lt;/span&gt; database);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    IConnectionString SetUsername(&lt;span class="kwrd"&gt;string&lt;/span&gt; username);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    IConnectionString SetPassword(&lt;span class="kwrd"&gt;string&lt;/span&gt; password);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ConnectionString : IConnectionString&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Server;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Database;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Username;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Password;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ToString()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;@"Data Source={0};Initial Catalog={1};User Id={2};Password={3};"&lt;/span&gt;, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            Server, Database, Username, Password); &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; ConnectionString() { }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; IConnectionString New() &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt;  &lt;span class="kwrd"&gt;new&lt;/span&gt; ConnectionString();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; IConnectionString SetServer(&lt;span class="kwrd"&gt;string&lt;/span&gt; server)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Server = server;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; IConnectionString SetDatabase(&lt;span class="kwrd"&gt;string&lt;/span&gt; database)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Database = database;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; IConnectionString SetUsername(&lt;span class="kwrd"&gt;string&lt;/span&gt; username)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Username = username;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; IConnectionString SetPassword(&lt;span class="kwrd"&gt;string&lt;/span&gt; password)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Password = password;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Using ConnectionString :&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    IConnectionString connectionString = ConnectionString.New()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        .SetServer(&lt;span class="str"&gt;"127.0.0.1"&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        .SetDatabase(&lt;span class="str"&gt;"AdventureWorks"&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        .SetUsername(&lt;span class="str"&gt;"WebUser"&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        .SetPassword(&lt;span class="str"&gt;"123456"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    Console.WriteLine(connectionString.ToString());&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    Console.Read();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Output :&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;Data Source=127.0.0.1;Initial Catalog=AdventureWorks;User Id=WebUser;Password=12&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: black; color: white;"&gt;3456;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;More information for Fluent Interface :&lt;br /&gt;&lt;a href="http://randypatterson.com/index.php/2007/09/26/how-to-design-a-fluent-interface/"&gt;http://randypatterson.com/index.php/2007/09/26/how-to-design-a-fluent-interface/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.hanselman.com/blog/TheWeeklySourceCode14FluentInterfaceEdition.aspx"&gt;http://www.hanselman.com/blog/TheWeeklySourceCode14FluentInterfaceEdition.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.bofh.org.uk/2005/12/21/fluent-interfaces"&gt;http://www.bofh.org.uk/2005/12/21/fluent-interfaces&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1436624777568857305?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1436624777568857305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1436624777568857305' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1436624777568857305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1436624777568857305'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/08/fluent-interface-implementation-in-c.html' title='Fluent Interface Implementation in C#'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4827171537594486873</id><published>2011-07-29T17:04:00.001+02:00</published><updated>2011-08-02T20:26:23.487+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='constructor'/><category scheme='http://www.blogger.com/atom/ns#' term='csharp'/><title type='text'>How to Write Copy Constructor in C#</title><content type='html'>C# doesn't support a copy constructor. When you need to create a new object and copy values from existing project to the new object, you should write an extra constructor.&lt;br /&gt;&lt;br /&gt;The new constructor should take its own data type as a parameter then call the instance constructor.&lt;br /&gt;&lt;br /&gt;Example written below, there is a class called &lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;Product&lt;/span&gt; which contains two overload constructors. One takes two parameters which are &lt;i&gt;Id &lt;/i&gt;and &lt;i&gt;Name&lt;/i&gt;, another takes &lt;i&gt;Product &lt;/i&gt;data type and pass the properties of Product to another constructor.&lt;br /&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Product &lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id;&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; Product(&lt;span class="kwrd"&gt;int&lt;/span&gt; id, &lt;span class="kwrd"&gt;string&lt;/span&gt; name) &lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Id = id;&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Name = name;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; Product(Product product) : &lt;span class="kwrd"&gt;this&lt;/span&gt; (product.Id, product.Name)&lt;br /&gt;    {&lt;br /&gt;    &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ToString()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"Id of {0} is {1}"&lt;/span&gt;, &lt;span class="kwrd"&gt;this&lt;/span&gt;.Name, &lt;span class="kwrd"&gt;this&lt;/span&gt;.Id);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;    {&lt;br /&gt;        Product productA = &lt;span class="kwrd"&gt;new&lt;/span&gt; Product(1, &lt;span class="str"&gt;"Fridge"&lt;/span&gt;);&lt;br /&gt;        Product productB = &lt;span class="kwrd"&gt;new&lt;/span&gt; Product(productA);&lt;br /&gt;&lt;br /&gt;        Console.WriteLine(productB.ToString());&lt;br /&gt;        &lt;span class="rem"&gt;// output : "Id of Fridge is 1"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        Console.Read();&lt;br /&gt;        &lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4827171537594486873?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4827171537594486873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4827171537594486873' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4827171537594486873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4827171537594486873'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/07/how-to-write-copy-constructor-in-c.html' title='How to Write Copy Constructor in C#'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1417049218105406175</id><published>2011-07-28T10:18:00.004+02:00</published><updated>2012-01-25T23:28:11.007+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='constructor'/><category scheme='http://www.blogger.com/atom/ns#' term='static'/><category scheme='http://www.blogger.com/atom/ns#' term='private'/><category scheme='http://www.blogger.com/atom/ns#' term='csharp'/><title type='text'>Private and Static Constructors in C#</title><content type='html'>&lt;span class="Apple-style-span" style="background-color: #f4cccc;"&gt;Private&lt;/span&gt; and &lt;span class="Apple-style-span" style="background-color: #f4cccc;"&gt;Static&lt;/span&gt; constructors are rarely used. Mostly we tend to create only public conctructors when we create a class.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Private Constructors&lt;/b&gt; are used to prevent creating &amp;nbsp;instances of a class. If a class has only static members or methods, the declaration of the empty constructor doesn't let the automatic generation of a default constructor.&lt;br /&gt;&lt;br /&gt;If you try to instantiate a class, when you build your application you've got the error "&lt;span class="Apple-style-span" style="color: red;"&gt;... is inaccessible  due to its protection level&lt;/span&gt;".&lt;br /&gt;&lt;br /&gt;Private constructor is used &amp;nbsp;in &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Singleton design pattern&lt;/span&gt;. You can be sure external code never creates a singleton instance accidentally. Private constructor prevents access to the object constructor.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Example code :&lt;/u&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Person&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kwrd"&gt;private&lt;/span&gt; Person()&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Speak()&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&lt;span class="str"&gt;"I spoke"&lt;/span&gt;);&lt;br /&gt;&amp;nbsp; &amp;nbsp; } &amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;span class="kwrd"&gt;new&lt;/span&gt; Person();&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="rem"&gt;// Test.StaticConstructor.Person.Person()' is inaccessible &lt;br /&gt;due to its protection level&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.Read();&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Static constructors&lt;/b&gt; are use to initialize any static data when any static method is invoked or static member is referenced or when you create an instance of a class which has static constructor.&lt;br /&gt;&lt;br /&gt;This static constructor called &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;only once&lt;/span&gt;. Beside that static constructor doesn't take any access modifiers or have any parameters.&lt;br /&gt;&lt;br /&gt;Most common usage of it is to write logs into a file when class is used. In addition, it's used to set default value &amp;nbsp;to static members in class.&lt;br /&gt;&lt;br /&gt;You can be sure that static constructor is &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;thread safe&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;In static constructor you can not access any members or methods which are not static.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Remember, if any exception is thrown inside static constructor the runtime can not call a second time and it remains uninitialized for the life time of application.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Example code :&lt;/u&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Car&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; Car() &lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Static constructor is called"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Color;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Drive() &lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Car is driven"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;    {&lt;br /&gt;        Car.Drive(); &lt;span class="rem"&gt;// static constructor is invoked&lt;/span&gt;&lt;br /&gt;        Car car = &lt;span class="kwrd"&gt;new&lt;/span&gt; Car(); &lt;span class="rem"&gt;// static constructor is not invoked&lt;/span&gt;&lt;br /&gt;        Car.Color = &lt;span class="str"&gt;"Green"&lt;/span&gt;; &lt;span class="rem"&gt;// static constructor is not invoked&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        Console.Read();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;Output : &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;Static constructor is called&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;Car is driven&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1417049218105406175?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1417049218105406175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1417049218105406175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1417049218105406175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1417049218105406175'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/07/private-and-static-constructors-in-c.html' title='Private and Static Constructors in C#'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2855735428553011303</id><published>2011-07-27T15:55:00.000+02:00</published><updated>2011-07-27T15:55:14.448+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='benchmarking'/><category scheme='http://www.blogger.com/atom/ns#' term='hashtable'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='dictionary collection'/><title type='text'>Dictionary and Hashtable Benchmarking</title><content type='html'>I made a simple test to see performance result between Dictionary and Hashtable in .NET framework by using C#. In this test I use :&lt;br /&gt;&lt;br /&gt;.NET Framework 3.5 on Windows XP Professional OS with Service Pack 2. My PC hardware configuration is Intel(R) Pentium(R) Dual CPU E2160 1.80GHz and 4GB Memory.&lt;br /&gt;&lt;br /&gt;In order to perform test I added 10 million items into Dictionary and Hashtable and retrieve all values from the collections in for loop. Each test was repeated 5 times.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Dictionary Collection Test Result&lt;/b&gt;&amp;nbsp;:&lt;br /&gt;Please look below for the results which are &lt;u&gt;taking time to add values into Dictionary collection&lt;/u&gt;, &lt;u&gt;to retrieve values from Dictionary collection&lt;/u&gt; and &lt;u&gt;memory usage respectively&lt;/u&gt;.&lt;br /&gt;&lt;pre&gt;add       get       memory usage&lt;br /&gt;------------------------------&lt;br /&gt;11.89sec | 4.22sec | 571,676KB&lt;br /&gt;11.84sec | 4.38sec | 571,624KB&lt;br /&gt;11.89sec | 4.22sec | 571,684KB&lt;br /&gt;11.89sec | 4.22sec | 571,644KB&lt;br /&gt;11.87sec | 4.22sec | 571,636KB&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Hashtable Collection Test Result&lt;/b&gt;&amp;nbsp;:&lt;br /&gt;Please look below for the results which are&amp;nbsp;&lt;u&gt;taking time to add values into Hastable collection&lt;/u&gt;,&amp;nbsp;&lt;u&gt;to retrieve values from&amp;nbsp;&lt;/u&gt;&lt;u&gt;Hastable&amp;nbsp;&lt;/u&gt;&lt;u&gt;collection&lt;/u&gt;&amp;nbsp;and&amp;nbsp;&lt;u&gt;memory usage respectively&lt;/u&gt;.&lt;br /&gt;&lt;pre&gt;add       get       memory usage&lt;br /&gt;------------------------------&lt;br /&gt;17.27sec | 1,23sec | 630,692KB&lt;br /&gt;17.24sec | 1.23sec | 630,692KB&lt;br /&gt;17.18sec | 1.23sec | 630,632KB&lt;br /&gt;17.24sec | 1.23sec | 630,672KB&lt;br /&gt;17.49sec | 1.23sec | 630,672KB&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;Adding value into Dictionary collection is faster than Hashtable usage since retrieving value from Hashtable collection is faster than dictionary collection. But Hashtable needs more memory to store values than Dictionary collection.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;I'm surprised because I assumed that retrieving object from Hashtable collection and convert it to string type takes time. But it's ~3.5 times faster than Dictionary collection.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Please don't forget some other tests such as adding different type values to Dictionary and Hashtable should be performed to get better test results to comprehend usage of two different kind of collections.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Source Code Used for Benchmarking&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;public class &lt;/span&gt;Program&lt;br /&gt;{&lt;br /&gt;        &lt;span class="Apple-style-span" style="color: blue;"&gt;static &lt;/span&gt;&lt;span class="Apple-style-span" style="color: #45818e;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span class="Apple-style-span" style="color: blue;"&gt;int&lt;/span&gt;, &lt;span class="Apple-style-span" style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; dictionaryNumber = new Dictionary&amp;lt;&lt;span class="Apple-style-span" style="color: blue;"&gt;int&lt;/span&gt;, &lt;span class="Apple-style-span" style="color: blue;"&gt;string&lt;/span&gt;&amp;gt;();&lt;br /&gt;        &lt;span class="Apple-style-span" style="color: blue;"&gt;static &lt;/span&gt;&lt;span class="Apple-style-span" style="color: #45818e;"&gt;Hashtable &lt;/span&gt;hash = new Hashtable();&lt;br /&gt;&lt;br /&gt;        &lt;span class="Apple-style-span" style="color: blue;"&gt;static void &lt;/span&gt;Main(&lt;span class="Apple-style-span" style="color: blue;"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;        {&lt;br /&gt;            TestDictionary();&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #38761d;"&gt;//TestHashtable();&lt;/span&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.Read();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class="Apple-style-span" style="color: blue;"&gt;static&lt;/span&gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;void &lt;/span&gt;TestHashtable()&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long &lt;/span&gt;duration;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long &lt;/span&gt;start;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long&lt;/span&gt; end;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long &lt;/span&gt;result;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span class="Apple-style-span" style="color: #990000;"&gt;"adding"&lt;/span&gt;);&lt;br /&gt;            start = &lt;span class="Apple-style-span" style="color: #45818e;"&gt;DateTime&lt;/span&gt;.Now.Ticks;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #38761d;"&gt;// add &lt;/span&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;for &lt;/span&gt;(&lt;span class="Apple-style-span" style="color: blue;"&gt;int &lt;/span&gt;i = 0; i &amp;lt; 10000000; i++)&lt;br /&gt;            {&lt;br /&gt;                hash.Add(i, i.ToString());&lt;br /&gt;            }&lt;br /&gt;            end = &lt;span class="Apple-style-span" style="color: #45818e;"&gt;DateTime&lt;/span&gt;.Now.Ticks;&lt;br /&gt;&lt;br /&gt;            duration = end - start;&lt;br /&gt;            result = duration / 100000;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span class="Apple-style-span" style="color: #990000;"&gt;" result : "&lt;/span&gt; + result);&lt;br /&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.WriteLine("retrieve");&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #38761d;"&gt;// retrieve&lt;/span&gt;&lt;br /&gt;            duration = 0;&lt;br /&gt;            start = 0;&lt;br /&gt;            end = 0;&lt;br /&gt;            result = 0;&lt;br /&gt;&lt;br /&gt;            start = &lt;span class="Apple-style-span" style="color: #45818e;"&gt;DateTime&lt;/span&gt;.Now.Ticks;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;string &lt;/span&gt;s;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;for &lt;/span&gt;(&lt;span class="Apple-style-span" style="color: blue;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 10000000; i++)&lt;br /&gt;            {&lt;br /&gt;                s = hash[i].ToString();&lt;br /&gt;            }&lt;br /&gt;            end = DateTime.Now.Ticks;&lt;br /&gt;&lt;br /&gt;            duration = end - start;&lt;br /&gt;            result = duration / 100000;&lt;br /&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span class="Apple-style-span" style="color: #990000;"&gt;" result : "&lt;/span&gt; + result);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class="Apple-style-span" style="color: blue;"&gt;static void &lt;/span&gt;TestDictionary()&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long &lt;/span&gt;duration;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long &lt;/span&gt;start;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long &lt;/span&gt;end;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;long &lt;/span&gt;result;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span class="Apple-style-span" style="color: #990000;"&gt;"adding"&lt;/span&gt;);&lt;br /&gt;            start = &lt;span class="Apple-style-span" style="color: #45818e;"&gt;DateTime&lt;/span&gt;.Now.Ticks;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #38761d;"&gt;// add &lt;/span&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;for &lt;/span&gt;(&lt;span class="Apple-style-span" style="color: blue;"&gt;int &lt;/span&gt;i = 0; i &amp;lt; 10000000; i++)&lt;br /&gt;            {&lt;br /&gt;                dictionaryNumber.Add(i, i.ToString());&lt;br /&gt;            }&lt;br /&gt;            end = &lt;span class="Apple-style-span" style="color: #45818e;"&gt;DateTime&lt;/span&gt;.Now.Ticks;&lt;br /&gt;&lt;br /&gt;            duration = end - start;&lt;br /&gt;            result = duration / 10000;&lt;br /&gt;            Console.WriteLine(&lt;span class="Apple-style-span" style="color: #990000;"&gt;" result : "&lt;/span&gt; + result);&lt;br /&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span class="Apple-style-span" style="color: #990000;"&gt;"retrieve"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #38761d;"&gt;// retrieve&lt;/span&gt;&lt;br /&gt;            duration = 0;&lt;br /&gt;            start = 0;&lt;br /&gt;            end = 0;&lt;br /&gt;            result = 0;&lt;br /&gt;&lt;br /&gt;            start = &lt;span class="Apple-style-span" style="color: #45818e;"&gt;DateTime&lt;/span&gt;.Now.Ticks;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;string &lt;/span&gt;s;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: blue;"&gt;for &lt;/span&gt;(&lt;span class="Apple-style-span" style="color: blue;"&gt;int &lt;/span&gt;i = 0; i &amp;lt; 10000000; i++)&lt;br /&gt;            {&lt;br /&gt;                s = dictionaryNumber[i];&lt;br /&gt;            }&lt;br /&gt;            end = &lt;span class="Apple-style-span" style="color: #45818e;"&gt;DateTime&lt;/span&gt;.Now.Ticks;&lt;br /&gt;&lt;br /&gt;            duration = end - start;&lt;br /&gt;            result = duration / 10000;&lt;br /&gt;&lt;br /&gt;            &lt;span class="Apple-style-span" style="color: #45818e;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span class="Apple-style-span" style="color: #990000;"&gt;" result : "&lt;/span&gt; + result);&lt;br /&gt;        }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2855735428553011303?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2855735428553011303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2855735428553011303' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2855735428553011303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2855735428553011303'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/07/dictionary-and-hashtable-benchmarking.html' title='Dictionary and Hashtable Benchmarking'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7578789979960892120</id><published>2011-06-16T12:53:00.000+02:00</published><updated>2011-06-16T12:53:26.557+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual studio'/><category scheme='http://www.blogger.com/atom/ns#' term='x86'/><category scheme='http://www.blogger.com/atom/ns#' term='64-Bit'/><category scheme='http://www.blogger.com/atom/ns#' term='32-Bit'/><title type='text'>How to Run 32-Bit DLL on 64-Bit Operating System</title><content type='html'>When I encountered the problem which 32-Bit DLL doesn't work on 64-Bit operating system - Windows 7-, &amp;nbsp;I tried to register 32-Bit DLL. But it's futile and I was on wrong way.&lt;br /&gt;&lt;br /&gt;In my case, I use 32-Bit DLL on windows desktop application which I built. When I start up the application it throws an error. Without 32-Bit DLL, it works nicely.&lt;br /&gt;&lt;br /&gt;The solution for this issue is easier than you think by using Visual Studio 2008 or 2010. The only thing you accomplish is to compile your application for 32-Bit operating system &lt;i&gt;if you don't have a good reason to run your application on 64-Bit OS.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;If you use &lt;b&gt;Visual Studio 2008&lt;/b&gt;, you can perform following steps :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Click&lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt; Debug/Release&lt;/span&gt; drop down list to open &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Configuration Manager&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;In new window, you see &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Active Solution Platform&lt;/span&gt; drop down list. In this list, select &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;New&lt;/span&gt;, then choose &lt;span class="Apple-style-span" style="background-color: #e69138;"&gt;x86&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-C9F5auOO-68/TfnInw5603I/AAAAAAAAAUs/dFmDYQzOFVw/s1600/vs2008-release-configuration-manager.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="201" src="http://4.bp.blogspot.com/-C9F5auOO-68/TfnInw5603I/AAAAAAAAAUs/dFmDYQzOFVw/s320/vs2008-release-configuration-manager.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you use &lt;b&gt;Visual Studio 2010&lt;/b&gt;, you can perform same steps, but you have to &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;enable Advanced Build Configurations&lt;/span&gt;. In order to use Configuration Manager, follow steps written below :&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;On you Visual Studio 2010, click &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Tools&lt;/span&gt; on Visual Studio menu and select &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Options&lt;/span&gt;&lt;/li&gt;&lt;li&gt;You see new window. In this window expand &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;Projects and Solutions&lt;/span&gt;&amp;nbsp;and click &lt;span class="Apple-style-span" style="background-color: #fce5cd;"&gt;General &lt;/span&gt;section then check &lt;span class="Apple-style-span" style="background-color: #e69138;"&gt;Show advanced build configurations&lt;/span&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-EztHR8lTAUE/TfnIugfnstI/AAAAAAAAAUw/86r-5zJKOZY/s1600/vs2010-show-advanced-build-configurations.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="187" src="http://4.bp.blogspot.com/-EztHR8lTAUE/TfnIugfnstI/AAAAAAAAAUw/86r-5zJKOZY/s320/vs2010-show-advanced-build-configurations.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Lastly, do same steps mentioned above for Visual Studio 2008.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Eventually, you are ready to compile your application for 32-Bit.&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7578789979960892120?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7578789979960892120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7578789979960892120' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7578789979960892120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7578789979960892120'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/06/how-to-run-32-bit-dll-on-64-bit.html' title='How to Run 32-Bit DLL on 64-Bit Operating System'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-C9F5auOO-68/TfnInw5603I/AAAAAAAAAUs/dFmDYQzOFVw/s72-c/vs2008-release-configuration-manager.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5440409006987709841</id><published>2011-06-14T23:41:00.001+02:00</published><updated>2011-06-14T23:43:28.728+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='iPad'/><category scheme='http://www.blogger.com/atom/ns#' term='web clip icon'/><title type='text'>Web Clip Icon on Home Screen for iPad and iPhone</title><content type='html'>It's possible to create native-look iPhone or iPad applications by using HTML and Javascript. But if you want to more you need to apply some settings on your html page. For instance web clip icon on your home screen. Please keep reading to learn how to do that.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-EZxuiSCE200/TffU14VwrpI/AAAAAAAAAUo/0Nr6JKlq9yI/s1600/iphone_home_screen.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-EZxuiSCE200/TffU14VwrpI/AAAAAAAAAUo/0Nr6JKlq9yI/s320/iphone_home_screen.jpg" width="179" /&gt;&lt;/a&gt;When you click icon on your Home Screen, your web application opens without address bar.It looks like native application. In order to build native-feeling iOS application you need to add following statement inside &lt;b&gt;Head &lt;/b&gt;tag in your html page.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #ffd966;"&gt;&amp;lt;link rel="apple-touch-icon" href="images/yourIcon.png" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #ffd966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Your icon size for&lt;u&gt; iPhone&lt;/u&gt; and &lt;u&gt;iPod &lt;/u&gt;should be &lt;b&gt;57x57 pixels&lt;/b&gt; or &lt;b&gt;114x114 pixels&lt;/b&gt; for high resolution&lt;br /&gt;&lt;br /&gt;For &lt;u&gt;iPad&lt;/u&gt; you need to create and icon that measures; &lt;b&gt;72x72 pixels&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;iOS automatically add some visual effects such as glosy finish, rounded corners and reflective shine. So you don't need to add any visual effects to your icon.&lt;br /&gt;&lt;br /&gt;For more information about web clip icons check this &lt;a href="http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW11"&gt;documentation&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5440409006987709841?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5440409006987709841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5440409006987709841' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5440409006987709841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5440409006987709841'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/06/web-clip-icon-on-home-screen-for-ipad.html' title='Web Clip Icon on Home Screen for iPad and iPhone'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-EZxuiSCE200/TffU14VwrpI/AAAAAAAAAUo/0Nr6JKlq9yI/s72-c/iphone_home_screen.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5832869109653195503</id><published>2011-05-20T16:34:00.000+02:00</published><updated>2011-05-20T16:34:52.252+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><title type='text'>Everything Works But ASP.NET Pages on IIS</title><content type='html'>Last week I installed windows server 2003 R2 standard edition on our server for hosting our web applications, web services and databases.&lt;br /&gt;&lt;br /&gt;Although I experienced same error before, I forgot how to fix it. I don't know why but when you install IIS 6, ASP.NET service extension is disabled. If you try to request html pages you can see them on your browser. When you request any asp.net, IIS responds you with following message :&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;"HTTP Error 404 - File or directory not found."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you are in this situation, you have to allow &lt;span class="Apple-style-span" style="background-color: #ffd966;"&gt;ASP.NET service extension&lt;/span&gt; on your IIS under &lt;b&gt;Web Service Extensions&lt;/b&gt;. Below, you can see the screenshot I took from our web server.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-mdVXFCXbRM4/TdZ3Ckw9sbI/AAAAAAAAATQ/-56p_PeLMuQ/s1600/webserviceextension.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="197" src="http://1.bp.blogspot.com/-mdVXFCXbRM4/TdZ3Ckw9sbI/AAAAAAAAATQ/-56p_PeLMuQ/s320/webserviceextension.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5832869109653195503?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5832869109653195503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5832869109653195503' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5832869109653195503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5832869109653195503'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/05/everything-works-but-aspnet-pages-on.html' title='Everything Works But ASP.NET Pages on IIS'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-mdVXFCXbRM4/TdZ3Ckw9sbI/AAAAAAAAATQ/-56p_PeLMuQ/s72-c/webserviceextension.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7304255307058879348</id><published>2011-05-05T15:11:00.000+02:00</published><updated>2011-05-05T15:11:33.047+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>How to Parse Query String in Javascript?</title><content type='html'>If you want to access query string in javascript, you can use following code. &lt;br /&gt;&lt;br /&gt;When page is loaded, call &lt;b&gt;parseQueryString() &lt;/b&gt;function to parse query string and set query string variables to &lt;b&gt;queryString&lt;/b&gt; property.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;queryString = [];&lt;br /&gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;function &lt;/span&gt;parseQueryString() {&lt;br /&gt;    queryString = []; &lt;span class="Apple-style-span" style="color: #38761d;"&gt;// reset queryString&lt;/span&gt;&lt;br /&gt;    &lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;u = document.URL;&lt;br /&gt;    &lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;q = u.substring(u.indexOf("?") + 1, u.length);&lt;br /&gt;    &lt;br /&gt;    &lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;arr = q.split("&amp;amp;");&lt;br /&gt;&lt;br /&gt;    &lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;n = ""; &lt;span class="Apple-style-span" style="color: #38761d;"&gt;// name&lt;/span&gt;&lt;br /&gt;    &lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;v = ""; &lt;span class="Apple-style-span" style="color: #38761d;"&gt;// value&lt;/span&gt;&lt;br /&gt;    &lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;ind; &lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;// index of equal symbol&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class="Apple-style-span" style="color: blue;"&gt;for&lt;/span&gt; (&lt;span class="Apple-style-span" style="color: blue;"&gt;var &lt;/span&gt;i = 0; i &amp;lt; arr.length; i++) {&lt;br /&gt;        ind = parseInt(arr[i].indexOf("="));&lt;br /&gt;        v = arr[i].substring(ind+1, arr[i].length);&lt;br /&gt;        n = arr[i].substring(0, ind);&lt;br /&gt;&lt;br /&gt;        queryString[n] = decodeURI(v);&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;$(&lt;span class="Apple-style-span" style="color: blue;"&gt;function&lt;/span&gt;() {&lt;br /&gt;    parseQueryString();&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;How to Get Query String Value?&lt;/b&gt;&lt;br /&gt;When you need to have query string value, you can use &lt;b&gt;queryString &lt;/b&gt;property by passing query string name to queryString array : &lt;br /&gt;&lt;br /&gt;For example, if URL consists of query string named id, use "id" to retrieve value of "id".&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;queryString["id"]&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7304255307058879348?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7304255307058879348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7304255307058879348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7304255307058879348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7304255307058879348'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/05/how-to-parse-query-string-in-javascript.html' title='How to Parse Query String in Javascript?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-304076986006225679</id><published>2011-03-21T11:26:00.000+01:00</published><updated>2011-03-21T11:26:52.870+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css3'/><category scheme='http://www.blogger.com/atom/ns#' term='keyboard'/><category scheme='http://www.blogger.com/atom/ns#' term='html5'/><category scheme='http://www.blogger.com/atom/ns#' term='touch screen keyboard'/><title type='text'>Touch Screen Keyboard</title><content type='html'>&lt;b&gt;Touch Screen Keyboard&lt;/b&gt; was designed for touch screen applications to input easily. Because of that &lt;b&gt;Touch Screen Keyboard&lt;/b&gt; was built by using HTML5 and CSS3, it's better to use browser supporting html5 and css3.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh3.googleusercontent.com/-C5vU7BecaU0/TYcScIfnQwI/AAAAAAAAATM/z15c0GMQLxA/s1600/touch_screen_keyboard_screnshot.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="243" src="https://lh3.googleusercontent.com/-C5vU7BecaU0/TYcScIfnQwI/AAAAAAAAATM/z15c0GMQLxA/s320/touch_screen_keyboard_screnshot.PNG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In this project, I didn't use any image to create keyboard layout. By changing&amp;nbsp;css styles&amp;nbsp;easily&amp;nbsp;you can have different type of keyboard.&lt;br /&gt;&lt;br /&gt;If you want to add a new symbol or letter, you can edit &lt;a href="http://www.json.org/"&gt;json &lt;/a&gt;data called &lt;b&gt;&lt;i&gt;defaultKeyboard&lt;/i&gt;&lt;/b&gt; in &lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;jsKeyboard.js&lt;/span&gt;&amp;nbsp;file.&lt;br /&gt;&lt;br /&gt;Beside that, you can add new keyboard type which is compatible with other languages by creating new &lt;a href="http://www.json.org/"&gt;json &lt;/a&gt;data and adding to &lt;b&gt;&lt;i&gt;keyboard&lt;/i&gt;&lt;/b&gt;&amp;nbsp;&amp;nbsp;array in &lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;jsKeyboard.js&lt;/span&gt;. You can switch keyboard without difficulty.&lt;br /&gt;&lt;br /&gt;In order to display &lt;b&gt;Touch Screen Keyboard&lt;/b&gt; properly, I recommend following browsers; Firefox 3.5+, Google 4.0+, Safari 3.1+, Opera 10.5+, IE 9+&lt;br /&gt;&lt;br /&gt;If you want to know how you can use &lt;b&gt;Touch Screen Keyboard&lt;/b&gt; please read the following documentation :&lt;br /&gt;&lt;a href="http://code.technolatte.net/TouchScreenKeyboard/default.htm"&gt;http://code.technolatte.net/TouchScreenKeyboard/default.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For demo please click the link below :&lt;br /&gt;&lt;a href="http://code.technolatte.net/TouchScreenKeyboard/Demo.htm"&gt;http://code.technolatte.net/TouchScreenKeyboard/Demo.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-304076986006225679?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/304076986006225679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=304076986006225679' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/304076986006225679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/304076986006225679'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/03/touch-screen-keyboard.html' title='Touch Screen Keyboard'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh3.googleusercontent.com/-C5vU7BecaU0/TYcScIfnQwI/AAAAAAAAATM/z15c0GMQLxA/s72-c/touch_screen_keyboard_screnshot.PNG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2802364665457754740</id><published>2011-02-19T09:00:00.001+01:00</published><updated>2011-02-24T10:00:55.599+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bug tracking'/><title type='text'>How to Report a Bug?</title><content type='html'>"&lt;i&gt;I cannot login to the system, it doesn't work&lt;/i&gt;." or "&lt;i&gt;this function is horrible.&lt;/i&gt;"&lt;br /&gt;&lt;br /&gt;Most probably, you've heard or read these kind of bug statements above. They are the worst bug reports. It's not helpful, it's not clear, it says only the expression of you were having a bad time.&lt;br /&gt;&lt;br /&gt;A bug report should contains detailed information helping developers to find the problem easily and answers the following questions:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;What you did?&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;What you expected to happen?&lt;/span&gt; or &lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;What should have happened?&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;What actually happened?&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Before sending a bug report, you should consider these :&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Determine if the bug is really a bug&lt;/span&gt; : If it performs correctly what the requirement says, this is not a bug. If you don't like the workflow, this isn't a bug.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Make sure that the bug hasn't been reported&lt;/span&gt;. : You should always search the bug first on your bug tracker system. You shouldn't create a duplicate bug.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Only report one problem in each bug report&lt;/span&gt; : If you encounter 2 or more bugs which don't seem to be related, create different bug report for each problem. It's easy for different people who works on fixing the different bugs.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Be specific &lt;/span&gt;: If the application has two different ways to execute same action, please tell which way you selected. For instance, "&lt;i&gt;I selected two files to upload&lt;/i&gt;" or "&lt;i&gt;I dragged and dropped two files to upload&lt;/i&gt;".&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Give more information but don't be&amp;nbsp;verbose&lt;/span&gt; : Give detailed information rather than &amp;nbsp;less. Don't write redundant information. Information should be useful. You can add screenshots to explain the problem clearly.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Be careful of pronouns &lt;/span&gt;: Be careful when you write bug report and avoid to use too much pronouns. Your statement should be clear. Assume this case; "&lt;i&gt;I started up the application. The warning message appeared and I tried to close it and it crashed.&lt;/i&gt;" What you think about this bug report. Here "it" can be referred to the warning message or the application. What you think? The warning message&amp;nbsp;was closed or the application. Instead, you could report, "&lt;i&gt;I started up the application. The warning message appeared and I tried to close the warning message but the application crashed.&lt;/i&gt;"&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Describe the steps how to reproduce the bug&amp;nbsp;&lt;/span&gt;: Write the steps what you did so that developer can create same error to investigate and find the exact problem easily.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Don't add "vital, important or urgent" words if it's not really urgent&lt;/span&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2802364665457754740?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2802364665457754740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2802364665457754740' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2802364665457754740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2802364665457754740'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/02/how-to-report-bug.html' title='How to Report a Bug?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5155426525533914212</id><published>2011-02-13T18:13:00.000+01:00</published><updated>2011-02-13T18:13:01.710+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='client-side'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='jshelper'/><title type='text'>Javascript Helper</title><content type='html'>&lt;b&gt;jsHelper&lt;/b&gt; is a javascript framework which uses &lt;a href="http://jquery.com/"&gt;jQuery &lt;/a&gt;to support common client side functionalities developers need when they build client side application. By using &lt;b&gt;jsHelper &lt;/b&gt;you can :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;check whether cookie is enabled on user's browser.&lt;/li&gt;&lt;li&gt;set a cookie on client side.&lt;/li&gt;&lt;li&gt;get existing cookie on client side.&lt;/li&gt;&lt;li&gt;delete an existing cookie.&lt;/li&gt;&lt;li&gt;disable/enable page background.&lt;/li&gt;&lt;li&gt;display notification message on the top, bottom and center of the window.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;You can validate form controls. Such as :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Required field validator.&lt;/li&gt;&lt;li&gt;Integer field validator.&lt;/li&gt;&lt;li&gt;Minimum and maximum value of integer in form controls.&lt;/li&gt;&lt;li&gt;Minumum and maximum length of value in form controls.&lt;/li&gt;&lt;li&gt;Email validation control.&lt;/li&gt;&lt;li&gt;Email match validation control.&lt;/li&gt;&lt;li&gt;Visa, master and american express credit card validation.&lt;/li&gt;&lt;li&gt;IP validation.&lt;/li&gt;&lt;li&gt;Web url validation.&lt;/li&gt;&lt;li&gt;Ftp url validation.&lt;/li&gt;&lt;li&gt;Checkbox control whether it's checked.&lt;/li&gt;&lt;li&gt;Date validation with different date pattern like dd.mm.yyyy, mm.dd.yyyy, dd.mm.yy, dd/mm/yyy etc.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;If you want to know how to use and implement &lt;b&gt;jsHelpe&lt;/b&gt;r into your web application, please read documentation of &lt;b&gt;jsHelper.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://code.technolatte.net/jshelper/"&gt;http://code.technolatte.net/jshelper/&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5155426525533914212?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5155426525533914212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5155426525533914212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5155426525533914212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5155426525533914212'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/02/javascript-helper.html' title='Javascript Helper'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5237798099853667837</id><published>2011-02-10T21:41:00.000+01:00</published><updated>2011-02-10T21:41:00.184+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><title type='text'>Internet Explorer 9 Test Drive</title><content type='html'>Follow the progress of the Internet Explorer Developer Platform, download preview releases, try the latest demos.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://ie.microsoft.com/testdrive/Default.html"&gt;http://ie.microsoft.com/testdrive/Default.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5237798099853667837?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5237798099853667837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5237798099853667837' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5237798099853667837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5237798099853667837'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/02/internet-explorer-9-test-drive.html' title='Internet Explorer 9 Test Drive'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-735628893866781937</id><published>2011-02-05T13:01:00.009+01:00</published><updated>2011-02-06T10:45:35.444+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><title type='text'>Javascript Confirmation Plugin</title><content type='html'>&lt;b&gt;Javascript Confirmation Plugin&lt;/b&gt; is the custom dialog box written by javascript with html5 and css3 features to retrieve user's response. Instead of using standard javascript confirm message box, I highly recommend you to use rich &lt;b&gt;Javascript Confirmation Plugin&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_luRD3lsHwX4/TUv2kJB2DUI/AAAAAAAAASU/r6GZr0zlN30/s1600/confiramtionplugin_screenshot.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="157" src="http://2.bp.blogspot.com/_luRD3lsHwX4/TUv2kJB2DUI/AAAAAAAAASU/r6GZr0zlN30/s320/confiramtionplugin_screenshot.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;If you want to know how to implement it to your project, please click the link written below to have more information.&lt;br /&gt;&lt;a href="http://code.technolatte.net/confirmation/default.htm"&gt;http://code.technolatte.net/confirmation/default.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-735628893866781937?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/735628893866781937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=735628893866781937' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/735628893866781937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/735628893866781937'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/02/javascript-confirmation-plugin.html' title='Javascript Confirmation Plugin'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_luRD3lsHwX4/TUv2kJB2DUI/AAAAAAAAASU/r6GZr0zlN30/s72-c/confiramtionplugin_screenshot.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5489616714748617176</id><published>2011-02-03T14:01:00.000+01:00</published><updated>2011-02-03T14:01:04.509+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual studio'/><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Minify Javascript Tool and Solution</title><content type='html'>When you come up against performance issue, every small improvement will help you to increase performance of your application. I will explain one of the small step of decreasing the response time. This solution has been using for the current project I've been working on. It's proven method.&lt;br /&gt;&lt;br /&gt;Core minify javascript code was written by Douglas Crockford. I modified the code in order to shrink all javascript files in your web application folder while compiling it. It means, you don't need to make an extra effort to shrink all javascript files.&lt;br /&gt;&lt;br /&gt;When you click to build your web application, the original javascript files in your web project are retrieved by &lt;b&gt;minify javascript tool&lt;/b&gt;, shrink them and save to folder called &lt;u&gt;packed&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_luRD3lsHwX4/TUpl1nkvYaI/AAAAAAAAASM/2kMmdIBHnNc/s1600/minifyjs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_luRD3lsHwX4/TUpl1nkvYaI/AAAAAAAAASM/2kMmdIBHnNc/s320/minifyjs.jpg" width="304" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You should write the path of &lt;b&gt;minify javascript tool&lt;/b&gt; in your project's &lt;u&gt;Build Events&lt;/u&gt; section of Visual Studio IDE. Please click to link below read more about how to implement the tool and solution into your project.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.technolatte.net/minifyjavascriptfiles/"&gt;http://code.technolatte.net/minifyjavascriptfiles/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5489616714748617176?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5489616714748617176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5489616714748617176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5489616714748617176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5489616714748617176'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/02/minify-javascript-tool-and-solution.html' title='Minify Javascript Tool and Solution'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_luRD3lsHwX4/TUpl1nkvYaI/AAAAAAAAASM/2kMmdIBHnNc/s72-c/minifyjs.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8041848541314875636</id><published>2011-01-04T14:26:00.001+01:00</published><updated>2011-08-17T23:20:19.012+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='technical debt'/><title type='text'>Technical Debt</title><content type='html'>Technical debt is a metaphor coined by Ward Cunningham. You can watch his&amp;nbsp;speech&amp;nbsp;in this &lt;a href="http://www.youtube.com/watch?v=pqeJFYwnkjE" target="_blank"&gt;video&lt;/a&gt;&amp;nbsp;. Technical debt is the kind of debt you borrow mostly when you choose "&lt;i&gt;quick and dirty way&lt;/i&gt;" to implement new functionality into your current project or weak design to build your application.&lt;br /&gt;&lt;br /&gt;Most probable you've encountered the dilemma which is "&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;b&gt;do it proper way&lt;/b&gt;&lt;/span&gt;" or "&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;b&gt;do it quick and dirty way&lt;/b&gt;&lt;/span&gt;".&amp;nbsp;If you decide latter you have debt. You borrow quality in order to buy time. &amp;nbsp;If you choose former you don't have debt but need more time to implement in future. This causes delay to roll out your project. It's double-edged sword.&lt;br /&gt;&lt;br /&gt;Having debt doesn't mean pernicious. In business, if you need to grow, you should take on loan with acceptable interest . It's the same in software development. Some people called Technical Mortgage in order to explain Technical Debt easily. If you want to have house, you accept mortgage which is really wise idea to buy your house if interest is reasonable. Otherwise you have to wait until you save enough money to have a new house. But it could take years. So, &lt;u&gt;Technical Debt can be used for leverage.&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;The problem here, you should know how to deal with your debt and its interest which is the sort of extra effort you have to do more in future development. If you cannot manage your debt, your loan with interest will be more and more. It means, you have to work for maintenance to make your product stable.&amp;nbsp;Soon or later, you will be bankrupt.&lt;br /&gt;&lt;br /&gt;You need to know take this control and prevent from being out of control. &amp;nbsp;If you can deal with the consequences you can choose to have Technical Debt.&lt;br /&gt;&lt;br /&gt;From the point of other view, Technical Debt term helps us conceptualize the common software development concept. The term is perfect explanation for not only technical staffs but also non-technical stakeholders. For instance, when you don't have enough time to finalize your project, you need to inform your client that the project will be delayed. So you can give two options to your client, "proper way" or "quick and dirty way". Of course, you client always tend to say "&lt;i&gt;quick and proper way&lt;/i&gt;". At this point, you can describe the situation by telling Technical Debt. It's meaningful for people in business. They can comprehend the situation better.&lt;br /&gt;&lt;br /&gt;In order to solve Technical Debt situation, you can classify your Technical Debt. Martin Fowler describes Technical Debt as a quadrant.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://martinfowler.com/bliki/images/techDebtQuadrant.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://martinfowler.com/bliki/images/techDebtQuadrant.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;For more information about the quadrant above you can read &lt;a href="http://martinfowler.com/bliki/TechnicalDebtQuadrant.html" target="_blank"&gt;TechnicalDebtQuadrant &lt;/a&gt;article written by Martin Fowler.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;On the other hand, according to Steve McConnell, here is the summary of kinds of the Technical Debt :&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;Non Debt&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Feature backlog, deferred features, cut features, etc. Not all incomplete work is debt. These aren't debt, because they don't require interest payments.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;Debt&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp;&amp;nbsp; I. Debt incurred &lt;b&gt;unintentionally&lt;/b&gt; due to low quality work&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp;&amp;nbsp; II. Debt incurred &lt;b&gt;intentionally&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;II.A. &lt;b&gt;Short-term &lt;/b&gt;debt, usually incurred reactively, for tactical reasons&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; II.A.1. Individually identifiable shortcuts (like a car loan)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; II.A.2. Numerous tiny shortcuts (like credit card debt)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;II.B. &lt;b&gt;Long-term&lt;/b&gt; debt, usually incurred proactively, for strategic reasons&lt;/div&gt;&lt;br /&gt;For more information you can read the whole &lt;a href="http://blogs.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx" target="_blank"&gt;article&lt;/a&gt;&amp;nbsp;about Technical Debt written by Steve McConnell.&lt;br /&gt;&lt;br /&gt;In order to cope with Technical Debt, you should take into account following advices :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When &amp;nbsp;you have Technical Debt, you should schedule discharge time.&lt;/li&gt;&lt;li&gt;Avoid unnecessary and excessive&amp;nbsp;Technical Debt.&lt;/li&gt;&lt;li&gt;Do not try to pay back by having new Technical Debt&lt;/li&gt;&lt;li&gt;Technical Debt is not the problem with not also developer but also people in business. Every staff assigned to the project should be responsible for paying back Technical Debt.&lt;/li&gt;&lt;li&gt;Classify your Technical Debts by using methods mentioned above.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Fix the issues (pay off your Technical Debt) which are scheduled to be solved before starting a new iteration&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8041848541314875636?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8041848541314875636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8041848541314875636' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8041848541314875636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8041848541314875636'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2011/01/technical-debt.html' title='Technical Debt'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4190390662534669837</id><published>2010-12-30T12:23:00.001+01:00</published><updated>2010-12-30T12:24:20.157+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Dude'/><category scheme='http://www.blogger.com/atom/ns#' term='Network Monitor'/><title type='text'>How to Add Probe as Function Type in The Dude</title><content type='html'>The Dude network monitor is powerful and functional tool. Moreover it's freeware. You can find information and download link on link written below :&lt;br /&gt;&lt;a href="http://www.mikrotik.com/thedude.php"&gt;http://www.mikrotik.com/thedude.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In this blog entry I won't explain how The Dude works. Instead of this, I will tell you how you can add custom function into The Dude and assign it to any device.&lt;br /&gt;&lt;br /&gt;Although there are lots of predefined services in The Dude such as ping, monitor memory and disk size in use &amp;nbsp; and processor usage and so on, you may need to monitor something difference values. In my case was to monitor whether our devices &amp;nbsp;registered to our SIP server and are online. If you are the person who is using The Dude you probably noticed there is lack of documentation. I struggled with implementing custom service into The Dude. Finally I found out the solution. Here you can read how I did.&lt;br /&gt;&lt;br /&gt;Let's start to add custom function. Please do following steps&amp;nbsp;respectively.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Click to &lt;i&gt;Probes &lt;/i&gt;on the left of The Dude&lt;/li&gt;&lt;li&gt;Click to + icon to add new probe in Probe window&lt;/li&gt;&lt;li&gt;Select &lt;i&gt;Function&lt;/i&gt; in Type list box&lt;/li&gt;&lt;li&gt;You can give a unique name to your new probe&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;After doing above, in my case, I wrote the following statements :&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f9cb9c;"&gt;&lt;b&gt;Available :&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #f9cb9c;"&gt; if(string_size(device_property("CustomField1")) &amp;gt; 0, 1,0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f9cb9c;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;&lt;b&gt;Error :&lt;/b&gt; if(array_element(execute("GetOnlineStatus.exe", device_property("CustomField1"), "C:\Tasks",30),0)=1,"","error")&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For this example, I use CustomField1 as a parameter passed to GetOnlineStatus.exe. In my case, CustomField1 represents a SipNumber in our SIP Environment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;execute :&lt;/b&gt; This is the predefined function of The Dude used to perform executable file which is GetOnlineStatus.exe. execute function takes 4 parameters. First is&amp;nbsp;mandatory, others are optional.&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;First is the executable file.&lt;/li&gt;&lt;li&gt;Second is the parameter passed to the executable file.&lt;/li&gt;&lt;li&gt;Third is the path of the executable file.&lt;/li&gt;&lt;li&gt;Fourth is the timeout value which represents second.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;device_property :&lt;/b&gt; predefined function which is used to retrieve custom field of the device.&lt;/div&gt;&lt;div&gt;&lt;b&gt;array_element :&lt;/b&gt; It's used with index value in order to retrieve return data from the executable file. In this example index is zero (0). It means I retrieve the first element of the return data.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;b&gt;if:&lt;/b&gt; If is used to evaluate return value. In this example, if device is online return value is 1 otherwise is zero(0). &lt;span class="Apple-style-span" style="background-color: #6fa8dc;"&gt;If your statement is true, you should write empty string ("")&lt;/span&gt;, if it's false you are free to write any output. In this case I wrote "error".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_luRD3lsHwX4/TRxZvxiEBhI/AAAAAAAAASA/wF-UGCqRIww/s1600/TheDude_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="280" src="http://2.bp.blogspot.com/_luRD3lsHwX4/TRxZvxiEBhI/AAAAAAAAASA/wF-UGCqRIww/s400/TheDude_1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to Assign Custom Function To Device As a Service&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Now, it's time to add new service. In order to do that, please right click device you want to monitor and choose &lt;i&gt;settings&lt;/i&gt;. On device settings window, select &lt;i&gt;Services&lt;/i&gt; tab and click to + icon to add new service.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;On General tab, find the function you created on &lt;i&gt;Probe &lt;/i&gt;section. Afterward, you can configure &lt;u&gt;interval time&lt;/u&gt; &lt;u&gt;timeout&lt;/u&gt; and &lt;u&gt;down count&lt;/u&gt; settings. In this example screenshot below, Interval time is 1 minute. You can see my settings I applied to this service.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_luRD3lsHwX4/TRxkvuMUvrI/AAAAAAAAASE/55bXE_tg0i8/s1600/TheDude_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="280" src="http://3.bp.blogspot.com/_luRD3lsHwX4/TRxkvuMUvrI/AAAAAAAAASE/55bXE_tg0i8/s400/TheDude_2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, click to apply all changes then click to Ok button to close the current window.&amp;nbsp;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4190390662534669837?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4190390662534669837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4190390662534669837' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4190390662534669837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4190390662534669837'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/12/how-to-add-probe-as-function-type-in.html' title='How to Add Probe as Function Type in The Dude'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_luRD3lsHwX4/TRxZvxiEBhI/AAAAAAAAASA/wF-UGCqRIww/s72-c/TheDude_1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2790981293622791678</id><published>2010-12-19T22:28:00.000+01:00</published><updated>2010-12-19T22:28:09.340+01:00</updated><title type='text'>Do not Touch that Code in Production Environment</title><content type='html'>Most probably, you experienced this case I mentioned in this blog. You published your code into production stage. After a while, one of the test team members realized that there was something wrong. Your first reaction is "&lt;i&gt;I know this problem, I can&amp;nbsp;&lt;/i&gt;&lt;i&gt;easily&amp;nbsp;&lt;/i&gt;&lt;i&gt;fix it in a minute&lt;/i&gt;".&lt;br /&gt;&lt;br /&gt;If you are tend to changing the code in production stage, it seems really easy solution, you're in a wrong way. You can cause another big problem. You never know this. Even if how easy, you should first change the code in development stage, then you should &amp;nbsp;roll out the code again. Otherwise, your code in production stage and development stage is never same.&lt;br /&gt;&lt;br /&gt;If one of your colleague working on your code that was changed on production stage needs to maintain it, most likely the code in production stage will be override, then same problem you had will be appeared again.&lt;br /&gt;&lt;br /&gt;Especially this case happens mostly in web-based development environment. Some part of ASP.NET applications code is written in HTML section. This code is script-code and not compiled. So you can easily modify it without generating dll of your project. It's not the case for ASP.NET. It can happen same thing for all script-language such as PHP or Javascript.&lt;br /&gt;&lt;br /&gt;In order to prevent this case, developers shouldn't &amp;nbsp;have right to access production server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2790981293622791678?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2790981293622791678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2790981293622791678' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2790981293622791678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2790981293622791678'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/12/do-not-touch-that-code-in-production.html' title='Do not Touch that Code in Production Environment'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4066044701443314927</id><published>2010-11-18T09:54:00.002+01:00</published><updated>2010-11-25T23:17:09.276+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Kindle'/><title type='text'>Amazon Kindle User-Agent</title><content type='html'>Finally&amp;nbsp;I've&amp;nbsp;got &lt;a href="http://www.amazon.com/Kindle-Wireless-Reader-Wifi-Graphite/dp/B003DZ1Y8Q"&gt;Amazon Kindle 3&lt;/a&gt;. I chose Kindle among the other e-book reader because of that i can enter input and it's thin and light. Apart from reading books you can surf on internet or listen to MP3. These are experimental features. It means it's not the exact features of Kindle. Amazon can remove these or stop their services.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.cennydd.co.uk/wordpress/wp-content/uploads/2010/10/amazon-kindle-3-xl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="197" src="http://www.cennydd.co.uk/wordpress/wp-content/uploads/2010/10/amazon-kindle-3-xl.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;As a software engineer, I wanted to browse by using experimental web browser application. Although it's not same as web browser in PC or MAC, I never expected standard web browser performance, web pages showed up clearly with images. For instance, I could read news from New York Times or Harvard Business Review without any big obstacles. But anyway, for these web sites are not compatible with Kindle screen which is 600x800 resolution. I hope they will design special web pages for Kindle. Because most of web pages' width &amp;nbsp;are too long for Kindle screen. You need to zoom in to read it easily.&lt;br /&gt;&lt;br /&gt;If you need to detect user request coming from any Kindle web browser to display your Kindle friendly web pages, i'll write down Kindle User-Agent string :&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600x800; rotate)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This user-agent is for only Kindle 3. Most probably, for other Kindle versions, UA string must be :&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #d9ead3;"&gt;Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/2.0 (screen 600x800; rotate)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #d0e0e3;"&gt;Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/1.0 (screen 600x800; rotate)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4066044701443314927?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4066044701443314927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4066044701443314927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4066044701443314927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4066044701443314927'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/11/amazon-kindle-user-agent.html' title='Amazon Kindle User-Agent'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2222497461844477839</id><published>2010-11-05T14:03:00.000+01:00</published><updated>2010-11-05T14:03:23.643+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='x.509'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='wcf'/><category scheme='http://www.blogger.com/atom/ns#' term='certificates'/><title type='text'>How to Create X.509 Certificates</title><content type='html'>&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;When developing a WCF Service that uses X.509 certificates to provide client authentication and message security, you need to work with temporary certificates because of that production certificates are expensive. For this purpose i will explain how you can create X.509 certificates.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;First of all, you need two applications :&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;makecert.exe&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;certmgr.exe&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;You can install these two applications by installing Windows SDK, which you can download from&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;a href="http://go.microsoft.com/fwlink/?linkid=84091" style="color: #1364c4; text-decoration: underline;" target="_blank"&gt;http://go.microsoft.com/fwlink/?linkid=84091&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;I'll give you little trick. You don't need to install whole SDK. The only thing you can select is &lt;b&gt;Tools &lt;/b&gt;in &lt;b&gt;Windows Native Code Development &lt;/b&gt;section.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_luRD3lsHwX4/TMiE6WRKisI/AAAAAAAAAR4/LW9CpG7MJts/s1600/installcertificatetools.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="278" src="http://1.bp.blogspot.com/_luRD3lsHwX4/TMiE6WRKisI/AAAAAAAAAR4/LW9CpG7MJts/s400/installcertificatetools.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;After installing Windows SDK, find the folder you install. For instance mine is&amp;nbsp;&lt;i&gt;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin &lt;/i&gt;&amp;nbsp;or click &lt;i&gt;Start / Programs / Microsoft Windows SDK v7.1 /&lt;/i&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Windows SDK 7.1 Command Prompt&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;When you open Command Prompt, write these two statement and execute them respectively.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=localhost -sky exchange -pe&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;certmgr.exe -add -r LocalMachine -s My -c -n localhost -r CurrentUser -s TrustedPeople&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;First statement is used to create certificate. Second is for moving created certificate to TrustedPeople folder.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;If you want to clean up certificates you created before, please use these commands below :&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;certmgr.exe -del -r CurrentUser -s TrustedPeople -c -n &amp;nbsp;localhost&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="background-color: #b6d7a8;"&gt;certmgr.exe -del -r LocalMachine -s My -c -n localhost&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;For detailed explanation of various attributes specified in the makecert.exe and certmgr.exe, check this link;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bfsktky3(v=VS.100).aspx"&gt;http://msdn.microsoft.com/en-us/library/bfsktky3(v=VS.100).aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2222497461844477839?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2222497461844477839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2222497461844477839' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2222497461844477839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2222497461844477839'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/11/how-to-create-x509-certificates.html' title='How to Create X.509 Certificates'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_luRD3lsHwX4/TMiE6WRKisI/AAAAAAAAAR4/LW9CpG7MJts/s72-c/installcertificatetools.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8556113764905135502</id><published>2010-11-01T21:26:00.000+01:00</published><updated>2010-11-01T21:26:17.796+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firewall'/><category scheme='http://www.blogger.com/atom/ns#' term='wcf'/><title type='text'>Common WCF Errors and Solutions - 5</title><content type='html'>&lt;b&gt;Problem:&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;tcp error code 10061 no connection could be made because the target machine actively refused it wcf&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;I assume that you host WCF with net.tcp binding then you've the problem written above. The problem is about firewall. You have to give permission to the port used with net.tcp.&lt;br /&gt;&lt;br /&gt;For example: Your service uses&amp;nbsp;&lt;span class="Apple-style-span" style="color: #990000;"&gt;net.tcp://localhost:808/Service. &lt;/span&gt;For this address you need to modify your server's port number. I'll explain how you can change and give permission to specified port number by using Windows Server 2008 environment.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Open &lt;b&gt;Control Panel&lt;/b&gt; and click &lt;b&gt;Windows Firewall&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Click &lt;b&gt;Change Settings&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Open &lt;b&gt;Exceptions&lt;/b&gt; tab&lt;/li&gt;&lt;li&gt;Click the &lt;b&gt;Add Port&lt;/b&gt; button&lt;/li&gt;&lt;li&gt;Give a name like WCF.TCP&lt;/li&gt;&lt;li&gt;Write the &lt;b&gt;port number&lt;/b&gt; which is used in net.tcp address. for example : 808&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_luRD3lsHwX4/TMFqYPCIT8I/AAAAAAAAAR0/D_voD1Xx4FE/s1600/activelyrefused.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="283" src="http://4.bp.blogspot.com/_luRD3lsHwX4/TMFqYPCIT8I/AAAAAAAAAR0/D_voD1Xx4FE/s400/activelyrefused.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That's it. It's easy and still secure. You don't need to turn off your firewall. But please be sure that there can be another firewall program&amp;nbsp;installed&amp;nbsp;in your server. You have to configure it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8556113764905135502?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8556113764905135502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8556113764905135502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8556113764905135502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8556113764905135502'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/11/common-wcf-errors-and-solutions-5.html' title='Common WCF Errors and Solutions - 5'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_luRD3lsHwX4/TMFqYPCIT8I/AAAAAAAAAR0/D_voD1Xx4FE/s72-c/activelyrefused.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7703209599194912469</id><published>2010-10-29T21:38:00.001+02:00</published><updated>2010-10-29T21:40:32.544+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wcf. msmq'/><title type='text'>Common WCF Errors and Solutions - 4</title><content type='html'>&lt;b&gt;Problem :&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;Unable to load DLL 'mqrt.dll'&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Solution :&lt;/b&gt;&lt;br /&gt;If you decide to use msmq binding with WCF. But you are in trouble with the problem written above. The problem is that you forgot to install msmq which is an optional component.&lt;br /&gt;&lt;br /&gt;The only thing you should do is to install &lt;span class="Apple-style-span" style="background-color: #ffd966;"&gt;Message Queuing components&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_luRD3lsHwX4/TMFig8acdsI/AAAAAAAAARw/YwOkg1Gu1i0/s1600/message+queuing.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://4.bp.blogspot.com/_luRD3lsHwX4/TMFig8acdsI/AAAAAAAAARw/YwOkg1Gu1i0/s400/message+queuing.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7703209599194912469?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7703209599194912469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7703209599194912469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7703209599194912469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7703209599194912469'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/10/common-wcf-errors-and-solutions-4.html' title='Common WCF Errors and Solutions - 4'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_luRD3lsHwX4/TMFig8acdsI/AAAAAAAAARw/YwOkg1Gu1i0/s72-c/message+queuing.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4663114775901933111</id><published>2010-10-26T12:44:00.000+02:00</published><updated>2010-10-26T12:44:33.761+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wcf'/><title type='text'>Common WCF Errors and Solutions - 3</title><content type='html'>&lt;b&gt;Problem:&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Cannot load the X.509 certificate identity specified in the configuration&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Solution :&lt;/b&gt;&lt;br /&gt;I assume that you have either Windows 7 or Windows Server 2008 operation system with IIS 7+ in order to host WCF services, suddenly you encounter the problem. Luckily, i have a solution for you.&lt;br /&gt;&lt;br /&gt;To resolve this problem you should add &lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;dns &lt;/span&gt;&lt;/b&gt;element into web.config file which is placed in your service folder. Please check this sample settings excerpted from a web.config.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;endpoint address="ws" binding="wsHttpBinding" contract="EvalServiceLibrary.IEvalService"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;listenUriMode="Explicit"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;identity&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: #ffd966;"&gt;&amp;lt;dns value="localhost" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #ffd966;"&gt; &lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;  &lt;br /&gt;&amp;lt;certificateReference storeName="My" storeLocation="LocalMachine"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;x509FindType="FindBySubjectDistinguishedName" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/identity&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/endpoint&amp;gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4663114775901933111?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4663114775901933111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4663114775901933111' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4663114775901933111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4663114775901933111'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/10/common-wcf-errors-and-solutions-3.html' title='Common WCF Errors and Solutions - 3'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1177118081921755438</id><published>2010-10-25T13:54:00.000+02:00</published><updated>2010-10-25T13:54:37.861+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iis7'/><category scheme='http://www.blogger.com/atom/ns#' term='wcf'/><title type='text'>Common WCF Errors and Solutions - 2</title><content type='html'>&lt;b&gt;Problem:&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Solution :&lt;/b&gt;&lt;br /&gt;I assume that you have either Windows 7 or Windows Server 2008 operation system with IIS 7+ in order to host WCF services, suddenly you encounter the problem. Luckily, i have a solution for you.&lt;br /&gt;&lt;br /&gt;In order to resolve this problem you should use &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;aspnet_regiis.exe&lt;/span&gt; called ASP.NET IIS Registration Tool which is placed in&amp;nbsp;&lt;i&gt;C:\Windows\Microsoft.NET\Framework\v4.0.30319&lt;/i&gt;. This path can be diverse due to your .NET Framework or operating system installation.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Open Command Prompt&lt;/li&gt;&lt;li&gt;Find&amp;nbsp;&lt;i&gt;C:\Windows\Microsoft.NET\Framework\v4.0.30319 &lt;/i&gt;path&lt;/li&gt;&lt;li&gt;Run aspnet_regiis.exe -iru&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;It's accomplished. Now, it's the time to see the result.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1177118081921755438?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1177118081921755438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1177118081921755438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1177118081921755438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1177118081921755438'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/10/common-wcf-errors-and-solutions-2.html' title='Common WCF Errors and Solutions - 2'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2187546735033080928</id><published>2010-10-22T11:20:00.001+02:00</published><updated>2010-10-22T11:21:17.580+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iis7'/><category scheme='http://www.blogger.com/atom/ns#' term='wcf'/><title type='text'>Common WCF Errors and Solutions - 1</title><content type='html'>&lt;b&gt;Problem :&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;The protocol 'net.tcp' is not supported.&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Solution : &lt;/b&gt;&lt;br /&gt;If you try to expose your service from IIS 5/6, i have to say it's not possible. There is nothing to do to overcome with IIS 5/6. You have to use IIS 7+.&lt;br /&gt;Although you see the error in WCF service run by IIS 7+, you have to install these following components :&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;a href="http://2.bp.blogspot.com/_luRD3lsHwX4/TMFScwUZvmI/AAAAAAAAARs/E29FuBgxin4/s1600/Windows+Process+Activation+Service.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/_luRD3lsHwX4/TMFScwUZvmI/AAAAAAAAARs/E29FuBgxin4/s320/Windows+Process+Activation+Service.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Windows Process Activation Service&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Process Model&lt;/li&gt;&lt;li&gt;.NET Environment&lt;/li&gt;&lt;li&gt;Configuration APIs&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;a href="http://3.bp.blogspot.com/_luRD3lsHwX4/TMFScZwitPI/AAAAAAAAARo/SafsyNpP_k4/s1600/.net+framework+3.0+features.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="218" src="http://3.bp.blogspot.com/_luRD3lsHwX4/TMFScZwitPI/AAAAAAAAARo/SafsyNpP_k4/s320/.net+framework+3.0+features.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;.NET Framework 3.0 Features&lt;/li&gt;&lt;ul&gt;&lt;li&gt;.NET Framework 3.0&lt;/li&gt;&lt;li&gt;WCF Activation&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;After installing these components written above, the next step is to make net.tcp enabled. The Default Web Site on your IIS must be bound to a net.tcp port. In this step, you have to modify &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;applicationHost.config&lt;/span&gt; file &amp;nbsp;which is in &lt;i&gt;C:\Windows\System32\inetsrv\config\&lt;/i&gt;&amp;nbsp;by using &lt;span class="Apple-style-span" style="color: #990000;"&gt;appcmd.exe&lt;/span&gt; in&amp;nbsp;&lt;i&gt;C:\Windows\System32\inetsrv\&amp;nbsp;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;I highly recommend to backup your applicationHost.config file. Before pass to the next step.&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;Open the command prompt and go to&amp;nbsp;&lt;i&gt;C:\Windows\System32\inetsrv\config\ &lt;/i&gt;path and run the following 4 commands :&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp', bindingInformation='808:*']&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.pipe', bindingInformation='*']&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.msmq', bindingInformation='localhost']&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #fff2cc;"&gt;appcmd.exe set app "Default Web Site/&amp;lt; your wcf application &amp;gt;" /enabledProtocols:http,net.pipe,net.tcp,net.msmq&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, the problem has been solved.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2187546735033080928?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2187546735033080928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2187546735033080928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2187546735033080928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2187546735033080928'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/10/common-wcf-errors-and-solutions-1.html' title='Common WCF Errors and Solutions - 1'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_luRD3lsHwX4/TMFScwUZvmI/AAAAAAAAARs/E29FuBgxin4/s72-c/Windows+Process+Activation+Service.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2918870569534821026</id><published>2010-10-15T15:01:00.003+02:00</published><updated>2010-10-15T15:13:28.272+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><title type='text'>JSON Validator</title><content type='html'>Certainly, internet has lots of source for people who is involved in software development. I came across nice tool to validate JSON. I'm surprised how i couldn't see it. Here is the link i mentioned.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jsonlint.com/"&gt;http://www.jsonlint.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2918870569534821026?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2918870569534821026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2918870569534821026' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2918870569534821026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2918870569534821026'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/10/json-validator.html' title='JSON Validator'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8353203599167716776</id><published>2010-09-27T20:53:00.000+02:00</published><updated>2010-09-27T20:53:35.880+02:00</updated><title type='text'>Windows IP Configuration - Reset Internet Protocol</title><content type='html'>Today, i've got a problem with my network settings of my pc. When i wrote &lt;u&gt;ipconfig &lt;/u&gt;at the command prompt, no ip information is returned. Only "&lt;span class="Apple-style-span" style="color: #990000;"&gt;Windows IP configuration&lt;/span&gt;".&lt;br /&gt;&lt;br /&gt;It's annoying issue. But finally, i've got the solution that i wanna share with you. I reset TCP/IP by using NetShell utility. In order to solve the problem please follow these steps written below;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Click &lt;b&gt;Start &lt;/b&gt;and then click &lt;b&gt;Run&lt;/b&gt;. Type &lt;b&gt;Cmd&lt;/b&gt; on the box then press &lt;b&gt;ENTER &lt;/b&gt;to open command prompt.&lt;/li&gt;&lt;li&gt;At the command prompt type the following command: &lt;b&gt;netsh int ip reset c:\resetlog.txt&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Reboot your computer.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;When you write &amp;nbsp;reset TCP/IP command, two registry keys that are used by TCP/IP are written. This is the same result as removing and reinstalling the protocol.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For more information please refer to following link &amp;nbsp;&lt;a href="http://support.microsoft.com/kb/299357"&gt;http://support.microsoft.com/kb/299357&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8353203599167716776?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8353203599167716776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8353203599167716776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8353203599167716776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8353203599167716776'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/09/windows-ip-configuration-reset-internet.html' title='Windows IP Configuration - Reset Internet Protocol'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8608783323325719554</id><published>2010-09-26T22:07:00.000+02:00</published><updated>2010-09-26T22:07:23.679+02:00</updated><title type='text'>Microsoft Network Monitor</title><content type='html'>Nowadays, i have needed to analyze network traffic. While i&amp;nbsp;goggled, i came across &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Microsoft Network Monitor&lt;/span&gt; which is a protocol analyzer. With this tool you can capture all network traffic. I found it very useful. Also it's free.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_luRD3lsHwX4/TJ-nsz0_ugI/AAAAAAAAARk/qhMwYdUmmAU/s1600/MicrospftNetworkMonitor.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="205" src="http://2.bp.blogspot.com/_luRD3lsHwX4/TJ-nsz0_ugI/AAAAAAAAARk/qhMwYdUmmAU/s320/MicrospftNetworkMonitor.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can download from this link written below;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=983b941d-06cb-4658-b7f6-3088333d062f"&gt;http://www.microsoft.com/downloads/en/details.aspx?FamilyID=983b941d-06cb-4658-b7f6-3088333d062f&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8608783323325719554?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8608783323325719554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8608783323325719554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8608783323325719554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8608783323325719554'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/09/microsoft-network-monitor.html' title='Microsoft Network Monitor'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_luRD3lsHwX4/TJ-nsz0_ugI/AAAAAAAAARk/qhMwYdUmmAU/s72-c/MicrospftNetworkMonitor.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5609284750780485723</id><published>2010-08-12T17:23:00.001+02:00</published><updated>2011-08-01T13:42:51.531+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='test driven development'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><category scheme='http://www.blogger.com/atom/ns#' term='mock and stub'/><category scheme='http://www.blogger.com/atom/ns#' term='rhino'/><category scheme='http://www.blogger.com/atom/ns#' term='nunit'/><title type='text'>The Difference between Mocks and Stubs</title><content type='html'>First off, i'll write some definitions for better off understanding differences between mocks and stubs.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;State-based Testing : &lt;/b&gt;State-based testing is also known as &lt;i&gt;state verification&lt;/i&gt;. The purpose of it is to exercise method(s) of an class under test whether the method(s) worked correctly by asserting the expected state of the class. For this, fake objects which are called stubs are used.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Stub : &lt;/b&gt;Stub is actually a fake object which is used to imitate a real object in order to test some state verifications.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Behavioral Testing : &lt;/b&gt;Some people use &lt;i&gt;interaction based testing&lt;/i&gt; or &lt;i&gt;action-driven testing &lt;/i&gt;instead behavioral testing. For performing behavioral testing, we use mock object which is fake object like stub.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Mock : &lt;/b&gt;Mock is actually fake object which is used to fake the real domain object for behavioral testing. In contrast to stub object, mock object can fail.&lt;br /&gt;&lt;br /&gt;I'll write an simple example to perceive the implications of differences between stub and mock objects. Following code sample shows the real domain code. &lt;span class="Apple-style-span" style="color: #b45f06;"&gt;Login()&lt;/span&gt; method in &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;LoginManager&lt;/span&gt; class is used to check whether email and password matches. If matched, write log message and set &lt;span class="Apple-style-span" style="color: #990000;"&gt;IsSaved &lt;/span&gt;property to &lt;u&gt;true&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Creating Real Domain Classes and Interfaces&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IUser&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; Id { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; Email { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; Password { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; User : IUser&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Email { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Password { get; set; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IUserRepository&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    IUser GetUser(&lt;span class="kwrd"&gt;string&lt;/span&gt; email, &lt;span class="kwrd"&gt;string&lt;/span&gt; password);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ILogger&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Save(&lt;span class="kwrd"&gt;string&lt;/span&gt; message);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    &lt;span class="kwrd"&gt;bool&lt;/span&gt; IsSaved { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LoginManager&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; IUserRepository repository;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; ILogger logger;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; LoginManager(IUserRepository repository, ILogger logger)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.repository = repository;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.logger = logger;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Login(&lt;span class="kwrd"&gt;string&lt;/span&gt; email, &lt;span class="kwrd"&gt;string&lt;/span&gt; password)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;        IUser user = &lt;span class="kwrd"&gt;this&lt;/span&gt;.repository.GetUser(email, password);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.logger.Save(user.Name + &lt;span class="str"&gt;" has been logged in"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.logger.IsSaved = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Writing Unit Testing with Stub Object&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First of all, we should decide what we test. We'll make state-based testing by checking the &lt;span class="Apple-style-span" style="color: #990000;"&gt;IsSaved &lt;/span&gt;property of the &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Logger &lt;/span&gt;class. I'll use &lt;b&gt;Rhino Mocks&lt;/b&gt; which you can download from&amp;nbsp;&lt;a href="http://www.ayende.com/projects/rhino-mocks.aspx"&gt;http://www.ayende.com/projects/rhino-mocks.aspx&lt;/a&gt;&amp;nbsp;.&lt;br /&gt;&lt;br /&gt;I'll follow the following steps to write test code:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Create instance of stub objects&lt;/li&gt;&lt;li&gt;Set expectations&lt;/li&gt;&lt;li&gt;Create a real domain object with stub objects&lt;/li&gt;&lt;li&gt;Assert it&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;[Test]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Login_EmailandPasswordIsCorrect_LogIsSaved()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="rem"&gt;// create stub objects&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    var repository = MockRepository.GenerateStub&amp;lt;IUserRepository&amp;gt;();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    var logger = MockRepository.GenerateStub&amp;lt;ILogger&amp;gt;();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="rem"&gt;// set expectations&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    repository.Stub(x =&amp;gt; x.GetUser(Arg&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;.Is.Anything, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        Arg&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;.Is.Anything)).Return(&lt;span class="kwrd"&gt;new&lt;/span&gt; User());&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="rem"&gt;// create real domain object&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    LoginManager manager = &lt;span class="kwrd"&gt;new&lt;/span&gt; LoginManager(repository, logger);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    manager .Login(&lt;span class="str"&gt;"test"&lt;/span&gt;,&lt;span class="str"&gt;"password"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="rem"&gt;// assert it&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    Assert.AreEqual(&lt;span class="kwrd"&gt;true&lt;/span&gt;, logger.IsSaved);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;On line 5 and 6, I created two fake objects which are stubs called &lt;b&gt;repository &lt;/b&gt;and &lt;b&gt;logger&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;On line 9, I used Stub method to set expectation with constraints. &lt;span class="Apple-style-span" style="color: #b45f06;"&gt;GetUser()&lt;/span&gt; method can only receive two string arguments and returns&amp;nbsp;&lt;span class="Apple-style-span" style="color: #990000;"&gt;User &lt;/span&gt;object.&lt;br /&gt;&lt;br /&gt;On line 13, I created an instance of a class which is under test and passed two stub objects into its constructor. Then i invoked &lt;span class="Apple-style-span" style="color: #b45f06;"&gt;Login()&lt;/span&gt; method with "dummy" arguments. If &lt;span class="Apple-style-span" style="color: #b45f06;"&gt;Login()&lt;/span&gt; method worked correctly, &lt;span class="Apple-style-span" style="color: #990000;"&gt;IsSaved &lt;/span&gt;property of &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Logger &lt;/span&gt;class must be set "&lt;u&gt;true&lt;/u&gt;".&lt;br /&gt;&lt;br /&gt;Finally, line 17th, i asserted that value of &lt;span class="Apple-style-span" style="color: #990000;"&gt;IsSaved&lt;/span&gt; property must be &lt;u&gt;true&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;It's nice to say that, I can test the method before implementing production code. Even if i haven't build &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Logger &lt;/span&gt;and &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;UserRepository &lt;/span&gt;classes. After testing all cases, if tests pass, there is nothing to stop me to write production code.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Writing Unit Testing with Mock Object&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I want to test&lt;b&gt; behavioral verification&lt;/b&gt;. Therefore I'll use mock object. My purpose is to be sure that &lt;span class="Apple-style-span" style="color: #b45f06;"&gt;Save()&lt;/span&gt; method in &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Logger &lt;/span&gt;class is invoked with correct arguments.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;[Test]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Login_EmailandPasswordIsCorrect_LogSaveMethodRunsCorrectly()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="rem"&gt;// create stub and mock objects&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    var repository = MockRepository.GenerateStub&amp;lt;IUserRepository&amp;gt;();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    var user = MockRepository.GenerateMock&amp;lt;IUser&amp;gt;();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    var logger = MockRepository.GenerateMock&amp;lt;ILogger&amp;gt;();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="rem"&gt;// set expectations&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    user.Expect(x =&amp;gt; x.Id).Return(1);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    user.Expect(x =&amp;gt; x.Name).Return(&lt;span class="str"&gt;"serkan"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    user.Expect(x =&amp;gt; x.Email).Return(&lt;span class="str"&gt;"test@technolatte.net"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    user.Expect(x =&amp;gt; x.Password).Return(&lt;span class="str"&gt;"123456"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    repository.Stub(x =&amp;gt; x.GetUser(Arg&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;.Is.Anything, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        Arg&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;.Is.Anything)).Return(user);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    logger.Expect(x =&amp;gt; x.Save(&lt;span class="str"&gt;"serkan has been logged in"&lt;/span&gt;));&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="rem"&gt;// create real domain object&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    LoginManager manager = &lt;span class="kwrd"&gt;new&lt;/span&gt; LoginManager(repository, logger);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    manager.Login(&lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty, &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;span class="rem"&gt;// verify mock object&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    logger.VerifyAllExpectations();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Line 6th and 7th, I created two mock objects and line 5th i created one stub object.&lt;br /&gt;&lt;br /&gt;I set mock objects with expected values.&lt;br /&gt;&lt;br /&gt;On line 17, I used &lt;span class="Apple-style-span" style="color: #b45f06;"&gt;Expect()&lt;/span&gt; method to assume that &lt;span class="Apple-style-span" style="color: #b45f06;"&gt;Save()&lt;/span&gt; method of &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Logger &lt;/span&gt;class would be invoked with string argument which is equal to "&lt;i&gt;serkan has been logged in&lt;/i&gt;".&lt;br /&gt;&lt;br /&gt;Line 24th, i verified all expectations.&lt;br /&gt;&lt;br /&gt;It's useless and less efficiency to write unit testing without knowing the differences between mock and stub objects. .&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Stub can't fail test but mocks can.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Stub is used for state-based testing, mock is used for behavioral testing.&lt;/li&gt;&lt;li&gt;Mock objects keep the history of communication which will be verified later.&lt;/li&gt;&lt;li&gt;The mock object is covered by a specification of expectation for the calls it’s expected to receive. Stub contains of  preserved responses to requests that are sent during the test process.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Every fake object you create is stub by default unless if you want to test it. Otherwise it's called mock. If you verify calls against it, it's a mock, otherwise it's a stub.&lt;br /&gt;&lt;br /&gt;Finally, I suggest the article written by Martin Fowler on his own web site about distinction of mock and stub to understand better what the differences are.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5609284750780485723?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5609284750780485723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5609284750780485723' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5609284750780485723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5609284750780485723'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/08/difference-between-mocks-and-stubs.html' title='The Difference between Mocks and Stubs'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-6696266843201345889</id><published>2010-08-06T09:29:00.004+02:00</published><updated>2010-08-08T09:34:49.353+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='test driven development'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><category scheme='http://www.blogger.com/atom/ns#' term='mock and stub'/><category scheme='http://www.blogger.com/atom/ns#' term='nunit'/><title type='text'>How to Create Fake Objects Manually</title><content type='html'>In order to understand xUnit frameworks, it'd be nice starting point to write your own fake objects to help yourself &amp;nbsp;write your test code by using "&lt;b&gt;isolation framework&lt;/b&gt;". I said "&lt;b&gt;fake&lt;/b&gt;" objects instead of mock or stub. Because your fake objects can act as a stub or mock depends on context of the unit test. I mean, same fake object can be stub or mock.&lt;br /&gt;&lt;br /&gt;Every unit test you will write you don't need to use mock or stub. You can create instance of a object that is under test code than assert the method with expected and current result.&lt;br /&gt;&lt;br /&gt;But sometimes, you need to touch external tools, devices or services in your production code. For instance you need to test sending email or changing speaker volume. Although it's possible to use concrete object to test your code, this way is not recommended. Because, it's take too much to write your test code and it's easily fragile. The point is you are able to test your code without touching external environment such as web services, email server or 3rd party tools.&lt;br /&gt;&lt;br /&gt;Here is our requirements:&lt;br /&gt;&lt;i&gt;You are able to change the speaker volume if value is greater than zero.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Let's make a simple class structure which we will test. We have a &lt;span class="Apple-style-span" style="color: #45818e;"&gt;&lt;b&gt;DeviceManager &lt;/b&gt;&lt;/span&gt;class which handle all devices such as speaker or microphone. Speaker class which is inherited by &lt;span class="Apple-style-span" style="color: #45818e;"&gt;ISpeaker&lt;/span&gt; interface is used to handle volume of speaker.&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DeviceManager&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; ISpeaker speaker;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; DeviceManager(ISpeaker speaker)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.speaker = speaker;    &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ChangeSpeakerVolume(&lt;span class="kwrd"&gt;int&lt;/span&gt; volume)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (volume &amp;gt; 0)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            speaker.ChangeVolume(volume);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ISpeaker&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; ChangeVolume(&lt;span class="kwrd"&gt;int&lt;/span&gt; volume);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Speaker : ISpeaker&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ChangeVolume(&lt;span class="kwrd"&gt;int&lt;/span&gt; volume)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        &lt;span class="rem"&gt;// we don't care how to touch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        &lt;span class="rem"&gt;// the hardware of your computer and change the volume&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Before writing test code, there are some widely accepted rules to make test codes more readable and maintainable. These rules are about naming conventions.&lt;br /&gt;&lt;br /&gt;For each test method's name should give an idea to developers what is tested. So, test method should contains of :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Method name, you want to test , in under test class&lt;/li&gt;&lt;li&gt;The conditions of testing&lt;/li&gt;&lt;li&gt;Expected&amp;nbsp;behavior&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;[&lt;b&gt;MethodName&lt;/b&gt;]_[&lt;b&gt;Conditions&lt;/b&gt;]_[&lt;b&gt;ExpectedBehavior&lt;/b&gt;]&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; NUnit.Framework;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;[TestFixture]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DeviceManagerTests&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;[Test]&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ChangeSpeakerVolume_VolumeIsGreaterThanZero_Success()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="rem"&gt;// create our fake object&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    FakeSpeaker fakeSpeaker = &lt;span class="kwrd"&gt;new&lt;/span&gt; FakeSpeaker();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="rem"&gt;// here our fake object acts as a mock object.&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="rem"&gt;// because our test aim is behavioral test. &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="rem"&gt;// i mean, we want to be sure that&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="rem"&gt;// ChangeSpeakerVolume method is performed.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; expectedVolume = 50;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="rem"&gt;// create instance of under test class&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    DeviceManager device = &lt;span class="kwrd"&gt;new&lt;/span&gt; DeviceManager(fakeSpeaker);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    device.ChangeSpeakerVolume(expectedVolume);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    Assert.AreEqual(expectedVolume, fakeSpeaker.LatestVolume);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    &lt;span class="rem"&gt;// assert is performed on the fake object which is mock.&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FakeSpeaker : ISpeaker&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; LatestVolume;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ChangeVolume(&lt;span class="kwrd"&gt;int&lt;/span&gt; volume)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.LatestVolume = volume;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;As you see, on 28th line, i created &lt;b&gt;FakeSpeaker &lt;/b&gt;class inherited by &lt;b&gt;ISpeaker&lt;/b&gt;. In this ChangeVolume method (on 32nd line), i didn't write code to touch speaker hardware and change its volume. Because, &lt;span class="Apple-style-span" style="color: #990000;"&gt;my aim is whether ChangeVolume method in DeviceManager class is invoked&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;.&amp;nbsp;&lt;/span&gt; I added LatestVolume variable (on 30th line) as public in our FakeSpeaker class to check ChangeVolume method in FakeSpeker class is called. If ChangeVolume method is performed successfully, i set the volume to LatestVolume variable.&lt;br /&gt;&lt;br /&gt;Steps are really easy :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Create a fake object (&lt;i&gt;on 10th line&lt;/i&gt;)&lt;/li&gt;&lt;li&gt;Set expectations (&lt;i&gt;on 17th line&lt;/i&gt;)&lt;/li&gt;&lt;li&gt;Create instance of under test class and call method under test (&lt;i&gt;on 20th and 21st line&lt;/i&gt;)&lt;/li&gt;&lt;li&gt;Assert it by passing expected and actual value (&lt;i&gt;on 23rd line&lt;/i&gt;)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Although you can use test frameworks to create fake objects, sometimes it's handy to create your own fake classes for simple projects. If you know how to create fake objects manually, you can have better comprehending when you start to use tool which is isolation framework to create mock and stub objects. I highly recommend using isolation framework to isolate the unit under tests from anything around it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-6696266843201345889?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/6696266843201345889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=6696266843201345889' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/6696266843201345889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/6696266843201345889'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/08/how-to-create-fake-objects-manually.html' title='How to Create Fake Objects Manually'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8860290910022301994</id><published>2010-07-26T23:25:00.002+02:00</published><updated>2010-07-26T23:25:50.670+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='test driven development'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><title type='text'>The Basic of Unit Testing</title><content type='html'>Do you test your program before releasing? Probably your answer is yes. I have never met a developer who doesn't test his/her code. But, this testing is usually individual and it's not repeatable. Just filling a form in user interface, click submit button and see the result. Sometimes, there are many cases which are bad and good you should test. While good case is usually one, bad cases can be more than one such as not filling required fields, invalid numeric value or date value you enter. You can test all the cases once and you say, it's done and test is approved.&lt;br /&gt;&lt;br /&gt;Consider this, you need to implement a new feature into the current application. You should test all the cases again "manually, individually". At this time, you may forget one bad case.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_luRD3lsHwX4/TEyq-soM_4I/AAAAAAAAAQ4/JwEgFXWUR0c/s1600/cre8.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_luRD3lsHwX4/TEyq-soM_4I/AAAAAAAAAQ4/JwEgFXWUR0c/s320/cre8.gif" /&gt;&lt;/a&gt;&lt;/div&gt;Needles to say, there are a few problems with your testing;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Takes time to test all cases&lt;/li&gt;&lt;li&gt;It's manually tested&lt;/li&gt;&lt;li&gt;It's not repeatable&lt;/li&gt;&lt;li&gt;It's not reusable&lt;/li&gt;&lt;li&gt;Nobody know what you test&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;In order to test your application you should be familiar unit testing approaches. For instance what is "unit" in test term? Let's explain some terms you need to understand clearly.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Unit : &lt;/b&gt;A unit is a piece of code of your application which is testable.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Unit Test: &lt;/b&gt;A unit test is a method which invokes another piece of code and test to determine whether they are correct according to some assumptions.&lt;/div&gt;&lt;div&gt;&lt;b&gt;Integration Testing : &lt;/b&gt;Testing one or more than one modules as a group. It occurs after unit testing.&lt;/div&gt;&lt;div&gt;&lt;b&gt;Refactoring : &lt;/b&gt;You will face this term if you use unit testing. Refactoring means changing code without changing&lt;b&gt;&amp;nbsp;&lt;/b&gt;its functionality. If you separate any method into smaller methods or change existing method name you did refactoring. The main aim of refactoring is to make the code become easier to maintain, read, change and test.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to do successful unit testing you should take into account these rules :&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Your unit testing should be easy to implement&lt;/li&gt;&lt;li&gt;Your unit testing should run quickly. When you start your unit testing it should be finish as soon as possible&lt;/li&gt;&lt;li&gt;Anyone in your team can run unit testing you write is able to run&lt;/li&gt;&lt;li&gt;It should be reusable&lt;/li&gt;&lt;li&gt;You should design your test code to be run automatically&lt;/li&gt;&lt;li&gt;When you write your test code, it should remain for future use&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Actually, before writing unit test, your software application should be designed having regard to test driven development. In order to write good unit testing, you should know &lt;a href="http://www.technolatte.net/search/label/Design%20Principle"&gt;software design principles&lt;/a&gt;&amp;nbsp;which led you to create useful unit testing. Beside this, you need to know some design patterns such as dependency injection pattern or &amp;nbsp;factory design pattern.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8860290910022301994?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8860290910022301994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8860290910022301994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8860290910022301994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8860290910022301994'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/07/basic-of-unit-testing.html' title='The Basic of Unit Testing'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_luRD3lsHwX4/TEyq-soM_4I/AAAAAAAAAQ4/JwEgFXWUR0c/s72-c/cre8.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8237115516608700592</id><published>2010-07-09T13:57:00.002+02:00</published><updated>2010-07-09T14:01:56.703+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wiki'/><category scheme='http://www.blogger.com/atom/ns#' term='documentation'/><title type='text'>Software Documentation</title><content type='html'>&lt;b&gt;&lt;span class="Apple-style-span" style="color: #990000;"&gt;Documentation is not only writing stuff, but it's managing information.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Before starting documentation advices, please read the sentence written red above. Documentation is the most ignored stage of software development.&amp;nbsp;Most of people think that "writing documentation" is waste of time, they say, "i know nobody will read it". Sometimes, they tend to find excuses&amp;nbsp;not to write documentation and sometimes it's understandable reasons not to write documentation. For the&amp;nbsp;successful&amp;nbsp;documentation, i made a list you should put into practice :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Documentation begins as soon as software development project starts&lt;/b&gt; : Requirements of software application is the first documentation paper. If you start to write documents after having completed software applications, you are on wrong way.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Documentation never ends. It's a ongoing process until the project is stopped or canceled &lt;/b&gt;: As i mention above, documentation begins with requirements and continue with maintenance information even if all software is completed. As long as you implement new feature, remove current feature and change the current business logic, you should keep sharing information.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Documentation is not a writing stuff, it's a sharing knowledge across the whole team&lt;/b&gt;. : It's the motto of documentation. While writing documents, you should always think this information you write for everybody not only for you. It should consist of useful information.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Documentation cannot be assigned to only one person, it's task in which everybody in the team involves&lt;/b&gt;. : Documentation is team work. There is no one who knows all information of the products. People in the team has different skills such as database administrator, network administrator or software developer. Each one should be responsible for own field.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Documentation consists of sensitive data. Therefore, It has to be protected and some permission level has to be created&lt;/b&gt;. : You expose all your information and knowledge to everybody in your team. But some information which has sensitive data shouldn't be reachable. You should create permission groups and assigned them to people in your team.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Information in documentation should be easily reachable and findable by everyone in the team if they have enough permission to see it&amp;nbsp;&lt;/b&gt;: Main idea of documentation is sharing information. You can write some documents but if nobody can find and read them, they will be thrash. You should take into account to create a documentation&amp;nbsp;environment where everybody know how to reach information.&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Content of information should be&amp;nbsp;separated&lt;/b&gt;. Some documents include advanced technical information&amp;nbsp;and this is not understandable for people in business level. If information is not useful, it's nothing and has no value. So, you should make categorization before starting to write.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Some rules have to be applied in order that information keeps clean, tidy, useful &lt;/b&gt;: Rules always required for each project otherwise it would be chaos. People in the team should arrive at a consensus about rules of documentation. But rules shouldn't be many, otherwise it's really difficult to compose documentation. People can be easily tired of it. If there is anyone who has an experience on documentation, he/she can lead the documentation process.&lt;/li&gt;&lt;li&gt;&lt;b&gt;All people in the team should control and give feedback each other what they write &lt;/b&gt;:&amp;nbsp;This is useful to increase quality of documentation and avoid making mistakes.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Don't forget to backup your documents&amp;nbsp;&lt;/b&gt;: It's always a risk to lose your documents. To prevent undesired problem, you should backup all records daily to external&amp;nbsp;hard disk&amp;nbsp;or another&amp;nbsp;PC&amp;nbsp;in your network.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Until now, i haven't talked about any documentation tool. Because tool which you use to carry out documentation comes later. First of all you should think about the advices written above then choose the tool which helps you to put into action.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Speaking about tool, i can recommend web based tool called&amp;nbsp;&lt;a href="http://www.screwturn.eu/"&gt;ScrewTurn&lt;/a&gt;&amp;nbsp;wiki. &lt;a href="http://www.screwturn.eu/"&gt;ScrewTurn&lt;/a&gt; wiki is a opensource application built by .NET. The reason to choose this tool apart from advises above is convenient to our system which is Windows based. If you use&amp;nbsp;Linux&amp;nbsp;environment you can find and select any wiki tools by searching on internet.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As summary, all people in your team has to understand why documentation is needed and what is the main idea of documentation. Remember this : &lt;b&gt;Documentation is not only writing stuff, but it's managing information.&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8237115516608700592?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8237115516608700592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8237115516608700592' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8237115516608700592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8237115516608700592'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/07/software-documentation.html' title='Software Documentation'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7821184218440885442</id><published>2010-06-24T21:45:00.001+02:00</published><updated>2010-08-13T21:35:40.270+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips-trick'/><category scheme='http://www.blogger.com/atom/ns#' term='casting'/><category scheme='http://www.blogger.com/atom/ns#' term='csharp'/><title type='text'>Safely Type Casting in .NET-CSharp</title><content type='html'>In software programming sometimes safely type casting is ignored. This causes unavoidable exception in run-time. I explain how you can cast object to another custom defined type "safely".&lt;br /&gt;&lt;br /&gt;Let's take &lt;b&gt;bad example&lt;/b&gt; to analyse :&lt;br /&gt;In this example, i defined two different classes which are &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Student&lt;/span&gt; and &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;User&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; User&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; FirstName { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; LastName { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Student&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Grade { get; set; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;Here, you can find the Foo() method that i try to obj parameter which it's type is Object.&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Foo(&lt;span class="kwrd"&gt;object&lt;/span&gt; obj)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;     User user = (User)obj;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;     Console.WriteLine(user.FirstName);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;In this Foo() method, there are two mistakes :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;After casting user variables needs to be checked if it's null or not.&lt;/li&gt;&lt;li&gt;obj parameter can be different type from User. In this example we have two different types of class Student and User. In Foo() method, User type is expected as a parameter.&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;If you send Student parameter to Foo() method instead of User type, &lt;span class="Apple-style-span" style="color: red;"&gt;System.InvalidCastException&lt;/span&gt; is thrown.&lt;/div&gt;&lt;br /&gt;Let's see the best example of Foo() method :&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Foo(&lt;span class="kwrd"&gt;object&lt;/span&gt; obj)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    User user = obj &lt;span class="kwrd"&gt;as&lt;/span&gt; User;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt;(user != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        Console.WriteLine(user.FirstName);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;In this Foo() method written above, as operator is used to cast the obj parameter to User type&amp;nbsp;to prevent invalid cast exception. Although the parameter's object type is not compatible with the type that we want to cast, it returns null. For instance, if student is passed to Foo() method, user variable in Foo() method will be null. It's suggested to use as operator then check whether the variable (here it's user) is null.&lt;br /&gt;&lt;br /&gt;For testing Foo() methods you can use Main method written below.&lt;br /&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    User user = &lt;span class="kwrd"&gt;new&lt;/span&gt; User();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    user.Id = 1;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    user.FirstName = &lt;span class="str"&gt;"Serkan"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    user.LastName = &lt;span class="str"&gt;"Karaarslan"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="rem"&gt;// If you send user parameter to Foo() method, &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="rem"&gt;// even if it's in bad example&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="rem"&gt;// it is casted correctly.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    Foo(user);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="rem"&gt;// if you send Student parameter to &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="rem"&gt;// Foo method in bad example&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="rem"&gt;// you get unable to cast object &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="rem"&gt;// (System.InvalidCastException)&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    student.Id = 2;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    student.Name = &lt;span class="str"&gt;"Serkan"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    student.Grade = &lt;span class="str"&gt;"B+"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    Foo(student);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    Foo(&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    Console.Read();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7821184218440885442?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7821184218440885442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7821184218440885442' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7821184218440885442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7821184218440885442'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/06/safely-type-casting-in-net-csharp.html' title='Safely Type Casting in .NET-CSharp'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7929907210479163508</id><published>2010-04-29T15:24:00.002+02:00</published><updated>2010-04-29T15:25:16.014+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wmic'/><category scheme='http://www.blogger.com/atom/ns#' term='bios serial number'/><title type='text'>How to Find the Serial Number of Bios in Windows</title><content type='html'>Before, i mentioned the subject about how to find bios serial number of windows using c# in this &lt;a href="http://www.technolatte.net/2010/02/retrieve-serial-number-of-bios.html"&gt;entry&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here, i will write another solution of finding bios serial number of your pc in windows operating system by using command prompt. In order to check the serial number, follow the instructions written below :&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Open &lt;b&gt;Start&lt;/b&gt; menu, click &lt;b&gt;Run&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Type "&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;wmic&lt;/b&gt;&lt;/span&gt;". (wmic stands for; Windows Management Instrumentation Command-line)&lt;/li&gt;&lt;li&gt;Type "&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;bios get serialnumber&lt;/span&gt;&lt;/b&gt;"&lt;/li&gt;&lt;li&gt;Bingo! You got it.&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Here is the screenshot of my command prompt's output.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_luRD3lsHwX4/S9mIHyZErYI/AAAAAAAAAQw/Frn_Kgie9Pg/s1600/biosserialnumbercmd.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="97" src="http://3.bp.blogspot.com/_luRD3lsHwX4/S9mIHyZErYI/AAAAAAAAAQw/Frn_Kgie9Pg/s400/biosserialnumbercmd.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7929907210479163508?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7929907210479163508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7929907210479163508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7929907210479163508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7929907210479163508'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/04/how-to-find-serial-number-of-bios-in.html' title='How to Find the Serial Number of Bios in Windows'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_luRD3lsHwX4/S9mIHyZErYI/AAAAAAAAAQw/Frn_Kgie9Pg/s72-c/biosserialnumbercmd.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8314015466191723429</id><published>2010-04-19T23:56:00.005+02:00</published><updated>2010-08-13T21:35:55.576+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ping'/><category scheme='http://www.blogger.com/atom/ns#' term='system.net.networkinformation'/><category scheme='http://www.blogger.com/atom/ns#' term='tips-trick'/><category scheme='http://www.blogger.com/atom/ns#' term='csharp'/><title type='text'>Ping a Hostname with C#</title><content type='html'>With C# you can detect a remote server whether is accessible using &lt;span class="Apple-style-span" style="color: #990000;"&gt;&lt;b&gt;Ping&lt;/b&gt; &lt;/span&gt;class in .NET. &lt;span class="Apple-style-span" style="color: #134f5c;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Send&lt;/span&gt; &lt;/b&gt;&lt;/span&gt;and &lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;SendAsync&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt; &lt;/span&gt;methods are used to send &lt;b&gt;Internet Control Message Protocol&lt;/b&gt; (ICMP) request message to a remote server and wait reply message from that server. For details of ICMP you can read on IETF web site,&amp;nbsp;&lt;a href="http://datatracker.ietf.org/doc/rfc792/"&gt;http://datatracker.ietf.org/doc/rfc792/&lt;/a&gt;. The internet protocol is not designed to be absolutely reliable. I mean, there is no guarantee that response from server is returned. Usually, &lt;i&gt;Success &lt;/i&gt;or &lt;i&gt;Timeout &lt;/i&gt;messages are sent as a response from remote server.&lt;br /&gt;&lt;br /&gt;To ping an host name,&amp;nbsp;&lt;b&gt;System.Net.NetworkInformation&lt;/b&gt; namespace has to be imported in your class application.&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;     List list = &lt;span class="kwrd"&gt;new&lt;/span&gt; List();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;     list.Add(&lt;span class="str"&gt;"www.technolatte.net"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;     list.Add(&lt;span class="str"&gt;"www.amazon.com"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;     list.Add(&lt;span class="str"&gt;"www.thereisnosuchdomain.com"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;     PingIt(list);  &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;     Console.ReadKey();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;After creating Ping object, you should call &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;Send &lt;/span&gt;method with &lt;b&gt;host name&lt;/b&gt; and &lt;b&gt;timeout&lt;/b&gt; parameters, which is set to 100ms in this example, to determine whether you can reach a computer across the network. Beside that, Send method has 8 different overload methods. &lt;br /&gt;&lt;br /&gt;Send method returns &lt;span class="Apple-style-span" style="color: #990000;"&gt;&lt;b&gt;PingReply &lt;/b&gt;&lt;/span&gt;object which contains &lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;b&gt;Status &lt;/b&gt;&lt;/span&gt;property which its type is&amp;nbsp;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #990000;"&gt;IPStatus&lt;/span&gt;&lt;/b&gt;. It's easy to read &lt;b&gt;Status &lt;/b&gt;message to retrieve whether sending ping is&amp;nbsp;successful. If you want to know detailed status enumeration properties, check &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipstatus.aspx"&gt;this link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As i mentioned above, there is no&amp;nbsp;guarantee&amp;nbsp;that you receive response from remote server because of firewall settings of remote server. If you run this code excerpt you can see www.amazon.com returns Timeout status while www.technolatte.net returns success.&lt;br /&gt;&lt;br /&gt;For more information check msdn library,&amp;nbsp;&lt;a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8314015466191723429?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8314015466191723429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8314015466191723429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8314015466191723429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8314015466191723429'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/04/ping-hostname-with-c.html' title='Ping a Hostname with C#'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8821793275303797691</id><published>2010-04-06T23:17:00.011+02:00</published><updated>2010-04-27T23:06:30.212+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Host Header Name'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><title type='text'>Host Header Name to Host Multiple Web Sites</title><content type='html'>For some reasons, you may want to host more than one web sites on same IIS using one public ip address.&amp;nbsp;In order to do this, you can use different port numbers to distinguish web sites in IIS. &amp;nbsp;As you know, as default, port 80 is used to host web sites in IIS.&amp;nbsp;But servicing your web sites from different ports, it's not handy to use port number with domain name like&amp;nbsp;www.technolatte.net:85. You can avoid port number by using &lt;b&gt;Host Header Name&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Before configuring this you should aware that your computer or network must be using a name resolution system, such as DNS to use Host Header Name.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Case &amp;nbsp;:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;You have IIS installed on your Web Server.&lt;br /&gt;Web Server's public IP address is : &lt;i&gt;212.212.212.212&lt;/i&gt;&lt;br /&gt;You have 2 Web Sites on the IIS. &lt;i&gt;Web Site A&lt;/i&gt;, &lt;i&gt;Web Site B&lt;/i&gt;.&lt;br /&gt;You have two different domain name, &lt;i&gt;www.websiteA.com&lt;/i&gt;, &lt;i&gt;www.websiteB.com&lt;/i&gt;&lt;br /&gt;DNS was configured and 212.212.212.212 was pointed to your web server.&lt;br /&gt;&lt;br /&gt;When user types www.websiteA.com on any browser, Web Site A on IIS should receive request and send response.&lt;br /&gt;When user types www.websiteB.com on any browser, Web Site B on IIS should receive request and send response.&lt;br /&gt;&lt;br /&gt;First, you need to point your web sites on IIS to &lt;b&gt;same &lt;/b&gt;ports.&lt;br /&gt;Let's say :&lt;br /&gt;Web Site A is pointed to port number &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;80&lt;/span&gt;&lt;br /&gt;Web Site B is pointed to port number &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;80&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Below, you can find steps how to add host header name for a web site already made;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution :&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Open your IIS&lt;/li&gt;&lt;li&gt;Right click on web site you already made&lt;/li&gt;&lt;li&gt;Click Properties.&lt;/li&gt;&lt;li&gt;On Web Site Identification field, click Advanced button.&lt;/li&gt;&lt;li&gt;On this form, click Edit button and check the following screenshot about the case written above.&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_luRD3lsHwX4/S9dRQqwLSvI/AAAAAAAAAQg/q1RmxVW8Ed4/s1600/websitea.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_luRD3lsHwX4/S9dRQqwLSvI/AAAAAAAAAQg/q1RmxVW8Ed4/s320/websitea.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="" style="clear: both; text-align: center;"&gt;&lt;br /&gt;Host Header Name for Web Site A&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_luRD3lsHwX4/S9dRXKK8E5I/AAAAAAAAAQo/q9j_YEhwc-I/s1600/websiteb.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_luRD3lsHwX4/S9dRXKK8E5I/AAAAAAAAAQo/q9j_YEhwc-I/s320/websiteb.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;Host Header Name for Web Site B&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8821793275303797691?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8821793275303797691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8821793275303797691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8821793275303797691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8821793275303797691'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/04/host-header-name-to-host-multiple-web.html' title='Host Header Name to Host Multiple Web Sites'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_luRD3lsHwX4/S9dRQqwLSvI/AAAAAAAAAQg/q1RmxVW8Ed4/s72-c/websitea.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2675109103902334066</id><published>2010-02-26T14:37:00.009+01:00</published><updated>2010-08-13T21:36:22.342+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dns'/><category scheme='http://www.blogger.com/atom/ns#' term='tips-trick'/><category scheme='http://www.blogger.com/atom/ns#' term='system.net'/><category scheme='http://www.blogger.com/atom/ns#' term='csharp'/><title type='text'>How to Check DNS with CSharp?</title><content type='html'>If you want to know any domain name is matched with certain ip address, you can use &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.aspx"&gt;System.Net&lt;/a&gt; namespace to retrieve &lt;b&gt;IPAddresses&lt;/b&gt;&amp;nbsp;collection which is related to domain name. Please check the code snippet written below :&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; CheckDNS(&lt;span class="kwrd"&gt;string&lt;/span&gt; domain)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;bool&lt;/span&gt; result = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;       IPAddress[] addressList = Dns.GetHostAddresses(domain);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;       result = addressList.length &amp;gt; 0 ? &lt;span class="kwrd"&gt;true&lt;/span&gt; : &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        result = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;If &amp;nbsp;CheckDNS method returns true, it means domain name is related to at least one ip address. If return false, the domain name is not associated to any ip address.&lt;br /&gt;&lt;br /&gt;For testing you can pass an existed domain name such as www.technolatte.net and pass a domain name which doesn't exist.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;CheckDNS("&lt;/span&gt;www.technolatte.ne&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;t");&lt;/span&gt; &lt;span class="Apple-style-span" style="color: #38761d;"&gt;//output is true&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;CheckDNS("&lt;/span&gt;www.thisistestdomainname.com&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt; //output is false&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2675109103902334066?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2675109103902334066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2675109103902334066' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2675109103902334066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2675109103902334066'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/02/how-to-check-dns-with-csharp.html' title='How to Check DNS with CSharp?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-3236111562477430040</id><published>2010-02-25T21:56:00.008+01:00</published><updated>2010-04-21T11:44:45.341+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='wmi'/><category scheme='http://www.blogger.com/atom/ns#' term='system.management'/><category scheme='http://www.blogger.com/atom/ns#' term='win32_bios'/><title type='text'>Retrieving Serial Number of BIOS</title><content type='html'>Nowadays, i have been working on Windows Desktop Application. In this project, i need to match application's serial number and BIOS' serial number to prevent illegal usage. To retrieve BIOS number of computer i &amp;nbsp;used &lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa394084(VS.85).aspx"&gt;WMI&lt;/a&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;Classes with .NET Framework namespace called &lt;b&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.management.aspx"&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;System.Management&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;. If you need to retrieve &lt;i&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;Serial Number&lt;/span&gt;&lt;/i&gt; of BIOS you can use following code snippet :&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;ManagementObjectSearcher wmiQuery = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManagementObjectSearcher(&lt;span class="str"&gt;"SELECT * FROM Win32_BIOS"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;ManagementObjectCollection wmiColl = wmiQuery.Get();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ManagementObject item &lt;span class="kwrd"&gt;in&lt;/span&gt; wmiColl)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;   Console.WriteLine(item.GetPropertyValue(&lt;span class="str"&gt;"SerialNumber"&lt;/span&gt;));&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;If you want to check other properties' name of &lt;a href="http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx"&gt;Win32_BIOS&lt;/a&gt;, click to see link written below :&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-3236111562477430040?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/3236111562477430040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=3236111562477430040' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3236111562477430040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3236111562477430040'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/02/retrieve-serial-number-of-bios.html' title='Retrieving Serial Number of BIOS'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2178841575593795537</id><published>2010-02-09T09:27:00.006+01:00</published><updated>2010-02-09T19:59:37.045+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mime type'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='flv'/><title type='text'>Adding .flv MIME Type into IIS</title><content type='html'>For web pages, flv files is one of the best video displaying solution with flash player. As a default settings, flv mime type is not added in IIS. Although your flv file exists in your web server, you may see 404 not found response sent by web server.&lt;br /&gt;&lt;div&gt;For supporting flv extension in your web server, there is one settings you should apply. It's really simple. Check the following steps :&lt;br /&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Open IIS manager in your web server.&lt;/li&gt;&lt;li&gt;Right click on your web site directory in the IIS and click &lt;b&gt;properties&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;Find &lt;b&gt;HTTP Headers&lt;/b&gt; tab and click on it.&lt;/li&gt;&lt;li&gt;Click on &lt;b&gt;MIME Types &lt;/b&gt;button.&lt;/li&gt;&lt;li&gt;Type &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;flv&lt;/span&gt;&lt;/b&gt; into Extension textbox then &lt;span class="Apple-style-span" style="color: #cc0000;"&gt;&lt;b&gt;videx/x-flv&lt;/b&gt;&lt;/span&gt; into MIME Type textbox.&lt;/li&gt;&lt;li&gt;Finally, click OK button. Now, it's ready.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;For more information about other MIME types, you can read the web page below which contains MIME Media Types.&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.iana.org/assignments/media-types/"&gt;http://www.iana.org/assignments/media-types/&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2178841575593795537?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2178841575593795537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2178841575593795537' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2178841575593795537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2178841575593795537'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2010/02/adding-flv-mime-type-into-iis.html' title='Adding .flv MIME Type into IIS'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-3904074767103480813</id><published>2009-12-16T21:17:00.004+01:00</published><updated>2010-04-21T12:07:08.746+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Liskov&apos;s Substitution Principle'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Principle'/><title type='text'>Liskov's Substitution Principle</title><content type='html'>Liskov's Substitution Principle (LSP) is one of the five software design principles. What programming languages you know, you should know these five principles written below :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/open-closed-principle.html" style="color: #999999; text-decoration: none;"&gt;Open Close Principle&lt;/a&gt;&amp;nbsp;(OCP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/11/dependency-inversion-principle.html" style="color: #999999; text-decoration: none;"&gt;Dependency Inversion Principle&lt;/a&gt;&amp;nbsp;(DIP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/interface-segregation-principle.html" style="color: #999999; text-decoration: none;"&gt;Interface Segregation Principle&lt;/a&gt;&amp;nbsp;(ISP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/single-responsibility-principle.html"&gt;Single Responsibility Principle&lt;/a&gt; (SRP)&lt;/li&gt;&lt;li&gt;Liskov's Substitution Principle (LSP)&lt;/li&gt;&lt;/ul&gt;In this article, i will explain&amp;nbsp;Liskov's Substitution Principle.&lt;br /&gt;&lt;br /&gt;LSP is first mentioned by Barbara Liskov in 1987 conference keynote. This principle is about relation between subclasses and base classes. We can say strong behavioral subtyping. When you read the principle, you will find something similar with Open Close Principle.&lt;br /&gt;&lt;br /&gt;If function in base class is modified because of that new derivative of the base class is created. You shouldn't need to change function which is placed in base class.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Key Principle&lt;/b&gt;&lt;br /&gt;&lt;span style="color: #0b5394;"&gt;Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Violation of Liskov's Substitution Principle&lt;/b&gt;&lt;br /&gt;I will write a best known example; Rectangle and Square. You can think of that Square is a kind of &amp;nbsp;special rectangle. Then the square can be inherited from Rectangle class.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Rectangle&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; _Width;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; _Height;&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SetWidth(&lt;span class="kwrd"&gt;int&lt;/span&gt; width)&lt;br /&gt;    {&lt;br /&gt;        _Width = width;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SetHeight(&lt;span class="kwrd"&gt;int&lt;/span&gt; height)&lt;br /&gt;    {&lt;br /&gt;        _Height = height;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; CalculateArea()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; _Height * _Width;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Square : Rectangle&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SetWidth(&lt;span class="kwrd"&gt;int&lt;/span&gt; width)&lt;br /&gt;    {&lt;br /&gt;        _Width = width;&lt;br /&gt;        _Height = width;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SetHeight(&lt;span class="kwrd"&gt;int&lt;/span&gt; height)&lt;br /&gt;    {&lt;br /&gt;        _Height = height;&lt;br /&gt;        _Width = height;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;br /&gt;{&lt;br /&gt;     &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main()&lt;br /&gt;     {&lt;br /&gt;        Rectangle r = GetNewRectangle();&lt;br /&gt;        r.SetHeight(5);&lt;br /&gt;        r.SetWidth(10);&lt;br /&gt;&lt;br /&gt;        Console.WriteLine(r.CalculateArea()); &lt;br /&gt;        &lt;span class="rem"&gt;// Output : 50 instead of 25&lt;/span&gt;&lt;br /&gt;     }&lt;br /&gt;     &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Rectangle GetNewRectangle()&lt;br /&gt;     {&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Square();&lt;br /&gt;     }&lt;br /&gt;}&lt;/pre&gt;The square class which is derived from Rectangle class assumes that width is equal with the height. When Square is used in context where Rectangle class is expected, unexpected behavior may occur, because the dimensions of the square can not be set independently.&lt;br /&gt;&lt;br /&gt;For further information you can download &lt;a href="http://www.objectmentor.com/resources/articles/lsp.pdf"&gt;pdf&lt;/a&gt;&amp;nbsp;file written by Robert C.Martin.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-3904074767103480813?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/3904074767103480813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=3904074767103480813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3904074767103480813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3904074767103480813'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/12/liskovs-substitution-principle.html' title='Liskov&apos;s Substitution Principle'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1368958282641215091</id><published>2009-12-13T01:58:00.002+01:00</published><updated>2010-04-21T12:06:02.865+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Single Responsibility Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Principle'/><title type='text'>Single Responsibility Principle</title><content type='html'>Single Responsibility Principle (SRP) is one of the five software design principles. What programming languages you know, you should know these five principles written below :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/open-closed-principle.html"&gt;Open Close Principle&lt;/a&gt;&amp;nbsp;(OCP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/11/dependency-inversion-principle.html"&gt;Dependency Inversion Principle&lt;/a&gt; (DIP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/interface-segregation-principle.html"&gt;Interface Segregation Principle&lt;/a&gt;&amp;nbsp;(ISP)&lt;/li&gt;&lt;li&gt;Single Responsibility Principle (SRP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/liskovs-substitution-principle.html"&gt;Liskov's Substitution Principle&lt;/a&gt; (LSP)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;In this article, i will explain Single Responsibility Principle.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;b&gt;Purpose / Reason&lt;/b&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Each class or module should be responsible only one task. For instance, if you have one Employee class to update Employee information, calculate salary and tax. You have more than one reason to modify Employee class. I mean, when you need to change algorithm of calculating salary or tax, you have to change same class. In our purpose, you have only one reason to change class or module.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;b&gt;Key Principle&lt;/b&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span style="color: #0b5394;"&gt;There should &amp;nbsp;never be more than one reason for a class to change.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;For instance, you have one Employee class which is responsible for calculation salary and tax, modify Employee information and sending hours reports to managers.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Bad Example :&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IEmployeeManager&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; SendHourReports();&lt;br /&gt;    Money CalculateSalary();&lt;br /&gt;    &lt;span class="kwrd"&gt;double&lt;/span&gt; CalculateTax();&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; UpdateEmployee(Employee employee);&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; CreateEmployee(Employee employee);&lt;br /&gt;}&lt;/pre&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;As you see Employee class has more than one task to perform. Instead of designing Employee class like that, it's better to separate similar functionalities into three classes. Look at good example.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Good Example :&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ISalary&lt;br /&gt;{&lt;br /&gt;    Money CalculateSalary();&lt;br /&gt;    &lt;span class="kwrd"&gt;double&lt;/span&gt; CalculateTax();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IReport&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; SendHourReports();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IEmployeeDatabase&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; UpdateEmployee(Employee employee);&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; CreateEmployee(Employee employee);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;I divide Employee class into three different classes which are &lt;span style="color: #0b5394;"&gt;ISalary&lt;/span&gt;, &lt;span style="color: #0b5394;"&gt;IReport&lt;/span&gt;, &lt;span style="color: #0b5394;"&gt;IEmployeeDatabase &lt;/span&gt;. Because, Employee class actually has three main functionalities :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Salary functionalities&lt;/li&gt;&lt;li&gt;Employee report s&lt;/li&gt;&lt;li&gt;Database&amp;nbsp;behaviors&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/div&gt;&lt;div&gt;If a class has more than one responsibility, then there will be more than one reason to modify class or module. Preventing this, you need to be able to separate classes or modules into more than one classes or module. Otherwise responsibilities become coupled and change is a manifest through a change in a responsibility among the classes or modules.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1368958282641215091?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1368958282641215091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1368958282641215091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1368958282641215091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1368958282641215091'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/12/single-responsibility-principle.html' title='Single Responsibility Principle'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-3139738202973856705</id><published>2009-12-09T22:13:00.000+01:00</published><updated>2009-12-09T22:13:55.465+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance counter'/><category scheme='http://www.blogger.com/atom/ns#' term='performance monitor'/><title type='text'>How to Investigate Disk Bottleneck</title><content type='html'>On previous entry, i explained how to determine that you have enough ram on your server. Today, i will tell you about how to examine disk bottleneck. For this purpose, you need monitor a few performance counters :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;PhysicalDisk : &lt;i&gt;Average Read Queue Length&lt;/i&gt;&lt;/li&gt;&lt;li&gt;PhysicalDisk : &lt;i&gt;Average Write Queue Length&lt;/i&gt;&lt;/li&gt;&lt;li&gt;PhysicalDisk : &lt;i&gt;Disk Transfer / sec&lt;/i&gt;&lt;/li&gt;&lt;li&gt;PhysicalDisk : &lt;i&gt;Idle Time&lt;/i&gt;&lt;/li&gt;&lt;li&gt;PhysicalDisk : &lt;i&gt;% Disk Time&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;I admit that, it is usually difficult to understand exact meaning of counters. But anyway, i will try to explain with the values what they should be.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_luRD3lsHwX4/SyAS_7R-P5I/AAAAAAAAAL8/w3YINOST_Ck/s1600-h/hard_disk_drive.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_luRD3lsHwX4/SyAS_7R-P5I/AAAAAAAAAL8/w3YINOST_Ck/s320/hard_disk_drive.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Average Read Queue Length&lt;/b&gt; indicates how many system request are waiting for disk access. This value should be &lt;span style="color: #990000;"&gt;less than 2&lt;/span&gt;.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Average Write Queue Length&lt;/b&gt; indicates average number of write requests that are queued. This value should be &lt;span style="color: #990000;"&gt;less than 2&lt;/span&gt;.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Disk Transfer / sec&lt;/b&gt; shows the rate or read and write operations on disk. If it is greater than 25 disk I/O per second, you have poor response time. This value of the counter should be &lt;span style="color: #990000;"&gt;below 25&lt;/span&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Idle Time&lt;/b&gt; indicates idle time of your disk. Normally, value of the counter should be &lt;span style="color: #990000;"&gt;greater than %20&lt;/span&gt;.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Disk Time&lt;/b&gt; is the percentage of elapsed time that the selected disk drive was busy servicing read or write requests. If it is &lt;span style="color: #990000;"&gt;more than %50&lt;/span&gt;, it indicates a disk bottleneck&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Beside these counters, you can check following counters to determine whether it's a bottleneck.&lt;/div&gt;&lt;div&gt;&lt;b&gt;Average disk seconds/read&lt;/b&gt; and &lt;b&gt;average disk seconds/write&lt;/b&gt; need to be &lt;span style="color: #990000;"&gt;below around 12ms.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-3139738202973856705?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/3139738202973856705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=3139738202973856705' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3139738202973856705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3139738202973856705'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/12/how-to-investigate-disk-bottleneck.html' title='How to Investigate Disk Bottleneck'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_luRD3lsHwX4/SyAS_7R-P5I/AAAAAAAAAL8/w3YINOST_Ck/s72-c/hard_disk_drive.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7223076032959543811</id><published>2009-12-08T23:31:00.002+01:00</published><updated>2009-12-08T23:32:09.600+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance counter'/><category scheme='http://www.blogger.com/atom/ns#' term='performance monitor'/><title type='text'>How to Determine Enough RAM in Your Server</title><content type='html'>In this entry,i explain how to determine whether your server has enough ram to perform operations prosperously. &amp;nbsp;For this aim, you should monitor some counters using performance monitor tool. There are three main counters to check wheter RAM size is enough.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_luRD3lsHwX4/Sx7ThOR5GsI/AAAAAAAAAL0/QB0CHJiYaWk/s1600-h/perfmon.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_luRD3lsHwX4/Sx7ThOR5GsI/AAAAAAAAAL0/QB0CHJiYaWk/s320/perfmon.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Memory\Pages/sec&lt;/b&gt;&lt;br /&gt;This counter is a general indicator of how often the system is using the hard drive to store or retrieve memory associated data.&amp;nbsp;If number of pages per second exceeds &lt;span style="color: #990000;"&gt;50 per paging&lt;/span&gt; disk, it indicates downward trend. You can create a trigger which notify you when it's &amp;nbsp;greater than 50.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Memory\Available Bytes&lt;/b&gt;&lt;br /&gt;This counter indicates remaining memory after nonpaged pool allocations,&lt;br /&gt;paged pool allocations, process' working sets, and the file system cache have all taken their piece&lt;br /&gt;If the counter is greater than &lt;span style="color: #990000;"&gt;10% of actual RAM&lt;/span&gt;, you are on safe side, you are away from risk zone.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Memory\Page Reads/sec.&lt;/b&gt;&lt;br /&gt;This counter is another good indicator of a memory shortage. The counter shows that how often the system is reading from disk.&amp;nbsp;A "sustained" value over &lt;span style="color: #990000;"&gt;5 page/sec&lt;/span&gt; &amp;nbsp;is "often" a strong indicator of a memory shortage. You may see more than 5 page/sec, but you don't have to be &amp;nbsp;worry about that because temporarily, it can be more than 5 page/sec.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc768048.aspx"&gt;Click for more performance counters explain&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7223076032959543811?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7223076032959543811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7223076032959543811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7223076032959543811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7223076032959543811'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/12/how-to-determine-enough-ram-in-your.html' title='How to Determine Enough RAM in Your Server'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_luRD3lsHwX4/Sx7ThOR5GsI/AAAAAAAAAL0/QB0CHJiYaWk/s72-c/perfmon.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5859381243327985285</id><published>2009-12-06T00:58:00.005+01:00</published><updated>2010-04-21T11:55:22.296+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Open Closed Principle'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Principle'/><title type='text'>Open Closed Principle</title><content type='html'>&lt;div style="color: #333333; font-family: verdana; font-size: 11px; line-height: 17px;"&gt;&lt;span style="color: #333333; font-family: verdana; font-size: 11px; line-height: 17px;"&gt;&lt;span style="color: #333333; font-family: verdana; font-size: 11px; line-height: 17px;"&gt;Open Closed Principle&amp;nbsp;(DIP) is one of the five software design principles. What programming languages you know, you should know these five principles written below :&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;Open Close Principle (OCP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/11/dependency-inversion-principle.html"&gt;Dependency Inversion Principle&lt;/a&gt;&amp;nbsp;(DIP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/12/interface-segregation-principle.html"&gt;Interface Segregation Principle&lt;/a&gt; (ISP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/12/single-responsibility-principle.html"&gt;Single Responsibility Principle&lt;/a&gt; (SRP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/12/liskovs-substitution-principle.html"&gt;Liskov's Substitution Principle&lt;/a&gt; (LSP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;In this column i will explain Open Closed Principle.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Purpose/Reason&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;The reason to use open closed principle is to add new features without changing existing software entities. Especially in enterprise application, due to marketing conditions, softwares need to be changed. In order to reduce time, cost and risk for implementation new features, you should consider how to expand software easily. Open closed principle is one of the five answers written above.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-weight: bold;"&gt;Key Principle&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #0b5394;"&gt;Open Close Principle states software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #0b5394;"&gt;&lt;span style="color: #333333;"&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Suppose that, you have two different database products which are MySQL and Oracle. In order to connect right database, you built a &lt;b&gt;&lt;span style="color: #073763;"&gt;DatabaseManager &lt;/span&gt;&lt;/b&gt;to decide that which database product is used to connect. Here is the solution which is not recommended.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Bad Example :&lt;/div&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DatabaseManager&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Connect(Database d)&lt;br /&gt;    {&lt;br /&gt;         &lt;span class="kwrd"&gt;if&lt;/span&gt; (d.DBType == 1)&lt;br /&gt;            ConnectMySQL((MySQLDB)d);&lt;br /&gt;         &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (d.DBType == 2)&lt;br /&gt;            ConnectOracle((OracleDB)d);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ConnectMySQL(MySQLDB db) &lt;br /&gt;    {&lt;br /&gt;        &lt;span class="rem"&gt;// connect&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ConnectOracle(OracleDB db)&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;// connect&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Database&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; DBType;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MySQLDB : Database&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; MySQLDB()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;base&lt;/span&gt;.DBType = 1;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; OracleDB : Database&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; OracleDB()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;base&lt;/span&gt;.DBType = 2;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;For instance, yesterday, your manager said that, we need to support Microsoft SQL database product. For this implementation, you need to modify almost all classes. But if you cared open closed principle before, you wouldn't need to change all classes. Let's see good example about how it should have built.&lt;br /&gt;&lt;br /&gt;Good Example :&lt;/div&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Database&lt;br /&gt;{ &lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Connect();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DatabaseManager&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; Database db;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; DatabaseManager(Database db)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.db = db;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Connect()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.db.Connect();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MySQLDatabase : Database&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Connect()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;//connect MySQL&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; OracleDatabase : Database &lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Connect()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;//connect Oracle&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;div&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;If you had built your database manager like above, you wouldn't have needed to modify all classes. The only thing you should do is add new MicrosoftSQL class into current situation.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MicrosoftSQL : Database&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Connect()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;// connect Microsoft SQL&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;b&gt;Summary :&lt;/b&gt; &lt;br /&gt;As you see, this principle should be applied software application which is most likely to be modified or added new features into current situation. Otherwise, your software application has more abstractions between classes and this occurs more complication in your code.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5859381243327985285?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5859381243327985285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5859381243327985285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5859381243327985285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5859381243327985285'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/12/open-closed-principle.html' title='Open Closed Principle'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2133309590971344595</id><published>2009-12-01T13:18:00.004+01:00</published><updated>2010-04-21T12:04:20.725+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interface Segregation Principle'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Principle'/><title type='text'>Interface Segregation Principle</title><content type='html'>&lt;span style="color: #333333; font-family: verdana; font-size: 11px; line-height: 17px;"&gt;Interface Segregation Principle&amp;nbsp;(DIP) is one of the five software design principles. What programming languages you know, you should know these five principles written below :&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/12/open-closed-principle.html"&gt;Open Close Principle&lt;/a&gt; (OCP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/11/dependency-inversion-principle.html"&gt;Dependency Inversion Principle&lt;/a&gt; (DIP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;Interface Segregation Principle (ISP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/12/single-responsibility-principle.html"&gt;Single Responsibility Principle &lt;/a&gt;(SRP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;a href="http://www.technolatte.net/2009/12/liskovs-substitution-principle.html"&gt;Liskov's Substitution Principle&lt;/a&gt; (LSP)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;In this column i will explain Interface Segregation Principle.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;b&gt;Purpose / Reason&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;The reason to use ISP is to prevent getting interface "fat". Fat in this subject means that unused methods and properties are still exist and it makes developers to force implement them. For instance, when you need to change obese interface, you will likely have to modify all codes which are unrelated with the obese interface. Another term of fat interface is "polluted interface". Having an interface pollution may occur uninvited exception in runtime. &amp;nbsp;To prevent this disadvantage, we should&amp;nbsp;separate&amp;nbsp;fat interfaces.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;b&gt;Key Principle&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;span style="color: #0b5394;"&gt;Clients shouldn't be forced to depend upon interfaces that they don't use. &lt;a href="http://www.objectmentor.com/resources/articles/isp.pdf"&gt;*&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0b5394; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;For this case we have two examples, one of them is bad, another is a good example. For these example, i use animal world. As you know each species has different abilities, such as flying, swimming. Some abilities are common, such as eating, sleeping.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;In order to clarify ISP, i starts with bad example.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;Bad Example :&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IAnimal&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Fly();&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat();&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; See();&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Swim();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Dog : IAnimal&lt;br /&gt;{&lt;br /&gt;&lt;span class="rem"&gt;// Fly couldn't be implemented&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Fly()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; NotImplementedException();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Dog is eating"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; See()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Dog is seeing"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;span class="rem"&gt;// Swim couldn't be implemented&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Swim()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; NotImplementedException();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Bird : IAnimal&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Fly()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Bird is flying"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Bird is eating"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; See()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Bird is seeing"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;span class="rem"&gt;// Swim couldn't be implemented&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Swim()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; NotImplementedException();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Fish : IAnimal&lt;br /&gt;{&lt;br /&gt;&lt;span class="rem"&gt;// Fly couldn't be implemented&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Fly()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; NotImplementedException();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Fish is eating"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; See()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Fish is seeing"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Swim()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Fish is swiming"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;div&gt;&lt;div style="color: #333333; font-family: verdana; font-size: 11px; line-height: 17px;"&gt;For this example, &lt;b&gt;&lt;span style="color: #45818e;"&gt;IAnimal &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: inherit;"&gt;is an interface and &lt;/span&gt;&lt;b&gt;&lt;span style="color: #6aa84f;"&gt;&lt;span style="font-family: inherit;"&gt;Fish&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: inherit;"&gt;, &lt;/span&gt;&lt;b&gt;&lt;span style="color: #6aa84f;"&gt;&lt;span style="font-family: inherit;"&gt;Bird &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: inherit;"&gt;and &lt;/span&gt;&lt;span style="color: #6aa84f;"&gt;&lt;b&gt;&lt;span style="font-family: inherit;"&gt;Dog &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;classes are derived from IAnimal interface. &lt;span style="font-family: inherit;"&gt;Although some methods are common in these classes, such as See(), Eat(); however, there are some methods that shouldn't be implemented. For Bird class Swim() method shouldn't be implemented by Bird. Because Bird cannot swim.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;br /&gt;Suppose, for example, you need to add Walk() functionality, your interface IAnimal is getting fat. Also classes which implement IAnimal interface have method which is never used.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;It seems work and can be built if we use this bad solution. But in runtime, exception can be&amp;nbsp;occurred.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Good Example :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Here is the solution. We need to separate common used method and create new interface for these. Look at following code example :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IAnimal&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat();&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; See();&lt;br /&gt;}&lt;br /&gt;&lt;span class="rem"&gt;// interface for living in air&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IAnimalAir&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Fly();&lt;br /&gt;}&lt;br /&gt;&lt;span class="rem"&gt;// interface for living in sea&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IAnimalSea&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Swim();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Fish : IAnimal, IAnimalSea&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Fish is eating"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; See()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Fish is seeing"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Swim()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Fish is swiming"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Dog : IAnimal&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Dog is eating"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; See()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Dog is seeing"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Bird : IAnimal, IAnimalAir&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Eat()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Bird is eating"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; See()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Bird is seeing"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Fly()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine(&lt;span class="str"&gt;"Bird is  flying"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt; &lt;/span&gt;&lt;/span&gt; &lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt;I know, it's really difficult to forecast the interface which was written whether can be expanded in future. Don't concern about next requirements. Just create your interface layout, after that, if you need to add new functions into the interface, you should think about whether you will separate the interface into different interfaces.&amp;nbsp;&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #333333; font-family: verdana; font-size: small;"&gt;&lt;span style="font-size: 11px; line-height: 17px;"&gt; &lt;/span&gt;&lt;/span&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2133309590971344595?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2133309590971344595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2133309590971344595' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2133309590971344595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2133309590971344595'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/12/interface-segregation-principle.html' title='Interface Segregation Principle'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8706002002163998921</id><published>2009-11-27T14:19:00.027+01:00</published><updated>2010-04-21T12:02:01.876+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Principle'/><category scheme='http://www.blogger.com/atom/ns#' term='Dependency Inversion Principle'/><title type='text'>Dependency Inversion Principle</title><content type='html'>Dependency Inversion Principle (DIP) is one of the five software design principles. What programming languages you know, you should know these five principles written below :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/open-closed-principle.html"&gt;Open Close Principle&lt;/a&gt; (OCP)&lt;/li&gt;&lt;li&gt;Dependency Inversion Principle (DIP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/interface-segregation-principle.html"&gt;Interface Segregation Principle&lt;/a&gt; (ISP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/single-responsibility-principle.html"&gt;Single Responsibility Principle&lt;/a&gt; (SRP)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.technolatte.net/2009/12/liskovs-substitution-principle.html"&gt;Liskov's Substitution Principle&lt;/a&gt; (LSP)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;In this article, i will explain Dependency Inversion Principle.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;Purpose / Reason&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;This principle's purpose is not to provide strong correlation between high level classes and low level classes. The reason of using DIP is that changing in low level class shouldn't affect high level class. When you need some change in low level classes, you shouldn't need to change code in high level classes. For&amp;nbsp;clarifying&amp;nbsp;, let's see a bad example and good example respectively, thus, you can understand better.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;b&gt;Key Principles&lt;/b&gt;&lt;br /&gt;&lt;span style="color: #0b5394;"&gt;High level classes should not depend on low level classes. Both should depend on abstractions.&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;span style="color: #0b5394;"&gt;Abstractions should not depend on details. Details should depend on abstractions.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;br /&gt;For this case, you build log manager 6 months ago to track user's action. For this aim, you decided to insert log into database. But right now, &lt;i&gt;y&lt;/i&gt;&lt;i&gt;our manager wanted that log must be inserted into file&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Bad Example :&amp;nbsp;&lt;/i&gt;&lt;br /&gt;Here is the code that you wrote 6 months ago to track user actions.&lt;/div&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LogDB&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AddLog()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;// Add log into database&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LogManager&lt;br /&gt;{&lt;br /&gt;    LogDB log = &lt;span class="kwrd"&gt;new&lt;/span&gt; LogDB();&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; LogManager(LogDB log)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.log = log;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Log()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.log.AddLog();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;div&gt;Here is the new low level class you write to insert log into file. It needs to be implemented current structure.&lt;/div&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LogFile&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AddLog()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;// add log into file&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;When you try to implement LogFile into current class structure. You will have to change LogManager classes. Using this bad solution, you have these problems written below :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The code statement where you used to invoke LogManager.Log() method.&amp;nbsp;&lt;/li&gt;&lt;li&gt;You have to redone your unit testing.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;It's obvious, you are able to implementing new requirements into your current code. However, it won't be a good solution. Because, you will need to modify all related classes to Log Business Logic.&lt;br /&gt;&lt;br /&gt;Let's see how you can build better using Dependency Inversion Principle&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Good Example &lt;/i&gt;&lt;b&gt;:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;According to this principle, the way of building class structure is to start from high level classes to &amp;nbsp;low level classes. And put abstract class or interface between high level classes and low level classes.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;High Level Classes &lt;/span&gt;&lt;/b&gt;&lt;span style="color: #0b5394;"&gt;==&amp;gt;&lt;/span&gt;&lt;span style="color: #0b5394;"&gt; &lt;/span&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Abstraction &lt;/span&gt;&lt;/b&gt;&lt;span style="color: #0b5394;"&gt;==&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt; Low Level Classes&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;//ILog is a abstraction.&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ILog&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; AddLog();&lt;br /&gt;}&lt;br /&gt;&lt;span class="rem"&gt;// LogManager is a high level class&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LogManager&lt;br /&gt;{&lt;br /&gt;    ILog log;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; LogManager(ILog log)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.log = log;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Insert()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.log.AddLog();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span class="rem"&gt;// LogDB is a low level class&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LogDB : ILog&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AddLog()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;// insert log into database&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span class="rem"&gt;// LogFile is a low level class&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LogFile : ILog&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AddLog()&lt;br /&gt;    { &lt;br /&gt;        &lt;span class="rem"&gt;//insert log into file&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;b&gt;Summary&amp;nbsp;&lt;/b&gt;&lt;br /&gt;If you build your class structure in respect of DIP, you can implement new low level class such as LogFile without changing any code in your high level class ( LogManager ). Also you minimize the risk to affect old functionality. Beside that, you don't need to rewrite your unit testing for LogManager class.&lt;br /&gt;&lt;br /&gt;For this good example, as you see, LogManager (High Level Class) doesn't know anything about low level classes. It knows only interface of log classes (ILog).&lt;br /&gt;&lt;br /&gt;When you use DIP, you have more flexible. But this principle can not be applied for every class. If you have a class functionalities these are more likely to remain same, unchanged in the future, you don't &amp;nbsp;have to apply this principle.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8706002002163998921?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8706002002163998921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8706002002163998921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8706002002163998921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8706002002163998921'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/11/dependency-inversion-principle.html' title='Dependency Inversion Principle'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1206038831725922008</id><published>2009-11-03T08:51:00.007+01:00</published><updated>2009-12-01T13:50:17.268+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><category scheme='http://www.blogger.com/atom/ns#' term='soa'/><title type='text'>Bypass Unauthorized Certificate Consuming Web Services</title><content type='html'>When you consume any web services which uses &lt;span style="color: #000099;"&gt;https &lt;/span&gt;without by any trusted certification authority, you may encounter following exception:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;The underlying connection was closed: Could not establish trust relationship for  the SSL/TLS secure channel.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When you try to open WSDL link in any browser, you see this warning message :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_luRD3lsHwX4/Su_mXEipPBI/AAAAAAAAALI/cUX-t2q3T7w/s1600-h/certificate+warning+message.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5399787762270944274" src="http://3.bp.blogspot.com/_luRD3lsHwX4/Su_mXEipPBI/AAAAAAAAALI/cUX-t2q3T7w/s320/certificate+warning+message.JPG" style="cursor: pointer; display: block; height: 131px; margin: 0px auto 10px; text-align: center; width: 320px;" /&gt;&lt;/a&gt;So. it's easy to override this screen accepting "&lt;span style="font-style: italic;"&gt;Continue to this website&lt;/span&gt;". But in SOAP request, there is no notification screen like that. You couldn't accept it. Here is the solution for .NET, how to accept unauthorized certificate.&lt;br /&gt;&lt;br /&gt;In your client code where SOAP request, before consuming web services, use this statement :&lt;br /&gt;&lt;br /&gt;&lt;b&gt;C# Solution&lt;/b&gt;&lt;br /&gt;&lt;span style="color: #ff6600;"&gt;ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #ff6600;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;VB.NET Solution&lt;br /&gt;&lt;span style="color: orange;"&gt;&lt;span style="color: #ff6600; font-weight: normal;"&gt;Dim delCert = Function() Return True&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #ff6600; font-weight: normal;"&gt;ServicePointManager.ServerCertificateValidationCallback = delCert&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-style: italic;"&gt;Note: Don't forget to add following namespaces :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-style: italic;"&gt;System.Net&lt;br /&gt;System.Net.Security&lt;br /&gt;System.Security.Cryptography.X509Certificates&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you check the statement, anonymous method always returns true. This means, accept all certificate regardless of their authorization.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1206038831725922008?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1206038831725922008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1206038831725922008' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1206038831725922008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1206038831725922008'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/11/bypass-unauthorized-certificate.html' title='Bypass Unauthorized Certificate Consuming Web Services'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_luRD3lsHwX4/Su_mXEipPBI/AAAAAAAAALI/cUX-t2q3T7w/s72-c/certificate+warning+message.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-5133694361355629284</id><published>2009-10-06T10:07:00.004+02:00</published><updated>2009-12-01T13:50:30.413+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>How to install MySQL, MySQL GUI on ubuntu?</title><content type='html'>If you are newbie on linux enviroment and familiar with Windows operating system, you come accross differences. Especially about installing application. Because it's different, there is no double-click on installation file and "next-next-yes". You have to use &lt;span style="color: #3366ff;"&gt;Terminal &lt;/span&gt;which is placed under "Application/Accessories". After running Terminal, follow the steps written below :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Installing MySQL :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;sudo apt-get install mysql-server&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Installing MySql Browser : &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;sudo apt-get install mysql-browser&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Installing MySql Administrator : &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;sudo apt-get install mysql-admin&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-5133694361355629284?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/5133694361355629284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=5133694361355629284' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5133694361355629284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/5133694361355629284'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/10/how-to-install-mysql-mysql-gui-on.html' title='How to install MySQL, MySQL GUI on ubuntu?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7640792589673736040</id><published>2009-10-05T12:20:00.008+02:00</published><updated>2009-12-01T13:49:52.088+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='performance counter'/><title type='text'>"Current Anonymous Users" and "Current Connections"</title><content type='html'>When you decide to test performance and capacity of your web application, there are two indications that shows the vital numbers of your application.&lt;br /&gt;&lt;br /&gt;If you are new in performance tester or you already use performance counters in windows server, you may be confused about counters like "&lt;span style="color: #cc0000;"&gt;Current Anonymous Users&lt;/span&gt;" and "&lt;span style="color: #cc0000;"&gt;Current Connections&lt;/span&gt;". The worst thing is "Current Anonymous Users" counter shows different meanings in IIS 5.0 and IIS 6.0. If you are test on your local pc with IIS 5.0 you see different behaviours of the counter in IIS 6.0. Here is differences.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-style: italic; font-weight: bold;"&gt;In IIS 5.0. Current Anonymous Users is the number of current anonymous HTTP connections. This number decreases when the connection is closed (for various reasons, such as when the connection explicitly closes or times out). &lt;br /&gt;&lt;/div&gt;&lt;div style="font-style: italic; font-weight: bold;"&gt;In IIS 6.0. Current Anonymous Users is the number of current anonymous requests being processed. This number decreases when the request is completed. (HTTP.sys and IIS user mode both provide numbers for this counter.)&lt;br /&gt;&lt;/div&gt;&lt;div style="font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;In short, IIS 6.0 counts each request as a user, whereas IIS 5.0 counts each connection as a user.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-style: italic;"&gt;&lt;span style="font-size: 85%;"&gt;Excerpted from http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1e240a6e-834e-4e0d-ab2a-4335c573c06a.mspx?mfr=true&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;A typical scenario looks like:&lt;br /&gt;&lt;ol style="font-style: italic;"&gt;&lt;li&gt;User requests a page&lt;/li&gt;&lt;li&gt;Connection is established and "Current Connections" increase&lt;/li&gt;&lt;li&gt;The request is being processed and "Current Anonymous Users" increase&lt;/li&gt;&lt;li&gt;The request has been processed and "Current Anonymous Users" decrease&lt;/li&gt;&lt;li&gt;The connection is idle for some time&lt;/li&gt;&lt;li&gt;The connection is closed, and "Current Connections" decrease&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-style: italic;"&gt;Excerpted from http://www.gafvert.info/notes/current_connections_users.htm&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7640792589673736040?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7640792589673736040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7640792589673736040' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7640792589673736040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7640792589673736040'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/10/current-anonymous-users-and-current.html' title='&quot;Current Anonymous Users&quot; and &quot;Current Connections&quot;'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4225963771070736581</id><published>2009-10-02T15:11:00.008+02:00</published><updated>2009-12-01T13:50:46.088+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><category scheme='http://www.blogger.com/atom/ns#' term='architecture'/><title type='text'>Do you have any risk plan?</title><content type='html'>You have to admit that your applications or servers will be crashed. You have to be panic now. Because it's better to feel trouble than when you are in real trouble.&lt;br /&gt;&lt;br /&gt;Most of company back up their database, their sources in case of any uninvited problem. That's great idea to back up isn't that?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_luRD3lsHwX4/SsYFVLbLgzI/AAAAAAAAALA/-F5CfKcO58s/s1600-h/Risk20Management.92112037_std.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5387999865597559602" src="http://4.bp.blogspot.com/_luRD3lsHwX4/SsYFVLbLgzI/AAAAAAAAALA/-F5CfKcO58s/s320/Risk20Management.92112037_std.jpg" style="cursor: pointer; display: block; height: 286px; margin: 0px auto 10px; text-align: center; width: 301px;" /&gt;&lt;/a&gt;&lt;br /&gt;What's next? Imagine that, your database is corrupted. Do you know what you should do? If you can you answer following questions, just wait trouble time comfortably, you don't need to be afraid of. You can feel a little bit fear, not to much.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;How do you restore again?&lt;/li&gt;&lt;li&gt;How much time do you need to work the database again? &lt;/li&gt;&lt;li&gt;Who is/are responsible for restoring it?&lt;/li&gt;&lt;li&gt;Where is your database backup stored?&lt;/li&gt;&lt;li&gt;Is permission given to copy database backup from backup server to live database server?&lt;/li&gt;&lt;li&gt;Is there enough bandwidth between backup servers and live database servers?&lt;/li&gt;&lt;li&gt;Do you know username and password to access backup server?&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Let's explain why answers of these questions are vital for your application.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Do you restore manually using management tool of your database or using command prompt in windows operating system or terminal in linux operating system? If you use command prompt or terminal, you have to be sure to remember code what your write. It's better to write down in any simple file like notepad. It's quick way to copy "restore statement" and paste it. Or you can create bat files for windows operation system. &lt;/li&gt;&lt;li&gt;While your database doesn't work, your users want to know when application will be used again. You should notify problem and time when database is restored and used again. Because your users will be angry. Also your managers. Ambiguity should be clarified.&lt;/li&gt;&lt;li&gt;It's simple answer. This person can be your system administrator or database administrator or both of them. Just assign any person to this vital task.&lt;/li&gt;&lt;li&gt;Person who is responsible this task have to know where back up files are stored.&lt;/li&gt;&lt;li&gt;Responsible person has to have enough permission to access backup files and copy this file to database server.&lt;/li&gt;&lt;li&gt;Bandwidth is most important factor to shorten restoring database time. It should be more bandwidth as far as possible.&lt;/li&gt;&lt;li&gt;Ok, you have enough permission to access database server and backup server. Do you remember username and password? Also you shouldn't remember you have to write down somewhere else to find it quickly.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Finally, all of this instructions should be written on your dashboard. It's easy accessible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4225963771070736581?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4225963771070736581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4225963771070736581' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4225963771070736581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4225963771070736581'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/10/do-you-have-any-risk-plan.html' title='Do you have any risk plan?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_luRD3lsHwX4/SsYFVLbLgzI/AAAAAAAAALA/-F5CfKcO58s/s72-c/Risk20Management.92112037_std.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-4565719189403401032</id><published>2009-10-01T10:34:00.011+02:00</published><updated>2009-10-01T10:48:26.844+02:00</updated><title type='text'>URL Unexpectedly Ending Error with ASP.NET 2.0 Web Services</title><content type='html'>When trying to run any method with parameter manually in any browser, i came accross&lt;br /&gt;"&lt;span style="color: rgb(204, 0, 0);"&gt;URL Unexpectedly Ending Error &lt;/span&gt;". I typed link manually because i want to test web services using WAST (&lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1298"&gt;Web Application Stress Tool&lt;/a&gt;). I need to write link into path value textbox in WAST.&lt;br /&gt;&lt;br /&gt;It's really irritating that i couldn't test. After a while i found the solution. Just adding a few lines into web.config :&lt;br /&gt;&lt;br /&gt;&amp;#60;system.web&amp;#62;&lt;br /&gt;    &amp;#60;webservices&amp;#62;&lt;br /&gt;      &amp;#60;protocols&amp;#62;&lt;br /&gt;        &amp;#60;add name="HttpGet"&amp;#62;&amp;#60;/add&amp;#62;&lt;br /&gt;        &amp;#60;add name="HttpPost"&amp;#62;&amp;#60;/add&amp;#62;&lt;br /&gt;   &amp;#60;/webservices&amp;#62;&lt;br /&gt;&amp;#60;/system.web&amp;#62;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-4565719189403401032?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/4565719189403401032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=4565719189403401032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4565719189403401032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/4565719189403401032'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/10/url-unexpectedly-ending-error-with.html' title='URL Unexpectedly Ending Error with ASP.NET 2.0 Web Services'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1358240332366653198</id><published>2009-09-10T08:14:00.003+02:00</published><updated>2009-12-01T13:49:29.075+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='usability'/><title type='text'>Can your user recover any problem easily?</title><content type='html'>Usually, software developers, they assume that they build application without any problem.&lt;br /&gt;Even if you estimate all possible problems and fix them before publishing. There are always some problems you don't/can't oversee. Some problems in your application cannot be handled directly like network problems, hardware problems or problems of client's PC may affect your application.  So what should we do? We have to accept these kind of problems that we cannot control. And let users to handle the problem.&lt;br /&gt;&lt;br /&gt;The bottom line is that, "&lt;span style="color: #3366ff; font-weight: bold;"&gt;when users encounter any problem, they are able to recover problem easily&lt;/span&gt;; &lt;span style="color: #3366ff; font-weight: bold;"&gt;if possible without losing their unsaved data.&lt;/span&gt;" As they try to recover and start application again, they want to continue what they did before occuring problem. Image that, you are working on preparing presentation, then suddenly the application has been crashed and closed. It's really irritating. Preventing to unwanted conditions, you should let users recover problem easily and continue to work what they did.&lt;br /&gt;&lt;br /&gt;You should avoid just showing  "&lt;span style="font-style: italic;"&gt;We're sorry but we are unable to process your request at this time.  A general application failure has been detected.&lt;/span&gt; ".&lt;br /&gt;&lt;br /&gt;Ok, at least, for users it's nice to know to understand "this is problem". But it's not enough. You have to show the way how to cope with this problem.&lt;br /&gt;&lt;br /&gt;Instead of this, i'll give you an example on firefox. When you open more than one tab and read some text, suddenly a problem occures and firefox is closed. When you restart firefox, you see a dialog box, it's written, "do you want to open previous session or a new window".  As you see user can recover the problem easily.&lt;br /&gt;&lt;br /&gt;Second example that i can give is blogger.com. While writing, blogger.com saves what you wrote peridodically. Even if undesirable problem occur, you can continue to write.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1358240332366653198?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1358240332366653198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1358240332366653198' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1358240332366653198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1358240332366653198'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/09/can-your-user-recover-any-problem.html' title='Can your user recover any problem easily?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-262880853603889108</id><published>2009-09-07T15:30:00.004+02:00</published><updated>2009-09-07T15:33:39.662+02:00</updated><title type='text'>Can a bug be a feature?</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_luRD3lsHwX4/SqULEC1jW2I/AAAAAAAAAK4/SIrzGyRdnqk/s1600-h/Buggie.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 95px; height: 125px;" src="http://3.bp.blogspot.com/_luRD3lsHwX4/SqULEC1jW2I/AAAAAAAAAK4/SIrzGyRdnqk/s320/Buggie.png" alt="" id="BLOGGER_PHOTO_ID_5378717494072793954" border="0" /&gt;&lt;/a&gt;A bug is a big scary thing which happens to a developer. I will tell you a short story about a bug.&lt;br /&gt;&lt;br /&gt;Think about a few widgets in a page, when user click on a widget a dialog box with content is displayed and other widgets&lt;br /&gt;are not available to be clicked. I mean, user cannot click on a another widget when a widget is opened. In the same time,&lt;br /&gt;one widget can be displayed.&lt;br /&gt;&lt;br /&gt;On a widget, there is a radio list. when use click any radio station, it's started to play.&lt;br /&gt;In the beginning of development stage, event if close radio list dialog box, selected radio station&lt;br /&gt;still plays. People say that, "hey! it's a bug". It should be turned off, after closing the radio list window.&lt;br /&gt;We fixed the bug.&lt;br /&gt;&lt;br /&gt;Then manager came to use the application, then he said, "what if i want to listen a radio, while i use different widget."&lt;br /&gt;I mean he wanted to listen a radio, while reading a news or checking a weather condition.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;Suddenly the bug was a feature.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-262880853603889108?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/262880853603889108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=262880853603889108' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/262880853603889108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/262880853603889108'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/09/can-bug-be-feature.html' title='Can a bug be a feature?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_luRD3lsHwX4/SqULEC1jW2I/AAAAAAAAAK4/SIrzGyRdnqk/s72-c/Buggie.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-1408776040815539077</id><published>2009-08-30T21:38:00.006+02:00</published><updated>2009-12-01T13:49:05.710+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='architecture'/><title type='text'>Architectural Agreement</title><content type='html'>Every software architect/engineer should know and understand you can't have it all. Whatever your stakeholder, manager says that, "we need high speed, high performance, more usability, more flexible, more secure application." don't accept. There is no application which has all.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As a software engineer or architecture, you should really understand your customer's needs. If customer demands a 100 meter length truck with features like carrying 500 tons and high speed. It's almost impossible. Think in one second, if it's possible, can you imagine cost and effectiveness and time which is required to finish. No doubt, it would be failure project.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/a/aa/The_Wasa_from_the_Bow.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" src="http://upload.wikimedia.org/wikipedia/commons/a/aa/The_Wasa_from_the_Bow.jpg" style="cursor: pointer; display: block; height: 302px; margin: 0px auto 10px; text-align: center; width: 472px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;I will tell you a true story in history. There is a war between Sweden and Poland in 1620. The king of Sweeden wanted to build a ship called the &lt;a href="http://en.wikipedia.org/wiki/Vasa_%28ship%29"&gt;&lt;span style="color: #ff6600;"&gt;Vasa&lt;/span&gt;&lt;/a&gt;. Because, this was is really costly war and he wanted to end quickly. But the ship was not an ordinary ship. It was to be more than 200 feet long, have the ability to transport 300 troops safely across the waters into Poland and carry 64 guns on two gun on decks. Time was of the essence and money was limited. The ship architect was not experienced to build this kind of big ship. He never designed before. But he accepted this task. After finishing to build the ship, vasa, the big day came. The ship sailed into the harbor and immediately sank less than 2km into her maiden voyage.&lt;br /&gt;&lt;br /&gt;The ship architect tried to fulfill all of the king's requirements. Finally, the project was failure.&lt;br /&gt;&lt;br /&gt;Ship architect behavior is similar to software architect-engineer. As a software leader, engineer or architect, you should avoid accept all requirements. You may think, "i have to satisfy my customer." That's correct. But if you accept all wishes, you creates unstable application it would be failure project after releasing. You should warn your customer, and &lt;span style="font-weight: bold;"&gt;try to understand what customer really needs. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-1408776040815539077?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/1408776040815539077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=1408776040815539077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1408776040815539077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/1408776040815539077'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/08/architectural-agreement.html' title='Architectural Agreement'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8323216875831321514</id><published>2009-08-14T11:19:00.004+02:00</published><updated>2009-08-14T11:32:35.624+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><title type='text'>AJAX - Asynchronous  JavaScript and XML</title><content type='html'>I won't explain what is ajax. I'm confused nowadays. Keep reading, why i'm puzzled.&lt;br /&gt;&lt;br /&gt;Ajax stands for &lt;span style="font-style: italic;"&gt;"Asynchronous  JavaScript and &lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;XML&lt;/span&gt;&lt;/span&gt;". As you see, you retrieve data from server using &lt;a href="http://en.wikipedia.org/wiki/Javascript"&gt;JavaScript &lt;/a&gt;asynchronously, the data returned from server is &lt;a href="http://en.wikipedia.org/wiki/XML"&gt;XML&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What if i retrieve data formed  as &lt;a href="http://en.wikipedia.org/wiki/JSON"&gt;JSON&lt;/a&gt;, can i say that i use Ajax?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8323216875831321514?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8323216875831321514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8323216875831321514' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8323216875831321514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8323216875831321514'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/08/ajax-asynchronous-javascript-and-xml.html' title='AJAX - Asynchronous  JavaScript and XML'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8474275796408374576</id><published>2009-08-13T11:27:00.008+02:00</published><updated>2009-12-01T13:48:44.109+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='naming convention'/><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><category scheme='http://www.blogger.com/atom/ns#' term='architecture'/><title type='text'>Define Terms and Rules</title><content type='html'>Think about that, a new project will be started or a new development team will be created. No mather what will happen. If you are leader of team or project, you should define some terms and rules "&lt;span style="color: red;"&gt;with team members&lt;/span&gt;". One person shouldn't decide every details.&lt;br /&gt;&lt;br /&gt;Each developer, engineer, designer and project manager has own style. It's so common, there is no wrong with that. Each person involved in any project has different skills, experiences. If they are free to apply their own style in same project, ultimately, it will be fail, no doubt. That's the big question how do we prevent unavoidable failure? Keep reading.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_luRD3lsHwX4/SoPkG8SRbhI/AAAAAAAAAKw/QgpnMSvMEe8/s1600-h/project_management-2.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5369385988668878354" src="http://2.bp.blogspot.com/_luRD3lsHwX4/SoPkG8SRbhI/AAAAAAAAAKw/QgpnMSvMEe8/s320/project_management-2.jpg" style="cursor: pointer; display: block; height: 222px; margin: 0px auto 10px; text-align: center; width: 320px;" /&gt;&lt;/a&gt;&lt;br /&gt;Team members including manager, leader,  customers anyone who is in project has to talk same "&lt;span style="color: #3366ff; font-weight: bold;"&gt;project language&lt;/span&gt;". Communication between team members is really more important than choosing technology to be used. If there is a lack communication, there are lots of missunderstanding and it causes big issues which are technical, cost, deadline etc. In my opinion communication is a  key pillar of project. For good communication, some terms and rules should be defined before starting project. Look at these example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Example 1:&lt;/span&gt;&lt;br /&gt;There is an object to contains record, stored procedure, functions etc. inside it. In MS SQL enviroment it's called "&lt;span style="color: black; font-style: italic;"&gt;database&lt;/span&gt;" while in MySQL it's called "&lt;span style="color: #3366ff; font-style: italic;"&gt;schema&lt;/span&gt;".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Example 2:&lt;/span&gt;&lt;br /&gt;If one object is not initialized in .NET Enviroment, developer who uses vb.net says, "&lt;span style="font-style: italic;"&gt;nothing&lt;/span&gt;", while developer who uses C# says "&lt;span style="font-style: italic;"&gt;null&lt;/span&gt;". VB.NET developers say "&lt;span style="font-style: italic;"&gt;function&lt;/span&gt;", C#  developers say "&lt;span style="font-style: italic;"&gt;method&lt;/span&gt;".&lt;br /&gt;&lt;br /&gt;You may think they are unimportant points, but misunderstanding may cause big issues.&lt;br /&gt;&lt;br /&gt;Also, some technical rules should be written, such as "&lt;span style="color: #cc0000;"&gt;naming convention&lt;/span&gt;". In same project, same naming convention rules should be used.&lt;span style="font-style: italic;"&gt; Hungarian, pascal, camel case&lt;/span&gt; etc. . More than one naming convention can be used in same project. For instance, hungarian convention can be used for local variables, for public variables pascal case can be used or camel case can be used for parameters.&lt;br /&gt;&lt;br /&gt;Another example can be "words" written in project proposal or concept. These terms written below can be identified:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Customer ; which person is called customer?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;User;  which person is called user?&lt;/li&gt;&lt;li&gt;Name,-surname or first name-last name; which one is choosen?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Postcode or zipcode; which one is used?&lt;/li&gt;&lt;li&gt;Which term is used "authorization" or "roles"?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;These list can be expanded in respect of your needs. It's not possible to identify all items in one meeting session. It can be boring. During development process, it's always possible to define these terms which are not defined.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8474275796408374576?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8474275796408374576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8474275796408374576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8474275796408374576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8474275796408374576'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/08/define-terms-and-rules.html' title='Define Terms and Rules'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_luRD3lsHwX4/SoPkG8SRbhI/AAAAAAAAAKw/QgpnMSvMEe8/s72-c/project_management-2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-6098475195727149501</id><published>2009-07-28T09:16:00.015+02:00</published><updated>2009-12-01T13:43:21.094+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='usability'/><title type='text'>Are we missing usability?</title><content type='html'>As a software engineer, our purpose is to keep software working without any problem (at elast a few acceptable bug), implement new requirements into current project easily, build easy maintenable framework, provide fast responses to client, building robust system for security etc. Our positions requires that functionalites of software have to work correctly, securely, fast. Beside that, we have to deal with database environment and network to work together with software.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_luRD3lsHwX4/Sm6xiKqMvmI/AAAAAAAAAKo/FBrL_1QagVY/s1600-h/usability-day.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5363419406779858530" src="http://1.bp.blogspot.com/_luRD3lsHwX4/Sm6xiKqMvmI/AAAAAAAAAKo/FBrL_1QagVY/s320/usability-day.jpg" style="cursor: pointer; display: block; height: 152px; margin: 0px auto 10px; text-align: center; width: 309px;" /&gt;&lt;/a&gt;&lt;br /&gt;In our universities we learned software development life cycle (SDLC) consist of 6 phahes :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Requirements&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Analysis&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Design&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Coding&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Testing&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Implementation&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;These list can be expanded.&lt;br /&gt;&lt;br /&gt;When we start a new project these phases are followed even if  &lt;a href="http://en.wikipedia.org/wiki/Scrum_%28development%29"&gt;SCRUM&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Extreme_programming"&gt;XP &lt;/a&gt;or &lt;a href="http://en.wikipedia.org/wiki/Waterfall_model"&gt;waterfall&lt;/a&gt;  methodologies are used.&lt;br /&gt;&lt;br /&gt;Let's assume, all phases was completed and it was rolled out.&lt;br /&gt;&lt;br /&gt;When project is published, the user begins to use software. Mostly, the user calls your colleague and ask that "&lt;span style="color: #ff9900; font-style: italic;"&gt;how can i send message?&lt;/span&gt;" or "&lt;span style="color: #ff9900; font-style: italic;"&gt;error is occured, but i dont't know what should i do&lt;/span&gt;&lt;span style="color: #ff9900;"&gt;?&lt;/span&gt;". In most situations, we may think like that "&lt;span style="font-style: italic;"&gt;they didn't find how to solve because they are novice users. it will take time to learn&lt;/span&gt;" Is it good excuse? No.&lt;br /&gt;&lt;br /&gt;Even if your users has little information about computer technologies like pc, mobile phone, smart application or others. You shouldn't blame your users' insufficient skills. You heard complaints everyday like these.  So, how can you cope with and decrease these kind of complaints?&lt;br /&gt;&lt;br /&gt;Altough your application executed really complex tasks, you don't great job. (ok, you did half of it) One remains. &lt;span style="font-weight: bold;"&gt;Usability &lt;/span&gt;phase should be added in your software development life cycle regardless of methodologies that we use. If your users cannot perform tasks, your software is nothing. Even if you use lots of design patterns, algorithms, develop robost system...&lt;br /&gt;&lt;br /&gt;Unfortunately, little details determine whether a software is used easily. For instance, feedback messages should help users recover from any problem by oneself . It shouldn't give fear to users. Users can overcome any problem without any fear. You have to encourage users to discover your software without any fear.&lt;br /&gt;&lt;br /&gt;Usability has own life cycle, before starting usability working,  there are some items you should follow. it has testing phase, you need to create test scenarios, you have to find test users which are suitable for your project. After completing all tests, you need to evaluate test results.&lt;br /&gt;&lt;br /&gt;Summary, I can say, usability it has own unique field. it requires experienced usability engineer. As a manager or cio, you shouldn't measure usability of application. As a developer, it's easy for you to find and perform tasks. Because you did it, even if more complex, you can execute easily. Usability is not only to decide which color or images are used. You have to find someone who manage whole usability phases.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-6098475195727149501?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/6098475195727149501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=6098475195727149501' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/6098475195727149501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/6098475195727149501'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2009/07/are-we-missing-usability.html' title='Are we missing usability?'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_luRD3lsHwX4/Sm6xiKqMvmI/AAAAAAAAAKo/FBrL_1QagVY/s72-c/usability-day.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7541831873822030789</id><published>2008-06-19T13:47:00.016+02:00</published><updated>2009-07-21T10:00:11.379+02:00</updated><title type='text'>Difference among Int32.Parse(), Convert.ToInt32(), and Int32.TryParse()</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_luRD3lsHwX4/SFpMuje0c5I/AAAAAAAAAGs/RV_kRmrRX40/s1600-h/Converting.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_luRD3lsHwX4/SFpMuje0c5I/AAAAAAAAAGs/RV_kRmrRX40/s320/Converting.jpg" alt="" id="BLOGGER_PHOTO_ID_5213563881316971410" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family: verdana;font-family:verdana;font-size:100%;"  &gt;Have you ever considered between the methods which are used convert to integer? If yes or no, please continue to read. When you write code, probably you use convert process between types. Especially from string type to integer type. NET Framework 1.x supports two methods for converting. One of them is Int32.Parse and another is Convert.ToInt32. And also in .NET framework 2.0, Int32.TryParse is available in c#. Ok let's begin to explain what are differences between them.&lt;/span&gt;&lt;span style="font-family: verdana;font-size:100%;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;&lt;span style="font-family: verdana;"&gt;First of all. we define the variables to be used following examples.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:100%;color:DarkBlue;" id="ctl00_ContentPlaceHolder1_lblDescription"   &gt;string s1 = "123";&lt;br /&gt;string s2 = "123.45";&lt;br /&gt;string s3 = null;&lt;br /&gt;string s4 = "123456789123456789123456789123456789123456789";&lt;br /&gt;&lt;br /&gt;int result;&lt;br /&gt;bool success; &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;Int32.Parse(string s)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;When s is null, &lt;span style="color: rgb(0, 102, 0);"&gt;ArgumentNullException&lt;/span&gt; is throwed, if s is not integer value, &lt;span style="color: rgb(0, 102, 0);"&gt;FormatException&lt;/span&gt; is throwed. If s represents number less than&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;MinValue or grater than MaxValue, &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;OverFlowExceptin&lt;/span&gt; is throwed.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;result = Int32.Parse(s1);  &lt;span style="color: rgb(153, 153, 0);"&gt;//output --&gt; 123&lt;/span&gt;&lt;br /&gt;result = Int32.Parse(s2);  &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; FormatException&lt;/span&gt;&lt;br /&gt;result = Int32.Parse(s3);  &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; ArgumentNullException&lt;/span&gt;&lt;br /&gt;result = Int32.Parse(s4);  &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt; OverflowException &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;font-family:verdana;font-size:100%;"  &gt;Convert.ToInt32(string s)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;When s is null, &lt;span style="color: rgb(0, 102, 0);"&gt;zero &lt;/span&gt;is returned, if s is not integer value, &lt;span style="color: rgb(0, 102, 0);"&gt;FormatException&lt;/span&gt; is throwed. If s represents number less than&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;MinValue or grater than MaxValue, &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;OverFlowExceptin&lt;/span&gt; is throwed.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;result = Convert.ToInt32(s1);  &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; 123&lt;/span&gt;&lt;br /&gt;result = Convert.ToInt32(s2);  &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; FormatException&lt;/span&gt;&lt;br /&gt;result = Convert.ToInt32(s3);  &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; 0&lt;/span&gt;&lt;br /&gt;result = Convert.ToInt32(s4);  &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt; OverflowException &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-family:verdana;font-size:100%;"  &gt;Int32.TryParse(string, out int)&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;When s is null or not integer value, &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);font-family:verdana;font-size:100%;"  &gt;zero &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;is returned.&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;success = Int32.TryParse(s1, out result);    &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; true;   result =&gt; 123&lt;/span&gt;&lt;br /&gt;success = Int32.TryParse(s2, out result);   &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; false;   result =&gt; 0&lt;/span&gt;&lt;br /&gt;success = Int32.TryParse(s3, out result); &lt;span style="color: rgb(153, 153, 0);"&gt;  //&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(255, 102, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="color: rgb(153, 153, 0);"&gt; false;   result =&gt; 0&lt;/span&gt;&lt;br /&gt;success = Int32.TryParse(s4, out result);    &lt;span style="color: rgb(153, 153, 0);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt;output --&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription" style="color: rgb(153, 153, 0);font-family:verdana;font-size:100%;"  &gt; false;   result =&gt; 0&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;As a result, &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);font-family:verdana;font-size:100%;"  &gt;Int32.TryParse&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt; is most usefull and better. it reduces the risk of converting to integer during runtime.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7541831873822030789?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7541831873822030789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7541831873822030789' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7541831873822030789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7541831873822030789'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/06/difference-among-int32parse.html' title='Difference among Int32.Parse(), Convert.ToInt32(), and Int32.TryParse()'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_luRD3lsHwX4/SFpMuje0c5I/AAAAAAAAAGs/RV_kRmrRX40/s72-c/Converting.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-6487759313798999414</id><published>2008-06-12T12:30:00.004+02:00</published><updated>2008-06-12T12:34:43.270+02:00</updated><title type='text'>10 Things Make Developers to be Succesfull</title><content type='html'>&lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;1.Clarifying user requirements&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;As you spend more time developing an application, you can sometimes predict some of the requests of your customers. Don’t take this for granted and assume you know more than your users do. When you receive the requirements, spend some time with them and review their specification to confirm you are on the same page. Not doing so can end up costing you time as you rework the application later on.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;2.Collaborating&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;Call it brainstorming, call it peer code review, call it whatever you want — but just make sure you collaborate with those around you. Bouncing ideas off others will help you identify any holes in your potential solution and might even help you develop a solution better than your original design.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;3.Version control&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;Anybody who has ever had his or her code stepped on or deleted knows the value of a good version control system. It doesn’t matter if its CVS, ClearCase, or even Visual Source Safe. Get it, learn it, and use it. You don’t want all your hard work to be blown away with a few mistaken keystrokes.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;4. Basic system testing&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;Most developers don’t like to test. Or maybe I should say most developers hate testing. But it’s crucial for you to do your own testing before you release it to anybody else. Nothing will get your testing group upset and knocking on your door quicker than receiving code that doesn’t perform the basics. Make sure entry screens allow input, check that you can’t enter a letter where only numbers are allowed, verify that reports actually print information and that columns add up — the basic stuff.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;5. Usability&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;Early in my career, I designed a screen for a group of data entry users. I thought my design was so slick. The system had all the bells and whistles they needed and then some. I was just about ready to install it when it was pointed out to me that the users almost never used a mouse. My design had added some buttons to the screen and had them lifting their hands from the keyboard over and over. Not efficient for them and very humbling for me. Spend some time to learn about the types of usability issues your customers may have and everybody will be happier.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;6. System performance&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;In this era of instant gratification, it’s hard to satisfy end users. When they click on a button, they expect that the system will immediately respond. Or they may have the misconception that overnight processes really should take only an hour or two. When developing your application, ensure that you understand what type of response the users expect and require.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;7. Comments in your code&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;Comments are the bane of many developers’ existence. We want to spend our time writing code not writing &lt;em&gt;about&lt;/em&gt; code. But most of us have been tasked at some point with going in and maintaining somebody else’s work. If you’re like me, you may have sometimes found it so confusing that your first reaction was to rip it all out and start over. My experiences have taught me that even by adding some very basic commenting around sections of code and trying to use descriptive variable names and the like, you can have a significant positive impact on the next person who has to maintain your legacy.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;8. Logging&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;When you’re developing applications (especially those without any type of user interface), make sure you build some helpful logging solutions into the code. There are few worse things for a developer to do than to try to debug an application with little visibility into what is going on when it is running.&lt;/p&gt; &lt;p&gt;It doesn’t have to be overly complex. Maybe just writing out some of the values of your variables or counters at certain places in the code or when it hits certain subroutines. You can set it up so it logs only when a particular environmental condition exists (maybe a specific text file exists in a directory). Trapping anything that is going to help you track down and resolve issues quickly is what you’re going for here.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;9. Keeping your skills up to date&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;Still coding in something a few years old? Many people work for companies run by legacy applications that are past their prime. But that doesn’t mean you should ignore what’s going on in the world around you. A lot of the new technologies out there can be integrated and could provide a boost to you and your company. Take some time to try to understand them a bit, and who knows when you can use it to your advantage.&lt;/p&gt; &lt;h3 style="color: rgb(255, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;10. Taking pride in your work&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;One thing I always thought about and tried to pass along to my teams was the concept of having pride and ownership in the applications we were responsible for. I never wanted to hear that my applications weren’t working at their peak capabilities or that users were happy. And if we did hear about a problem, we would go out of our way to do everything we could to rectify the situation immediately.&lt;/p&gt; &lt;p&gt;It doesn’t matter if you are a head-down developer in a large organization, a systems designer, or a single jack-of-all-trades for your own company. Taking some of these ideas into consideration will not only help you produce a better end product but it will also allow you continue to evolve yourself and your career to the next level.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-6487759313798999414?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/6487759313798999414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=6487759313798999414' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/6487759313798999414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/6487759313798999414'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/06/10-things-make-developers-to-be.html' title='10 Things Make Developers to be Succesfull'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7149588136757227004</id><published>2008-06-10T14:59:00.003+02:00</published><updated>2009-12-01T13:47:34.652+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='linq'/><title type='text'>LINQ Pad</title><content type='html'>&lt;a href="http://www.linqpad.net/linqpadlogo.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" src="http://www.linqpad.net/linqpadlogo.png" style="cursor: pointer; float: left; margin: 0pt 10px 10px 0pt; width: 200px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx"&gt;LINQ &lt;/a&gt;stands for .NET Language Integrated Query which helps developers to query ant data soruce. You can filter any data source such as ArrayList, Collections, DataSet or Xml File etc. If you know T-SQL, it's easy for you to use LINQ. And you understand what i mean.&lt;br /&gt;&lt;br /&gt;Speaking LINQ, i came accross the tool which is used to query with LINQ. LINQPad. LINQPad has lots of sample about LINQ. If you want to learn LINQ, it's for you.   And LINQPad is more than just a LINQ query tool: it's a code snippet IDE.  Instantly execute any C# 3 or VB 9 expression or statement block.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.linqpad.net/"&gt;LinqPad Homepage&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.linqpadupdates.net/LINQPad.exe"&gt;LinqPad Download&lt;/a&gt;&lt;br /&gt;&lt;iframe id="AnswersBalloonIframe" src="javascript:;" style="background-color: transparent; border: medium none; height: 306px; left: 113px; margin-left: 10px; margin-top: 10px; position: absolute; top: 36px; visibility: hidden; width: 490px; z-index: 99998;"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;div id="AnswersBalloon" style="left: 113px; position: absolute; text-align: left; top: 12px; visibility: hidden; width: 490px; z-index: 99999;"&gt;&lt;div id="AnswerTipHook" style="background-image: url(http://www.answers.com/main/images/hook-topL.gif); height: 24px; margin-left: 25px; position: relative; top: 10px; width: 67px;"&gt;&lt;/div&gt;&lt;div class="AnswersHeader"&gt;&lt;div class="AnswersHeaderInner" handlefor="AnswersBalloon" id="AnswersHandle0" style="cursor: move;"&gt;&lt;div class="AnswersHeader1"&gt;&lt;a href="" onclick="var ac = document.getElementById('answertipClose'); if (ac) ac.innerHTML='close'; else window.status='close'; return true;" style="float: right;"&gt;&lt;img align="top" alt="Close" border="0" id="AnswersCloseImage" src="http://www.answers.com/main/images/close.gif" style="cursor: pointer; margin-right: 10px; position: relative;" /&gt;&lt;/a&gt;&lt;a href="" id="AnswertipMore" onclick="var ac = document.getElementById('answertipClose'); if (ac) ac.innerHTML='close'; else window.status='close';return true;" style="cursor: pointer; float: right; margin-top: 9px; padding-right: 10px; text-decoration: none; visibility: hidden;" target="AnswersQueryWindow"&gt; Read more &amp;gt;&amp;gt;  &lt;/a&gt;&lt;a href="" id="AnswertipOptions" onclick="var ac = document.getElementById('answertipClose'); if (ac) ac.innerHTML='options'; else window.status='options';return true;" style="cursor: pointer; float: right; margin-top: 9px; padding-right: 10px; text-decoration: none;"&gt; Options &amp;gt;&amp;gt;  &lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.answers.com/?initiator=FFANS" style="cursor: pointer; float: left;"&gt;&lt;img align="top" alt="Visit Answers.com" border="0" id="AnswersLogoImage" src="http://www.answers.com/main/images/answers-logo.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="AnswersContentFrame" id="Answers_frame"&gt;&lt;table class="donotmoveme" id="Balloontable2" style="float: left; width: 480px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div id="Answertip" style="height: 235px; overflow: hidden; width: 473px;"&gt;&lt;/div&gt;&lt;div id="answertipClose" style="display: none;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="AnswersFooter" id="Answers_footer"&gt;&lt;div style="float: left; height: 22px; width: 471px;"&gt;&lt;iframe allowtransparency="true" frameborder="0" id="AnswersAds" scrolling="no" src="http://www.answers.com/main/tip2.jsp?s=developers%2520to%2520query%2520from%2520any%2520%2520&amp;amp;wt=1&amp;amp;nafid=&amp;amp;cobrand=" style="border: 0px none; height: 22px; padding: 0px; width: 100%;"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-7149588136757227004?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/7149588136757227004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=7149588136757227004' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7149588136757227004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/7149588136757227004'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/06/linq-pad.html' title='LINQ Pad'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-249036949952075447</id><published>2008-05-26T16:22:00.006+02:00</published><updated>2009-12-01T13:43:52.731+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='openNETCF'/><category scheme='http://www.blogger.com/atom/ns#' term='GPRS'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET compact framework'/><title type='text'>Start GPRS connection Programatically</title><content type='html'>In windows mobile application, you can start up the GPRS connection programatically. When i developed Windows Mobile Application with .NET Compact Framework 2.0, i came across &lt;a href="http://www.opennetcf.com/"&gt;&lt;span style="font-weight: bold;"&gt;openNETCF&lt;/span&gt; &lt;/a&gt;organization. This organization develops some usefull library for Windows Mobile Application. One of them is &lt;span style="color: #ff6600;"&gt;OpenNETCF.Net.dll &lt;/span&gt;and &lt;span style="color: #ff6600;"&gt;OpenNETCF.dll&lt;/span&gt;. Using this library you can make GPRS connection start up. After referencing these libraries, write these statements where you want to start up GPRS connection below :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #990000;"&gt;            connMgr = new OpenNETCF.Net.ConnectionManager();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #3366ff;"&gt;&lt;span style="color: #990000;"&gt;            connMgr.Connect(); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;to disconnect GPRS connection, write this :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;  &lt;span style="color: #990000;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3366ff;"&gt;&lt;span style="color: #990000;"&gt;connMgr.Disconnect();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;Please &lt;a href="http://www.opennetcf.com/FreeSoftware/SDF14/tabid/91/Default.aspx"&gt;click &lt;/a&gt;to download openNETCF libraries.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-249036949952075447?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/249036949952075447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=249036949952075447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/249036949952075447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/249036949952075447'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/05/start-gprs-connection-programatically.html' title='Start GPRS connection Programatically'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-151815926038075</id><published>2008-03-22T09:22:00.004+01:00</published><updated>2008-03-22T09:30:52.947+01:00</updated><title type='text'>Windows Vista Service Pack 1</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;Finally Service Pack 1 for windows vista released on 18 March 2008. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;SP1 contains changes focused on addressing specific reliability and performance  issues, supporting new types of hardware, and adding support for several  emerging standards. Windows Vista SP1 also addresses some management,  deployment, and support challenges.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="font-family: verdana;" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B0C7136D-5EBB-413B-89C9-CB3D06D12674"&gt;Download Vista SP1 for x86&lt;/a&gt;&lt;br /&gt;&lt;a style="font-family: verdana;" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=874A414B-32B2-41CC-BD8B-D71EDA5EC07C"&gt;Download Vista SP1 for x64&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;For an overview of significant changes and improvements in SP1, see &lt;/span&gt;&lt;a style="font-family: verdana;" href="http://go.microsoft.com/fwlink/?LinkId=107921" target="_blank" logredir="CTT=ToExternal"&gt;http://go.microsoft.com/fwlink/?LinkId=107921&lt;/a&gt;&lt;span id="EDC"  style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;For a list of the hotfixes and security updates included in SP1, see  &lt;/span&gt;&lt;a style="font-family: verdana;" href="http://go.microsoft.com/fwlink/?LinkId=107922" target="_blank" logredir="CTT=ToExternal"&gt;http://go.microsoft.com/fwlink/?LinkId=107922&lt;/a&gt;&lt;span id="EKC"  style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;script language="Javascript"&gt;    if(typeof(IsPrinterFriendly) != "undefined")    {    var l = "http://go.microsoft.com/fwlink/?LinkId=107921";    var nl;    var c = l.charAt(0);    var o = document.getElementById("EDC");    switch (c){    case "/":    nl=(" [http://" + document.domain + l + "]");    break    case "#":    nl=("");    break    default:    nl=" [" + l + "]"    }    if(o != null) o.innerHTML = nl;    } &lt;/script&gt;&lt;script language="Javascript"&gt;    if(typeof(IsPrinterFriendly) != "undefined")    {    var l = "http://go.microsoft.com/fwlink/?LinkId=107922";    var nl;    var c = l.charAt(0);    var o = document.getElementById("EKC");    switch (c){    case "/":    nl=(" [http://" + document.domain + l + "]");    break    case "#":    nl=("");    break    default:    nl=" [" + l + "]"    }    if(o != null) o.innerHTML = nl;    } &lt;/script&gt;&lt;h2  style="font-family:verdana;"&gt;&lt;span style="font-size:100%;"&gt;Before you install Windows Vista Service Pack 1&lt;/span&gt;&lt;/h2&gt;&lt;span style="font-family: verdana;font-size:100%;" &gt;If you install Windows Vista and then install SP1 without first activating  Windows Vista, you might not be able to uninstall the service pack.&lt;/span&gt; &lt;p style="font-family: verdana;font-family:verdana;" &gt;&lt;span style="font-size:100%;"&gt;Either activate Windows Vista before you install SP1 or activate SP1 before  you attempt to uninstall the service pack.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-151815926038075?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/151815926038075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=151815926038075' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/151815926038075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/151815926038075'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/03/windows-vista-service-pack-1.html' title='Windows Vista Service Pack 1'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8646206953210191236</id><published>2008-03-07T09:54:00.002+01:00</published><updated>2008-03-07T10:07:10.392+01:00</updated><title type='text'>Internet Explorer 8 Beta 1</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: verdana;"&gt;Internet Explorer 8 Beta 1 has been released. This version is for web developers and designers. According to Chris Wilson who is IE platform Architect;&lt;br /&gt;&lt;br /&gt;"&lt;/span&gt;&lt;span style="font-family: verdana;" class="style1"&gt;&lt;em&gt;This release contains some great   advances in Cascading Style Sheets (CSS) and layout, programming model,   performance, reliability, usability and service integration. We are eager to   ensure that the transition to Internet Explorer 8 is seamless for you and   your audience, and to give you a head start on using many of the new   features with your sites and services. We encourage you to test your sites   and services, and our platform implementation, and give us feedback!"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Internet Explorer Standart Supports:&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: verdana;"&gt;Developers and designers of all skill levels need great tools to deliver modern websites and write more efficient code without having to switch between the browser and a separate development environment. Internet Explorer 8 includes built-in tools that work well for professionals as well as those trying CSS and scripting for the first time.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-family: verdana;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Debug JavaScript&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;View and change the document object model (DOM)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;CSS 2.1&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Data URI&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;AJAX enhancements including navigation&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: verdana;" class="style1"&gt;&lt;em&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;&lt;/span&gt;&lt;br /&gt;click on &lt;a href="http://www.microsoft.com/windows/ie/ie8/welcome/en/default.html"&gt;http://www.microsoft.com/windows/ie/ie8/welcome/en/default.html&lt;/a&gt; to find out some new features.&lt;br /&gt;&lt;br /&gt;click on &lt;a href="http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/"&gt;http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/&lt;/a&gt; to read toolkit.&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8646206953210191236?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8646206953210191236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8646206953210191236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8646206953210191236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8646206953210191236'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/03/internet-explorer-8-beta-1.html' title='Internet Explorer 8 Beta 1'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-3934215342662285293</id><published>2008-02-17T22:50:00.005+01:00</published><updated>2009-12-01T13:45:36.878+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><title type='text'>Use explicit casting instead of DataBinder.Eval</title><content type='html'>&lt;div style="font-family: verdana;"&gt;&lt;span style="font-size: 100%;"&gt;The &lt;a href="http://msdn2.microsoft.com/en-us/library/4hx47hfe.aspx"&gt;DataBinder.Eval&lt;/a&gt; method uses .NET reflection to evaluate the arguments that are passed in and to return the results. Consider limiting the use of DataBinder.Eval during data binding operations in order to improve ASP.NET page performance.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: verdana;"&gt;&lt;span style="font-size: 100%;"&gt;Consider the following ItemTemplate element within a Repeater control using DataBinder.Eval:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 50%; color: black; font-family: Courier New; font-size: 10pt;"&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;tr&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;#&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; &lt;/span&gt;&lt;span style="color: #2b91af; font-size: 100%;"&gt;DataBinder&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;.Eval(Container.DataItem, &lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;"field1"&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;) &lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;#&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; &lt;/span&gt;&lt;span style="color: #2b91af; font-size: 100%;"&gt;DataBinder&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;.Eval(Container.DataItem, &lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;"field2"&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;) &lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;tr&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: verdana;"&gt;Using explicit casting offers better performance by avoiding the cost of .NET reflection. Cast the Container.DataItem as a DataRowView:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 50%; color: black; font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;tr&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;#&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; ((&lt;/span&gt;&lt;span style="color: #2b91af; font-size: 100%;"&gt;DataRowView&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;)Container.DataItem)[&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;"field1"&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;] &lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;#&lt;/span&gt;&lt;span style="font-size: 100%;"&gt; ((&lt;/span&gt;&lt;span style="color: #2b91af; font-size: 100%;"&gt;DataRowView&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;)Container.DataItem)[&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;"field2"&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;] &lt;/span&gt;&lt;span style="color: yellow; font-size: 100%;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;td&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;tr&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 100%;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue; font-size: 100%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 50%; color: black; font-family: verdana; font-size: 10pt;"&gt;&lt;div style="font-family: verdana; font-style: italic; margin: 0px;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-family: verdana; font-size: 78%; font-style: italic;"&gt;&lt;span style="color: black;"&gt;Referenced by http://dotnettipoftheday.org/tips/use-explicit-casting-instead-of-databinder.eval.aspx?discussion=1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-3934215342662285293?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/3934215342662285293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=3934215342662285293' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3934215342662285293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/3934215342662285293'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/02/use-explicit-casting-instead-of.html' title='Use explicit casting instead of DataBinder.Eval'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-2328112891737905171</id><published>2008-02-06T21:58:00.001+01:00</published><updated>2009-12-01T13:47:05.800+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='smtp'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><title type='text'>How to check email works without using SMTP</title><content type='html'>&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: arial;"&gt;Testing code that sends email has always been a pain. You had to set up a SMTP service just to test that your .NET application sends the e-mail correctly.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;However, there is a way to send e-mails with no SMTP server set up. Just configure your .NET application to drop e-mails into a specified folder instead of sending them via SMTP server:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-family: arial;"&gt;&amp;lt;system.net&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-family: arial;"&gt;&amp;lt;mailSettings&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-family: arial;"&gt;&amp;lt;smtp deliveryMethod="SpecifiedPickupDirectory"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-family: arial;"&gt;&amp;lt;specifiedPickupDirectory pickupDirectoryLocation="c:\Test\" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-family: arial;"&gt;&amp;lt;/smtp&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-family: arial;"&gt;&amp;lt;/mailSettings&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000; font-family: arial;"&gt;&amp;lt;/system.net&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;This will instruct SmtpClient class to generate mail message, save it as .eml file and drop it into c:\Test\ folder.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 85%; font-style: italic;"&gt;Referenced by http://dotnettipoftheday.org/tips/smtp-delivery-method-SpecifiedPickupDirectory.aspx&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;&lt;!--     google_ad_client = "pub-5058348535387881";     //.NET tips: ad on a tip page     google_ad_slot = "2523759684";     google_ad_width = 468;     google_ad_height = 60;     //--&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-2328112891737905171?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/2328112891737905171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=2328112891737905171' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2328112891737905171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/2328112891737905171'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/02/how-to-check-email-works-without-using.html' title='How to check email works without using SMTP'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8634585874621137083</id><published>2008-02-05T21:44:00.004+01:00</published><updated>2009-12-01T13:46:24.322+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sharepoint'/><title type='text'>SharePoint Technologies</title><content type='html'>&lt;div class="MsoNormal" style="font-family: verdana; line-height: 150%; text-align: justify;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="line-height: 150%;"&gt;SharePoint is a family of technologies from Microsoft that provides a server infrastructure to support the needs of information workers and their employers. SharePoint makes it possible for companies to engage all their information workers through the tools people are using already - Office clients (such as Word and Excel), Internet browsers (such as Internet Explorer), and e-mail clients (such as Outlook). Obviously, SharePoint works best with Office 2007.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: verdana; line-height: 150%; text-align: justify;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="line-height: 150%;"&gt;&lt;br /&gt;SharePoint also provides workers with the ability to connect with each other. Instead of sending files back and forth via e-mail, workers can set up information environments that make it easy to collaborate on documents or share a calendar. SharePoint uses a Web site infrastructure to deliver the bulk of its features. Users can use a Web browser or familiar Office clients, such as Word and Excel, to access SharePoint’s features. Office clients enable information workers to use familiar tools in new ways, which reduces training and support costs and increases solution development opportunities.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: verdana; line-height: 150%; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: verdana; line-height: 150%; text-align: justify;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="line-height: 150%;"&gt;SharePoint isn’t a new technology. The ability to provision team sites for use with Office clients was first introduced in May 2001 &lt;/span&gt;&lt;span style="line-height: 150%;"&gt; with a product called SharePoint Team Services. &lt;i&gt;SharePoint Portal Server 2001,&lt;/i&gt; a product for connecting team sites, was released in June 2001. With each subsequent release, more and more features were added. Windows SharePoint Services (WSS) version 3, which was released in November 2006, represents a major re-architecting of the product.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: verdana; line-height: 150%; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 150%; text-align: justify;"&gt;&lt;span style="line-height: 150%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: verdana;"&gt;Starting with the 2003 release, WSS became a component of the Windows Server operating system. The portal product, SharePoint Portal Server 2003, released alongside Office 2003. The latest release, Microsoft Office SharePoint Server (MOSS) 2007, is now officially part of the Microsoft Office suite of products.&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;span style="color: red; font-size: 85%; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #ff6600; font-size: 85%;"&gt;&lt;span style="font-style: italic;"&gt;excerpt from Microsoft Sharepoint 2007 for Dummies book.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8634585874621137083?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8634585874621137083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8634585874621137083' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8634585874621137083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8634585874621137083'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/02/sharepoint-technologies.html' title='SharePoint Technologies'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-8084647159976880519</id><published>2008-02-02T21:38:00.001+01:00</published><updated>2009-12-01T13:46:00.784+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><title type='text'>Correct using of ASP.NET Cache</title><content type='html'>Often in ASP.NET application we see a code which looks like this one:  &lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 50%; color: black; font-family: Courier New; font-size: 10pt;"&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (Cache[&lt;span style="color: #a31515;"&gt;"SomeData"&lt;/span&gt;] != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;{&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; name = ((&lt;span style="color: #2b91af;"&gt;SomeClass&lt;/span&gt;)Cache[&lt;span style="color: #a31515;"&gt;"SomeData"&lt;/span&gt;]).Name;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;//.....&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;}&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;This code is not safe enough and the second statement can generate a NullReferenceException sometimes. There is no guaranttee that a cached object will stay in the cache between two calls. After the first call it can be deleted either by garbage collector or by another thread to refresh cached data.&lt;br /&gt;So to overcome this problem rewrite the code using &lt;a href="http://msdn2.microsoft.com/en-us/library/cscsdfbt%28VS.80%29.aspx"&gt;as operator&lt;/a&gt;:&lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 50%; color: black; font-family: Courier New; font-size: 10pt;"&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;SomeClass&lt;/span&gt; someClass = Cache[&lt;span style="color: #a31515;"&gt;"SomeData"&lt;/span&gt;] &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;SomeClass&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (someClass != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;{&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; name = someClass.Name;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;//.....&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;}&lt;br /&gt;&lt;/div&gt;&lt;div style="margin: 0px;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: 85%; font-style: italic;"&gt;Referenced by http://dotnettipoftheday.org/tips/correct-using-of-aspnet-cache.aspx&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-8084647159976880519?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/8084647159976880519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=8084647159976880519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8084647159976880519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/8084647159976880519'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/02/correct-using-of-aspnet-cache.html' title='Correct using of ASP.NET Cache'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-779378834772536193</id><published>2008-01-18T08:53:00.000+01:00</published><updated>2008-01-18T08:56:50.231+01:00</updated><title type='text'>Yahoo Announces Support For Open ID 2.0</title><content type='html'>&lt;span id="articleBody"&gt;Yahoo (NSDQ: &lt;a target="_blank" href="http://www.techweb.com/financialCenter/index.jhtml?Account=techweb&amp;amp;Page=QUOTE&amp;amp;Ticker=YHOO" class="stockLink"&gt;YHOO&lt;/a&gt;) will support digital identity framework OpenID 2.0 in beta form Jan. 30. &lt;p&gt; Yahoo announced Thursday that it would support the technology, which allows users to consolidate their Internet identities. Plaxo and JanRain are working with Yahoo so users don't have to create separate IDs and logins at the Web sites blogs, and profile pages they visit -- as long as the sites support OpenID 2.0. &lt;/p&gt;&lt;p&gt; The OpenID Foundation and community also helped create specifications to improve security and convenience of OpenID. &lt;/p&gt;&lt;p&gt; Users can customize &lt;a href="http://openid.yahoo.com/"&gt;OpenID&lt;/a&gt; identifiers on me.yahoo.com or type "www.yahoo.com" or "www.flickr.com" on sites that support the platform. Yahoo said users will be protected by the company's sign-in seal while they surf the Web. Web sites can also add an option to allow users to sign in with their Yahoo ID. E-mail and  &lt;span style="text-decoration: underline;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;instant messaging addresses are withheld as users log in, and that creates a barrier to phishing or other attacks, Yahoo said.  &lt;/p&gt;&lt;p&gt; "A Yahoo ID is one of the most recognizable and useful accounts to have on the Internet, and with our support of OpenID, it will become even more powerful," Ash Patel, executive VP of platforms and infrastructure at Yahoo, said in a statement. &lt;/p&gt;&lt;p&gt;Scott Kveton, chairman of the board for the OpenID Foundation, said Yahoo's support of "an open Web" validates the OpenID movement and immediately triples the number of people who can use OpenID. Yahoo has 248 million users. &lt;/p&gt;&lt;p&gt;"With Yahoo actively engaged with the OpenID Foundation and its community to promote OpenID, Yahoo's users will be able to more easily access the many sites across the Web that support the standard, and the potential for access to Yahoo's vast international user base will create an even more powerful incentive for additional Web sites to begin accepting OpenID users," he said. &lt;/p&gt;&lt;p&gt; Joseph Smarr, chief platform architect of Plaxo, said the move also supports data portability for various Web services. &lt;/p&gt;&lt;p&gt;Larry Drebes, founder and VP of engineering for JanRain, said that secure, portable, digital identities are keys to advancing Web applications. &lt;/p&gt;&lt;p&gt; More than 120 million URLs and 9,000 sites support Open ID, created by open-source developers.&lt;/p&gt;&lt;a href="http://www.informationweek.com/shared/printableArticle.jhtml?articleID=205900413"&gt;Reference&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6277654023607323021-779378834772536193?l=www.technolatte.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.technolatte.net/feeds/779378834772536193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6277654023607323021&amp;postID=779378834772536193' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/779378834772536193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6277654023607323021/posts/default/779378834772536193'/><link rel='alternate' type='text/html' href='http://www.technolatte.net/2008/01/yahoo-announces-support-for-open-id-20.html' title='Yahoo Announces Support For Open ID 2.0'/><author><name>Serkan Karaarslan</name><uri>https://profiles.google.com/103367037296606772604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-ahyhUc3CaNM/AAAAAAAAAAI/AAAAAAAAAZs/vVrg7cW2qFU/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6277654023607323021.post-7793285355453218037</id><published>2008-01-16T00:16:00.000+01:00</published><updated>2008
