|
Hi again Michael,
Unintentionally to abuse, but already abusing am not sure if I understood what you wanted to say below sentence:
theRealCondor wrote:
The only item that I would say you should make an adjustment to is the ISerializable implementation. The reason I say so is that you have to implement your own serializer/deserializer!!!
The one that I thought about doing is something of the type:
[Serializable()]
public class MyModelObject : ISerializable
{
private int a;
private string b;
public MyModelObject()
{
}
public MyModelObject(int a, string b):base()
{
this.a = a;
this.b = b;
}
protected MyModelObject(SerializationInfo info, StreamingContext context)
{
this.A = info.GetInt32("A");
this.B = info.GetString("B");
}
public int A
{
get {return this.a;}
set {this.a = value;}
}
public string B
{
get {return this.b;}
set {this.b = value;}
}
void ISerializable.GetObjectData(SerializationInfo info,
StreamingContext context)
{
info.AddValue("A", this.a);
info.AddValue("B", this.b);
}
}
For the what could understand I should not make this?! Only use [Serializable()] it didn't work. Can you feel a light (larger still)?
Greetings,
Marcelo Palladino
Brazil
|
|
|
|
|
Pallidino said:
Michael responds:
Here is what I did that worked and is very simple:
using System.Runtime.Remoting;
using System.Collections;
[Serializable]
public class WidgetCollection:CollectionBase
{
public WidgetItem this[int index]
{
get{return (WidgetItem)this.List[index]; }
set{this.List[index] = value; }
}
public void Add(WidgetItem item)
{List.Add(item)}
public WidgetItem this(string key)
{return (WidgetItem) List(key)}
}
[Serializable]
public class WidgetItem
{
Sprocket internalSprocket
Spoke internalSpoke
DooHickey internalDooHickey
...
}
This construct is used by both the client and server objects.
Server creates the WidgetCollection and populates it with Widgets.
Both the WidgetCollection and the Widget are marked [Serializable].
So your server object could be like this assuming that you had a server object instance named Server that handled the population of the WidgetCollection, and you already created the Interface object that defines your WidgetManager for your client use:
public class WidgetManager:MarshalByRefObject, IWidgetManager
{
public Widget GetWidget(WidgetKey item)
{
WidgetCollection itemList = Server.PopulateWidgets();
return itemList[item];
}
}
Now.....if you do this, run your remote objects, and get an error that says that {some object} cannot be serialized , then {some object} has not been marked [Serializable].
In my example, WidgetItem uses a unique object type of Sprocket, Spoke, and DooHickey. I must make certain that all three object type definitions are marked as [Serializable]. You must keep iterating through your object tree until you finally succeed without the 'cannot be serialized' error. So I'm required to add:
[Serializable]
public class Sprocket()
{
...existing definition
}
[Serializable]
public class Spoke()
{
...existing definition
}
[Serializable]
public class DooHickey()
{
...existing definition
}
The advantage of this approach.....
You can construct your client and use the remote object as a local object while developing and testing without any serialization occuring.
Once you are ready to make the move, you change the local object to a MarshalByRefObject object and mark the objects being returned as [Serializable] and your client use is almost identical with the exception of how the objects are initialized.
We established the standard that if you have objects that are local and MIGHT become remote, that the object initialization be isolated in a method. That way all remote objects are isolated and easy to change from new Object to Activator.GetObject() with the beginning of the method altered to first initialize the channel.
Voila, remoting at it's simplest.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
 Marcelo,
