January 2011 - Posts

Map XML and Consuming Cross Domain Service in JSon Type

I’m making a simple app to consume external services. this trick is old one.

these raise 2 questions as usual and common one:

  • What is the quickest and fastest way to de-serialize the xml string that typed object or anything that we can directly consume?
  • How to consume Json , get and post to External services?

With XML, you’ve got choices like XmlSerializer (have to define class with attributes), DataContract (have to define class with attributes), XMLDoc (have to use Xpath, selectNodes)

the quickest way in my opinion would be, save your external services output in xml file, Use Xsd.exe to generate the XSD the command-line is pretty simple :

XSD.exe [xmlfilename] [ouputdirectory]

Than just create DataSet

   1: using (XmlReader xmlReader = new XmlTextReader(fullUrl))
   2:          {
   3:              DataSet dataSet = new DataSet();
   4:              dataSet.ReadXmlSchema(Server.MapPath("~/test/SomeMethod.xsd"));
   5:              dataSet.ReadXml(xmlReader);
   6: //Consume it through datatable and columns
   7:              grvaccessories.DataSource = dataSet.Tables[0];
   8:              grvaccessories.DataBind();
   9:          }
  10: }

As for Json but coming from External service, or different domain. you are touching a security issue. which is browser does not allow us to make a call outside of current domain.

In order to solve this , you can use JSONP, it’s the same as jquery.ajax but set the type to jsonP.

what JsonP does is embed an external services with callback pattern, and embed on your document.body.

This trick nice and working for http GET, but how to make a POST?

the Quickest way is to make a middle man instead. which run on server and acting like a midfield guy, just pass the ball forward.

   1: public class CrossDomainHandler : IHttpHandler {
   3:     public void ProcessRequest (HttpContext context) {
   4:         string url = HttpUtility.UrlDecode(context.Request["url"]);
   5:         MakeWebRequest request=new MakeWebRequest();
   6:         string postRequest = "",responseAsString="";
   7:         if (context.Request.HttpMethod == "POST")
   8:         {
   9:             using (StreamReader reader = new StreamReader(context.Request.InputStream))
  10:             {
  11:                 postRequest = reader.ReadToEnd();
  12:             }        
  13:            responseAsString=  request.MakeRequest(MakeWebRequest.Method.POST, url, postRequest);
  14:         }
  15:         else
  16:         {
  17:            responseAsString= request.MakeRequest(MakeWebRequest.Method.GET, url, "");
  19:         }
  20:         context.Response.ContentType = "text/html";
  21:         context.Response.Write(responseAsString);
  22:     }
  23: }
Share this post: | | | |
Posted by cipto with no comments

Send Form as Email

This is old one. You’ve got a case where you have questionary form or registration form and all you want to do is , when you press submit sent what the user filled in by mail.

perhaps somebody will check it manually.

this is the perfect case for you to use Response.Filter. you can sent the output of your webform and what is filled in there by Mail. since mail support html Content.

Response.Filter is the final HTML output generated by webform.

in order to override this you need to set it to new Stream type which over ride the write method. Asp.net will send chunk of data approx 16kb . so it will call the Write method over and over.

