Wednesday, May 27, 2009

Reflector on the job

 

You have a list full of custom class items and want to find according to one property.Ok the best way is lambda functions(Or Not?).Other than lambda functions you can use reflection and use some code like:

 

public NeuronList FindByProperty(string PropertyName, object Value)
 {
     try
     {
         NeuronList foundItems = new NeuronList();
 
         foreach (NeuronBase item in List)
         {
             System.Type itemType = item.GetType();
             PropertyInfo[] itemProperties = itemType.GetProperties();
 
             foreach (PropertyInfo info in itemProperties)
             {
                 if (info.Name == PropertyName)
                 {
                     object itemValue = info.GetValue(item, null);
                     if (Convert.ChangeType(itemValue, info.PropertyType).Equals(Value))
                     {
                         foundItems.Add(item);
                     }
                 }
             }
         }
 
         return foundItems;
     }
     catch (Exception ex)
     {
         throw new Exception("Can not find property", ex);
     }
 }

Neural Networks

Have written a basic ann app which can do anything known about neural networks and has a simple ui, of course it needs lots of improvements but to get the basic idea you can take a look.

I am assuming you have some idea about neural networks

BaseNeuron is my neuron class which derives from user control. Input Neuron Middle Neuron and Output Neurons are derived from Base Neuron .Input Neuron is the neurons where you apply input output neurons are as name implies output :).Every neuron can be connected to another by synaps.A synaps becomes more powerful as it transmit signals

NeuralNetwork is our network and contains two collections inputneurons and neurons(middle and output).NeuralNetwork stores the fired neurons you can find all fired neurons in our network in nth turn.

NeuralPort is the ports where you can make connections(input and output) to ann.

NeuronList is our List that hold neurons and enables us to find desired neuron by neuronNo

NetworkVisualiser is the gui that shows our neural network connections and fired neurons.

Network builder is obsolete now network build her own.

I am uploading a copy in google code under hyacinth.

http://code.google.com/p/hyacinth/downloads/list

Wednesday, May 20, 2009

N-Depend

I have been busy with artificial neural networks for some time so couldn’t post much.

NDepend is a static code analyzer it inspects your code and tells dependincies metrics code analysis. I found metrics very useful.It tell if you used boxing if your namings are wrong, if you used wrong access modifier, you have too many fields.You can also write your own queries it uses cql code query language very similar to sql, You can select methods which returns int.

http://www.ndepend.com/ is the web page.

Take a look

Thursday, May 7, 2009

Hyacinth v1.1

I added some missing things to hyacinth my jabber client.She can now encrypt messages .