Putting this another way:
"With the exception of earlier TCP/IP RPC implementations, in which you even had to worry about little-endian/big-endian conversions,
all current remoting frameworks support the automatic encoding of simple data types into th echosen transfer format.
The problem starts when you want to pass a copy of an object from server to client. Java RMI and EJB support these requirements, but COM+ for example, did not.
The commonly used serializable objects within COM+ were PropertyBags and ADO Recordsets -- but there was no easy way of passing large object structs around.
In .NET Remoting the encoding/decoding of objects is natively supported.
You just need to mark such objects with the [Serializable] attribute -OR- implement the interface ISerializable and the rest will be taken care of by the framework.
This even allows you to pass your objects cross-platform via XML.
The serialization mechanism marshal simple data types and subobjects (which have to be serializable or exist as remote objects),
and even ensures that circular references (which could result in endless loops when not discovered) don't do any harm.
<sub> -- Ingo Rammer, Advanced .NET Remoting </sub>
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
Michael,
I don't have as thanking for this "chat" that we had. For this first moment it is everything OK, thank you very much (really)! With relationship to the Ingo book´s, I tried to buy for here but I didn't get (still)...
It was worth,
Marcelo Palladino
Brazil
|
|
|
|
|
How to debug JavaScript code in C#.
|
|
|
|
|
You have to attach a JavaScript debugger to the C# application. If you're using JScript.NET, you can attach the Managed Debugger to the code. If not, you'll have to find some proprietary JavaScript debugger capable of this but I know of none that can attach to running processes.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi all.
Is there an easy way to retrieve the names of all the local user accounts on a computer? If it is possible to get additional information about the accounts that would be great, but it is not absolutely necessary...
Thanks
/EnkelIk
|
|
|
|
|
|
Thanks for your answer.
This also works (putting the names of the accounts into a datatable):
string strHost=Environment.MachineName;
DirectoryEntry vscDirEnt=new DirectoryEntry("WinNT://" + strHost + ",computer");
DataTable vscDT=new DataTable();
DataRow vscDR;
vscDT.Columns.Add("names",System.Type.GetType("System.String"));
foreach(DirectoryEntry vscAccount in vscDirEnt.Children)
{
if(string.Compare(vscAccount.SchemaClassName,"User",true)==0)
{
vscDR=vscDT.NewRow();
vscDR["names"]=vscAccount.Name;
vscDT.Rows.Add(vscDR);
}
}
Thanks
/EnkelIk
|
|
|
|
|
Yes,but only works when you working wiht Active Directory.
Mazy
No sig. available now.
|
|
|
|
|
Hello!
I want to draw a reversible frame on my windows form. I have found the method ControlPaint.DrawReversibleFrame, but this method is not, what I'm looking for.
I need a dotted frame like a fokus rectangle.
Is there somebody who can tell me, how I can draw such a frame or how I can draw dashed lines with a XOR combination of colors?
Thanks
Björn
|
|
|
|
|
If you need a focus rectangle, why not use ControlPaint.DrawFocusRectangle ? You can specify both the foreground and background colors. If you need to invert the colors, you can create a new Color by XOR'ing each of the R, G, and B components with 0 or 0xfff.
If you want to draw a rectangle around the bounds of the control itself use the Control.Bounds property for the rectangle param of the DrawFocusRectangle method.
If neither of these approaches is quite what you want, you can draw dotted lines by using a custom Pen with the Pen.DashStyle property set in calls to Graphics.DrawLine or Graphics.DrawRectangle and similar methods.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I follow all ms treeview document steps, There need to copy webcontrls.dll to app's direction,but i can't find this file.
|
|
|
|
|
You have to download it from http://asp.net/ControlGallery/default.aspx?Category=38&tabindex=2[^]. Follow the directions to properly install the client files and ASP.NET assemblies in the appropriate directories. Unfortunatley, this is a manual installation for each Web Application in which you want to use these controls.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
It doesn't necessarily need to be configured per app. In our configuration the dll is loaded into the GAC on the webserver and the webctrl_client folder is under the webroot.
|
|
|
|
|
sharing internet offline files between two OS?
which i mean if i have two OS Win 98 and 2000 Pro
and each one on different partition
and i connect to the internet using win 98 i want to see
the offline files win i'm using win 2000
i want to write program that do this or if there are solution at the windows
please tell me
|
|
|
|
|
Why are you posting this in the C# forum? This is a Windows question and should be directed to the appropriate forum or the Lounge. I will answer anyway, but please do not post in an inappropriate forum again.
There is a solution in Windows already. Add a favorite to a web site and check the "Offline" check box (or something like that) to download a cached copy. This will be limited to the current OS unless you share the same Internet Cache folder for Internet Explorer in both operating systems, but remember that Windows 9x/ME cannot access NTFS so you'll either have to format your Win2K partition as FAT32 (not a good idea because you loose file security features) or have Win2K access the FAT/FAT32 partition in Windows.
If you're talking about offline network share files, only Windows NT (which includes 2000, XP, and 2003) supports this so your Win98 installation will have to access that folder, which means you'll have to format the partition as FAT32 (again, a bad idea).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
sorry for posting in wrong forum
but i did that in case that i have to write application to do this
in all cases thanks for your help
|
|
|
|
|
Hello,
I'm writing an application that reads in a .WAV file and performs some DSP operations on it.
Visual representation of this data is essential, and I'm looking for some classes that would help generate X-Y plots, including the following:
1. Plot title
2. X and Y axis titles
3. Choice of color for multiple plots on the same graph.
Could somebody point me to suitable resources? I know that there are companies selling such packages, but all I need is an X-Y plot, and a free class would be ideal.
Thank you!
|
|
|
|
|
crushinghellhammer wrote:
Could somebody point me to suitable resources? I know that there are companies selling such packages, but all I need is an X-Y plot, and a free class would be ideal.
Try the MSChart control. It is installed with VS.NET. I realize that it is COM, but it still works nicely in .NET.
Brian
|
|
|
|
|
|
I'm curious if you know of any good documentation on how to convert a C# string to an MFC CString. A C# application I'm working on needs to call a C++ function exported by a dll, and the prototype of that function includes several MFC CString objects.
I suspect it's trivial to do, but that it involves some esoteric knowledge of the built-ins that I just don't have. I'm also hoping to circumvent the use of managed C++ to do this but simply preparing the correct byte-format structure that can sit in and be accepted and properly interpreted as a CString by the C++ function.
Thanks,
Jerry
jerry@cs.stanford.edu
|
|
|
|
|
The first thing to do is read the documentation for the DllImportAttribute in the .NET Framework SDK, as well as the MarshalAsAttribute . The first is how you P/Invoke native functions. Since an MFC CString can be cast to an LPTSTR , you use use the UnmanagedType.LPTStr in the MarshalAsAttribute for the string parameter. There's also several articles about P/Invoke and interoperability in the .NET Framework SDK that should help.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hello all,
I have any unusual question for you all. My piqued interest in the Thai lanugage/culture has prompted me to develop my own Thai Learning System. For the various consonants and vowels I want to animate how to draw each symbol. I was thinking of using a Thai True Type font and for each character animate along it to demostrate how it is drawn.
My problem is how can I read the true type fonts coordinates and animating along the symbol? Perhaps I need to hook the event that actually paints the symbols on the canvas then with my own event actually paint the symbol in some sort of time lapse fashion to present it in an animated fashion.
My other thought was to create a bunch of methods that draw each symbol as lines/arcs/Bezier Curves, but I figured it would be easier tracing the true type font in a generic fashion. With the lines/arcs/Bezier Curves I don't know how to get teh GDI+ engine to animate the points. Is there a way?
If anyone has any other suggestions or a better solution, which I am sure exist, please let me know.
Mark H.
|
|
|
|
|
First of all, .NET doesn't contain such low-level hooks. All you could do is draw the fonts yourself. I'm not even aware of any way to control fonts to such a degree exposed in the Win32 APIs and I've spent over a decade getting headaches from them (though such headaches might have lead to temporary blindness, causing me to miss such functionality )! This would be a function of GDI so you could look into the documentation.
Besides, true type fonts don't really contain any data that would allow you to show how each character is drawn. They contain points that help with resizing but those aren't in any order that is representational to how a human would draw them.
Your best bet will be to - as you didn't want to do - use lines, beziers, etc., to draw the characters.
Might I recommend Macromedia Flash, though? I've seen a lot of examples of similar presentations that actually draw things in steps. You would also be able to easily host this in a web page (you can with .NET controls, but it requires the ~20 MB framework and a pre-installed security policy to allow your code form a specific site to run), any COM client, or even a .NET application (which can be a COM client).
If you wanted to use GDI+ in a .NET application, you would have to worry about all the animation. For example, if you use Graphics.DrawLine to draw a line, the line is just there. It won't be animated. You'd instead have to call Graphics.DrawLine repeatedly to draw longer and longer lines until you reached the desired length! That's easy, though, compared to curves - you would have to calculate each point in the spline or the start and sweep angles for arcs with each iteration of the animation!
You could use Managed DirectX - which will help you with graphics a little - but you'd still need to worry about creating a package to handle the character animation. Things like Flash and even DHTML with vector graphics already have this support - you just have to tell it how to animate what you want.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|