to work around this on Write put the chunk of data to Temporary String and only do what you have to do on Flush. you might also want to exclude the viewstate and Submit button to sent through mail


   1: public class SMTPFilterOut:Stream
   2: {
   3:     private const string From="test@test.com";
   4:     private const string Subject = "User registration";
   5:     private readonly string Emailto;
   6:     /// <summary>
   7:     /// Original Stream
   8:     /// </summary>
   9:     private Stream Base;
  10:     /// <summary>
  11:     /// Holder later on we get it from here
  12:     /// </summary>
  13:     private string WholeContent;
  14:     /// <summary>
  15:     /// Initiate here
  16:     /// </summary>
  17:     /// <param name="To">Email to</param>
  18:     /// <param name="stream">The Response Stream</param>
  19:     public SMTPFilterOut(string To, Stream stream)
  20:     {
  21:         Emailto = To;
  22:         Base = stream;
  23:     }
  27:     public override bool CanRead
  28:     {
  29:         get
  30:         {
  31:         return Base.CanRead;
  32:         }
  35:     }
  37:     public override bool CanSeek
  38:     {
  39:         get{
  40:             return Base.CanSeek;
  41:         }
  42:     }
  44:     public override bool CanWrite
  45:     {
  46:         get
  47:         {
  48:             return Base.CanWrite;
  49:         }
  50:     }
  52:     public override void Flush()
  53:     {
  56:             string viewState = GetViewstate(WholeContent);
  57:             string submitbutton = GetSubmitButton(WholeContent);
  58:             //remove viewState & submit button
  59:             WholeContent = WholeContent.Replace(viewState, "").Replace(submitbutton,"");
  60:             MailMessage mail = new MailMessage();
  63:             mail.From = new MailAddress(From);
  64:             mail.To.Add(Emailto);
  65:             mail.IsBodyHtml = true;
  67:             mail.Subject = Subject;
  68:             mail.Body = WholeContent;
  70:             SmtpClient smtp = new SmtpClient();
  71:             smtp.Send(mail);
  73:             //give user success message
  74:             string successMessage="Your Form has been sent!";
  75:             string htmlformat=String.Format("<html><head></head><body>{0}</body></html>",successMessage);
  76:             byte[] htmltobyte=Encoding.UTF8.GetBytes(htmlformat);
  77:             Base.Write(htmltobyte, 0, htmltobyte.Length);
  78:             Base.Flush();
  79:             Base.Close();
  81:     }
  83:     public override long Length
  84:     {
  85:         get{
  86:        return Base.Length;
  87:         }
  88:     }
  90:     public override long Position
  91:     {
  92:         get
  93:         {
  94:         return Base.Position;
  95:         }
  96:         set
  97:         {
  98:         Base.Position=value;
  99:         }
 100:     }
 102:     public override int Read(byte[] buffer, int offset, int count)
 103:     {
 104:         return Base.Read(buffer, offset, count);
 105:     }
 107:     public override long Seek(long offset, SeekOrigin origin)
 108:     {
 109:         return Base. Seek( offset,  origin);
 111:     }
 113:     public override void SetLength(long value)
 114:     {
 116:     }
 117:     /// <summary>
 118:     /// Response.Filter will send on Chunck of data 16kb, so your whole response
 119:     /// will be truncated and this method will be called couple of times
 120:     /// </summary>
 121:     /// <param name="buffer"></param>
 122:     /// <param name="offset"></param>
 123:     /// <param name="count"></param>
 124:     public override void Write(byte[] buffer, int offset, int count)
 125:     {
 126:         var content=System.Text.UTF8Encoding.UTF8.GetString(buffer);
 127:         WholeContent += content;
 129:     }
 130:     private string GetViewstate(string html)
 131:     {
 132:         Regex regex = new Regex("(<input.*?__VIEWSTATE.*?/>)", RegexOptions.IgnoreCase);
 133:         Match match = regex.Match(html);
 135:         if (match.Success)
 136:         {
 137:             int start = match.Captures[0].Value.IndexOf("value=\"") + 7;
 138:             int stop = match.Captures[0].Value.LastIndexOf("\"");
 139:             return match.Captures[0].Value.Substring(start, stop - start);
 140:         }
 142:         return string.Empty;
 143:     }
 144:     private string GetSubmitButton(string html)
 145:     {
 146:         int startsubmit = html.IndexOf("<td class=\"SubmitContainer\">", 0, StringComparison.CurrentCulture);
 147:         int endsubmit = html.IndexOf("</td>", startsubmit, StringComparison.CurrentCulture);
 148:         return html.Substring(startsubmit,(endsubmit+5)-startsubmit);
 149:     }
 150: }


Set it on postback or Button submit

   1: protected void btnSubmit_Click(object sender, EventArgs e)
   2:    {
   4:            Response.Filter = new SMTPFilterOut("oci_beken@yahoo.co.id", Response.Filter);
   6:    }

Magic happens , sent as what is filled in Smile

Share this post: | | | |
Posted by cipto with no comments

Messaging is not suitable for Request and Response architecture

Messaging is a Sample of running publisher and subscriber,fault tolerance, sync between multiple active site.

which is good, but somehow i think it doesn’t suit a model of request and response.

it’s only for Submit and Forget Scenario, where you don’t need the response.

