searchosearcht Formula d Szh vasearche Effectivestudyformula asearchl Formula searchrsearch searchosearchm Immune l Formula Effective N System T Support Isearchfsearch
Delicious Twitter Facebook Digg Stumbleupon Technorati RSS
Links to this post

C++0x Dynamic Message Passing

0 comments
Introduction

Sometimes it is useful to have dynamic message passing as in Objective-C. The small header presented below allows any class to contain a dynamic message map that can be used to add methods dynamically to an object.

Background
Objective-C is deemed more flexible than C++ because it allows a form of dynamic dispatch known as message passing.
Message passing is a form of dynamic dispatch that does not require implementation of a specific interface type. When sending a message to a target object, it is unknown to the compiler if the message can be handled by the object or not. It is only during the execution of the program that conformance to an interface is discovered.
Message passing is quite flexible because it does not require a lot of planning. Objective-C has been praised for this feature as more flexible than C++. This article demonstrates how easy it is to do the same in standard C++ (c++0x).

Using the code
Using the code is very easy. The following steps have to be followed:

  • include the header "mp_object.hpp" in your project.
  • inherit from class mp_object.
  • add dynamic methods to your object by using the method 'add_method'.
In order to add methods to an object, you need a prototype function. A prototype function can be any free-standing function. The following code is an example of how to declare prototypes and add dynamic methods to your code:

#include <iostream>
#include "mp_object.hpp"
using namespace std;
//prototype method
void draw() {}
//prototype method
void setColor(int color) {}
//rectangle
class rect : public mp_object {}
   //draw
   void draw() {}
   //set color
   void setColor(int color) {}
};
//circle
class circle : public mp_object {};

and a UserControl with the property such as the following:

private States _state;
public  States State
{}
   set {}
}

and you want to hook up a combo box, a list box or a panel of radio buttons to the property to allow the user to select a specific value.

1 - Create the User Control
We want to bind to the property in our UserControl, so we will have to change it fire the PropertyChanged event.
So we do the following:
Add the System.ComponentModel namespace:

using System.ComponentModel;

Add the INotifyPropertyChanged interface to our UserControl and implement the interface by adding a PropertyChanged event:

public partial class UserControl1 : UserControl, INotifyPropertyChanged
{}
   set
   {}
       }
   }
}

Make it pretty.

If you have multiple properties, this snippet of code takes a lot of coding. We can separate this out by creating a convenience function to check and call the PropertyChanged event.

Read more: Codeproject
Posted via email from .NET Info
Delicious Twitter Facebook Digg Stumbleupon Technorati RSS
Links to this post

Get Property using Reflection C# +Java

0 comments
התבקשתי לכתוב ב java class מאוד גדול (שלא ניתן לחלק אותו)ולהפוך אותו ל xml, סיקרן אותי מאוד כיצד כותבים את אותו class גם ב c#:
יש לציין שניתן להפוך Class ל XML גם בצורה אחרת דרך XmlSerializer.
להלן הקוד ב C#:
//Class into XML
//Get the Properties of the Class and
//Create xml element
XElement xml_line = new XElement("je");
Type type = MyClass.GetType(); //Get the Type of your Class
PropertyInfo[] properties = type.GetProperties(); //Get the PropertyOnly
foreach (PropertyInfo property in properties)
{}
להלן הקוד ב java:

try 
{}
}
catch (Throwable e) 
{}

Read more: Uzi Drori's Blog
Posted via email from .NET Info
Delicious Twitter Facebook Digg Stumbleupon Technorati RSS
Links to this post

כיווץ מחיצות

0 comments
שלום לכולם ,
כאן ליעד מצוות התמיכה של Microsoft.
היום נלמד כיצד להקטין את גודלן של המחיצות בדיסק הקשיח במערכת ההפעלה Windows 7  .
ממשק ניהול המחיצות (מנהל הדיסקים) של Windows 7  מספק ממשק נוח וקל לשימוש דרכו ניתן להקליד , להקטין , לערוך ולמחוק מחיצות בדיסק הקשיח שלנו .
כיום , ניתן להקטין מחיצה עד לחצי מגודלה המקורי – כלומר במידה וכונן C קיים במערכת ההפעלה ככונן יחיד וגודלו הוא 300GB נוכל להקטינו על למחצית מגודלו – 150GB .
את החלק ה"עודף" שנוצר נוכל להגדיר ככונן נוסף ולמעשה ליצור 2 כוננים שונים בגודל כולל של 300GB
חשוב לזכור כי על מנת להקטין את הכונן עלינו למחוק מידע בנפח אותו אנחנו מעוניינים להקטין מהכונן – כמות המידע הפנוי יוצג לפנינו באשף עצמו אך עדיף להכין את הכונן לפני תחילת התהליך 
מתחילים!
1. לחצו על התחל > מקש ימין על המילה מחשב > בחרו בניהול



Read more: MS Support Blog
Posted via email from .NET Info
Delicious Twitter Facebook Digg Stumbleupon Technorati RSS
Links to this post

Rapid Dev – a new unit testing tool is born

0 comments