|
Ok,
But how can i count the number of strings in the cell and determine if to do the new line?
|
|
|
|
|
Don't break it up by number of words, rather break it up by number of characters, give it a try and tell me if you get stuck.
|
|
|
|
|
I have a big ogg file that contains words in a foreign language one after another with a small but noticeable gap between them. I want to be able to detect this gap and record the time in which it occurs. Is there a way to do this in c#?
or could this data be somehow stored in the ogg file itself?
|
|
|
|
|
Tricky but entirely possible. First thing I'd do is convert from Vorbis to a good old fasioned PCM wav file (get some third party thing to do this for you). You then need to interpret that, its in RIFF format which is pretty straight forward.
The quiet bits between words will be represented by a series of smaller numbers. Large numbers represent loud noises. So you need to pass the file looking for periods of lower value samples. Set a threshold and minimum duration. By knowing where you are in the file and the sample rate you can work out the times of the quiet bits.
You might need to potentially create some sort of low pass filter to remove any artifacts which could confuse the procedure. Sounds grim but its easy enough.
Sort of vague, but hope that helps a bit.
Regards,
Rob Philpott.
|
|
|
|
|
Hi.
In the following snippet code :
static void func(ref string bits)
{
for (int i = 0; i < bits.Length; i++)
{
if (RANDOM_NUM < MUTATION_RATE)
{
if (bits[i] == '1')
bits[i] = '0';
else
bits[i] = '1';
}
}
}
I receive this error :
Property or indexer 'string.this[int]' cannot be assigned to -- it is read only
What's wrong ?
|
|
|
|
|
Mohammad Dayyan wrote: I receive this error :
Property or indexer 'string.this[int]' cannot be assigned to -- it is read only
What's wrong ?
Nothing. Strings in C# are immutable.
From the MSDN on string:
A String object is called immutable (read-only) because its value cannot be modified
once it has been created. Methods that appear to modify a String object actually return a
new String object that contains the modification. If it is necessary to modify the actual
contents of a string-like object, use the System.Text.StringBuilder class.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks a lot.
I didn't know it !
|
|
|
|
|
I had a question about StringBuilder
What's the equel of Substring method in StringBuilder ?
|
|
|
|
|
Don't think there is one. But try calling the ToString() method and then the SubString() method on the returned string object.
StringBuilder s = new StringBuilder();
s.Append("foo");
string a = s.ToString().SubString(0,1);
|
|
|
|
|
Wouldn't use it if there was one (which there isn't, I don't think)!
Try this, if you are most comfortable with strings.
static void func(ref string bits)
{
StringBuilder sb = new StringBuilder();
char Out;
foreach (char c in bits)
{
if (RANDOM_NUM < MUTATION_RATE)
{
if (c == '1')
Out = '0';
else
Out = '1';
}
else
{
Out = c;
}
sb.Append(Out);
}
bits = sb.ToString();
}
You could use a System.Collections.BitArray, but it may be a little heavy-duty for what you are trying to do. Probably the proper way to do it though!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Strings are immutable. This means you can't change them once they have been created.
You can access the individual characters like you are doing, but you can't set them to new values. (Don't be fooled into thinking you can modify strings by doing concatenation and stuff like that. Every string operation that looks like it is making a change is actually creating a new string object so if you do it a lot it can get quite slow)
Take a look at the System.Collections.BitArray[^] class instead, it might be better suited to what you are doing.
Simon
|
|
|
|
|
While strings are meant to be immutable, you can cheat with pointers. It's dangerous though, with interned strings etc. So just don't. But that doesn't mean it's impossible.
|
|
|
|
|
Howdy,
I'm using this.Refresh() method in the Button_Click event to refresh the machine, but this only works for the form in particular. It doesn't seem to refresh the system, rather it seems like as if the form is getting refreshed up.
Any way through which I can refresh the machine from two to three times, on a single button click? And is it possible to send the F5 key in oder to refresh?
plz help!
i_w32_app.
|
|
|
|
|
What are you trying to achieve?
this.Refresh() just invalidates the object (in this case the form your button is on) and issues paint messages for it and child controls.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi,
Lemme clarify my question. I am trying to refresh the machine after a specific task has been accmplished.
Like:
private void button1_Click(object sender, EventArgs e)
{
.........................................................
.........................................................
}
Help
|
|
|
|
|
Do you mean you want to refresh the entire view in the monitor?
If so, you'll have to use some PInvoke and at a minimum, get the desktop's handle and call InvalidateRect or UpdateWindow. You may need to do this for every open window too.
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) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Is there some comprehensive way to this? I mean to say that this is quite difficult.
PS: I only want to refresh the desktop.
What about this:
private void Button1_Click(object sender, System.EventArgs e) {
SendKeys.Send("{ENTER}");
}
Please let me know.
|
|
|
|
|
It seems the easiest way to do this is to make the shell think file associations have changed. When it does, it redraws the desktop. Not sure how 'expensive' this is - but it works.
SHChangeNotify(SHCNE_ASSOCCHANGED, 0, 0, 0);
[DllImport("shell32.dll")]
static extern void SHChangeNotify(uint wEventId, uint uFlags, uint dwItem1, uint dwItem2);
const uint SHCNE_ASSOCCHANGED = 0x08000000;
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) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Invalid_Win32_app. wrote: I am trying to refresh the machine
What exactly do you mean by "refresh the machine"? Do you mean reboot?
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
molesworth wrote: What exactly do you mean by "refresh the machine"? Do you mean reboot?
Not Reboot, I am just trying to refresh the PC, like we do by right-clicking on an empty space on the desktop and clicking on the Refresh option from the menu display. Thats what I want to do.
|
|
|
|
|
Your request is totally dumb! refresh the system doesn't mean anything.
Refresh your desktop doesn't mean to refresh your system...
Try to be more explicit Rajdeep
|
|
|
|
|
I think this should do:
private void button1_Click(object sender, EventArgs e)
{
SendKeys.Send("{F5}");
}
What do you say?
PS: How did you know that I am Rajdeep?
|
|
|
|
|
Invalid_Win32_app. wrote: PS: How did you know that I am Rajdeep?
You can see the last 200 messages somebody has posted.
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Your level of stupidity is unique.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Hey Rajdeep.NET, did you think that we wouldn't notice if you changed your name?
You're still asking strange questions.
Now I don't really know about this refresh thing, this is not normally something you even need to consider doing. Why do you even need to do this?
Anyway, I'd look into sending a F5 keypress, like you suggested..
|
|
|
|