There is a way to do it , if i see the code sample it’s using callback.

   1: var sync = Bus.Send<SomeMessage>(/*data*/)
   2:             .Register((AsyncCallback)delegate(IAsyncResult ar)
   3:                           {
   4:                               var result = ar.AsyncState as CompletionResult;
   5:                               // do something with result.Messages
   6:                           },
   7:                           null
   8:             );
  10:            sync.AsyncWaitHandle.WaitOne( /*timeout*/);

it’s non blocking using asp.net 2.0 callback, but hey it should take long.

and it is designed to give response straight away from architectural point of view



Share this post: | | | |
Posted by cipto with no comments

Windsor how to use it

Upgrade MVC 2 to 3 Tool

Windsor Step by Step for MVC 3 ,

After following that steps. you should have all the things needed to run it on MVC 3.

From there please view the Using Container section on home page.

what all ios framework main task is ,to take care of the injection for you, after you provide the mapping

Windsor is part of castle project and it’s using Fluent API. a nice set and chain API which you can use to define things more dynamic

You have to Register your “components” which is what Interface mapped to what Class, this will tell the Windsor what to give when it encounter such request.

   1: public class ControllersInstaller:IWindsorInstaller
   2:     {
   4:         #region IWindsorInstaller Members
   6:         public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
   7:         {
   8:             container.Register(FindControllers().Configure(ConfigureControllers()));
  10:             //1st way registering
  11:             //container.AddComponentLifeStyle<IAccessoryRepository, AccessoryRepository>(LifestyleType.Transient);
  12:             //container.AddComponentLifeStyle<IMemberDetailsRepository, MemberDetailsRepository>(LifestyleType.Transient);
  14:             //2nd way registering
  15:             //Default is singleton , we have to change to ondemand
  16:             container.Register(Component.For<IAccessoryRepository>().ImplementedBy<AccessoryRepository>().LifeStyle.Transient);
  17:             container.Register(Component.For<IMemberDetailsRepository>().ImplementedBy<MemberDetailsRepository>().LifeStyle.Transient);
  19:             //it's so dynamic , fluent api rocks 
  21:             //To define default property
  22:             //can use From xml configuration, from .config file
  23:             //http://www.castleproject.org/container/documentation/trunk/usersguide/compparams.html#parameters
  24:             //and then everything is string
  25:             //to convert that string into custom object, than you have to implement type converter
  26:             //http://www.castleproject.org/container/documentation/trunk/usersguide/typeconverters.html
  27:             //easy way use instance
  28:             container.Register
  29:              (Component.For<IConfigurationManager>().Instance(new ConfigurationManagerWrapper() { ConnectionStrings = ConfigurationManager.ConnectionStrings, AppSettings = ConfigurationManager.AppSettings }).LifeStyle.Singleton);
  38:             container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithConfig("log4net.config"));   
  40:         }
  41:         private ConfigureDelegate ConfigureControllers()
  42:         { 
  43:         return c=>c.Named(c.ServiceType.Name).LifeStyle.Transient;
  45:         }
  46:         private BasedOnDescriptor FindControllers()
  47:         {
  48:             return AllTypes.FromThisAssembly().BasedOn<IController>()
  49:                     .If(Component.IsInSameNamespaceAs<AccessoryController>())
  50:                     .If(t => t.Name.EndsWith("Controller"));
  51:         }
  53:         #endregion
  54:     }

You can set what value of default parameters in xml file, .config file, and to make it coming from dynamic instantiated object, use instance or the hard way is using Typeconverter.

