|
Hello,
I wish to monitor bytes per second written or read from a directory.
Is something like this revealed by .NET framework, similar to that of FileSystemWatcher?
I am attempting to monitor I/O to the DfsrPrivate folder to better understand the I/O of the dfsr.exe process.
Thanks very much,
Matt
|
|
|
|
|
You can't monitor I/O speed based on a folder. The best you're going to get is to/from the entire disk or the I/O statistics for a process.
You'd use the PerformanceCounter[^] counter class and the appropriate performance counters to get the data you want.
|
|
|
|
|
My work around is to use process monitor by the sysinternals dudes. Then parse the data.
With the proper filters in place, the log ("backing file") grows about 4MB/minute; which is manageable.
Process Monitor has a feature called File Summary (http://www.pcmag.com/slideshow_viewer/0,3253,l%253D248743%2526a%253D248736%2526po%253D13,00.asp?p=n[^]) which will summarize exactly what I want.
Now, I guess the question is, how does Process Monitor gather this information? It's likely via the processes; monitoring the process's handles and where they are reading and writing.
For me, this method, using Process Monitor, will do. However, it would still be interesting to investigate further ways to actually ways to grab the handles and identify their I/O.
Thanks,
Matt
|
|
|
|
|
Process Monitor does it by sitting over the file system I/O functions. The technique is called API Hooking. PM hooks a lot of functions covering I/O, Registry, Process, ... It maintains a huge database that is populated with the API call data. It can give you all the details on a per-process basis quite easily.
|
|
|
|
|
http://www.codeproject.com/KB/cs/tictactoewin32.aspx
why this code can't run in c# visual studio 2008 ??
please answer , i need your helped thanks
|
|
|
|
|
It's customary, with articles, to just ask on the article forum itself. After all, the author is usually best placed to judge what's wrong. I appreciate though that this is an extremely old article, so there's a good chance you won't get an answer from the author.
In this case, the answer is extremely simple. This article is written for a version of .NET that isn't supported in VS2008. Back in 2002, .NET was at version 1, and the minimum version that VS2008 supports is 2. Saying that, you could create a new project in 2008 and then copy parts of the code in from this version, bearing in mind that .NET2 introduced lots of improvements to the language such as generics.
|
|
|
|
|
Is there a way in .Net to convert a given SQL data type to a .Net data type?
Everything makes sense in someone's mind
|
|
|
|
|
It depends. Perhaps you could be a little more specific
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes.
It's called casting[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Yes, there is a way. But unless you are more specific, it is difficult to get better answers.
|
|
|
|
|
|
|
The data adapter should already do this for standard types.
|
|
|
|
|
|
Hi all,
First some context to my question:
I am working on a utility that queries the Windows registry for a large number of keys set by a particular application.
I am using multiple DataGridView (DGV) controls to display the information (Reg Key and Value) on my form. Each DGV is tied to a Dictionary using a BindingSource.
This has worked out fine for all sets of keys except for one.
- This application has provision for 10 different user-profiles.
- Associated with each user-profile are 7 SETS of feature keys.
- At any given time, the user needs to see the settings for only ONE of the 10 profiles.
- On my form, I have a collection of radiobuttons that I use to select a profile.
PROBLEM:
1. Should I use an array of dictionaries (dimension 1: profile; dimension 2: feature)? If so, how do I do this? If not, what is a better solution?
2. Can I have only 1 set of DGVs (representing the feature keys), so when I click between profiles, the DGVs are updated with the values for that profile?
Thanks for your help!
|
|
|
|
|
0) The registry is evil, don't use it.
1) DataGridView is evil and likely an inappropriate control for your purpose.
2) The registry is a tree, why not use a TreeView?
|
|
|
|
|
PIEBALDconsult wrote: The registry is evil, don't use it.
Unfortunately, I have to
class="FQA">PIEBALDconsult wrote: 1) DataGridView is evil and likely an inappropriate control for your purpose.
Not sure why the DGV is so evil but it does work quite nicely for the purpose of my project.
PIEBALDconsult wrote: 2) The registry is a tree, why not use a TreeView?
I will look into using a TreeView... I did not know about this when I started working on my utility and I have the information displayed the way it is required. However, it might not be too late to rethink this design... thanks for the tip!
|
|
|
|
|
The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities.
A list of dictionaries is probably appropriate.
You can only have one set of controls, and switch their data sources when the profile changes.
|
|
|
|
|
BobJanova wrote: The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities.
Yes, they are.
BobJanova wrote:
A list of dictionaries is probably appropriate.
You can only have one set of controls, and switch their data sources when the profile changes.
Thank you! I will look into the list of dictionaries.
|
|
|
|
|
Hi Bob,
I have a follow-up question. Is there a way for me to avoid declaring 10 * 7 = 70 dictionaries? 10 is the number of use-cases and 7 is the number of dictionaries I would require for each use case.
I have a group of radio controls (gb_profiles) on the GUI and have been able to edit its CheckedChanged function to derive the index of the control that has been checked.
private void rb_prof_CheckedChanged(object sender, EventArgs e)
{
foreach (Control ctl in gb_profiles.Controls)
{
if (sender.Equals(ctl))
{
profile_selected = gb_profiles.Controls.IndexOf(ctl);
}
}
}
How do I use this to load the dictionary with only the values for this profile?
Thanks for your help!
|
|
|
|
|
Would you ever have more than one use case open at once? If so, I don't see how you can avoid declaring dictionaries for each use case, and within each one you would have a dictionary for each option. (You could do some lazy loading and caching but honestly for a reasonable sized registry key it is nit worth it.)
|
|
|
|
|
I will not be displaying more than one use case at once. However, the user will have the option to save the results of the registry key to a file (I think I am going to go with XML for that).
Given this, it appears that I might have to declare dictionaries for all these use cases...
|
|
|
|
|
I am using a dll called "EPPlus.dll" in my code and I want to wrap it into the executable.
http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx[^]
Using the post above, it appears to be possible but my code below is failing. I'm not 100% on how the string resourceName is supposed to play into this, can anyone offer advice on how to get this code to work with EPPlus.dll? Thanks for reading.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Reflection;
namespace QCVerification
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainVerification());
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
String resourceName = "AssemblyLoadingAndReflection." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
Byte[] assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
};
}
}
}
|
|
|
|
|
|
Hi,
I'm unsure of why it did not work for me (I do have the case correct) and knew I had to be doing something wrong ...
First I tried
String resourceName = "EPPlus.dll";
Then I tried
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EPPlus.dll"))
and finally I tried
AppDomain.CurrentDomain.AssemblyResolve += (sender, "EPPlus.dll") =>
Should it be? (I'm not at work to try this)
String resourceName = "AssemblyLoadingAndReflection." + new AssemblyName("EPPlus").Name + ".dll";
|
|
|
|