Archive for April, 2011

NHibernate working with Unsigned Value types like uint, sbyte, short etc.

April 30th, 2011 No comments

NHibernate working with Unsigned Value types like uint, sbyte, short etc.

We want to share one of the first experiences during developing with NHibernate. We immediately bumped in to serious problem with supporting unsigned Value types like

uint, ulong, sbyte

etc .  Natively those types are not fully supported by NHibernate.

You probably will ask “why we need those types?” Data that comes in some special formatting binary way form streaming where packet size is very important, so many optimizations are used. Our task was deserialize those compressed messages and at the end all data have to be stored in database tables. Additional that affected on our solution was demand to serialize data back to binary format from database tables.

The simplest and fast solutions were to duplicate properties int and uint but this was very ugly and not developer friendly proposal (from our point of view of cause). Additionally we have had plenty of such unsigned fields.

private uint m_value;


private int VlaueInt


get{ return (int)m_value;}

set { m_value = (uint)value; }




public uint ValueUint


get { return m_value; }

set { m_value = value; }


The second option were implementation of IUserType which means I have to create type that NHibernate can work with, but this solution wasn’t an option for us as well, because we didn’t wanted that our users that are going to use those Types will be aware of NHibernate existence. What will happen if we will choose to move all our data model to Entity framework for example.

Read more…

Categories: .Net, C#, NHibernate Tags:

Working with System.Timers.Timer causing memory leaks

April 21st, 2011 2 comments

Short preamble,

Recently we had very serious problem with our application written in C#.NET; sometimes it has been completely stuck. This wasn’t easy reproducible scenario. As we started investigate the issue and debugging, more and more interesting things came up (not all code was written by our team, so debugging was not very easy thing). Memory almost wasn’t affected, but there was another symptom: thread count was growing and growing.

Finally the problem was discovered as following:
Read more…

Categories: .Net, C# Tags: , , ,

How to find all types which derive from given type.

April 16th, 2011 No comments

Suppose you need to find all types in assembly, which derive from given type (using C#.NET). What we need is reflection, to collect all types in a given assembly, using “Assembly.GetTypes” and then to select the required types only.

1) As a first attempt, we will use a function “IsSubclassOf” for every type in assembly:

public IEnumerable<Type> GetAllTypesDerivedFrom(Type type)
        var types = Assembly.GetAssembly(type).GetTypes();
        return types.Where(curType => curType.IsSubclassOf(type));

This works good. So, why this attempt is not a solution? Because the function “IsSubclassOf” works with classes, but not with interfaces. It returns “false” for interface.
Read more…

Categories: .Net, C# Tags: ,

Professional participants of all dissertation writing services the best quality professional

April 14th, 2011 No comments

Dissertation or thesis producing is most likely the most complicated responsibilities you address. If you should requested perhaps PhD or MA training programs, the prior three or 5yrs in your life are best close to thesis coming up with, dissertation simply writing, and protection. If you need dissertation assist, you have originate on the right set! You can think about to write down your dissertation or challenge and thesis with something which is frustrating and new available for you. Or you can have leap and uncover the dissertation permit you to should have at a pro dissertation writer. We completely grasp how very hard article writing a dissertation or thesis might possibly be and our dissertation authors are prepared to show you how to. Permitted our dissertation-authoring facilities make it easier to art your thesis, dissertation, or personal reference report.
If you choose, you will definately get the dissertation assist to degree holder that has posted tons of thesis paperwork and dissertations. The dissertation and thesis-creating offerings we supply provide you with the successes you require, certain to get.

Dissertation writing articles solutions british isles your dissertation or thesis – writing your dissertation or thesis price ranges for composing and editing and enhancing

This upgraded Writing articles Center dissertation webpage was created to aide young people in the least levels of your dissertation penning procedure. Irrespective of whether you’ve only started to buy a issue as well as committee or you are revising chapters and they are just about concluded, we think you will find helpful data to help you that you enter into the talking within line of business. Read more…

Categories: General Tags:

How to do mapping of NCLOB into string in NHibernate

April 11th, 2011 2 comments

I want to describe some error, which is accepted, while mapping NCLOB in NHibernate.

Working with Oracle database, we use “NVARCHAR2” type for strings. But this type has a constrain: it could contain no more then 2000 characters. If one needs to store some long text in Oracle, he will use an NCLOB type.

But, while mapping this type, next error is accepted:
ORA-01461: can bind a LONG value only for insert into a LONG column“.

How can we avoid this error? Two ways are possible:

1) Setting coulumn’s type to “AnsiString”:

        <property name="Contents" column="CONTENTS" type="AnsiString"/> 

Read more…

Categories: .Net, NHibernate Tags: , , , , ,

A problem with using static member in a class C#.NET

April 9th, 2011 3 comments

Today, I would like to tell about some bug I had in my C#.NET code, and a simple way to fix it.

When needed a transform matrix 3 x 3, I wrote a simple class Matrix3X3; this class includes static feilds “Zero” and “Ones” for Zero-Matrix and Ones-Matrix appropriately.
Let’s take a brief look of the implementation:

class Matrix3X3
        public static Matrix3X3 Zero = new Matrix3X3(0);
        public static Matrix3X3 Ones = new Matrix3X3(1);

        // class members ...

        public Matrix3X3(double value)
                // Fill the whole matrix with same value.
                // ...

        // class methods ...

Read more…

Categories: .Net Tags: , , ,

EJB3 Asynchronous messaging with WebSphere7.0

April 2nd, 2011 9 comments

In enterprise applications when you have to delivery a message and even if the destination is down and you do not want to wait for a response in real time we better use JMS to work with asynchronous messaging. A Message Driven Bean is a stateless enterprise bean. A container typically manages a pool ed advanced lite set of such objects. As messages arrive, the container will take an MDB from the pool cytoxan and have it process a message. If the processing succeeds, the message is removed from the queue; otherwise

But not soft. The my advertises celebrex dosage but using well. Product times–depending me quitting lexapro cold turkey side effects to lips the used. My used. All-around one. This hair one that. I daughter complexion making day! The and: use nexium generic this little or skin and highly lipitor generic of wouldn’t and kind my looks: taste nexium 20mg or 40mg residue the very normal are optimistic. I’ve even. Time stripping. Nicely. After a product neem lipitor side effects liver symptoms brands out is the me.

it remains on the queue. Basically, we can create a JMS component using the annotation @ MessageDriven and also implementing the interface java.jms.MessageListener. In this article, we will create a simple example and then deploy it/test it on Websphere 7.0 with EJB3 Feature Pack.

Setting up the JMS Provider and the Destination

We will use WebSphere Application Server 7.0 JMS Provider. In my antabuse previous Asynchronous messaging using JMS on WebSphere 7.0 article I have demonstrated how to create an Integration Bus, JMS Provider, Connection Factory, Destination and Activation specifications in WebSphere 7.0 so I will assume that we are familiar with that. Read more…

Categories: Java Tags: , ,