|
whats your email and ill send it asap
jesse M
The Code Project Is Your Friend...
|
|
|
|
|
I'd like to take a peek at it if I could..
furty74@yahoo.com
|
|
|
|
|
I wanted to find out the total bytes sent out by IIS virtual website. there are performance counter support in c#
like System.Diagnostics.PerformanceCounter
which works fine. But the problem is, if that site is restarted (directly of by iisreset or a machine reboot) the counters are reset to zero. Is there a way to cacth an event that the counter is reset to zero and read the value just before it was reset to zero?
Swarup Das
|
|
|
|
|
Couldn't you just remember the last value you got? Then when the counter comes back as zero, you can substitute the last value which you have stored already.
John :D
|
|
|
|
|
Yess, but its not a perfect solution. lemme explain why
say the counter was 200 when I sampled the value and stored it. Then the counter was increased to 250 and suddenly reset to zero. and then it grew to 100 before the next sampling happens. So I have lost 250-200 = 50 bytes.
Unless its event driven, I have to sample it at regular interval. And all the ups and downs withing my sampling window are not trapped. WMI is a resource consuming thing and not advisible to run it frequently.
Probably I can do away with the missing values withing the sampling window but is there a perfect solution? Instead of sampling If I am notified when the counter is reset to zero with the value it had just before it was reset, that will be the best possible solution. What do u think ?
Swarup Das
|
|
|
|
|
I'm not sure what exactly you're trying to do. You can use a performance counter at a relatively small interval (every 1 or 2 seconds), which will likely avoid your missing bytes problem. In fact, that's exactly what the performance monitor app which comes with Windows will do. Yes, these are related to WMI, but I don't see any significant resources being used with a single performance counter.
I don't know of an event that will give you what you want, but if the neither the WMI docs nor the IIS docs describe such an item, it's probably not there.
John :D
|
|
|
|
|
May I ask if anyone got the experience on creating skinable or non-regular form with C#?
|
|
|
|
|
I have ...
im creating a form skinner right now.
it works quite good , im overriding the wm_ncpaint (and other related messages) to draw the form border and caption.
currently im using gdi+ but will upgrade it to old gdi32 since gdi+ is horribly slow..
the stuff i have left to do is:
make it work 100% with mdi forms...
make it use layered windows for transparency instead of regions.
make it draw the attatched menu (the menu is otherwise drawn at the default location ,which might be inside the caption if using a larger caption than normal)
//Roger
|
|
|
|
|
Paste the code!
Thanks,
Orlanda
|
|
|
|
|
is it possible to get the name of each Component created in my form and intialized from a System.ComponentModel.Container. I created a console app for my program that runs through command line args...i want to dump the names of each component on the form (the code name for the component) to this console. possible via a foreach statement. Please write me back in reguards. i can always go through and just write the names manually but it would be easyer if i could do it with a foreach statement... thanks alot
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
It sounds like all you need is to do something like this:
foreach(object o in container)
{
string itemTypeName = o.GetType().ToString();
}
John :D
|
|
|
|
|
i just recently got a loan finally for school and im starting some MCSD classes here in washington for a hopefull good start in C# and programming. after im done with this schooling they set you up with a job and such. but my question is what do i do after i get my MCSD ? where else do i go for schooling.. how can i be competive in the Software Development field.. i know alot of people in this class are all from C++ backgrounds...not me though i never wrote more then a Hello world app in C++ but in C# i have reflection and just about everything i can think of i can do (if i cant... leppie is here too help me ).....can i still be competive in this field even without knowing much about C++ ? thanks for your time
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
jtmtv18 wrote:
my question is what do i do after i get my MCSD ?
Learn to program ? MCSD classes are likely to be somewhat of a waste of money IMO. You should buy some books, lock yourself in your room, and learn.
jtmtv18 wrote:
how can i be competive in the Software Development field..
I started teaching myself C++ at home and had a job in six months, three years ago. So I'm all for teaching yourself and working hard.
jtmtv18 wrote:
can i still be competive in this field even without knowing much about C++ ?
It seems obvious to say this, but unless the job is C++, why would you need to know C++ ? For all that, I'm teaching myself J2EE at the moment, you can't know too many languages/frameworks. I do all ASP.NET at work.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
yeah i started teaching myself C# about 6 months ago when i got in my motorcycle accident..(ouch) i love it. but im only 19 so i figured....having a MCSD would help me out more..and let me be taken more seriously... i mean hell i was a cook before my accident...i new macromedia and javascript lol.... but my passion is programing. and when i look at C++ it seems to look easyer to me now after C#. As far as books...my first book was Sams Teach yorself C# in 21 days... it was a awesome book and i totally recommend it to anyone. it was 1300 pages of C# goodness from forms to reflection too xml...but it was nice cause it went at a slow pace....(good for the begining programmer) anyways why do you feel mcsd is a waste of time? what other routes can a 19 year old do to be taken seriously in this lion eat lion field
The Code Project Is Your Friend...
|
|
|
|
|
jtmtv18 wrote:
i mean hell i was a cook before my accident
I didn't have an accident, but I was a sales rep. )
jtmtv18 wrote:
when i look at C++ it seems to look easyer to me now after C#.
It should, C++ is very similar to C#, except it has a lot of advanced facilities you can learn once you get past the basics.
jtmtv18 wrote:
my first book was Sams Teach yorself C# in 21 days.
Mine was C++ in 24 hours :P
jtmtv18 wrote:
anyways why do you feel mcsd is a waste of time?
Courses typically cost a lot, and teach you enough to have brief retention of all you need to pass the exam. I expect employers to know this. It can't *hurt*, but I don't believe there will be much bang for your buck.
jtmtv18 wrote:
what other routes can a 19 year old do to be taken seriously in this lion eat lion field
Get published in a magazine. Write an amazing ASP.NET webpage, get it hosted, and put it on your resume. Involve yourself in an open source project as an aid to learning. Write some CP articles.
I agree though - the 1st job is the hardest to get, no matter what.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
need some open source C# help for free Christian?
Jesse M
i always wanted to see what it was like to work with another C# coder..just to see diffrent styles and to learn from what then know also
The Code Project Is Your Friend...
|
|
|
|
|
jtmtv18 wrote:
need some open source C# help for free Christian?
LOL - no. Although I have used an open source C# lib recently that was missing features I needed, that wasn't what I had in mind.
jtmtv18 wrote:
i always wanted to see what it was like to work with another C# coder..just to see diffrent styles and to learn from what then know also
Best thing that happend to me C# wise was the screensaver contest here on CP. I did one together with James T Johnson and he taught me a great deal.
An open source project is still a *project* and will give you skills in working with others, as well as the chance to learn from them.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
i just looked at your screen saver project with james...christian you are a scarry lookin dude .j.k well next time you work on a article...let me know maybe i can watch and learn from you or something. im sure i could help but i dont think there is anything i know that you dont already....anyways thanks for all the awnsers.....to anyone else i would like to work on a project...however small a part.
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Hi all
I have a Thread that adds delegates periodically to a ThreadPool. Now when I debug this in VS.NET every behaves no matter how much delegates gets queued. BUT as soon as I detach from the process, the threads starts going beserk. According to TaskMan the threads are at 35 (max i think). Breaking back into the code I see the thread is still adding delegates but when they fire, i can NOT step thru the code(ok maybe 2/3 statements). It keeps jumping back to the breakpoint.
OK As I was writing this I manage to "fix" it. It seems stable now. It appears to be from using Console.Writeline from a thread. Weird indeed.
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
its becaused console.writeline blocks threads - i.e. only one thread at a time can execute it.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
|
I have a method that takes byte[] parameter.
But the data, that I want to pass into the method is
contained inside long[] array.
How to convert these types?
I c++ i would simply cast the pointer to (unsigned char*)
e.g
//============= c++
int elCount=10;
long* longTable = new long[elCount];
SomeObject.SomeFunction((unsigned char*)longTable,sizeof(long)*elCount);
In c# it looks like
//============== C#
int elCount=10;
long[] longTable = new long[elCount]
//what to do here to convert long[] to byte[]
SomeObject.SomeFunction(.....)//taking byte[] argument
Is it possible to do it without serialization or any other
"heavy" method
|
|
|
|
|
|
When doing in this way:
byteTable[] data = System.Convert.ToByte(arrayLong);
I get message from compliler:
Cannot implicitly convert type byte to byte[]
When using explicit cast:
byteTable[] data = (byte[])System.Convert.ToByte(arrayLong);
I get message from compliler:
Cannot convert type byte to byte[]
help
Michal
|
|
|
|
|
You can copy the long[] to a byte[] and back using the static methods of the Buffer class, but you will end up with two copies of the data in memory.
As an alternative, you could use a pseudo-union to get two views of the same data. You need to be very careful when you access the arrays, since the length of one array will be overwritten with the length of the other:
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
public struct IntArray
{
public const int ElementSize = 4;
[FieldOffset(0)]
private int _size;
[FieldOffset(4), MarshalAs(UnmanagedType.ByValArray)]
public readonly int[] intArray;
[FieldOffset(4), MarshalAs(UnmanagedType.ByValArray)]
public readonly byte[] byteArray;
public IntArray(int size)
{
_size = size;
intArray = new int[size];
byteArray = new byte[size * ElementSize];
}
public int IntSize
{
get { return _size; }
}
public int ByteSize
{
get { return ElementSize * _size; }
}
public byte[] GetSafeBytes()
{
byte[] ret = new byte[ElementSize * _size];
Buffer.BlockCopy(byteArray, 0, ret, 0, ElementSize * _size);
return ret;
}
public int[] GetSafeInts()
{
int[] ret = new int[_size];
Buffer.BlockCopy(byteArray, 0, ret, 0, ElementSize * _size);
return ret;
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|