The Parameters is set by String the syntax to use it : For(PropertyName).eq("Value”) , if the Value is outside of int,string, which the Windsor can’t handle for example your custom object you have to make your own type converter .

You can define the lifetime of the object registered.

To add Faciliy of log4net logging ,please add the .withconfig(“nameofconfig.config”)

and add that config to your project


   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <configuration>
   3:   <log4net>
   5:     <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
   6:       <file value="error.log" />
   7:       <appendToFile value="true" />
   8:       <maximumFileSize value="100KB" />
   9:       <maxSizeRollBackups value="2" />
  11:       <layout type="log4net.Layout.PatternLayout">
  12:         <conversionPattern value="%level %thread %logger - %message%newline" />
  13:       </layout>
  14:     </appender>
  16:     <root>
  17:       <level value="DEBUG" />
  18:       <appender-ref ref="RollingFile" />
  19:     </root>
  20:   </log4net>
  21: </configuration>

Windsor will Inject All Property which is Public and it’s on its component list, it will also inject on constructor automatically

To mark a public property so the Windsor doesn’t have to inject object to it use [DoNotWire] attribute

   1: //set to public for automatic property injection on runtime
   2: public IConfigurationManager _configurationmanager { get; set; }

To get Instantiate object based on mapping use Resolve

You can Debug your Kernel, see what component in there already, what would cause conflict


The 3 principle or pattern for Windsor , like said on the wiki : Register, Resolve, Release

Make your Bootsrapper and container can accessible anywhere on the code, so that you can Resolve what you’ve registered

Now because of this loosely couple your unit test will be pure unit test, not integration test, which involve to db saving etc.

The aim of Ios is so the object become more loosely coupled , as the impact of that , it makes the object more test Able and easy to maintain

Windsor is more than IOS, it support logging feature and Dynamic Proxy (if you want to extend and implement proxy pattern)

Not ever place should be loosely couple , some still has that layering, it’s the matter of design and when to use it properly

Share this post: | | | |
Posted by cipto with 1 comment(s)

Dependency Injection

Martin Fowler , Stefano

“Inversion of control” in general, or more specific called  Depedency Injection is something that must not be mislead interpreted . it’s not just about “Injecting”

it’s about how to loosely coupled class. we create a class which the aim is obvious, do a single task . know what it should have to run.

than when we just inject What they need, but we can Configure easily what we want to inject them. it works like Plugin , example:give them the main class and they can implement things differently. it’s highly testable, because all of our class are very specific for a task and mock able.

To loosely coupled Of course we need to Inject on Constructor ,Property , Interface Injection.

when things get complicated on constructor, like it gets more and more override and too many parameters. consider change the obvious one,

into a Setter injection which you can set on xml or add on the Base Configuration File.

We can use a  Service Locator alternative to achieve dependency injection,

the aim is the same to give the correct initiated Class to the caller.

Read carefully what stefano said:

For example we have an application of winform , we referenced Class library, than we call the method on that class library.

But for Inversion Control :" framework calls the application code”

Inversion of control is not a pattern but a general principle that seperates an API from a framework, based on who is in control.

An Inversion of Control Container uses the principle stated above to (in a nutshell) manage classes. Their creation and destruction. Their lifetime, configuration. Their dependencies and configuration required by them. This way classes do not need to obtain and configure the classes they depend on. This dramatically reduces coupling in a system, and as a consequence simplifies reuse and testability.

Apart from both of them who argue about whether it is pattern or not.

it think it’s not, it’s just about how to loosely coupled one object to another.



so it won’t be like pilled layer. but it’s like those electronic circuit



Lastly, when we implement DI. we can Make DI where spot is needed, for MVC it will make the controller clean, and we can unit test our Repository Pattern with Out have to go saving to real DB, we are doing Real Unit Test Instead of Integration Test

Share this post: | | | |
Posted by cipto with no comments

New Learning Curve

After digging in from azure and do a browse,

i found out about the CQRS,

than i go to the site top 10 what .net developer can do to improve him self.

From there my journey start. and I've learn and sharpen my skill on Dependency injection, Ios in general. touch a bit on windsor and Autofac (wait for my article)

begin to realize and understand the usage of Message Queueng Architecture,  I've view the video of high availability (73 minutes) , it's interesting but a bit like speech.

begin to think of High Availability , it's not just about putting it on cloud and there you go the high availability.

begin to get the big picture,understand the approach and feel the solution of common problem in software application

I've tried a couple of NServiceBus example, yes you have to try out the example than you understand what that guy meant.(wait for my article)

also have put domain driven design by Eric Evans on the list. also found another possible good book from ms press: architecturing application for the enterprise

 we need to break down the domain using the DDD approach, currently strengthen this skill by reading and applying to project.

Share this post: | | | |
Posted by cipto with 5 comment(s)

RadStyleSheetManager and RadDecorativeForm Bugs when they are used in one page

Today i found a weird Bug, after enable and disable the CDN on certain page, The RadComboBox load on demand just don’t work. After doing a trace it turns out the errror start ,

when i try to enable the combobox on javascript.

as this article is written,I’m using the latest telerik build : 2010.3.1215.40.

When i do a trace

  • it happens when setting the disabled ,
  • browser Firefox
  • message: too much recursion

it looks like the RadDecorativeForm js is overlapping with the radstylesheet manager, and some optimization code that make a bug on it, read it Here

So you have to just remove the RadDecorativeForm control or some how use the zone feature to avoid this.

i remove the RadDecorativeForm and the js from the combined Script , and it works

Share this post: | | | |
Posted by cipto with no comments
Filed under:

How to Run Mac OsX on VMWare

This is about how to run macosx on VMWare windows version.

I think it’s still relevant as this is how to run on windows.

  1. Download VMWare
  2. Download the MacOSx, if you have genuine that’s good, but if not there is many hackintosh version, i use the iAtkos S3
  3. Get The Snowy
  4. Open the Mac OsX server 10.6 experimental File
  5. Set the CD to  darwin_snow.iso
  6. During the Boot, choose to boot from DVD, click you cd setting set it to your virtual cd or where you Put your (2) macosX DVD
  7. install it
  8. After Restart, set the CD setting back to the  darwin_snow.iso
  9. run it , Save it, and when you want to load it again nextime Click the Revert to Snapshot
Share this post: | | | |
Posted by cipto with no comments

asp.net 4.0 Browser capability and Detecting installed Firefox add on

asp.net 4.0 comes with much more browser property , detecting more and more with more browser supported.and Extendable

I’ve got a scenario to print out this capability in a page, and also detect what firefox addon installed.


Code Behind File

   1: protected void Page_Load(object sender, EventArgs e)
   2:    {
   3:        // Get browser caps for user agent string ignoring headers
   4:        var caps = GetBrowserCapabilities(Request.UserAgent, new NameValueCollection());
   6:        // Display the caps
   7:        Results.Text = RenderCapsTable(caps);
   8:    }
   9:    public HttpBrowserCapabilities GetBrowserCapabilities(string userAgent, NameValueCollection headers)
  10:    {
  11:        HttpBrowserCapabilities browserCaps = new HttpBrowserCapabilities();
  12:        Hashtable hashtable = new Hashtable(180, StringComparer.OrdinalIgnoreCase);
  13:        hashtable[string.Empty] = userAgent; // The actual method uses client target
  14:        browserCaps.Capabilities = hashtable;
  16:        var capsFactory = new System.Web.Configuration.BrowserCapabilitiesFactory();
  17:        capsFactory.ConfigureBrowserCapabilities(headers, browserCaps);
  18:        capsFactory.ConfigureCustomCapabilities(headers, browserCaps);
  19:        return browserCaps;
  20:    }
  23:    private string RenderCapsTable(HttpBrowserCapabilities caps)
  24:    {
  25:        var sb = new StringBuilder();
  26:        sb.Append("<table>");
  28:        string[] keys = caps.Capabilities.Keys.OfType<string>().OrderBy(k => k).Select(k => k).ToArray();
  30:        foreach (string key in keys)
  31:        {
  32:            sb.AppendFormat("<tr><th>{0}</th><td>{1}</td></tr>", key, caps[key]);
  33:        }
  35:        sb.Append("</table>");
  36:        return sb.ToString();
  37:    }


Now you might wondering how the hell we are going to Detect Firefox addon is Installed or not?

the answer is very hard to find, but i finally manage to get it working Smile

the Trick is We make a Image logo or what ever that is part of that extension and put javascript on the image Onload Event,

which the Source (src) is following the pattern : “chrome://[Extension Name]/content/images/logo/small.png 

now how do we know the path Image to be requested?  the content/images/logo/small.png , it’s hidden. Well we can use this Addon

after install click tools->Explore Chrome, explore the images


Now please look at the code Below, i make a nice JS to load it and append to the list when it’s installed

Page end result

   1: <html xmlns="http://www.w3.org/1999/xhtml">
   2: <head runat="server">
   3:     <title></title>
   4:   <style type="text/css">
   6:     th 
   7:     {
   8:         text-align:right;
   9:     }
  11:     td, th
  12:     {
  13:         border-bottom:1px solid black;
  14:         padding:5px;
  15:     }
  17:     </style>
  18: </head>
  19: <body>
  20:     <script src="Include/JS/jquery-1.3.2.min.js" type="text/javascript"></script>
  24:     <form id="form1" runat="server">
  25:     <div>
  26:       <asp:Literal ID="Results" runat="server" />
  27:       <ul id="ExtensionList" />
  28:       <script type="text/javascript">
  29:       //Firefox 3 addon Detection
  30:          var extensionlisttocheck=
  31:           {
  32:               'webdeveloper': 'chrome://webdeveloper/content/images/logo/small.png',
  33:               'firebug':'chrome://firebug/skin/firebug.png',
  35:           };
  37:           for (key in extensionlisttocheck) {
  38:                   var addonImage = new Image();
  39:                   addonImage.name = key.toString();
  40:                   addonImage.src = extensionlisttocheck[key];
  41:                   addonImage.onload = function () {
  42:                       var li = $('#ExtensionList').append('<li></li>');
  43:                       li.append(this);
  44:                       li.append(this.name + ' is installed');
  45:                   }
  47:           }
  49:       </script>
  51:     </div>
  52:     </form>
  54: </body>
  55: </html>


I give up on Detecting wether noScript addon is installed or not. I’ve try a suggestion like import CSS , but it doesn’t work

Share this post: | | | |
Posted by cipto with 1 comment(s)

ViewState Compression and what’s new on asp.net 4.0

on asp.net 4.0 page and each control now has it’s individual ViewStateMode Property, which you can set to enable,disable or inherit(following parent) .

I happen to have a page which i don’t need to maintain the postback, but still some times the server control save the value on the Viewstate that is why when disabled it messed up my UI.

I disabled it on the page and it’s get smaller. it’s still there because the server control still enable it for it’s usage.

to see the size There is this useful Firefox addon , it’s what i need because it tell us the Total size, not like trace, individual

Before                        After

image      image


There is another thing to improve:

  • we can still Compress using the Gzip for the ViewState Hidden value
  • or save the ViewState on the session

the Purpose of this is supposed to make the Viewstate Length value on the Input shorter.

the Correct way to do this is To make a new class inherit from PageStatePersister , it provides the base functionality for ASP.NET view state persistence mechanisms.

than you make the PageAdapter to use our new class.

than your in the end you will be overriding the default viewstate name:  __viewState.

there are a lot of example on the web that override the basepage and then override the LoadPageStateFromPersistenceMedium and SavePageStateToPersistenceMedium on that point. but it will create New ViewState Name

There are already provided one for this purpose for Telerik user, read it here.

But either i code it by myself and use that one on some Case, strangely when The view state it’s compressed the size get smaller, but when we convert.Tobase64String the end result yield longer than the previous one.that is odd perhaps there is some character, or it has to be on certain size than compressed. it’s still on my research, perhaps a bit later on.

if we want to move the viewstate to sesion, for telerik user read it here

Share this post: | | | |
Posted by cipto with no comments

Azure History and Introduction


The seeds for Windows Azure were sown in a 2005 memo from Ray Ozzie, Microsoft’s
then-new Chief Software Architect, who had just taken over from Bill Gates. In that
memo, Ozzie described the transformation of software from the kind you installed on
your system via a CD to the kind you accessed through a web browser. It was a call to
action for Microsoft to embrace the services world. Among other things, Ozzie called
for a services platform. Several teams at Microsoft had been running successful services,
but these lessons hadn’t been transformed into actual bits that internal teams or external customers could use.”

“In 2006, Amitabh Srivastava, a long-time veteran at Microsoft, was in charge of fixing
the engineering processes in Windows. As Windows Vista drew close to launch,
Srivastava met Ozzie and agreed to lead a new project to explore a services platform.
Srivastava quickly convinced some key people to join him. Arguably, the most important of these was Dave Cutler, the father of Windows NT and Virtual Memory System
(VMS). Cutler is a legendary figure in computing, and a near-mythical figure at Microsoft, known for his coding and design skills as well as his fearsome personality. Convincing Cutler to come out of semiretirement to join the new team was a jolt in the arm.”

it turns out ,

“They found that everyone was spending a lot of time managing the machines/virtual machines they owned, and that these machines were inefficiently utilized in the
first place.”

This is typically happen when we use our own server and data center, install the OS and all prerequisites, manual virtualization , set the load balancer.

and there is this 1 machine that is heavy load, and the other is just sit there and to nothing. there is no Sharing of Resource.

i think the analogy is very similar to Jakarta Bus way Open-mouthed smile, there are many bus stop but there is no bus to serve, some have more buses than it should. while the lane just sit there with no buses

the code project name is ‘Pink poodle’, than ‘Red dog’, than seriously officially released as Azure. Smile

Azure works close alike with Grid Computing, but what differentiate both?

  • well if there are small number of request ,but the computing or the process will take long that it won’t even be finished and take like forever ,it suites with Grid Computing
  • if the Number of request is plenty, but it’s served or finish quick or in short period of time, than this suites with the Cloud


  • Azure has it’s own hypervisor build from scratch and it’s specially design for cloud, hypervisor is the software that works close to kernel to do the virtualization. on the host machine can run multiple guest OS.
  • Azure is a Platform as a Service, it’s not just infrastructure, it provides platform as a whole feature. a common and generic language that everybody can understand
  • Built in .net 3.5 sp1, on all of the nodes
  • Host any app that can run on windows
  • Built in Free tools for monitoring hardware ,software failure, statistic
  • Windows Azure offers three key data services: blobs, tables, and queues, the reason why they have to design it a bit different, because the native one doesn’t work well on cloud.
  • Azure AppFabric, it’s used to deploy on local and cloud
  • Fabric controller, the man behind the screen who does all the Automation. from hardware management,service type setting, service life cycle .Details 

what is the difference between app fabric and fabric controller?

When not to use

  • depend on the scenario, but the outages can still  happened on cloud also although a bit rare. but the cloud can be our helper when we are overload, or our local datacenter is down
  • when we need custom Infrastructure requirement. for example you need high GPU,or High area network,etc. Cloud use the same hardware
  • We have security regulation like Europe data can’t go outside of Europe, because it’s all going to be replicated everywhere depend on the vender.
  • we have concern of Confidential and Auditable
  • We have small budget for Capacity planning, because every storage on azure has to be paid. it’s paid as you go but so is the storage
  • although the cloud services has SLA, the performance still will be vary from time to time
  • Migration and Interoperability,although it provide us with the common language to talk to , it still has differences with other type of application

Source: Programming Windows Azure by O’Reilly chapter 1-2

Share this post: | | | |
Posted by cipto with 1 comment(s)

Logical Step of T-SQL query Processing

This is the in-essence of the inside tsql-programming Sql server 2008 chapter 1 (well franky until page 16 Smile).

It’s interesting to know the logical step of a query being parsed by the query optimizer.



For each Step it will create a virtual table and only The Final one is being returned to us .

The Logical in Order is :

  1. the FROM , if you have From table A join B on A.id=B.id. join C  it will first Cross Join table A and B , in result virtualtable 1. then applied the filter based on the ON clause .virtualtable1 Cross Join C resulting virtualtable 2 ,then applied the filter based on the ON clause and so on
  2. if the clause is Outer Join, any rows that is not a match will be inserted on the virtualtable of the that step. if A Left Outer join B, as the name implies , any rows not a match on A will be added.
  3. Where Clause will be executed in this step
  4. Next go to Group by.if there is group by, the virtualtable at that point all result will be piled 1 by 1, resulting only 1 row per Group.
  5. Having than applied after the group by
  6. Then it will go to upper SELECT, if there is distinct. execute it and remove all duplicate rows
  7. Next i there is top it will work Differently , here the query will ask By what? than it will see the Order By Clause. if the column on order by is unique the result will be fixed and predictable else not unless the keyword With Ties is used.
  8. The Order By is executed. the orderby will return not a table but cursor which you can iterate.that is why can’t be use on inline expression,CTE,view.

We can fine tune the query, so it doesn’t cost too much, but in the end , query optimizer will choose from available routes which one Cost the lowest and Run it

Share this post: | | | |
Posted by cipto with 1 comment(s)

Telerik RadFormDecorator

This control idea is quite nice as this will Decorate your control and html.

it tries to make the whole control have rounded corners ,the colour and looks are following the Skin that you choose.

it will wrap the control with table and add the rounded corner as workaround for IE

You can choose the All, Checkboxes, Radio button,Select,Grid,Textarea,H4H5H6.

put the control right after the telerik scriptmanager

but again for IE, it will break the css, some clue to make it work:

  • remove all width 100%.
  • add a Wrapper of div around the control you wanted to , add fixed width on this div

After doing the testing, it will be very sluggish on IE. so i don’t use it for all, just what i needed to be decorated.


Share this post: | | | |
Posted by cipto with no comments