|
- The readability, and hence, maintenance would suffer. Lambda's and delegate's are fast.
- It's an extra assignment. Assignments don't take much time though.
- We don't use exceptions to influence the flow of the program. Ever.
- Your switch reminds me of the
Strategy pattern.
BillWoodruff wrote: thanks ! ... and Merry Xmas ... Bill
Enjoy your holidays
Bastard Programmer from Hell
|
|
|
|
|
1. I don't know, I have to do some benchmarks to find out myself.
2. It normally should not make the switch statement less performant, but again, it depends.
3. It's a very bad programming practise to control flow using exceptions.
4. A better solution would be to use Strategy pattern, it would make the code more readable and easy to follow by all programmers, not just the .NET ones.
|
|
|
|
|
I Using C# and DirectX.Capture I Can capture Webcame, but I can't figure out how to mix it with rotating text, should I create a filter?
|
|
|
|
|
Hello,
I am not sure if this is allowed or not – if this post is against any Rules i apologize in advance and this post can be removed.
I am in the process of creating a open-source project to track the Psychological Mood of a person, this application will be used by people visiting psychologists.
Target Audience
People that are currently in therapy or want to keep track of mood changes. The program is based on CBT.
Aims
To provide to the end-user the tools for him to be able to monitor his mood.
To provide to the therapist additional information for the client through the automatic generation of graphs.
To reduce the international suicide rate.
To make this application available for everyone to use.
We are looking for some volunteers to help with Coding of the Project.
The Project has been seperated into three parts for easier management.
The Desktop Application is coded in VB.NET and using an ORM called nHibernate.
Project URL: http://moodtracker.codeplex.com
The Web-Based Application will be coded in C# and use MSSQL as the Database.
Project URL: http://webmoodtracker.codeplex.com/
The iPhone Application.
Project URL: http://iphonemoodtracker.codeplex.com/
We're aiming to develop a feature-rich Psychological Mood Tracker to help the end-users as much as we can.
If anyone is interested please feel to apply to the CodePlex Project Page.
Thank you in advance.
Constantinos
|
|
|
|
|
I don't believe this belongs here. You could post the Jobs board.
No comment
|
|
|
|
|
hello guys... If this is not the right forum, plz guide me to the right one. I have successfully made my first crystal report with VS 2010. But I want to add page header and design my column IDs little bit. I did so (at design time in Crystal Report using 'Format Object') and ran the project. But it does not show the page header at all and does not show the formatted column id. whats wrong? thnx
|
|
|
|
|
We don't seem to have a forum for Crystal Reports but a lot of CR questions get posted in the Quick Answers[^] section, so it may be worth trying there.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Why don't you use Microsoft ReportViewer? It's much better and easy for generating reports.
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hi,
This is my first post and i am quite new to c# but am really enjoying the learning process, i have been looking at the many examples on the code project site for a few weeks now and have not found anything that i think covers what i want to do.
I want to read in an hours worth of audio in a wav file and check that there is audio in it. the audio is recorded from a radio receiver into the computer and stored in hour chunks.
i just need to be sure it is storing audio (radio program) not static noise (lower level) or very low level (wrong audio source etc.)
Any input or advice on how to achieve this would be greatly appreciated
thanks
Simon
|
|
|
|
|
The simple approach is to define a threshold between useful audio and silence. Discard audio segments that fall below this threshold.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
This probably should be in the C# forum, since the question really goes down into what is silence in audio data and what type of audio encoding is within the WAV file. What it comes down to is you're going to have to interpret the PCM data in the WAV file.
|
|
|
|
|
|
|
How to add the video String(OSD), I use DirectX.Capture Class Library?
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private Capture capture = null;
private Filters filters = new Filters();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
capture = new Capture(filters.VideoInputDevices[0], filters.AudioInputDevices[2]);
try
{
if (capture.PreviewWindow == null)
{
capture.PreviewWindow = panelVideo;
}
else
{
capture.PreviewWindow = null;
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to enable/disable preview. Please submit a bug report.\n\n" + ex.Message + "\n\n" + ex.ToString());
}
}
private void button2_Click(object sender, EventArgs e)
{
capture.FrameEvent2 += new Capture.HeFrame(CaptureDone);
capture.GrapImg();
}
private void CaptureDone(System.Drawing.Bitmap e)
{
this.pictureBox.Image = e;
capture.FrameEvent2 -= new Capture.HeFrame(CaptureDone);
}
private void button3_Click(object sender, EventArgs e)
{
if (!capture.Cued)
capture.Filename = @"F:\demo.wmv";
capture.RecFileMode = DirectX.Capture.Capture.RecFileModeType.Wmv;
capture.Cue();
capture.Start();
}
private void button4_Click(object sender, EventArgs e)
{
capture.Stop();
}
}
}
modified 22-Dec-11 5:44am.
|
|
|
|
|
Hi All,
I have a website (web application) publish to an IIS server and it is work fine, but the problem is if i open or request the site from the internet more than 10 times the site go down and dosen't work from the internet or from the local network, its work just from the IIS (go to the IIS and Browse the site from it).
And i restart the IIS but this step doesn't solve the problem. The only thing that solve it is to restart the whole Machine (Computer Server).
please help me if you know any solution.
Best Regards.
Zeyad Abed Aljalil
Senior Developer
Isra' Software & Computer Co.
|
|
|
|
|
You already posted this on Quick Que/Ans.
Continue on that and, stick on one. don't spam the board with reposts.
check my comment on Quick Que/Ans Post.
IIS Web Site Problems[^]
Rajesh B --> A Simple Programmer <--
modified 22-Dec-11 5:00am.
|
|
|
|
|
Include the link(of the question) in your message.
|
|
|
|
|
Updated..
Rajesh B --> A Simple Programmer <--
|
|
|
|
|
How is this a C# question?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I'm having great difficulty serializing an object that uses a field that is of type Type .
The field can be any of the fundamental types, and when I try to serialize the object using the XmlSerializer,
it bombs with the following exception:
"The type 'System.Int64' may not be used in this context"
Is it possible to serialize the type Type ?
SOLUTION:
Instead of trying to send Type over the wires, I now just send the text name of the type, then use
Type.GetType(name); to reconstruct it at the other end.
The difficult we do right away...
...the impossible takes slightly longer.
modified 22-Dec-11 0:47am.
|
|
|
|
|
You should be using Object rather than Type. Type is used in Reflection to determine characteristics of an object; it isn't a generic placeholder.
No comment
|
|
|
|
|
You're right, I changed the design so that it uses the Type 'FullName' property instead of the type itself.
Then at the other end, I just say
Type.GetType(typeName);
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
As another responder indicated, Type.GetType(typeName) will not always work. I can name a few situations right off the top of my head:
1) if your code is in a DLL and the type is in the calling EXE or another assembly, you must use the fully qualified name for this method to work.
2) if your code is on machine A in A.DLL and called by A.EXE on machine A and it gets serialized over the wire to machine B where its decoded by A.DLL again, it won't work unless A.EXE is running in the process AND has the same exact FQN as machine A did. i.e. if machine A has version 1.0 of A.EXE and machine B has version 1.1, it won't work.
|
|
|
|
|
Thanks for the feedback. I agree totally with what you say.
However, the Type will only ever be one of the fundamental types: int, long, string, etc..
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Richard Andrew x64 wrote: The field can be any of the fundamental types
Can someone put in some other type? If so...
Richard Andrew x64 wrote: Type.GetType(name);
might not work.
A safer solution might be to define an enumeration that contains only those types you wish to support and pass an instance of that.
|
|
|
|