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

<channel>
	<title>Akash Kava &#187; Technology</title>
	<atom:link href="http://akashkava.com/blog/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://akashkava.com/blog</link>
	<description>Founder of NeuroSpeech</description>
	<lastBuildDate>Fri, 25 Jun 2010 16:07:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>UI Delegation Pattern for Data Controls in WPF/Silverlight</title>
		<link>http://akashkava.com/blog/258/ui-delegation-pattern-for-data-controls-in-wpfsilverlight/</link>
		<comments>http://akashkava.com/blog/258/ui-delegation-pattern-for-data-controls-in-wpfsilverlight/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 10:44:00 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Delegation]]></category>
		<category><![CDATA[Pattern]]></category>
		<category><![CDATA[SilverLight]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/?p=258</guid>
		<description><![CDATA[This is Preliminary documentation about UI Delegation Pattern to create Clean and Reusable Data Components and UI Markups in a Business Application. UI Delegation Pattern for WPF and Silverlight View more presentations from Akash Kava. UI Delegation Pattern I would call it simply divide and rule, UI Delegation Pattern is narrowing the focus towards piece [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/258/ui-delegation-pattern-for-data-controls-in-wpfsilverlight/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "UI+Delegation+Pattern+for+Data+Controls+in+WPF%2FSilverlight";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F258%2Fui-delegation-pattern-for-data-controls-in-wpfsilverlight%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F258%2Fui-delegation-pattern-for-data-controls-in-wpfsilverlight%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p align="justify">This is Preliminary documentation about UI Delegation Pattern to create Clean and Reusable Data Components and UI Markups in a Business Application.</p>
<div align="justify">
<div style="padding-bottom: 0px; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:77a73d93-0392-4904-b5ec-376ec54e12c8" class="wlWriterEditableSmartContent">
<div>
<div style="width:425px" id="__ss_3832620"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/ackava/ui-delegation-pattern-for-wpf-and-silverlight" title="UI Delegation Pattern for WPF and Silverlight">UI Delegation Pattern for WPF and Silverlight</a></strong><object width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=uidelegationpatternfordatacontrolsinwpfandsilverlight-100423123459-phpapp02&amp;stripped_title=ui-delegation-pattern-for-wpf-and-silverlight" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=uidelegationpatternfordatacontrolsinwpfandsilverlight-100423123459-phpapp02&amp;stripped_title=ui-delegation-pattern-for-wpf-and-silverlight" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/ackava">Akash Kava</a>.</div>
</div>
</div>
</div></div>
<h2 align="justify">UI Delegation Pattern</h2>
<p align="justify">I would call it simply divide and rule, UI Delegation Pattern is narrowing the focus towards piece of UI Element on the screen and have a UI component to fulfill every specific business needs.</p>
<p align="justify">User Interface is the direct connection between User and your business application, thought MVC, MVVM models exist, but they are found to be very useful in CRUD business applications, but when your application is more then CRUD and it involves complex UI and media / hardware interfaces for scientific and entertainment related applications, MVC/MVVM are little difficult to maintain over huge applications. This pattern is already in existence at many places. </p>
<h2 align="justify">Initial Rough Draft</h2>
<p align="justify">This is initial rough draft, I intend to collect problems and solutions and then I want to give a good name to this pattern, for now I am calling this as “UI Delegation Pattern” however I don&#8217;t know whether it suits the name correctly or not. But your opinions are most welcome, if such pattern is already named and exists then I am sorry if I am unaware of it, but please suggest if you know so.</p>
<h2 align="justify">UI Markup vs. Editor Files</h2>
<p align="justify">Earlier Visual Basic or Visual Studio would create .frm and resource files that would contain the contents of UI design created in “Designer/Editor” inside an IDE. These Editors would create code that is required to execute at runtime to create desired user interface. However since Editors would create code with specific style and pattern, these editor files are more or less very structured and they are less buggy. Of course too much of code will certainly make Editor very slow but at the same time, the consistency of UI code is preserved. But you are too much dependent on the Editor and complex UI could be very difficult to work in Editors.</p>
<p align="justify">Where else UI Markup based on xml, gives full freedom to user to create highly complex UI, but at the same time there is no consistency left as everyone writes code very differently. Markups gets piled into one file and it becomes way to difficult to maintain and understand how it works.</p>
<h2 align="justify">Identify Markup Noise</h2>
<p align="justify">My first approach is to identify problems with Markup Noise, so lets identify what is markup noise. When I see any html, aspx, php or such web scripts, the most annoying things I discover that in spite&#160; great CSS and Modular programming support, the scripts becomes a big junk to maintain. Sure WPF / Silverlight are also text markups, hand coded markups becomes way to big junk to manage.</p>
<p align="justify">Bigger problem is to visualize markups as they become more complex. As more and more lines of code gets piled into markup, more time is spent understanding and troubleshooting the UI.</p>
<h2 align="justify">How to Reduce Markup Noise?</h2>
<p align="justify">
<p align="justify">CSS brought a very useful way to reduce markup noise. Still lot of developers write inline styles and I hate to see that. Ideally nicely written code should have inline styles as small as possible.</p>
<h3 align="justify">Appearance Delegation</h3>
<p align="justify">CSS comes under category of Appearance Delegation where your delegate the look and feel of your component to CSS file. In WPF and Silverlight the themes are styles are introduced and you must have all your styles and look and feel related code into resources only.</p>
<p align="justify">The markup containers (Connection Containers) such as Window / Page / User Control should not have any inbuilt styles at all.</p>
<h3 align="justify">Business Logic Delegation</h3>
<p align="justify">This was not possible in plain html, but aspx, php etc did brought concept of server side controls where in you could inject business logic specific to components and reuse them. But these components (user controls / custom controls ) are only designed when they need to be reused, but even if it will be used only once, I would still suggest its better to have components as small as possible.</p>
<p align="justify">Example, Country Combo drop down , Gender Combo drop down, these boxes are nothing but set of options provided to user to select one of them. Now nobody makes specific custom controls for such items, but lets see a practical example.</p>
<h2 align="justify">Bad Markup Example</h2>
<div align="justify">
<pre class="csharpcode">    <span class="kwrd">&lt;</span><span class="html">Window.Resources</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">XmlDataProvider</span> <span class="attr">x:Key</span><span class="kwrd">=&quot;CountryData&quot;</span> <span class="attr">XPath</span><span class="kwrd">=&quot;/Countries&quot;</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Countries</span> <span class="attr">xmlns</span><span class="kwrd">=&quot;&quot;</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Country</span>
                    <span class="attr">CountryName</span><span class="kwrd">=&quot;United States&quot;</span>
                    <span class="attr">CountryCode</span><span class="kwrd">=&quot;US&quot;</span><span class="kwrd">/&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Country</span>
                    <span class="attr">CountryName</span><span class="kwrd">=&quot;United States&quot;</span>
                    <span class="attr">CountryCode</span><span class="kwrd">=&quot;US&quot;</span><span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Countries</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">XmlDataProvider</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Window.Resources</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span>

        <span class="kwrd">&lt;</span><span class="html">ComboBox</span>
            <span class="attr">ItemsSource</span><span class="kwrd">=&quot;{Binding Source={StaticResource CountryData},
                XPath=Country}&quot;</span>
            <span class="attr">DisplayMemberPath</span><span class="kwrd">=&quot;@CountryName&quot;</span>
            <span class="attr">SelectedValuePath</span><span class="kwrd">=&quot;@CountryCode&quot;</span>
            <span class="kwrd">/&gt;</span>

        <span class="kwrd">&lt;</span><span class="html">ComboBox</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">sys:String</span><span class="kwrd">&gt;</span>Male<span class="kwrd">&lt;/</span><span class="html">sys:String</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">sys:String</span><span class="kwrd">&gt;</span>Female<span class="kwrd">&lt;/</span><span class="html">sys:String</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">ComboBox</span><span class="kwrd">&gt;</span>

    <span class="kwrd">&lt;/</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span></pre>
</div>
<p align="justify">
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p align="justify">Now this file defines a resource xml for Country List, and it is bounded by ComboBox to list countries and another ComboBox defines inline items to be displayed.</p>
<h3 align="justify">Let us identify “Controls and Connection Containers”.</h3>
<p align="justify">The window, that hosts Country List and Gender Combo Boxes is <strong>“Connection Container” </strong>in which we should only host controls and connect inter dependent properties of every controls.</p>
<p align="justify">The Connection Container should not have any code that is not related to either any other items or business logic of the container at all.</p>
<p align="justify">List of Countries and Gender items are not at all related to anyone else except for the drop downs. This is pure markup junk where we have so many unnecessary information.</p>
<h2>Solution</h2>
<p>Define custom controls as shown below and see how small our markup becomes. And move Country List xml to some resource file.</p>
<pre class="csharpcode">    <span class="kwrd">public</span> <span class="kwrd">class</span> CountryComboBox : ComboBox
    {

        <span class="kwrd">public</span> CountryComboBox()
        {
            <span class="kwrd">this</span>.DisplayMemberPath = <span class="str">&quot;@CountryName&quot;</span>;
            <span class="kwrd">this</span>.SelectedValuePath = <span class="str">&quot;@CountryCode&quot;</span>;

            Binding b = <span class="kwrd">new</span> Binding();
            b.XPath = <span class="str">&quot;Country&quot;</span>;
            b.Source = FindResource(<span class="str">&quot;CountryData&quot;</span>);
            <span class="kwrd">this</span>.SetBinding(ItemsSourceProperty, b);
        }

    }</pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<pre class="csharpcode">    <span class="kwrd">public</span> <span class="kwrd">class</span> GenderComboBox : ComboBox
    {
        <span class="kwrd">public</span> GenderComboBox()
        {
            <span class="kwrd">this</span>.ItemsSource =
                <span class="kwrd">new</span> <span class="kwrd">string</span>[] {
                    <span class="str">&quot;Male&quot;</span>,
                    <span class="str">&quot;Female&quot;</span>
                };
        }
    }</pre>
<p>&#160;</p>
<p>The final Markup.</p>
<pre class="csharpcode">    <span class="kwrd">&lt;</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span>

        <span class="kwrd">&lt;</span><span class="html">local:CountryComboBox</span>
            <span class="kwrd">/&gt;</span>

        <span class="kwrd">&lt;</span><span class="html">local:GenderComboBox</span>
            <span class="kwrd">/&gt;</span>

    <span class="kwrd">&lt;/</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&#160;</p>
<p>Wow, the markup is very clean now. Also the code is easy to understand.</p>
<h2>Conclusion</h2>
<p align="justify">The connection container (Window / Page / User Control) should only have interdependent declarations and should not have any items that are only specific to one control. It should be as clean as possible and it should execute all necessary business logic for the component.</p>
<p align="justify">Configuration items, even resource bindings should be avoided in Connection Containers. They should be narrowed down to custom controls as much as possible.</p>
<p align="justify">This increases readability, reusability and helps in troubleshooting while focusing by narrowing the target.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F258%2Fui-delegation-pattern-for-data-controls-in-wpfsilverlight%2F&amp;linkname=UI%20Delegation%20Pattern%20for%20Data%20Controls%20in%20WPF%2FSilverlight" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/258/ui-delegation-pattern-for-data-controls-in-wpfsilverlight/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LOB Business Form Layout for WPF &amp; Silverlight</title>
		<link>http://akashkava.com/blog/272/lob-business-form-layout-for-wpf-silverlight/</link>
		<comments>http://akashkava.com/blog/272/lob-business-form-layout-for-wpf-silverlight/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 10:34:48 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[DataForm]]></category>
		<category><![CDATA[Layout]]></category>
		<category><![CDATA[LOB]]></category>
		<category><![CDATA[SilverLight]]></category>
		<category><![CDATA[UI Atoms]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/272/lob-business-form-layout-for-wpf-silverlight/</guid>
		<description><![CDATA[UI Atoms LOB Business Form Layout for WPF &#38; Silverlight View more presentations from Akash Kava. There is lot of buzz about LOB Business Form Layout for new platforms WPF &#38; Silverlight, both capable of displaying rich content and extend functionalities of existing components so better then ever before. XAML is better then earlier Rapid [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/272/lob-business-form-layout-for-wpf-silverlight/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "LOB+Business+Form+Layout+for+WPF+%26amp%3B+Silverlight";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F272%2Flob-business-form-layout-for-wpf-silverlight%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F272%2Flob-business-form-layout-for-wpf-silverlight%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<div style="padding-bottom: 0px; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:e15324b0-9e04-458a-bccf-63639d8642e2" class="wlWriterEditableSmartContent">
<div>
<div style="width:425px" id="__ss_3756627"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/ackava/ui-atoms-lob-business-form-layout-for-wpf-silverlight" title="UI Atoms LOB Business Form Layout for WPF &amp; Silverlight">UI Atoms LOB Business Form Layout for WPF &amp; Silverlight</a></strong><object width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=uiatomslobbusinessformlayoutforwpfsilverlight-100417052402-phpapp01&amp;stripped_title=ui-atoms-lob-business-form-layout-for-wpf-silverlight" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=uiatomslobbusinessformlayoutforwpfsilverlight-100417052402-phpapp01&amp;stripped_title=ui-atoms-lob-business-form-layout-for-wpf-silverlight" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/ackava">Akash Kava</a>.</div>
</div>
</div>
</div>
<p align="justify">There is lot of buzz about LOB Business Form Layout for new platforms WPF &amp; Silverlight, both capable of displaying rich content and extend functionalities of existing components so better then ever before.</p>
<p align="justify">XAML is better then earlier Rapid Form designers where you need to drag and drop within an IDE and the layout management becomes so complicated because no IDE is perfect. I remember upgrading from Visual Studio 2005 to 2008 and now 2010, most of our ASP.NET and WinForm projects would require lot of effort to work seamlessly in newer versions. The worst of all is, modifying layout without IDE becomes way to difficult.</p>
<p align="justify">In this presentation, I collected all important aspects of Business Form that we encounter in our day to day life and the complexity of forms make life terrible when clients request changes that takes hours on any IDE that sure breaks lot of code graphs and makes existing working system as completely useless code junk.</p>
<p align="justify">In UI Atoms, we at NeuroSpeech tried make set of components that are very easy to operate while going through tough change management.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F272%2Flob-business-form-layout-for-wpf-silverlight%2F&amp;linkname=LOB%20Business%20Form%20Layout%20for%20WPF%20%26amp%3B%20Silverlight" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/272/lob-business-form-layout-for-wpf-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SQL Assembly to replace T-SQL Business Logic</title>
		<link>http://akashkava.com/blog/259/using-sql-assembly-to-replace-t-sql-business-logic/</link>
		<comments>http://akashkava.com/blog/259/using-sql-assembly-to-replace-t-sql-business-logic/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 09:00:32 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Assembly]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/?p=259</guid>
		<description><![CDATA[SQL Assembly brings power of CLR (Common language runtime) inside SQL Database Stored Procedure which can overcome T-SQL programming pains of Intellisense, Debugging, Logging and Versioning. Traditional Problems with T-SQL and Stored Procedures I never liked programming in T-SQL, for various reasons listed below, No Intellisense, of course it has been introduced SQL 2008 onwards, [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/259/using-sql-assembly-to-replace-t-sql-business-logic/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Using+SQL+Assembly+to+replace+T-SQL+Business+Logic";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F259%2Fusing-sql-assembly-to-replace-t-sql-business-logic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F259%2Fusing-sql-assembly-to-replace-t-sql-business-logic%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>SQL Assembly brings power of CLR (Common language runtime) inside SQL Database Stored Procedure which can overcome T-SQL programming pains of Intellisense, Debugging, Logging and Versioning.</p>
<h2>Traditional Problems with T-SQL and Stored Procedures</h2>
<p>I never liked programming in T-SQL, for various reasons listed below,</p>
<ol>
<li><font color="#333333">No Intellisense, of course it has been introduced SQL 2008 onwards, but still its far behind what we get in Visual Studio.</font> </li>
<li><font color="#333333">Source Code Control, although scripts can be added to source code control, usually its unawareness and unwillingness of Database Administrator / Designer to use it correctly and mess things up.</font> </li>
<li><font color="#333333">Less human readable, T-SQL is very difficult to understand if its not documented well.</font> </li>
<li><font color="#333333">Source code is open, it can be modified, so in short Database Administrator has complete access to alter business logic.</font> </li>
<li><font color="#333333">Very less reusable, unless you do copy paste, no way to standardize the development.</font> </li>
<li><font color="#333333">No support for advanced visual tools to design T-SQL Stored Procedures.</font> </li>
<li><font color="#333333">Deployment is difficult, minor alternation can cause problems.</font> </li>
<li><font color="#333333">Most of business logic involves, loops, if-else, switch statements, and it takes 10 times more code to execute such logic in T-SQL then any other programming language in world.</font> </li>
<li><font color="#333333">You need multiple language talent, one with either VB.NET/C# and T-SQL.</font> </li>
<li>Difficult to Log information.</li>
</ol>
<h2>Introduction of SQL Assembly</h2>
<p>Since SQL 2005, introduction of SQL Assembly has been of great importance, however not much of people still use it, because of unawareness. But SQL Assembly can be modularized and reused, and it exists as simple CLR assembly inside database. </p>
<p>And following are benefits of SQL Assembly, besides few listed in <a href="http://msdn.microsoft.com/en-us/library/k2e1fb36(v=VS.100).aspx" target="_blank">MSDN here</a>.</p>
<ol>
<li><font color="#333333">LINQ in CLR Stored Procedure.</font> </li>
<li><font color="#333333">Better Source Code control over Visual C#/Visual Basic.NET project through Team System.</font> </li>
<li><font color="#333333">Intellisense.</font> </li>
<li><font color="#333333">Closed source, its safe.</font> </li>
<li><font color="#333333">Highly secure as Database Administrator can not alter business logic.</font> </li>
<li><font color="#333333">C# and VB.NET along with LINQ are more human readable, understanding and reusing code can be very easy.</font> </li>
<li><font color="#333333">Support for advanced documentation in comments.</font> </li>
<li><font color="#333333">Visual Studio Model designer can be used.</font> </li>
<li>Reuse your Business Logic for other database vendor products, e.g. Oracle, MySQL (Explained below). </li>
<li>You can do advanced logging with log-4-net or custom logging.</li>
</ol>
<h2>Small Example of How to use LINQ in SQL Assembly</h2>
<ol>
<li>Create a simple Visual C# Class Library Project. </li>
<li>Add reference of “System.Data” Assembly. </li>
<li>Create new ADO.NET Entity Model, and you can create it from Database or empty model, the way you want to develop your project. </li>
<li>Add few entities, I am going to demonstrate entity “Cart” which is a saved shopping cart for the Customer. </li>
</ol>
<h2><a href="http://akashkava.com/blog/wp-content/uploads/2010/04/CartDemo.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="CartDemo" border="0" alt="CartDemo" src="http://akashkava.com/blog/wp-content/uploads/2010/04/CartDemo_thumb.png" width="389" height="206" /></a>Create a Stored Procedure Class</h2>
<p>After creating model, lets create a class called “ShoppingCart” and add a static method as shown below.</p>
<blockquote><pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">ShoppingCart
</span>{

    <span style="color: gray">/// &lt;summary&gt;
    /// </span><span style="color: green">Creates new Cart if none exists and returns the Cart ID
    </span><span style="color: gray">/// &lt;/summary&gt;
    /// &lt;param name=&quot;CustomerID&quot;&gt;&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    </span>[<span style="color: #2b91af">SqlProcedure</span>]
    <span style="color: blue">public static </span><span style="color: #2b91af">SqlInt64 </span>GetSavedCartID(<span style="color: #2b91af">SqlInt64 </span>CustomerID)
    {

        <span style="color: green">// Set context connection=true
        </span><span style="color: #2b91af">ShoppingCartModelContainer </span>context =
            <span style="color: blue">new </span><span style="color: #2b91af">ShoppingCartModelContainer</span>(<span style="color: #a31515">&quot;context connection=true&quot;</span>);

        <span style="color: green">// Query for exisitng cart
        </span><span style="color: #2b91af">Cart </span>c = context.Carts.FirstOrDefault(
                        t =&gt; t.CustomerID == CustomerID.Value);

        <span style="color: blue">if </span>(c == <span style="color: blue">null</span>) { 

            <span style="color: green">// create new Cart
            </span>c = <span style="color: #2b91af">Cart</span>.CreateCart(0, CustomerID.Value, <span style="color: #2b91af">DateTime</span>.Now);
            context.AddToCarts(c);
            context.SaveChanges();
        }

        <span style="color: green">// return the Cart ID
        </span><span style="color: blue">return new </span><span style="color: #2b91af">SqlInt64</span>(c.CartdID);

    }

}</pre>
</blockquote>
<p align="justify">This code demonstrates how easy it is to write SQL Assembly, now here is the ultimate benefit of everything.</p>
<h2>Ultimate Benefit</h2>
<p align="justify">You can use your Business Logic in multiple vendor databases, like for example for Oracle and MySQL, you can reuse your SQL Assembly and just change your connection string. You can reuse your business logic in your front end code with simple wrapper.</p>
<p align="justify">And with SQL Server, you can reuse this assembly inside SQL Database.</p>
<p align="justify"><a href="http://akashkava.com/blog/wp-content/uploads/2010/04/CodeSharing.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="CodeSharing" border="0" alt="CodeSharing" src="http://akashkava.com/blog/wp-content/uploads/2010/04/CodeSharing_thumb.png" width="644" height="200" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F259%2Fusing-sql-assembly-to-replace-t-sql-business-logic%2F&amp;linkname=Using%20SQL%20Assembly%20to%20replace%20T-SQL%20Business%20Logic" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/259/using-sql-assembly-to-replace-t-sql-business-logic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WPF vs Silverlight &#8211; Native vs Thin Applications</title>
		<link>http://akashkava.com/blog/244/wpf-vs-silverlight-native-vs-thin-applications/</link>
		<comments>http://akashkava.com/blog/244/wpf-vs-silverlight-native-vs-thin-applications/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 09:28:54 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[SilverLight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/244/wpf-vs-silverlight-native-vs-thin-applications/</guid>
		<description><![CDATA[Looking at the innovation driving inside Silverlight, it is getting more attention then the former WPF. However having very similar syntax and .NET as base platform, both WPF and Silverlight are very different in approach, design and use. Today lot of developers live in dilemma of WPF vs Silverlight and it has now become a [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/244/wpf-vs-silverlight-native-vs-thin-applications/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "WPF+vs+Silverlight+%26ndash%3B+Native+vs+Thin+Applications";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F244%2Fwpf-vs-silverlight-native-vs-thin-applications%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F244%2Fwpf-vs-silverlight-native-vs-thin-applications%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p align="justify">Looking at the innovation driving inside Silverlight, it is getting more attention then the former WPF. However having very similar syntax and .NET as base platform, both WPF and Silverlight are very different in approach, design and use. Today lot of developers live in dilemma of WPF vs Silverlight and it has now become a great trade off as similar to speed vs size.</p>
<p align="justify">Lets compare the need and features of both and make the trade off very easy to understand.</p>
<h1 align="justify">History of Microsoft Development Platform</h1>
<p align="justify">We all loved Visual Basic, what did it provide? a rapid development platform to make quick business applications. By business applications I mean, the one to track your purchases, your activities which are just probably relational database and reports. Business Application makers didn’t have to worry about device drivers, system services, hardware and component versions.</p>
<p align="justify">Visual Basic provided very thin layer of application development for rapid turnaround time of small scale but huge in demand business applications. These applications require very less programming language expertise but more of business expertise. But it had limitations, you could not create a huge resource intensive application like CAD programs, Media editing programs, servers, games etc.</p>
<p align="justify">On other hand we had Visual C++, a huge development framework with possibility to do almost everything that was possible on Windows Operating System. Where you could fulfill need of any program, be it CAD, games, media editing, or servers etc.</p>
<p align="justify">But the development time required was very high, performance was great and the intelligence required to create system applications was very high. Getting talent to build such applications weren&#8217;t easy and even it is not easy today, because you need real in depth knowledge of how every part of the system functions. There is more dependency upon device drivers, component versions and there was no drag and drop.</p>
<p align="justify">Apart from any other platforms existed so far, Microsoft clearly and distinctly divided development into two major categories. Rapid vs System, or Native vs Thin applications.</p>
<h1 align="justify">Evolution of .NET</h1>
<p align="justify">Ever since c# came into existence, we started seeing quick shift from tedious MFC/COM/ATL to c#, because all technologies were simply extension of c/c++ and each needed separate runtime to exist. Even still today, some of my components are written in ATL/COM and compiling them in newer version of Visual Studio is always pain. Compilation time is huge.</p>
<p align="justify">Where else, .NET based project took less time to compile, even the 1.0 versions are still in use and still in good shape.</p>
<p align="justify">Earlier it was expected that it will only replace the Visual Basic segment of programming, but somehow all devs started liking it and preferred it as an alternative to ATL/COM/MFC as its native capability and speed provided easy development and quick turnaround.</p>
<p align="justify">Windows Forms did provide an alternative to Visual Basic. But there was lack of more powerful, GUI interface in .NET. So came WPF. Not only this, .NET being neutral, the compiled apps are independent of 32 bit or 64 bit platforms.</p>
<h1 align="justify">Windows Presentation Framework</h1>
<p align="justify">As we clearly see, Microsoft has its plan to make WPF as its primary GUI framework against all Win32 components. WPF is very easy to write as it is very simple XML, XML is very easy to read, and its very easy to organize, even the editors and compilers need less overhead in parsing and taking decisions based on XML.</p>
<p align="justify">The challenge here was to imitate almost everything that existed in Win32 inside WPF, and WPF became very feature rich, but once again it requires more intelligence to write complicated and big applications. Having talent already expert in HTML+JS area, and transforming them into WPF talent was little difficult.</p>
<p align="justify">Plus the way WPF was built, it was built more tight coupled with system operating system, just like the way MFC/ATL/COM were built. But WPF is very fast and very rich in features. It is now possible to write CAD, games and such high performance applications in WPF which can utilize latest hardware technologies.</p>
<p align="justify">And it is exact alternative for COM/ATL/MFC today.</p>
<h1 align="justify">Silverlight</h1>
<p align="justify">Realizing that converting HTML+JS and Visual Basic devs to WPF was more challenging, silverlight pop in to existence, Which is very light weight, a smaller counterpart of WPF, although the syntax remains same, the ability to develop apps are limited in silverlight as it is not very tightly coupled with operating system.</p>
<p align="justify">However, you can develop apps pretty fast, but only focused on business logic, which here is one step ahead amongst all being platform independent. The devs are not required to have in depth knowledge of system, nor silverlight are more dependent on hardware, resources or other components.</p>
<p align="justify">But you cant develop high performance apps like CAD, games and media editing apps.</p>
<p align="justify">Indeed, it is an exact alternative for Visual Basic.</p>
<h1>Conclusion</h1>
<p align="justify">You need to choose WPF when you are creating any application of following type,</p>
<ol>
<li>
<div align="justify">Interfaces with custom hardware.</div>
</li>
<li>
<div align="justify">You need to control memory and control the performance of app.</div>
</li>
<li>
<div align="justify">Create application that requires very high memory, CAD programs etc.</div>
</li>
<li>
<div align="justify">Connect to system components and used to manage system, hardware.</div>
</li>
<li>
<div align="justify">Want to connect to native system via COM/DLL interfaces.</div>
</li>
<li>
<div align="justify">Media (Audio/Video/Picture) editing applications.</div>
</li>
<li>
<div align="justify">Where your target audience can download and install .NET platform easily.</div>
</li>
</ol>
<p align="justify">However you can use Silverlight for following alternative type of applications,</p>
<ol>
<li>
<div align="justify">Provides smooth and quick animation on the web.</div>
</li>
<li>
<div align="justify">Make Rapid Business Applications, which can connect to your enterprise apps.</div>
</li>
<li>
<div align="justify">Make typical CRUD applications.</div>
</li>
<li>
<div align="justify">Registration, Dashboard type of applications.</div>
</li>
<li>
<div align="justify">Lightweight gaming and interaction websites.</div>
</li>
<li>
<div align="justify">Run in browser, with very small installation needed.</div>
</li>
</ol>
<h2>Coming Up:</h2>
<blockquote><p>UI Atoms from NeuroSpeech, a set of controls to develop rapid business applications on both WPF as well as Silverlight. A true alternative for DataForm on Silverlight and WPF, to have unified coding for Business Apps. <a href="http://uiatoms.neurospeech.com/silverlight/index.html" target="_blank"><strong>Please click here to check the preview</strong></a>.</p>
</blockquote>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F244%2Fwpf-vs-silverlight-native-vs-thin-applications%2F&amp;linkname=WPF%20vs%20Silverlight%20%26ndash%3B%20Native%20vs%20Thin%20Applications" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/244/wpf-vs-silverlight-native-vs-thin-applications/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apple&#8217;s iPad risks RIA Technologies (Flex/Silverlight)</title>
		<link>http://akashkava.com/blog/222/apples-ipad-risks-ria-technologies-flexsilverlight/</link>
		<comments>http://akashkava.com/blog/222/apples-ipad-risks-ria-technologies-flexsilverlight/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 09:25:35 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Future]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[PC]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/?p=222</guid>
		<description><![CDATA[Apple announces iPad, a bigger version of iPod Touch. With a big screen of 1024&#215;786 pixels. And it comes with basic need of surfing internet and be online. So called magical and revolutionary device does not support Flash and Silverlight yet. And most of business apps today, built upon RIA are running either on Flash [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/222/apples-ipad-risks-ria-technologies-flexsilverlight/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Apple%26rsquo%3Bs+iPad+risks+RIA+Technologies+%28Flex%2FSilverlight%29";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F222%2Fapples-ipad-risks-ria-technologies-flexsilverlight%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F222%2Fapples-ipad-risks-ria-technologies-flexsilverlight%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://apple.com/ipad" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Apple-iPad" border="0" alt="Apple-iPad" src="http://akashkava.com/blog/wp-content/uploads/2010/02/AppleiPad1.png" width="244" height="200" /></a> </p>
<p align="justify">Apple announces iPad, a bigger version of iPod Touch. With a big screen of 1024&#215;786 pixels. And it comes with basic need of surfing internet and be online. So called magical and revolutionary device does not support Flash and Silverlight yet. And most of business apps today, built upon RIA are running either on Flash or on Silverlight. And IT Devs are heavily investing in RIA technologies due to snail speed of WWW group. However, the device can replace a laptop for most of users who just spend time on internet doing their regular business, studies or entertainment. So lets analyze what will be future of Web for different type of users.</p>
<h2>Students</h2>
<p align="justify">Today students need a good web browser and an internet with lot of social media websites to study, interact, entertain and play games. Apple iPad is a best bet for students. Do they really care that it does not support Flash and Silverlight yet? Answer is no. They will certainly buy iPad, come to the website, and if it has Flash or Silverlight, they will call website’s support instead of Apple’s support and say, </p>
<blockquote><p align="justify">Your website is not working on my iPad.</p>
</blockquote>
<h2>Sales Reps and Business Owners</h2>
<p align="justify"><font color="#000000">Looking at the cost, and attractive looks, Sales Reps and Business Owners will buy iPad because they usually do not type anything great whole day, all they do is, look at websites, present demos (which are powerpoint or keynote), and access their office through online business portals. For all these purpose they will be very happy with iPad. However, once they come to your business app through online portal, they cant see Flash or Silverlight, they are not going to call apple support. They will call IT devs and say,</font></p>
<blockquote><p>What the hell IT devs are doing, cant they make our business app work on iPad?</p>
</blockquote>
<h2>Independent Professionals</h2>
<p align="justify">Independent professionals like Doctors, Lawyers, Photographers, Actors .. anyone who probably does not sit in front of PC for more then 2 hours a day, will certainly like to get rid of big laptop bag with 4-10 external wires and device connectors. All what they do mostly is, check their emails, surf the websites, fill simple forms on some business web apps and which they can do it on iPad. Today iPad may not have great drawing tools but some professional apps on App store will certainly provide capability of tagging, drawing and marking tools needed by these professionals. Today lot of business applications are on Flash and new ones are coming on silverlight. But iPad will not support !! , once again, they will pickup the phone to vendor and say,</p>
<blockquote><p>Your website is not working on my iPad.</p>
</blockquote>
<h2>Who needs any of following?</h2>
<p align="justify"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="pc_vs_mac" border="0" alt="pc_vs_mac" src="http://akashkava.com/blog/wp-content/uploads/2010/02/pc_vs_mac1.jpg" width="244" height="128" />Clerks,&#160; Graphics/Media artist and IT Developers, which comprises of small part of computer users. Because their applications and workspace requires bigger screens and multiple devices, connectivity and computing performance. Apple’s iPad will be useful only to test the business apps and for other entertainment to this group.</p>
<p align="justify">It seems iPad will spread in Home Entertainment, Education and Independent Professional sectors very fast because of low cost solution. And that will shake the developer community.</p>
<h2>Troubles for IT Devs</h2>
<ol>
<li>Current investment in Flex or Silverlight is at stake, as usage of mobile devices is increasing heavily, supporting business apps on these devices will not be possible until device OS creators, Adobe or Microsoft work towards supporting RIA technologies. </li>
<li>Silverlight/Flex are heavy and costly to run on battery based devices, they will consume more cpu and battery to create consumption problems. </li>
<li>Rewriting apps in light HTML5 is a big challenge, training, planning and supporting all existing modules will be a big pain. However looks like World Wide Web Consortium (W3C) has been sleeping for 10 years to create features of RIA required today. Need of consumers were high, that created innovations like DHTML, Flash and Silverlight, and the problem was, W3C never observed in market what consumers (Internet users) really need. </li>
<li>Even if you decide to invest heavily on iMac and decide to make apps that can run on iPad, your Apps are at mercy of Apple Employee doing approval, here is the funny process. </li>
</ol>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="AppStoreComic" border="0" alt="AppStoreComic" src="http://akashkava.com/blog/wp-content/uploads/2010/02/AppStoreComic.jpg" width="364" height="574" /> </p>
<h2>Death of Free and Open Internet</h2>
<p>IT Devs will slowly loose the independence over distributing apps against open free internet distribution. Today any release, distribution of media (song, movie, play) etc are controlled by major Labels.</p>
<blockquote><p>If The&#160; Intelligence will be controlled by major Labels in IT with narrow route to success by Apple, Google, Microsoft etc giants, then the growth we saw in last decade in IT industry will slow down very rapidly and independent innovators will become slaves to major labels. </p>
</blockquote>
<h2>Will Bubble of RIA Burst now?</h2>
<p>Once again, just like Dot Com, if RIA (Flex/Silverlight) Bubble bursts and all IT Devs will be blamed again.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F222%2Fapples-ipad-risks-ria-technologies-flexsilverlight%2F&amp;linkname=Apple%26rsquo%3Bs%20iPad%20risks%20RIA%20Technologies%20%28Flex%2FSilverlight%29" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/222/apples-ipad-risks-ria-technologies-flexsilverlight/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Retouch! I would say &#8211; why not?</title>
		<link>http://akashkava.com/blog/204/retouch-i-would-say-why-not/</link>
		<comments>http://akashkava.com/blog/204/retouch-i-would-say-why-not/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 18:42:38 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Beauty]]></category>
		<category><![CDATA[Cindy]]></category>
		<category><![CDATA[Crawford]]></category>
		<category><![CDATA[Diet]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Retouch]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/?p=204</guid>
		<description><![CDATA[Its less of a risk then getting yourself a liposuction or a nasty boob job .. Before I answer WHY let me answer WHAT! For all of you who don&#8217;t know what I am talking about watch this video “The Photoshop Effect” &#160; Why Retouching On a serious note, Human psyche has been on a [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/204/retouch-i-would-say-why-not/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Retouch%21+I+would+say+%26%238211%3B+why+not%3F";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F204%2Fretouch-i-would-say-why-not%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F204%2Fretouch-i-would-say-why-not%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Its less of a risk then getting yourself a liposuction or a nasty boob job <img src='http://akashkava.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ..</p>
<p>Before I answer WHY let me answer WHAT! For all of you who don&#8217;t know what I am talking about watch this video <strong>“The Photoshop Effect”</strong></p>
<div style="padding-bottom: 0px; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:fdd4286b-40ba-48ee-ae61-f83aa8fee6c3" class="wlWriterEditableSmartContent">
<div><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/YP31r70_QNM&amp;hl=en"></param><embed src="http://www.youtube.com/v/YP31r70_QNM&amp;hl=en" type="application/x-shockwave-flash" width="425" height="355"></embed></object></div>
</div>
<h1>&#160;</h1>
<h1>Why Retouching</h1>
<p>On a serious note, Human psyche has been on a constant Endeavour to achieve perfection. Retouching is a means to persue that human pursuit. How else would you preserve and portray the invaluable momentary short lived tequila shots of your life. A retouched image would give you that well deserved kick time and again.</p>
<p>Besides not all of us can carry a Cindy Crawford mole as a beauty spot the way she does. Come on, would you want that dark spot seen in your wedding snaps. You would rather get them retouched. Similarly you would more often then not, want to get a brighter retouch-er if you are from the Naomi Campbell or a Hale Berry progeny. &quot;I don&#8217;t mean to be a racist here&quot; unless you want to spend a bomb to look as good.</p>
<h1>Retouching the History</h1>
<p>Beginning from our inception, Adam was perfect as a first masterpiece, as a human being, but as a man he was lacking. Later, Adam with Eve became a perfect couple until they fell prey to Satan&#8217;s handiwork and since then we&#8217;ve been living in an imperfect world. I need not elaborate on this any further and no wonder everything around us is (believe it or not) imperfect.</p>
<h1>Retouched &#8211; Do We Even Know?</h1>
<p>BTW If you see a problem here, sure do something, lets run a campaign to make it a mandate to put an * (asterisk) symbol on every retouched image. I bet you would see 99.9 % of photographs retouched in any magazine or billboard or for that matter any print media with an asterisk sign, the way we notice &quot;*&quot; or &quot;Conditions Apply&quot; on every shop running a SALE.</p>
<p>Lately there has been a lot of hype around retouching and its adverse effect or so they call it, just because some nuts went on an indefinite dieting spree to fulfill there fantasies of attaining that perfection portrayed by a retouched image of a model. I have a question here, if some one ignores that &#8216;asterisk&#8217; on a FOR SALE sign board and happens to pick up stuff and queued up at the counter only to realize that there was some other exception, what do you think would happen. Wouldn&#8217;t you ask her to go back to shopping basics. She&#8217;s not duped! An asterisk is supposed to be taken for granted.</p>
<h1>Retouching&#160; &amp; The Craving Need of It</h1>
<p>As I proclaimed above I see no moral hang-up in retouching a photo but the reality is that it can change a picture from something you dislike to something enjoyable. We all understand the difference between tweaking the truth and portraying the expected. Perfect moments do not always prove to be perfect and that&#8217;s where we need the so called digital liposuction.</p>
<p>Let me sum up with a practical example:</p>
<p>A stunning model sitting right in front of you that has potential but several flaws. By several I mean the following two major flaws apart from a few here and there that can otherwise be taken care of:</p>
<p>Dull Hair    <br />has a pimple right on the face of the camera lights</p>
<p>What do you do ?</p>
<p>1) Hand over the best shampoo available and wait for the results + wait for the pimple to even out.    <br />2) Click the snap and retouch it. Its simple and worth while.</p>
<p>I leave it for you guys to decide. Any takers!!</p>
<p>For all of you guys who want to try the first option you need to keep visiting my blogs for the rest I know you guys understand how difficult it is to get a boob job done, and how difficult it is to get that perfect look unless we go to <a href="http://RetouchMAX.com" target="_blank">RetouchMAX.com</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F204%2Fretouch-i-would-say-why-not%2F&amp;linkname=Retouch%21%20I%20would%20say%20%26%238211%3B%20why%20not%3F" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/204/retouch-i-would-say-why-not/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Current Problems of Windows 7 for Developers</title>
		<link>http://akashkava.com/blog/180/current-problems-of-windows-7-for-developers/</link>
		<comments>http://akashkava.com/blog/180/current-problems-of-windows-7-for-developers/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 10:09:29 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/?p=180</guid>
		<description><![CDATA[After visiting Microsoft TechNet Seminar everyone was quite excited about Windows 7 and everyone was saying that Windows 7 is far better then Vista and its now ready to go alive. I did stick to my plan of upgrading my development machine to Windows 7 only after Service Pack 1 arrives. But everybody argued that [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/180/current-problems-of-windows-7-for-developers/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Current+Problems+of+Windows+7+for+Developers";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F180%2Fcurrent-problems-of-windows-7-for-developers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F180%2Fcurrent-problems-of-windows-7-for-developers%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>After visiting Microsoft TechNet Seminar everyone was quite excited about Windows 7 and everyone was saying that Windows 7 is far better then Vista and its now ready to go alive. I did stick to my plan of upgrading my development machine to Windows 7 only after Service Pack 1 arrives. But everybody argued that no its ready for developers even. Fine I tried to install it on my laptop which I rarely use for development and here is the experience.</p>
<p>It took drivers and it was pretty faster then Vista as far as installation goes, but then immediately I found two problems.</p>
<h1>Move Files Progress Bar Bug</h1>
<p>I took backup on my other D drive and I have both administrator and basic user and while copying files back on basic user I found this bug. When you are trying to move files, and if you are an administrator and it doesnt need any UAC permissions then you can see progress bar as shown below.</p>
<p><img class="alignnone size-full wp-image-182" title="Original" src="http://akashkava.com/blog/wp-content/uploads/2009/09/Original.png" alt="Original" width="416" height="201" /></p>
<p>But if your destination folder/drive requires some UAC permission then the UAC dialog box comes and when you accept everything after that the progress bar no longer displays progress as shown below.</p>
<p><img class="alignnone size-full wp-image-183" title="MoveBug" src="http://akashkava.com/blog/wp-content/uploads/2009/09/MoveBug.png" alt="MoveBug" width="416" height="201" /></p>
<p>This happens if you try to copy something into windows/program files or anywhere for some other users when running from basic user.</p>
<p>And we have to wait endlessly for this window to get closed automatically and that probably proves that operation was successful.</p>
<p>I am really disappointed to see bugs on very critical operations like file operations are most crucial. Even on Vista, Move operation did not work correctly as it did not delete the source files/folders and that leaves us with confusion.</p>
<h1>Canceling Move Operation Creates Inconsistencies</h1>
<p>While the Move operation is on, if you decide to cancel, you are left in bad position because then you are left with half files from old location and half in new. Sure its not great problem as we can consolidate immediately.</p>
<h1>Cant Install Remote Server Administration Tools (RSAT)</h1>
<p>This is really great bug, because on development machine, we really cant live without RSAT. We need them to manage servers. I found this link from live search, <a title="RSAT for Windows 7" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d&amp;displaylang=en" target="_blank">RSAT for Windows 7</a> . When I try to install this update it gave this error message &#8220;This update is not applicable for your computer&#8221;. Further more in Event Viewer, I got this message.</p>
<blockquote><p>Windows update  could not be installed because of error 2149842967</p></blockquote>
<p>I did report this bug to lot of places, hope it gets resolved soon, but I think on Microsoft Download website they should put some feedback about the item being downloaded.</p>
<h1>Visual Studio 2008 Installation Problems</h1>
<p>I am not sure whether VS 2008 installed successfully or not, because although it said it was successful, there were certain errors in Event Viewer.</p>
<blockquote><p>Product: Microsoft Visual Studio 2008 Professional Edition &#8211; ENU &#8212; Error 1935.An error occurred during the installation of assembly &#8216;Microsoft.Windows.Design,<br />
version=&#8221;3.5.0.0&#8243;,<br />
publicKeyToken=&#8221;b03f5f7f11d50a3a&#8221;,<br />
processorArchitecture=&#8221;MSIL&#8221;,<br />
fileVersion=&#8221;9.0.30729.1&#8243;,<br />
culture=&#8221;neutral&#8221;&#8216;.<br />
Please refer to Help and Support for more information. HRESULT: 0&#215;80070005. assembly interface: IAssemblyCacheItem, function: Commit, component: {7A515F16-7D3F-4A41-910A-E704ABC9E8CA}</p></blockquote>
<p>I havent yet started using VS on 7 but I will soon and I am sure there will be many problems.</p>
<h1>Cant Install Visual Studio 2008 Service Pack 1</h1>
<p>However when I tried to install Visual Studio 2008 Serivce Pack 1, it didnt install and gave following errors in log.</p>
<blockquote><p>Product: Microsoft Visual Studio 2008 Professional Edition &#8211; ENU &#8211; Update &#8216;KB945140&#8242; could not be installed. Error code 1603.</p></blockquote>
<p>And another error at the last,</p>
<blockquote><p>Product: Microsoft Visual Studio 2008 Professional Edition &#8211; ENU &#8211; Update &#8216;Visual C++ 2008 SP1 Design-Time Components for x86 &#8211; KB947888&#8242; could not be installed. Error code 1603. Additional information is available in the log file C:\Users\***\AppData\Local\Temp\Microsoft Visual Studio 2008 SP1_20090913_140916022-Microsoft Visual Studio 2008 Professional Edition &#8211; ENU-MSP0.txt.</p></blockquote>
<h1>Cant Install SQL 2008 Management Tools</h1>
<p>I tried to install SQL 2008 Management Tools, it gave me compatibility issue and warned me that you must install SQL 2008 SP 1, I agreed. And I went ahead with installation and Installation stopped because Visual Studio 2008 SP 1 was not installed.</p>
<p><a href="http://akashkava.com/blog/wp-content/uploads/2009/09/Cant-Instal-SQL-2008-Tools.png" target="_blank"><img class="alignnone size-full wp-image-189" title="Cant Instal SQL 2008 Tools" src="http://akashkava.com/blog/wp-content/uploads/2009/09/Cant-Instal-SQL-2008-Tools.png" alt="Cant Instal SQL 2008 Tools" width="492" height="369" /></a></p>
<h1>Conclusion</h1>
<p>I think I am on conclusion that Windows 7 is not yet ready for Developers and they should wait for Windows 7 SP1 to arrive.  And it should only be used by Testing Teams to test the products.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F180%2Fcurrent-problems-of-windows-7-for-developers%2F&amp;linkname=Current%20Problems%20of%20Windows%207%20for%20Developers" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/180/current-problems-of-windows-7-for-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Huge File Storage in Database instead of File System</title>
		<link>http://akashkava.com/blog/127/huge-file-storage-in-database-instead-of-file-system/</link>
		<comments>http://akashkava.com/blog/127/huge-file-storage-in-database-instead-of-file-system/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 18:55:08 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[File Storage]]></category>
		<category><![CDATA[File System]]></category>
		<category><![CDATA[Huge]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/?p=127</guid>
		<description><![CDATA[The quest to store large number of files in database or on regular file system began at a time when number of files to manage went beyond 1 million in one of our project. We started noticing a huge drop in performance of our windows server. After investigating we found out that using pure file [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/127/huge-file-storage-in-database-instead-of-file-system/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Huge+File+Storage+in+Database+instead+of+File+System";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F127%2Fhuge-file-storage-in-database-instead-of-file-system%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F127%2Fhuge-file-storage-in-database-instead-of-file-system%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>The quest to store large number of files in database or on regular file system began at a time when number of files to manage went beyond 1 million in one of our project. We started noticing a huge drop in performance of our windows server. After investigating we found out that using pure file system to store more then million files is really a bad solution. And following are key points.</p>
<ol>
<li>Each operation of file open/close requires kernel operation, because it needs to do various security checks.</li>
<li>Every file operation requires some minimum locking mechanism which uses your cpu in kernel mode.</li>
<li>Above operations being kernel operations, they slow down entire server even if your file access may be of least priority then any transactional database operation.</li>
<li>Each services on server slows down.</li>
<li>Even operating system itself manages a file system database (typically known as File Allocation Table and similar names in other systems).</li>
<li>These databases are optimized but not for millions or trillions files. They are good to work under million files.</li>
<li>It causes huge fragmentation on your storage media.</li>
<li>Not only media, but even File System Database gets fragmented, leading to more slow down.</li>
<li>Durability of storage media also can reduce because of too much fragmented usage.</li>
<li>Backup and Restore operations take too long time. You can easily conduct an experiment, on any ftp client, try to upload only one 1Meg file and then try to upload 100 10KB files, although the total transfer is only 1Meg, you will notice uploading 100 files of smaller size takes longer.</li>
<li>Keeping track of changes/deleted items are even more difficult.</li>
<li>Tools for replication and change tracking for file systems aren&#8217;t available for huge file storages.</li>
<li>The web server will need write access to some folders which is always a big security hole.</li>
<li>And file system crash = operating system crash and thats  a huge challenge to bring it back up.</li>
<li>For transferring files you need to open ftp and develop some tools to replicate them.</li>
</ol>
<p>Finally, after all these observations, we started considering other options.</p>
<ol>
<li>Network File System, it looks promising, but even at other end of node, its simply an operating system. It still has same problems as mentioned above.</li>
<li>Distributed File Systems like Hadoop and other tools require too much of learning, management and I think they are good when you need file storage as huge as Facebook, Yahoo etc. We are mid size company and our need is 1TB for now.</li>
</ol>
<h2>Database Solution:</h2>
<p>Finally we began testing database solution with MySQL and then we moved onto MS SQL, however both have good advantages and disadvantages that we will discuss further.</p>
<p>We have following advantages over file systems, and also I have provided solution detail later on this article.</p>
<ol>
<li>Database systems have matured enough to handle large data easily today.</li>
<li>They use small number of files to store all relational data in well organized form.</li>
<li>They keep their database files open all the time, so the kernel operations of locks are reduced.</li>
<li>You can consider as if your load of entire server is now concentrated only on your database.</li>
<li>Databases are much advanced in terms of their scheduling of queries, you can reduce priority of your file database and database will easily offer more performance on other transactional databases.</li>
<li>Data storage is transactional, where else file systems are not completely transactional. And file systems require more programming to make them transactional.</li>
<li>Remember if its your customers data, even if its a small picture/icon any video.. if they are paying for your service then its better to store those media files in transactional storage.</li>
<li>Database crash doesnt crash entire server and nor even other databases on same server.</li>
<li>Backing up and restoring databases are easier because of the inbuilt tools.</li>
<li>Replication on database are much easier.</li>
<li>Change tracking is available on database.</li>
<li>Database access is standard its not dependent on ftp/http like tools.</li>
<li>Database can easily take over failures of neighbor nodes in network.</li>
<li>You can easily query database and do multiple operations on files.</li>
<li>The biggest point is, your web server does not need any write permission on any folder !!</li>
</ol>
<h2><strong>Comparison between MySQL and MSSQL for file storage</strong></h2>
<ol>
<li>MySQL offers replication over internet, MSSQL doesnt, you will have to write your own replication program.</li>
<li>MSSQL offers auto grow option for database file, with which you can reduce fragmentation. MySQL&#8217;s innodb doesnt have such option for database file auto grow method which leads to more fragmentation.</li>
<li>MSSQL offers easy incremental backup/restore and more over, in case of crash, you can use actual data folder files to restore, where else MySQL&#8217;s innodb doesnt support hot backups so either you buy their hotbackup tool or rely on mysql&#8217;s backup tool which is not incremental.</li>
<li>MSSQL costs $1600 for standard edition, where else MySQL innodb is free, but hotbackup or incremental backup tools will cost exactly the same. MSSQL wins over mysql for offering better file management and increasing disc durability.</li>
</ol>
<h2><strong>Sample Solution<br />
</strong></h2>
<p>After reading various articles, we came to conclusion that storing entire file in one blob or image doesnt make sense as it will deteriorate performance like anything.</p>
<p>So we came with easy solution, which is already used by existing file systems. Thats &#8220;Breaking down file into smaller blobs, max 512kb&#8221;.</p>
<p>As MySQL and MSSQL both have network packet size limit, you should not store more then 512kb in one row. Otherwise you will have to increase network packet size and that will slow down database server. Following is easy small table structure we used.</p>
<h3><strong>Table: NSFiles</strong></h3>
<p>NSFileID (Auto Number) (bigint)<br />
NSFileName (varchar 50)<br />
NSContentType (varchar 100) ** This is most important for web access</p>
<h3><strong>Table: NSFileBlobs</strong></h3>
<p>NSFileBlobID (Auto Number) (bigint)<br />
NSFileID (bigint) (indexed) (Reference of NSFiles.NSFileID)<br />
NSBlobIndex (int)<br />
NSBlobData (medium blob or image)</p>
<p>Following are Storage/Retrieval methods specified in C# with using Linq or any similar ORML tool.</p>
<blockquote><p>//Upload Handler<br />
<code>NSFile file = new NSFile();<br />
file.NSFileName = .....<br />
file.NSContentType = Request.Files[0].ContentType;<br />
file.Insert(); // &lt;-- insert into database and get new unique NSFileID<br />
byte[] buf = new byte[512000];<br />
int i = 0;<br />
using(MemoryStream ms = new MemoryStream(Request.Files[0].FileData))<br />
{<br />
int count = ms.Read(buf,0,512000);<br />
</code><code>while(count&gt;0)<br />
{<br />
NSFileBlob blob  = new NSFileBlob();<br />
blob.NSFileID = file.NSFileID;<br />
blob.NSBlobIndex = i++;<br />
if(count==512000)<br />
{<br />
blob.NSBlobData = buf;<br />
}<br />
else<br />
{  // last blob will always be less then 512kb<br />
blob.NSBlobData = new byte[count];<br />
Buffer.BlockCopy(buf, 0 , blob.NSBlobData, 0 , count);<br />
}<br />
blob.Insert();<br />
}<br />
}</code></p></blockquote>
<blockquote><p>And following is simple code for Download Handler<br />
<code><br />
// Download Handler<br />
long fileID = long.Parse(Request.QueryString["FileID"]);<br />
NSFile file = NSFile.Adapter.Get(fileID);<br />
Response.ContentType = file.NSContentType; // important for web browser<br />
// following line causes "Save As" box on client<br />
Response.AddHeader("content-disposition","attachment;filename=\"" + file.NSFileName + "\"");<br />
// following loops over all file blobs whose NSFileID is fileID and they are sorted by blob index<br />
NSFileBlob.Adapter.ForEach(<br />
NSFileBlob.Schema.NSFileID == fileID,<br />
NSFileBlob.Schema.NSBlobIndex.SortAs(),<br />
(t)=&gt;{<br />
Response.OutputStream.Write(t.NSBlobData,0,t.NSBlobData.Length);<br />
}<br />
);</code></p></blockquote>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F127%2Fhuge-file-storage-in-database-instead-of-file-system%2F&amp;linkname=Huge%20File%20Storage%20in%20Database%20instead%20of%20File%20System" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/127/huge-file-storage-in-database-instead-of-file-system/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Day and Night time format</title>
		<link>http://akashkava.com/blog/91/day-and-night-time-format/</link>
		<comments>http://akashkava.com/blog/91/day-and-night-time-format/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 01:49:26 +0000</pubDate>
		<dc:creator>Akash Kava</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[Format]]></category>
		<category><![CDATA[Time]]></category>

		<guid isPermaLink="false">http://akashkava.com/blog/?p=91</guid>
		<description><![CDATA[Conventional AM/PM time format is very confusing. At NeuroSpeech we decided to use new format to distinguish visually the day and night format. Rules are as follow, 1. Day time is considered between morning 6 to evening 5.59 as assuming range of average sun shined day. 2. Night time is considered as 6 of evening [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://akashkava.com/blog/91/day-and-night-time-format/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Day+and+Night+time+format";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fakashkava.com%2Fblog%2F91%2Fday-and-night-time-format%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fakashkava.com%2Fblog%2F91%2Fday-and-night-time-format%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Conventional AM/PM time format is very confusing. At NeuroSpeech we decided to use new format to distinguish visually the day and night format. Rules are as follow,</p>
<p>1. Day time is considered between morning 6 to evening 5.59 as assuming range of average sun shined day.</p>
<p>2. Night time is considered as 6 of evening till 5.59 of next day morning.</p>
<p><strong>Representations:</strong></p>
<p><strong>Print and computer</strong></p>
<p><strong>White background:</strong></p>
<p>1. Day time should be written with black box around the time and white background inside the box with black text color.</p>
<p>2. Night time should be written as black background of text with white color text. No border.</p>
<p><a href="http://akashkava.com/blog/wp-content/uploads/2009/03/wb.png"><img class="size-full wp-image-117 alignnone" title="White Background" src="http://akashkava.com/blog/wp-content/uploads/2009/03/wb.png" alt="" width="400" height="130" /></a></p>
<p><strong>Black Background</strong></p>
<p>1. Day time should be written as white background with black as text color with no background. No border.</p>
<p>2. Night time should be written as white border around the white color text.</p>
<p><a href="http://akashkava.com/blog/wp-content/uploads/2009/03/bb.png"><img class="size-full wp-image-119 alignnone" title="Black Background" src="http://akashkava.com/blog/wp-content/uploads/2009/03/bb.png" alt="" width="400" height="130" /></a></p>
<p><strong>Handwritten Format:</strong></p>
<p>1. Day time should be written as normal dark ink color.</p>
<p>2. Night time should be written as normal dark ink color with a border around it.</p>
<p><a href="http://akashkava.com/blog/wp-content/uploads/2009/03/hw1.png"><img class="size-full wp-image-122 alignnone" title="Hand Written" src="http://akashkava.com/blog/wp-content/uploads/2009/03/hw1.png" alt="" width="400" height="130" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fakashkava.com%2Fblog%2F91%2Fday-and-night-time-format%2F&amp;linkname=Day%20and%20Night%20time%20format" target="_blank"><img src="http://akashkava.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://akashkava.com/blog/91/day-and-night-time-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
