|
yes but I want to print all the document in reverse ,look my printer hp3700dn make this but I want make it from the code,i need for my aplication,you know how?
S.
bigmega
|
|
|
|
|
I've got a smart client app in which the server return lots of objects to the client. Each object is constructed of lots of primitive data (a few Int64s, strings, etc), plus a few generic collections.
My question is, what is the best way to return data read on the server to the client? I see 2 options:
Option #1: I could create the objects on the server and pass them to the client:
ComplexObject ReadData()
{
return new ComplexObject(string, int, float, string, long, ...);
}
ComplexObject obj = Server.ReadData();
Option #2: I could pass the raw data from the server to the client, and the client could create the object on his side:
struct RawData
{
string str, name, text;
float blah, test;
long someLong, ID;
}
RawData ReadData()
{
return new RawData(str, name, text, blah, test, someLong, ID);
}
RawData data = Server.ReadData();
ComplexObject object = new ComplexObject(data.ID, data.text, data.name, ...);
Currently I'm using something like option #2, passing a lightweight struct back to the client, and have the client create the complex objects. Is there a better way?
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
You could do your return in both ways, but in your first exemple if you say that the data quantum is large then the traffic caused by the app will be larger, thought, if you create the complex object onto the swerver your client will have less processing (work) to do.
Any other way I don't think there is
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Well I've guessed that the 2nd option (passing raw data over the network, creating complex object on the client) is less network-intensive and therefore faster.
However, I'm worried that my light-weight struct that I use to pass the data over the network is too large for a typical struct. I know Microsoft has suggested that structs be no larger than 16 bytes of data; the structure I'm using to hold the data is much larger than 16 bytes (currently, 13 strings, 10 longs, 2 bools, and 10 DateTimes).
Anyone know of the most efficient way to transport lots of objects from server to client?
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
|
Shameless plug if I've ever seen one. I looked at your AdvancedTextBox a few months back and I must say I was impressed.
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
how about tring Miscrosoft's SOAP? it's a great solution, I know that it works great for client server applications, it let's you transport as much data as you want
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
how i can open a form in pc from another pc ?
if any one know that repaly me
|
|
|
|
|
You'll need a client app running on the second PC that you want to display the form on. You can't just send a form to another machine and expect it to work. You'll need another app to do it for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I want to send multicast packets on a Windows 2000 Machine with 2 Network interfaces. I want to send the multicast Packets over the Interface that is not the Interface to the default gateway. But the Packets are sent to the default gateway interface. Where is the problem?
using System;
using System.Net.Sockets;
using System.Net;
using System.Text;
namespace Mssc.TransportProtocols.Utilities
{
class TestMulticastOption
{
static IPAddress mcastAddress;
static int mcastPort;
static Socket mcastSocket;
static void JoinMulticastGroup()
{
try
{
mcastSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram,
ProtocolType.Udp);
Console.Write("\nEnter local IPAddress for sending multicast packets: ");
IPAddress localIPAddr = IPAddress.Parse(Console.ReadLine());
IPEndPoint IPlocal = new IPEndPoint(localIPAddr, 0);
mcastSocket.Bind(IPlocal);
MulticastOption mcastOption;
mcastOption = new MulticastOption(mcastAddress, localIPAddr);
mcastSocket.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.AddMembership,
mcastOption);
}
catch (Exception e)
{
Console.WriteLine("\n" + e.ToString());
}
}
static void BroadcastMessage(string message)
{
IPEndPoint endPoint;
try
{
endPoint = new IPEndPoint(mcastAddress,mcastPort);
mcastSocket.SendTo(ASCIIEncoding.ASCII.GetBytes(message), endPoint);
Console.WriteLine("Multicast data sent..... " + mcastAddress.ToString());
}
catch (Exception e)
{
Console.WriteLine("\n" + e.ToString());
}
mcastSocket.Close();
}
static void Main(string[] args)
{
mcastAddress = IPAddress.Parse("224.100.0.1");
mcastPort = 11000;
JoinMulticastGroup();
BroadcastMessage("Hello multicast listener.");
}
}
}
Thanks
Roland
Wenn Du diesen Satz irgendwo liest, ignoriere ihn.
|
|
|
|
|
I found the solution myself:
With
<br />
mySocket.SetSocketOption( <br />
SocketOptionLevel.IP, <br />
SocketOptionName.MulticastInterface, <br />
interfaceAddress.GetAddressBytes() <br />
); <br />
the interface for the Multicast distribution is defined.
Greets
Roland
Wenn Du diesen Satz irgendwo liest, ignoriere ihn.
|
|
|
|
|
Hi all,
A beginners question:
I define
SqlCommand myCommand;
in a function
I then do
try<br />
{<br />
myCommand = new SqlCommand(mySelectQuery,mySQLConnection);<br />
}<br />
catch(System.Exception e)<br />
{}
I get an errormessage
Use of unasigned local variable myCommand
I see why I get the message but have no real clue on how I can use the try - catch without casting the errormessage.
regards
Stijn
|
|
|
|
|
try assigning the command a null value :
SqlCommand myCommand = null;
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Hi all,
A beginners question:
I define
SqlCommand myCommand;
in a function
I then do
try<br />
{<br />
myCommand = new SqlCommand(mySelectQuery,mySQLConnection);<br />
}<br />
catch(System.Exception e)<br />
{}
I get an errormessage
Use of unasigned local variable myCommand
I see why I get the message but have no real clue on how I can use the try - catch without casting the errormessage.
regards
Stijn
|
|
|
|
|
Some comments:
1. All too often you don't want to try/catch - a program should have way more try/finally than try/catch. If you're accessing myCommand after the catch ((System.Exception e) {}, myCommand may have not been initialized due to an exception, as you're "swallowing" exceptions on the catch. Notice that if you add a "throw;" statement to your catch, the error message goes away. Be aware that "swallowing" exceptions is a bad practice and leads to code that's hard to debug and problems hard to detect, as the problem will never happen near the real error.
2. If this doesn't solve, you can substitute SqlCommand myCommand; for SqlCommand myCommand = null;
Again, use this wisely, as you can hide exceptions and introduce subtle bugs...
Yes, even I am blogging now!
|
|
|
|
|
Hi!
I've written a windows service. This service can be in different states, for example running, paused, updating etc. To give the user a direct feedback of the services state, I want to display an icon on the windows system tray, which appears in different kind for each state......
The problem is, that the icon (System.Windows.Forms.NotifyIcon) is not displayed... but also no exception is thrown...
<br />
protected override void OnStart(string[] args)<br />
{<br />
NotifyIcon NI=new NotifyIcon();<br />
NI.Icon=new Icon(@" ... ");
NI.Text="My Service";<br />
NI.Visible=true;<br />
}<br />
Can somebody tell me, why my NotifyIcon is not displayed?
occcy
|
|
|
|
|
mabye I am wrong but i think that you should put the NI variable at the calss level. In the code exemple supplied by you NI will be removed (by the garbage colector) at the end of the OnStart function scope.
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
A service should not interact with the desktop unless unavoidable, because it could introduce some serious security issues. A sounder design would be the service "talking" to another program that displays the icon.
Don't forget that services run even when there is no desktop, i.e., when no user is logged in.
If you really must do it, there's the "allow service to interact with the desktop" checkbox on the service manager, but I strongly advise you not to use it, unless it's only test code...
Yes, even I am blogging now!
|
|
|
|
|
Okay!
That sounds plausible
Thanks!
occcy
|
|
|
|
|
Hello
I have a question about Microsoft Word events. I know it is possible to catch events cast in Word if you do something like this and start Word through your program.
oWord = new Word.Application();<br />
oWord.Visible = true;<br />
But is it possible to have a program in the "background" and when the user starts Word manually it starts to listen to the events? This sounds impossible to me, but would be nice if it was not
Thanks
|
|
|
|
|
Christer Claesson wrote:
But is it possible to have a program in the "background" and when the user starts Word manually it starts to listen to the events? This sounds impossible to me, but would be nice if it was not
Instead of this, you could write a Word macro or an addin that would call your program only when necessary. This way, your program would not even need to be in "background" all the time, only when needed.
Yes, even I am blogging now!
|
|
|
|
|
Ah, true. I've been looking around and learning about addins now and they seem to be able to do what I want.
Thanks
|
|
|
|
|
Search for "Word addin"
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
helpme
ArrayList al = new ArrayList();
foreach (TreeNode tn in tree.Nodes)
saveNode(tn, al);
}
// Datei anlegen
Stream file = File.Open(filename, FileMode.Create);
Stream file = File.Open(filename, FileMode.);
// Binär-Formatierer init.
BinaryFormatter bf = new BinaryFormatter();
try
{
// Serialisieren des bf.Serialize(file, al);
}
i have succsesful in sava file and unable to reed file help me for purpase
tankyou
|
|
|
|
|
Can you post the code you use for reading the file?
Which specific problems do you have?
www.troschuetz.de
|
|
|
|
|