|
Hi My Friends,
I need free C# TreeList code that will run on the web.
ASAP please. Thanks.
|
|
|
|
|
inerp wrote: ASAP please. Thanks.
hahaha... *breath* good one.
Im sorry, but we dont write code for you. Can I suggest heading over to rentacoder.com or google. take your pick.
|
|
|
|
|
Just leave your e-mail and whole codeproject community will send the code immediately.
|
|
|
|
|
Try the ASP.NET forum then!
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Dear friend,
It is clear that You have just registered to codeproject few minutes ago
We here do not do the job on behalf of you
Pleas, be more specific..
Try to write the code, when you face a trick post it with your sample code
Please read the most above message on the board with the title: "How to get an answer to your question" by Mr. Chris (CP Admin)
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Clearly defining the problem is 90% of the process. Now, write the code.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello Everyone,
I have a secenerio :
In my project I call a webservice,it has several methods.
I have a globals class which is purely static and its method are also static.
Now scene is that I want to access the webservice method into my Global class's method, so it is not possible to create the webservice object and call it into the static function because static call only static class and method.
But I just do one R&D i defined the webservice object as static as follows
static WebServiceClassName obj=new WebServiceClassName();
and I supersied that now obj is call every method from the webservice into the static function.
so it is a good approach to define an object as static whenever the class is not static.
So my question is that
Can I create an object as static as the point of oops or this is good for the project.
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Deepak the Cool wrote: it is not possible to create the webservice object and call it into the static function because static call only static class and method
Not true. Static methods can call non-static methods if it has a reference to the non-static object.
Deepak the Cool wrote: Can I create an object as static as the point of oops or this is good for the project.
Not sure what you mean by that.
You can create a static reference to an object if you need it. However, be aware that the object will be around for the life of the application until you set the reference to null even if nothing else references it.
|
|
|
|
|
I need to implement centralized exception handler and logger (for code reuse) with the following features:
- Class must record the exception in event log, log file...
- Class must inform user about exception in user friendly way.
-Class must send report to development team about critical errors.
I need some design and implementation guidelines about this problem.
matix
|
|
|
|
|
Have a look at Enterprise Library[^]
log4net is also worth considering.
matixsc wrote: - Class must inform user about exception in user friendly way.
I don't think all classes should be informing the user, the main thing is to get exceptions logged and not to throw away information stored in the exception. Only classes that are responsible for UI should communicate with users.
|
|
|
|
|
Giorgi Dalakishvili wrote: log4net is also worth considering.
I'll include log4net as an option too.
This class should be configurable enough to let caller decide what will be logged, where to log, what information enduser will see...
So, I need design guidelines, best practices, source code is also welcomed in order to fulfil my task.
Regards, matixsc
|
|
|
|
|
Hi,
i have a requirement to use flash player in my desktop application.I have used flash player componant comes with visual studio for this purpose and made a msi set up.When i installed it on other systems it was working fine if the system is already installed with flsh player if not it is giving unhandled error.Could anybody help me how to make flash player installation depedancy same like .net FW depedency for MSI set up?I am using VS2005 for my application developement.
Any help would be greatly appreciated.
|
|
|
|
|
Hi,
I am inserting and updating the database using the DataGridView. But when I insert or update the table in the database I got this error:"Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
I am writing the code here.
private void btnInsert_Click(object sender, EventArgs e)
{
sqlDataAdapter.Update((DataTable)bindingSource.DataSource);
}
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.DataSource = bindingSource;
PopulateDataGridView();
}
private void PopulateDataGridView()
{
try
{
String sqlCommand = "select * from " + tableName;
sqlDataAdapter = new SqlDataAdapter(sqlCommand, connString);
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(sqlDataAdapter);
DataSet dsData = new DataSet();
dsData.Locale = CultureInfo.InvariantCulture;
sqlDataAdapter.Fill(dsData);
bindingSource.DataSource=dsData.Tables[0];
}
catch (SqlException sqlException)
{
MessageBox.Show(sqlException.Message.ToString());
}
}
Everything is working fine but when I click on the Insert Button it gives me error. Please Help.
modified on Wednesday, October 8, 2008 6:19 AM
|
|
|
|
|
Try setting UpdateCommand property of SqlDataAdapter class manually.
|
|
|
|
|
listen,
i can´t debug that, because the way i code is different.
Try this routine, may work out for you.
public static string connection_string = "..."
public static string SP_whatever = "...";
public static void DataGridView_Fill(DataGridView dgv, string store_procedure)
{
SqlConnection sql_conn = new SqlConnection(connection_string);
SqlCommand sql_cmd = new SqlCommand();
sql_cmd.Connection = sql_conn;
sql_cmd.CommandText = store_procedure;
sql_cmd.CommandType = CommandType.StoredProcedure;
sql_conn.Open();
SqlDataAdapter sql_da = new SqlDataAdapter();
sql_da.SelectCommand = sql_cmd;
DataTable dt = new DataTable();
sql_da.Fill(dt);
sql_conn.Close();
dgv.DataSource = dt;
}
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi everybody,
I'm developing a network-based application. It is running on two stations. One station is sending 4separate & simultaneous voice streams
to the other station which in turn plays those streams. The problem is that memory consumption is high(4 MB/s) at the second station.
I've used Memoryobject.Dispose() to free up some memory but it seemed useless. Is there any other way to free up memory? Or am I using the Dispose method inappropriately?
Here is my code to play the sound streams:
<br />
private void Receive()<br />
{<br />
try<br />
{<br />
<br />
BufferDescription playbackBufferDescription = new BufferDescription();<br />
playbackBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;<br />
playbackBufferDescription.Format = waveFormat;<br />
<br />
bbStop = false; <br />
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0);<br />
<br />
byte[] byteData;<br />
byte[] byteDecodedData;<br />
<br />
<br />
while (!bbStop) <br />
{<br />
byteData = udpClient.Receive(ref remoteEP);<br />
byteDecodedData = new byte[byteData.Length * 2];<br />
<br />
<br />
ALawDecoder.ALawDecode(byteData, out byteDecodedData);<br />
<br />
playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device);<br />
playbackBuffer.Write(0, byteDecodedData, LockFlag.None);<br />
playbackBuffer.Play(0, BufferPlayFlags.Default);<br />
<br />
first = false;<br />
playbackBuffer=null;<br />
}<br />
<big>playbackBuffer.Dispose();</big>
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, "Error on Receive", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
}<br />
<br />
}
Thanks in forward
|
|
|
|
|
private void Receive()
{
try
{
BufferDescription playbackBufferDescription = new BufferDescription();
playbackBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;
playbackBufferDescription.Format = waveFormat;
bbStop = false;
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0);
byte[] byteData;
byte[] byteDecodedData;
while (!bbStop)
{
byteData = udpClient.Receive(ref remoteEP);
byteDecodedData = new byte[byteData.Length * 2];
ALawDecoder.ALawDecode(byteData, out byteDecodedData);
** HERE ==> playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device);
playbackBuffer.Write(0, byteDecodedData, LockFlag.None);
playbackBuffer.Play(0, BufferPlayFlags.Default);
first = false;
playbackBuffer = null;
}
playbackBuffer.Dispose();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error on Receive", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
You are creating a new playback buffer every time you loop round the while loop (See annotation above). You are then only disposing it at the end (after you've set it to null, so I'm surprised you don't get a null ref exception. (Also, if an exception occurs, the playback buffer will never get disposed)
You should either be re-using the same playback buffer all the time to prevent having to create a new one each time, or you should be properly disposing of it each time.
You can use the "using" construct to ensure it gets disposed of. This will automatically call dispose on the playback buffer object when it passes the closing brace, and also ensures it will get disposed even if an exception occurs:
using (playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device))
{
playbackBuffer.Write(0, byteDecodedData, LockFlag.None);
playbackBuffer.Play(0, BufferPlayFlags.Default);
}
Without seeing the rest of your code it's hard to tell, but if there is a way to just re-use the same playback buffer without creating a new one each time round the loop, that would be a better solution.
[By the way, If you use the <pre> "code block" tags instead, for large blocks of code it will be easier to read]
Simon
|
|
|
|
|
Good spot
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Thanks Simon for your useful answer. I tested what you offered, but anytime I tried, I lost the voices.
1.By using:
using (playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device))
{
playbackBuffer.Write(0, byteDecodedData, LockFlag.None);
playbackBuffer.Play(0, BufferPlayFlags.Default);
}
There were no voice being played anymore.
2.By transferring:
playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device); to outside of the while statement, the playing voice was cut just like 1010101010101 where the "1" character indicates parts where voice output was present. &therefore the "0" character represents the absence of voice output.
3.By disposing the playbackBuffer each time inside the while statement, again there exists no voice.
Note: the only part for playing voice is the routine above, &the rest is not in connection with the playing problem. So I don't think the rest code will be more helpful to send... Any other suggestions? I appreciate that!
|
|
|
|
|
I've never used directsound (I'm assuming that is what you are using), so I'm not entirely sure about all of this.
With 1 - The problem is likely to be that you are disposing of the buffer before it has a chance to do any playback.
With 2 - The problem is likely to be that you are calling play() while the buffer is still busy playing the previous bit (I'm assuming the play method is asynchronous). Hence it cuts.
What you probably need to do is remove the call to Play(). You need to track how much is in the buffer. When there is more than 5 seconds of data in the buffer, call play, and set a flag to prevent it calling play again. When the buffer runs out, clear the flag, and allow play to be called again when the buffer fills back up to the 5 second mark. This way you prevent play from being called repeatedly while the buffer is still playing, and you also prevent it from being called when there is only a small amount of data in the buffer.
if (!isPlaying && timeInBuffer > 5)
{
buffer.Play();
isPlaying = true;
}
else
{
isPlaying =
timeInBuffer =
}
Simon
|
|
|
|
|
Thanks again for the answer
But I don't consider this solution as an appropriate one, as it plays the buffer whenever it's full, but my application already plays the buffer without any problem or any cut in the voice, the problem is high consumption of memory, which is not likely to be solved with this solution.
And yes, I'm using DirectSound. It seems I have to place the
playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device) to prevent the voice to be cut up.
Anyway, I'll try to call play after some loops of filling the buffer. But the problem of disposing still remains unsolved and memory use is still too high.
Thanks again for any other help tips
|
|
|
|
|
No, your missing the point.
What you are doing is creating a new buffer every time you loop round. The sound processor is then queuing all of these buffers and playing them in order. Thus, you are getting a clear uninterrupted sound, but at the same time you are creating hundreds of buffer objects that are just forming a longer and longer queue.
What you should be doing is adding the data onto the end of the same buffer each time you go round the loop. This way the sound processor will continually play out of the same buffer as it will never run out of data because you are continually adding more data into the buffer.
My solution will stop the jittering because I am suggesting that you only need to call play once at the beginning. Provided that your source continues to send, you will never need to call play again. The 5 second counter is there to prevent play being called before there is anything in the buffer to begin with. And the flag is there so that play isn't called again. You will only need to call play again if the buffer runs out and stops (maybe you have network trouble, or the source stops for some reason, so if this happens, then flag is reset, and the code will wait until the buffer has 5 seconds in it before calling play() again)
Simon
|
|
|
|
|
what Simon's referring to is called a 'circular buffer' and is used in many communication protocols where data needs to be processed (played in your case) immediately, before the end of the stream is reached or where the end point is not known.
All live audio monitoring applications utilize this approach. Most use seperate record (receive) and playback buffers too to avoid possible data loss.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: 'circular buffer'
Ahh, yes...This is what I'm talking about. For some reason the word just never came to my head. Nice one.
Simon
|
|
|
|
|
serima nazarian wrote: my application already plays the buffer without any problem or any cut in the voice
You obviously haven't let it play long enough.
The way it's coded now, aside from the memory leak, you're going to
have problems with clock drift and network jitter.
Let it go for several minutes - you'll see what I mean
Good luck.
Edit:<br />
Actually, looking at the code again, you may not have too much problem<br />
with jitter or drift, since you're using a new secondary buffer for every<br />
receive. There will probably be a problem if the GC gets around to collecting<br />
any secondary buffers that are still playing asynchronously, however.
Mark Salsbery
Microsoft MVP - Visual C++
modified on Wednesday, October 8, 2008 2:15 PM
|
|
|
|
|