"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

December 30, 2011

NuoDB Conflict Management

Continuing previous post on NuoDB, December there was another technical session on NuoDB. I had few questions on conflict management as well. I have captured my understanding in below notes.
 
Does Readers block writers ?
Every new update is stored as new version. There are no updates to existing records. This way reads do not block writes.
 
Write / Write Conflicts ?
Only after recent Write operation is completed, the next write operation would be performed
 
How long does these versions exist in memory ?
Thanks to Jim for commenting on post. He has provided the answer
NuoDB has a garbage collector that runs around deleting inaccessible record versions

  • Bottleneck of Current OLTP Databases - Lock management, this is synchronous, related queries would be blocked until Data is committed, Managing the Table structures on the Disc along with supporting ACID compliance. Again this depends on so many factors isolation levels, locks set.
  • NuoDB - MVCC based. Asynchronous mechanism. Conflict management related questions listed above provides clarity on implementation
Brokers - Load Balancing
Archive Manager - Stores data as Key Value Pair
Transaction Manager - Diskless.
  • The process of performing a transaction includes
  • Broker Notifies Transaction Manager for Transaction to be performed
  • Fetch the required ATOMS from Archive Manager
  • Load the Data into Transaction Manager
  • Perform the transactions
  • Pass it to Archive Manager and commit in DB
Session also covers brief overview of Elasticity, Virtualization, High Availability support of Nuo-DB. Benchmark results against Mysql results are a good start and a compelling reason to try out NuoDB
 
Happy Learning!! 

December 29, 2011

Command Prompt Disappears in Win7

I had this issue for last 6 months. Command prompt window used to disappear immediately after launch. This link was very useful to solve the issue.

As suggested in the answer, You have to delete the AutoRun value set as Exit in the Registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor).

Happy Learning!!

.NET App Developer Notes

Last couple of weeks I have been busy trying out my new project in VS2010 / C#. Couple of basic exercises for my learning purpose are listed below. Please modify the code to make it work.
Tip #1
  • Working on Folder Open and Browse Dialog for a Windows FormsApp
  • Best option is to reuse codeplex code. Link 
Tip #2
  • Working with Threads
  • Below is a Simple Threadpool (For sum of two numbers). Try it out as a Forms app so see how operations are performed parallely.
using System;
using System.Threading;
using System.Windows.Forms;
class InputNumbers
{
    public int a { get; set; }
     public int b { get; set; }
}
class Example
{
    public Example()
    {
      // Declare a new argument object.
      InputNumbers IS = new InputNumbers();
      IS.a = 10;
      IS.b = 20;
      for(int i = 0; i<100 ; i++)
      {
            IS.a = i;
            IS.b = i+2;
            // Send the custom object to the threaded method.
            ThreadPool.QueueUserWorkItem(new WaitCallback(AddNumbers), InputNumbers);
    }

    private void AddNumbers(object a)
    {
      InputNumbers IS = a as InputNumbers;
      Messagebox.show((IS.a+IS.b).ToString());
    }
}

Tip #3

To keep methods seperate, DB Layer, Web Methods and UI Layer, I decided to keep them in different classes. This question was useful for my learning for this tip. Below is a simple example.
Class A
Class B
ProgramFile.cs
All classes in different file

classA.cs
using System;
namespace class_A
{
    class classA
    {
        public void methodA()
        {
            Console.WriteLine("In Method A");
        }
    }
}

classB.cs
using System;
namespace class_B
{
    class classB
    {
        public void methodB()
        {
            Console.WriteLine("In Method B");
        }
    }
}

program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using class_A;
using class_B;
namespace ClassExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            classA A = new classA();
            classB B = new classB();
            A.methodA();
            B.methodB();
            Console.ReadLine();
        }
    }
}

Tip #4
  • Working with Log4Net
  • The following two posts link1, link2 were useful to get started.
  • Below is simple Windows Forms App
  • Add the Log4Net DLL in project references
 LogHelper.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using log4net.Config;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
[assembly: log4net.Config.Repository()]
namespace loggingns
{
    public class Loghelper
    {
        #region Data Members
        public static readonly ILog testLogger = LogManager.GetLogger("log4NetExample");
        #endregion
    }
}

Program.cs
Invoke the following method to log entries . Use the namespace loggingns in Form1.cs.

using log4net;
using log4net.Config;
using log4net.Core;
using loggingns;

Sample Test method

        public void testMethod()
        {
            Loghelper.testLogger.Debug("Debug Log");
            Loghelper.testLogger.Info("Info Log");
        }
App.config file entry
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
      <configSections>
            <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
      </configSections>
      <appSettings file="" >
            <clear/>
             <add key="log4net.Internal.Debug" value="false"/>
      </appSettings>
      <!-- This section contains the log4net configuration settings -->
      <log4net debug="true">
            <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
                  <layout type="log4net.Layout.XMLLayout" /> -->
                  <param name="File" value="TestLoggerExample.log"/>
                  <param name="AppendToFile" value="false" />
                  <layout type="log4net.Layout.PatternLayout">
                        <header type="log4net.Util.PatternString" value="[START LOG] %newline" />
                        <footer type="log4net.Util.PatternString" value="[END LOG] %newline" />
                        <conversionPattern value="%d [%t] %-5p - %m%n"/>
                  </layout>
                  <filter type="log4net.Filter.LevelRangeFilter">
                        <param name="LevelMin" value="INFO"/>
                        <param name="LevelMax" value="INFO"/>
                  </filter>
            </appender>
            <!-- Setup the root category, add the appenders and set the default level -->
            <root>
                  <level value="ALL" />
                  <appender-ref ref="LogFileAppender" />
            </root>
            <!-- Specify the level for some specific categories -->
            <logger name="log4NetExample">
                  <!-- <appender-ref ref="B" /> -->
                  <level value="ALL" />
                  <appender-ref ref="LogFileAppender" />
            </logger>
      </log4net>
</configuration>

I hope these tips would help for future reference.

More Reads
N-Tier Architecture Best Practices, Part 1: 2-Tier Architecture with just a Data
N-Tier Architecture Best Practices, Part 2: 3-Tier Architecture with interfaces and a Data Tier


Happy Learning!!