|
Damn, C++ is ugly! All those >> and << make me woozy!
|
|
|
|
|
Anyone know of a reasonably fast grid control for .NET - e.g. something like Stingray for MFC. It just seems that the one thing .NET does badly is good performance on grid controls, or anything thats graphics intensive. Some of them look great, but put more than 50 rows and they crawl when you scroll.
Looking for something that is responsive enought to handle realtime data - not huge amounts of it but to be responsive when it does get it.
From what I can tell the double buffred drawing built into the Windows Forms Control is not as optimised as it could be.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
http://www.janusys.com/janus/library/
|
|
|
|
|
www.Infragistics.com[^] has an excellent deal.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Developer Express[^] has a good one, too. I've used Infragistics and I can tell you from experience that it is good, but their painting mechanism (very extensible) can be very slow on older machines.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Syncfusion www.syncfusion.com[^] has a great grid called "Essential Grid". It is developed by Stefan Hoenig, the man who build before the Stingray grid. It offers a "virtual mode" that can handle millions of rows. I like it!
Regards,
Holger Persch
|
|
|
|
|
Hi,
I'm trying to create a C# web service that takes a string (a file path) and returns the xml document. I'm having some trouble with this task so any help would be much appreciated. If you know of any examples that do this, please share them. My web service function looks like this:
[WebMethod(Description = "Returns the xml file.")]
public XmlDocument GetXmlFile( string sXmlFilePath )
{
if( sXmlFilePath != "" || sXmlFilePath != null )
{
m_XmlDocument.Load( sXmlFilePath );
m_XmlDocument.Save( @"C:\Documents and Settings\dsterling\Desktop\Golfers311.xml" );
}
return m_XmlDocument;
}
m_XmlDocument is a global variable. Below is the code in my web service consumer app.
private void button1_Click(object sender, System.EventArgs e)
{
XmlNode xNode = TWS.GetXmlFile( @"C:\Documents and Settings\bob\Desktop\Golfers.xml" );
xDoc.Load( @"C:\Documents and Settings\bob\Desktop\Golfers.xml" );
xDoc.Save( @"C:\Documents and Settings\bob\Desktop\Doug.xml" );
System.Diagnostics.Process.Start( "notepad.exe", @"C:\Documents and Settings\bob\Desktop\Doug.xml" );
}
Thanks for your help!
|
|
|
|
|
What's the error? And why is your XmlDocument "global"? You realize that more than one person could call this method concurrently, don't you? Your current method will invariably break because someone may get someone else's data since the variable reference could change mid-execution (since a CPU slices time between threads and processes).
Besides, your web application can't access a file on the client machine like that! That just isn't possible. In order to do that, you would have to either specify a path on the server or upload the document to the web server first. This doesn't have to be persistent, however. You could pass a stream that the web service would save to a file. Actually, though, a web server is probably not a good solution for your problem if all you're trying to do is upload a file. Simple HTTP can handle this easier than SOAP. You'd simply make a new HttpWebRequest , get the request stream, and pass the file. The handler on the server would get this stream and save it to a directory, passing back an HttpWebResponse that tells if it was successful or not. Be careful with this kind of solution, however, since the user your web application runs as (by default, this is ASPNET for ASP.NET and IUSR_YOURCOMPUTERNAME for IIS itself) will need write permissions. This means anyone could upload anything and could potentially upload - say - a .aspx file that deletes most of your hard drive! This is where you should try impersonation (even with the web service, which gets a little harder but isn't too bad) using the HttpWebRequest.Credentials property (and disabling anonymous access on the web server with something else enabled like Windows Integrated Authentication), or the WebClientProtocol.Credentials property, which your web service consumer class inherits.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to have a dynamic array that I can have as a lookup table so some elements will contain data and some will contain nothing.
Here's what I have now (This doesn't work yet)
<br />
ArrayList employeeLookup = new ArrayList();<br />
<br />
if (employeeLookup.Capacity < (employeeID + 1))<br />
{<br />
employeeLookup.Capacity = (employeeID + 1);<br />
}<br />
<br />
employeeLookup[employeeID] = i;<br />
This causes an index out of range error, because Capacity doesn't initialize anything. I can't just use the .Add method cause I need the data to be in a specific element of the array. Not to "troll" this message but is there a cleaner more C++ way of doing this? Hard to figure out without using pointers or allocating memory manually. Just looking for a clean way to accomplish this.
Thanks!
|
|
|
|
|
I'm wondering why you must have an array with unknown length fixed to an indeterminate length.
Wouldn't this be better served by using a Hashtable ? Then you don't need to worry about lengths. If employeeLookup is a Hashtable then employeeLookup[someemployeeid] is the value you are working with. No messing with lengths at all.
|
|
|
|
|
Instead of using an array by itself you probably need to deploy a more complex collection. For example:
public class EmployeeCollection:System.Collections.SortedList
{
}
This would provide you with a base collection that associates a key:value pair. Your key would be your employeeID and your value would be your employeeObject.
You would have to implement your Add, indexed access, and Remove to have them strongly-typed for your employee object and your employee ID along with validation that a valid ID is passed for adding to the hashtotal.
This particular collection would then allow you to access either by index or key.
myObject = employeeLookup[employeeKey];
myotherObject = employeeLookup[245];
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
I could go through find the highest employeeID and then create a fixed array, then I wouln't have to worry about any resizing whatsoever.
Basiclly I want to get to the point where eventually I am going to do assignments to another array by using NewArray[employeeLookup[employeeID]] = 5;
I haven't used the hastable object before but it seems like a lot of overhead for something simple, espically when I never plan to use any of the search functions or anything like that it offers (Could be wrong on this).
|
|
|
|
|
The SortedList is one way of deploying an array that also gives you a keyed access (which is what you are really asking for). HashTable is the only way you can create a keyed lookup within an array or collection. It is also the only way to avoid getting an index exception if you go to get a number that does not exist in the array. You really are not implementing any significant overhead when you do this. In fact I think you are adding more overhead by trying to set a capacity for an array.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
I am getting the following exception when I try to run the following MSDN Article[^].
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed.
I have not changed any of the code in the example, just loaded it in Visual Studio and did a build. Any ideas what is wrong?
|
|
|
|
|
Without knowing what object the exception is in reference too, you usually see this exception when an object is specifically made to not be marshalled for remoting. There are good security reasons why you don't want some objects to serialize let alone tell another computer the data structure.
Can you tell us any more? There is code access security that needs to be addressed for remoting but if you are running the client and the server on the same machine you should have all of the access you need to make it work.
|
|
|
|
|
<br />
internal static int ProcessRun(string[] args, Type userApplicationType) <br />
{<br />
SingletonCommunicator comm = (SingletonCommunicator)RemotingServices.Connect(typeof(SingletonCommunicator), SingletonCommunicatorUrl);<br />
<br />
if (comm.Control == null) <br />
{<br />
comm.Control = new SingletonCommunicatorControl();<br />
IntPtr h = comm.Control.Handle;<br />
<br />
UserApplicationContext context = (UserApplicationContext)Activator.CreateInstance(userApplicationType, true);<br />
comm.Control.App = context;<br />
<br />
comm.Control.App.FirstInstanceRun(args);<br />
}<br />
else <br />
{<br />
comm.Control.App.SecondInstanceRun(args);<br />
}<br />
return 0;<br />
}<br />
<br />
This is the method it kicks back to on the line: IntPtr h = comm.Control.Handle;
With this exception:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed.
Full source code can be found at MSDN link[^]
|
|
|
|
|
If you are running the 1.1. Framework and using VS 2003, then you need to add a command to your remoting initialization.
BinaryServerFormatterSinkProvider serverProv =
new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv =
new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = 1234;
HttpChannel chan = new HttpChannel(props, clientProv, provider);
ChannelServices.RegisterChannel( chan );
The 1.1 framework raised security of remoting. Default is set to the TypeFilterLevel.Low which does not allow marshalling ObjRef. Adding the TypeFilterLevel and setting it to Full will get around the issue.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
Where do I change the security for remoting?
|
|
|
|
|
AFAIK there's no global place to change this.
You have to configure your channel formatters to use full type filtering either programmatically or by using your app.config file.
The ugly thing is that .NET 1.0 doesn't understand the "typeFilterLevel" property, so you have to decide whether you app will run with .NET 1.0 or 1.1.
Take a look here for details.
Oh, and because you use the framework from the "Real World Applications Sample" articles on MSDN: In case you haven't done yet don't forget to override InitializeLifetimeService() in the SingletonCommunicator class or you won't be able to activate your running app after about 2 mins of inactivity...
|
|
|
|
|
I have not looked at the MSDN 'real world sample' so I cannot speak specifically to that one project. mav.northwind is correct, though, in that there is no single way you implement TypeFilter ing...it all depends on how you establish your channels.
The example might not address the fact that you can configure your channel either in the configuration file or in code. The code I posted in my reply gives you the development direction within your program.
Generally: If you have an application - and it always connects to only one machine - and you never have to dynamically change this -- then you can use a configuration section. The GotDotNet article that mav pointed to will give you a discussion on the config file pieces.
Specifically: In any remoting application that we have put together we do not have a single machine being connected to. Thus we allow the user to answer a few questions in a wizard and then we let them dynamically choose the server to connect to. Then, programmatically, we get the URL from the user choice, append the remoting object URI pieces, and then create and establish the channel to the specific server. We have control over the formatters as well as defining the needed parameters such as killing the proxy server search. It minimizes what is exposed to the client that they can go mucking about in, it lets us update servers by modifying a simple config statement, and it does no expose any remoting-specific information outside of what is needed at the IIS side.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
Hi,
I have a TabControl with 4 TabPages. Based on Access Permissions I want to grey out the selection of a particular TabPage.
I used following property to disbale:-
tabControlDeal.TabPages[3].Enabled = false
But this disables all the controls on TabPages[3], but doesn't greyout TabPage selection.
Is there any way out to greyout TabPage selection.
Thanks in advance
Ruchi
|
|
|
|
|
You could owner-draw the tabs and set the text color to SystemColors.GrayText based on the TabPage.Enabled property. Then, just make sure to reset the focus in case someone clicks on the tab. It's simplistic, but there's not a whole lot you can do with the TabControl provided in the .NET FCL (mostly because there's not a lot you can do with the tab common control it encapsulates).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to convert html file to Doc or rtf file. How it will be possible using c# through coding. Actually i have xml file and xsl file too. So if there is a way through which we can create a doc or rtf file if we provide xml and xsl file path or html file path than guide me to that.
Thanx in advance
Inam
|
|
|
|
|
There's many ways to do this. Since RTF, for example, is just simple text, you could write your XSLT to output the necessary lines (actually, XSLT can also output binary files, but this gets much more difficult). You can find the RTF specifications on Microsoft's site, as well as other places if you try googling.
To create Word docs, you could do a number of things. You could use the Office PIAs (primary interop assemblies, which is recommended as opposed to making your own interop assemblies) to load the HTML document into word and then save it back out as a Word Document or an RTF document, all without showing the Word UI (it's still started, but not visible until you call Show on the application).
Also, Word 2000, XP, and 2003 all support XHTML - an XML document with the default namespace resembling HTML. You could always generate this instead of HTML (which doesn't necessarily conform to XML standards - nor does it have to in some cases). Word 2003 also has a well-defined schema for Word Documents that is also published on MSDN[^].
Finally, in referene to this and your previous question, there's products out there that can save reports (if you're doing any sort of reporting) to many common formats, such as HTML, PDF, and RTF. Crystal Reports for VS.NET comes with VS.NET and is installed by default. The runtime and your report definitions can be distributed freely so long as you have a valid license for VS.NET, have registered Crystal Reports for VS.NET, and are shipping as part of a Windows Forms application (ASP.NET application have additional restrictions and typically require additional runtime licenses). A cheaper alternative is ActiveReports from Data Dynamics[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i would like to implement a ihttphandler to handle all image request in a particular folder so i an add a "watermark" to the images, i have it working great for jpegs, pngs and bmps... problem is gifs, especially animated gifs... how can i watermark these on the fly?
i cannot seem to open the gifs into a Graphic object, thanks!
|
|
|
|