|
Hi,
Thanks for that. A couple of questions / observations:
1. The C# documentation refers to the resolve method as being obsolete.
2. The java type of "address" is byte[]. The method returns a "raw" ip address. The C# equivalents, including Dns.resolve return an IPAddress[] type which i assume isn't raw. Can C# return raw addresses? I assume the type to use is c# byte[]...
Additionally, I'm unclear as to what the java documentation means by a raw ip address. Can you clarify? I'm expecting that it means that I the IPAddress[] type is not the correct type for this operation.
Regards,
Dave
|
|
|
|
|
DwR wrote: I'm unclear as to what the java documentation means by a raw ip address
One would presume that the raw IP Address is just the bytes that make up the IP Address - as it would normally be with anything described as raw.
DwR wrote: I'm expecting that it means that I the IPAddress[] type is not the correct type for this operation
What operation?
|
|
|
|
|
Hi,
I think I've resolved this. By setting the type as IPAddress the member "GetAddressBytes" can be used to convert the address to bytes matching the type of the variable "address". Thanks for your tip, it pointed me in the right directions.
That said, I've hit another problem which seems to be a bit trickier. I need to determine the IP addresses associated with the network interfaces of the multi-homed host the code is running on. I am capturing the available interfaces as follows:
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
I then want to loop through the entries and for each one load it's associated IP Addresses into an IPHostEntry instance (or similar). However, I don't see any way to determine the list of ip addresses associated with a particular network interface returned by the foreach loop as it iterates through "interfaces". How is this done?
Regards,
Dave
|
|
|
|
|
Hello, i`m a newbie when it come`s to programming, i have read a lot, and made 1 proggy about 1.5 years ago and now i have forgotten most of the language..
So here`s the case: I got 2 richTextBoxes on 1 page, so when i load 2 diffrent files into each of the 2 rtb`s, i wan`t to make a function that does: if richTextBox1 is containing any of the words/numbers/signs that is loaded to richTextBox2, i wan`t the proggy to delte those from richTextBox2 and only keep the uniqe words/numbers/signs, so the user can save it..
Could any please help a newbie out with this one
Help is highly apereachiated
Thank you
|
|
|
|
|
The first thing that occurs to me is that you'll probably want to use a regular expression on the first textbox to retrieve the list of words in it. Possibly, you'll want to add the entries to a unique list so that you won't be performing unnecessary lookups on the second textbox. Then, you'll perform a regex search in the second textbox based on these results (respecting word boundaries of course) and remove the offending items using the replace method. And before you ask, I'm not going to give you the code to do this - it's quite lengthy.
|
|
|
|
|
Thank you for the reply Pete O'Hanlon
Yeah i figured out this code would be lenghty, i wasn`t either gonna ask u to do that code for me, cos i like doing the work my self. What i was hoping for where some example`s, maybe some links to some reading sources about this and or a comment like "u can do it if u take ur time" or "forget it, ur to unexperienced, maybe in a year or 2"
Nice tip: "Possibly, you'll want to add the entries to a unique list so that you won't be performing unnecessary lookups on the second textbox"
Thank you
|
|
|
|
|
I'm not going to talk down to you. This isn't a particularly arduous piece of code. The thing you need to look up is regexes with word boundaries.
|
|
|
|
|
Ok m8, thank you for the reply again, i`m gonna do some research on that
Cheers
|
|
|
|
|
Hi,
Does anyone have an example to get me started on recording to an mp3 file.
I want to record from the microphone and save it directly to an mp3.
I have a working project but now I save it to wav and then send it to lame and I want to skip that step.
Thanks,
/Johan
|
|
|
|
|
Hello,
the only program i know that streams "directly" to a desired audio format is the VLC Media Player. The good news is, that it is open source and quite well documented. But... it's unmanaged (of course) and i think you will have to dig through quite a bit of code in order to find something useful.
Anyway, try this:
http://www.videolan.org/developers/vlc.html[^]
Michael.
|
|
|
|
|
Thanks for your answer but I was hoping that there might be a simple library I could use
|
|
|
|
|
Check this[^] article - it uses the dll from Lame. Creating your own encoder will be a LOT of hard work and probably not possible in C#?
Dave
|
|
|
|
|
That article does pretty much what I have so far, it takes a wav-file and uses lame to create an mp3.
I want to record directly to mp3.
|
|
|
|
|
AFAIK, I could be wrong (but I've been around the pro audio world for over 20 years) it's not possible.
MP3 is an encoding format that compresses existing audio.
It's like trying to write data to a zip file without first either saving the file or creating it in memory - the file has to exist somewhere first.
Dave
|
|
|
|
|
Yes, I realize it has to created in memory or something like that, so what I'm looking for is a free audio library that takes the data from the mic and sends it directly to lame. My problem is that it must be free for commercial use.
|
|
|
|
|
Just had a quick look at the source code from the article I referenced.
It uses its own class WaveStream which takes a Stream in the constructor. I'm pretty sure that would work with a MemoryStream , and if not, I can't imagine it'd be too difficult to ads a new overload to the constructor. Then you could create the wav in memory (MemoryStream) and write directly to disk as mp3.
Dave
|
|
|
|
|
You're right, that could absolutely work, I will try it out
Thanks for the help everybody
|
|
|
|
|
let me know if you get it working. If it's viable I could find a use for it myself!
Dave
|
|
|
|
|
Audacity[^] is an excellent program that does the streaming. It is open-source (not .NET), but it might be an area to start. For encoding to mp3 is uses the lame library mentioned in a previous post.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi fellows, I have 50 textbox and 50 checkbox on my Form1.cs. While overriding the dispose method do i have to dispose all of those textbox and checkbox that were create explicitly e.g txtbox1.dispose(), checkbox1.dispose() or i can simply dispose the entire form e.g Form1.dispose();
Perhaps, what i want to know if GC dispose all the child controls when am disposing the form1. If so is there any compile list of controls that we have to dispose ourselves?
Thanks
|
|
|
|
|
Hi,
I trust Control.Dispose() disposes of its children (Control.Controls), and Form IS a Control.
BTW: That should be sufficient reason for you to call base.Dispose() inside myControl.Dispose()
when inheriting from a Control.
modified on Tuesday, July 15, 2008 3:37 PM
|
|
|
|
|
Visual Studio usually gives you a Dispose method to do that.
If you're using VS, look in the Form1.Designer.cs file (depending on version).
It should look something like this:
protected override void Dispose ( bool disposing )
{
if ( disposing && ( components != null ) )
{
components.Dispose ();
}
base.Dispose ( disposing );
}
|
|
|
|
|
Thanks for answering that we should trust on the base control.dispose to dipose all child controls but i didn't get the answer on what are the controls that we need to define the dispose explicitly. Are there any e.g for those controls.
|
|
|
|
|
Simply disposing of the form will take care of it if they are built in controls that aren't accessing unmanaged resources.
I suppose you could do
foreach (Control thisControl in Controls)
{
thisControl.Dispose();
} if you have reason to be paranoid!
Dave
|
|
|
|
|
You've already had the answer to your question but I have to ask, why do you have so many controls on 1 form? Isn't this going to be a bit much for your users to take in? Step back for a minute and think about how your users are going to use the application and then look again at the number of textboxes; then see if you can figure out a way to simplify the design for your users.
|
|
|
|