|
I have created a C# application with a main window which does not have a frame and - consequently - no system menu (no menu at all). I managed to have a taskbar button displayed which shows the application's main window title.
The bad part is that this taskbar button does not show any menu. To my knowlegde, that is because the main window does not have a system menu. But -- is there a way to create a popup menu in the taskbar button?
Thanks in advance.
Paul
|
|
|
|
|
|
iam having an aspx page with a text box and a button(link)for search.if i click that button a pop up window (which is supposed to be another aspx page which is made like a pop up window)will open which consists of a textbox and find button.when i type any text in that textbox and click that find button ,i want that value to be displayed in the previous page textbox.
can anyone help me in this regard.
pintoo
|
|
|
|
|
Hi,
How is it possible to populate a .csv file with the data inside a DataGridView?
Thanks
|
|
|
|
|
Open .csv for writing
loop for each row
loop for each column-1
write column value+"," to .csv file
write last column value +"\r\n"
close file
enjoy
Have a nice time!
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
Will this be as same as excel where each datagrid column goes into one cssv column?
Thanks
|
|
|
|
|
Exactly!
Example:
.csv file
x,y,z
d,f,g
t,y,u
in Excel it will open as:
<code>
A B C <-- Columns in Excel
Rows in excel--> 1 x y z
2 d f g
3 t y u
</code>
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
Hi guys!
I'm a bit at a loss regarding the scalability of a client-server-application, perhaps someone can give me some tips...
In this application, I have a .NET Remoting server running as a windows service. This server is using an SQLServer database and a file storage to perform the services it offers.
All clients communicate with this single service via remoting (usually with TCP binary formatters for performance reasons).
The problem is that I have no idea how many clients can be handled by the service (how could I test what's happening when 100 clients call methods on the server in parallel? How about 1000 or more?) and, what's worse, what to do once the maximum capacity has been reached.
Each client has to know exactly one URI with server machine and port to contact for remoting to work, so how can I distribute the requests to different servers?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
mav.northwind wrote: Each client has to know exactly one URI with server machine and port to contact for remoting to work, so how can I distribute the requests to different servers?
Could this point of contact act simply as a gateway and hand off the actual work requests to other servers?
|
|
|
|
|
Thanks for your suggestion!
That's one of the changes I had in mind, but I'm not sure how to actually do this or which architectural implications this yields.
How would you "hand off" a request to a different server when the initial request is a method call to a server object? And, the initial server would stay the bottleneck unless there's a way to hand off the request in a way so that the result doesn't have to pass through the initial server, wouldn't it?
Another way I thought of was a kind of broker that's assigning a server to a client, but that would require some changes at the client side and I'd rather have a scalable server architecture the clients don't have to know about.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
mav.northwind wrote: How would you "hand off" a request to a different server when the initial request is a method call to a server object?
Hmmm. Here's how I think it would work: when the client calls a method on the server object it's only aware of the data (if any) required by the method and the result (if any) returned by the method, but it doesn't know how the method is implemented.
In this case, then as long as the contract between the client and the server is honoured, then you can change the implementation as much as you want. For example given a server method like List<user> GetAllUsers() you could have this method contact a database directly and return a result, or it could asynchronously call a method on another server (the hand off) and when it gets the result back return that to the client.
mav.northwind wrote: And, the initial server would stay the bottleneck unless there's a way to hand off the request in a way so that the result doesn't have to pass through the initial server, wouldn't it?
In a way yes I guess it is, but in another way no I guess it isn't. I've been doing a fair bit of research/implementation on web services lately (not that this makes me an expert), and by far the biggest win for me is having this well defined single point of contact for clients to connect to*, which means I can make changes at the server and never need touch the clients. If at some point in the future I introduce a webmethod that taxes the current hardware, I can do what I described above and have the actual meat of that method execute on another machine. The clients won't be aware that this is what's happening, so I can make this switch pretty much seamlessly.
There is another consideration in that I needed to guarantee that the web service box could handle all the requests and traffic. I set up a little test with a webmethod that simply returned about 10Kb of text to the client. Overall I found that the server could easily deal with huge numbers of this type of request per minute - it didn't even break a sweat! But should the need ever arise I can add more bandwidth, more ram, a faster cpu, more cpu's etc etc. Along with the failover backup and the ability to hand intensive tasks off to another server without the client being aware of this I *think* what I've got is a fairly scalable, robust and predominantly "up" architecture (although time will tell).
From an architectural (software, hardware and infrastructure) point-of-view this sounds like a really interesting project you've got ahead of you. Like I say I'm not an expert - so take everything I say with a good pinch of salt and a shot of caution! - and my web services project was extremely well funded (and a good job too, as it was extremely expensive), but if I had any sage words of advice to offer at all it would be these: Budget, test and test again!
*this of course introduces some fragility if the server goes down - so what I did was to replicate completely the web service on another box as a failover. If the first server goes down, or for whatever reason the clients can't connect to it, the clients are configured to connect to the second server after a pre-determined amount of retries/time outs.
|
|
|
|
|
I'm developing a WinForm program in english.
Now I have clients that need the program to be translated into several languages. I have A LOT of MessageBoxes and so on that needs to be translated and now I wonder which techniques there is to solve my problem.
_____________________________
...and justice for all
APe
|
|
|
|
|
How about maintaing a separate xml file for language version like this
<root><br />
<row><br />
<name><br />
<en>test name en</en> <br />
<fr>test name fr</fr><br />
</name><br />
</row><br />
</root>
and maintain the desired language for the win app in app.config file. When the app starts it will load the XML document with the desired language version as selected in the app config.
label1.Text = xDoc.DocumentElement.SelectSingleNode("/root/row/name/" + System.Configuration.ConfigurationSettings.AppSettings["lang"]).InnerText;
hope this helps!!
Sathy
|
|
|
|
|
|
Ya that article sounds intersting!!!
How should be your app working ? Like the user can change the language at any point of time is it ??
Sathy
|
|
|
|
|
I have two options.
1. Read the users current culture options at program startup.
2. Let the user choose culture and reboot the program.
_____________________________
...and justice for all
APe
|
|
|
|
|
the easiest way is using resource files and then option 1 will be handled automagically if you set it up right.
I worked on a project nearly 10 years ago which used VB6 and we created a table in the application database that stored the language the labelname, the formname and the translation.
In the form load event we called a TranslateLabels function and passed me (this) as a parameter. As we were doing this to every form i think we kept the recordset of data for the current country in memory. If the user switched languages while the app was running we reloaded the data for the new language, looped through the collection of open forms and passed them back into the TranslateLabels function. Messageboxes etc were translated by a translatestring function that was also on the object.
Russ
|
|
|
|
|
So I have to create one resource file for each language?
I have a lot of assamblies. Do I have to create multiple .resx files in each assembly?
_____________________________
...and justice for all
APe
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/1021kkz0(VS.80).aspx[^]
That's got a lot of info from MS on how to go about things.
AFAIK you would have to have multiple resx files per assembly but if the output of an assembly is never going to be displayed to the user then the default would be all that was required.
Russ
|
|
|
|
|
I am sure I am missing something basic about how remoting works.
For starters I just wanted to see if I can share some data, but for some reason, the client only sees its own changes, and the server accordingly. With this code, the server always gets the output "Server", and the Client first "Start" and then "Client"
The connection is there, if I close the server, the client produces a socket error, and the Write method is printed on the server window.
//------------------------------------
//Remote Object:
//------------------------------------
using System;
namespace RemoteTestObj
{
public class cRemotableObject : MarshalByRefObject
{
public string test = "Start";
public void Write(string pText)
{
Console.WriteLine(pText);
}
}
}
//------------------------------------
//Server:
//------------------------------------
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using RemoteTestObj;
namespace RemoteTestServer
{
class Program
{
static void Main(string[] args)
{
cRemotableObject remoteObject = new cRemotableObject();
TcpChannel channel = new TcpChannel(8080);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(cRemotableObject), "Test1", WellKnownObjectMode.Singleton);
remoteObject.test = "Server";
Console.WriteLine(remoteObject.test);
Console.ReadLine();
Console.WriteLine(remoteObject.test);
Console.ReadLine();
}
}
}
//------------------------------------
//Client
//------------------------------------
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using RemoteTestObj;
namespace RemoteTestClient
{
class Program
{
static void Main(string[] args)
{
TcpChannel Channel = new TcpChannel();
ChannelServices.RegisterChannel(Channel, false);
cRemotableObject remoteObject = (cRemotableObject)Activator.GetObject(typeof(cRemotableObject), "tcp://localhost:8080/Test1");
Console.WriteLine(remoteObject.test);
remoteObject.Write("test");
Console.ReadLine();
remoteObject.test = "Client";
Console.WriteLine(remoteObject.test);
Console.ReadLine();
}
}
}
Does anyone know how to change it, so that both client and server always have the same data in the string test ?
Thanks, Eike
|
|
|
|
|
What book or tutorial are you using for learning remoting? What previous experience do you have with other forms if interprocess communications?
You don't make the singleton object in your server, the remoting framework controls that. Therefore in your server code you are creating a different instance than the one the client code is communicating with since it uses the framework to access the remote object. Your server code bypasses the framework and creates it's own instance that the framework knows nothing about.
namespace RemoteTestServer
{
class Program
{
static void Main(string[] args)
{
cRemotableObject remoteObject = new cRemotableObject();
led mike
|
|
|
|
|
Thanks, so then I need a reference to the instance that the client connects to, but how do I get that ?
|
|
|
|
|
Eike Mueller wrote: but how do I get that ?
The same way the client does of course.
"All other things being equal, the simplest solution is the best." - Occam's razor[^]
led mike
|
|
|
|
|
Ahh, ok thanks, that works, I changed this in the server
static void Main(string[] args)
{
TcpChannel channel = new TcpChannel(8080);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(cRemotableObject), "Test1", WellKnownObjectMode.Singleton);
cRemotableObject remoteObject = (cRemotableObject)Activator.GetObject(typeof(cRemotableObject), "tcp://localhost:8080/Test1");
And in the remote object I increased the lease time, so it doesn't lose the values every few minutes.
//100min lease time
public override Object InitializeLifetimeService()
{
System.Runtime.Remoting.Lifetime.ILease lease = (System.Runtime.Remoting.Lifetime.ILease)base.InitializeLifetimeService();
if (lease.CurrentState == System.Runtime.Remoting.Lifetime.LeaseState.Initial)
{
lease.InitialLeaseTime = TimeSpan.FromMinutes(100);
lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
lease.RenewOnCallTime = TimeSpan.FromSeconds(100);
}
return lease;
}
btw. would there be any problem with using unlimited lease time ?
//unlimited lease time
//public override Object InitializeLifetimeService()
//{
// return null;
//}
|
|
|
|
|
Eike Mueller wrote: btw. would there be any problem with using unlimited lease time ?
I don't know but if there is I would expect the documentation to address that.
led mike
|
|
|
|