|
I am not sure whether shotsound.Play will let further processing to take place. I mean like whether it Plays the wav file in a seperate thread. If it doesn't it means that timer1 doesn't start until the sound stops playing. So maybe you can try something like this...
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
...<br />
<br />
timer1.Start();<br />
shotsound.Play(0, BufferPlayFlags.Default);<br />
}<br />
<br />
<br />
private void timer1_Tick(object sender, EventArgs e)<br />
{<br />
if(shotsound != null)<br />
label1.Text = shotsound.Frequency.ToString();<br />
}<br />
If it doesn't work, play the wav file in a seperate thread.
-------------------------------------------
It's code that drives you - Shyam
|
|
|
|
|
Why are you expecting the sample rate of a wav file to change as it is played?
If you want the frequency(s) of the sound in the file then you'll have to look into fourier decomposition (look for an fft library).
|
|
|
|
|
Hey!
I'm trying to make a control which relies somewhat on tabs to display different panels, so at runtime controls can be added to each individual panel. I just can't figure out how to allow the tabs to be selected at designer time to display a different panel in correspondance.
A prime example would be the TabControl, where you can click a tab and a different panel in relation to the tab is displayed, so you can keep switching. I do have a property set for my control to adjust the ActiveTab digit to flick through the panels manually (by typing), but i'd much prefer to have the panels switching by having the tabs themselves selected at designer time.
If anyone can help, thanks in advance
Edit: I also set the panel controls to Control.Visible = false; in the code, but the *all* the controls are still displayed in the designer, so is there any way selectively hide panels in the editor until a particular tab is selected? Thanks
|
|
|
|
|
Hey Folks;
I was lucky enough to get a new development box. I have loaded 2008 server 64-bit as the OS, SQL 2005 64-bit SP-2. 8g of memory and a terabyte of disk space.
I downloaded the 64-bit SMO files from MS.
I am using VS2008.
This code used to be really fast on my old XP 32-bit machine and I have not changed the code but now it takes forever to find the db servers in my net.
Does anyone have any insight to this.
here is the code..pretty standard stuff I think.
{
Cursor.Current = Cursors.WaitCursor;
DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
if (dt.Rows.Count == 1)
cmbServers.Text = (dr["Name"].ToString());
Console.WriteLine(dr["Name"]);
cmbServers.Items.Add(dr["Name"]);
}
}
Cursor.Current = Cursors.Default;
}
Thanks in Advance for any Help
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
If it's a new machine, I would guess that you've got some configuration problems. I made a similar move (32-bit XP to 64-bit XP), and none of my code runs any slower than it did before.
"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 All ,
I have a Matrix which transforms the Graphics object during the OnPaint event handler to "zoom in/out" of a Panel that I have depending on this matrix.
I want to Invalidate() a specific region that is of absolute coordinates (relative to the control though). When the OnPaint method is called, I want to be able to set the transformation on the Graphics object and then paint a rectangle around the e.ClipRectangle region. Here's the problem: when you perform Graphics.DrawRectangle for the ClipRectangle AFTER it has been transformed, the rectangle is transformed and is now RELATIVE to the transformed Graphics object (and therefore translated and resized by the zoom scale). How can I transform the ClipRectangle such that it is the "same size and location" as the absolute rectangle? I basically want to inflate/deflate it depending on the zoom. This is so that it can be drawn and used to perform hit testing AFTER the transformation. I have several "shapes" that I want to make sure are INSIDE of the invalidated region, but the only way to do this is to transform the ClipRectangle .
I know this is a bit confusing so if you need more explanation, let me know.
Cheers!
|
|
|
|
|
Hi All,
I want to compress Image to maximum rate, what the best Algorithm can I use?
If any one have a class to do that, please give me it ?
Ala Qunaibi
|
|
|
|
|
Depends on the content of the image and the type of compression you like to have:
- lossy or lossless
- picture has few distinct colors (like a comic) or is a photograph
For photos, you should choose jpeg or some wavelet based algorithms like jpeg2000.
Both offer lossy and lossless compressions, although the lossy ones work pretty well for photographs, but look a bit ugly with high compression ratios (you will get lots of artifacts).
For pictures with only a few colors, you can choose the palette based GIF (up to 255 colors) or PNG for images with more colors. PNG offers lossless compression.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks,
My Images are Photos and Compression type is lossless.
Can You help me , where can I find source code about What you said, or Examples?
Ala Qunaibi
|
|
|
|
|
Greeeg wrote: For photos, you should choose jpeg or some wavelet based algorithms like jpeg2000.
Both offer lossy and lossless compressions
No, there is no lossless JPEG compression.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Matty22 wrote: JPEG 1991 supports lossless compression
No, it doesn't. That's an addition made in 1993, and it's not supported by the standard libraries.
wikipedia: Lossless JPEG[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I'm developing a SMS server, for which I need to store income SMS request and response of my appliction on those SMS in Windows message queue. I've done Googling but could not find some appropriate material. Please help me out.
|
|
|
|
|
Google MSMQ - there's a ton of resources out there, here's some links to some CP articles:
CP MSMQ Search[^]
|
|
|
|
|
I've been experimenting with various implementations of two-way communications using WCF over MSMQ, and without ever thinking it would work, tried the following:
using System;
using System.ServiceModel;
namespace MessagingSample
{
[ServiceContract]
public interface ISampleContract
{
[OperationContract(IsOneWay = true)]
void StartDoingSomething(string someText, SampleClient client);
}
[ServiceBehavior]
public class SampleClient
{
private ISampleContract workerService;
public void StartClient(string server)
{
EndpointAddress endpointAddress = new EndpointAddress(
new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server)));
NetMsmqBinding clientBinding = new NetMsmqBinding();
clientBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None;
clientBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None;
ChannelFactory<ISampleContract> channelFactory =
new ChannelFactory<ISampleContract>(clientBinding, endpointAddress);
workerService = channelFactory.CreateChannel();
}
public void StopClient()
{
if (workerService != null)
{
workerService = null;
}
}
public void StartDoingSomething(string text)
{
if (workerService != null)
{
workerService.StartDoingSomething(text, this);
}
}
public void DoSomethingElse(string text)
{
System.Diagnostics.Debug.WriteLine(text);
}
}
[ServiceBehavior]
public class SampleServer : ISampleContract
{
private ServiceHost serviceHost = null;
public void StartServer(string server)
{
Uri serviceUri = new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server));
NetMsmqBinding serviceBinding = new NetMsmqBinding();
serviceBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None;
serviceBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None;
serviceBinding.MaxReceivedMessageSize = 1024 * 4096;
serviceBinding.ReaderQuotas.MaxArrayLength = 1024 * 4096;
serviceHost = new ServiceHost(typeof(SampleServer));
serviceHost.AddServiceEndpoint(typeof(ISampleContract), serviceBinding, serviceUri);
serviceHost.Open();
}
public void StopServer()
{
if (serviceHost != null)
{
serviceHost.Close();
}
}
public void StartDoingSomething(string someText, SampleClient client)
{
System.Diagnostics.Debug.WriteLine(someText);
client.DoSomethingElse("Processed: "+ someText);
}
}
}
If you create another couple of applications - one that implements the SampleClient, and another that implements the SampleServer - both will communicate in a two-way fashion over MSMQ using this code.
If the server is down/stopped, messages will be queued and returned to the original client when the server comes back online. In situations where a message is received by the server but the client no longer exists it all fails silently - i.e. no exceptions at the server, and the response method call is simply lost in the ether.
The first question is why does it work? I'm not passing any service endpoints for the client to the server, so how is the server able to address the client? All of the two-way MSMQ/WCF samples I've seen thus far require that the client also act as a server.
The second question is when will it not work?
Note: you'll need to create a queue named "SampleQueue" in MSMQ for this all to work of course.
|
|
|
|
|
Try coding it in Java. C# sucks big time. May Allah give you the knowledge
|
|
|
|
|
The operative word there being try, of course.
P.S. Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
|
|
|
|
|
Furty wrote: Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
Dude i was showing u the right path for programming
|
|
|
|
|
Meer Osman Ali wrote: Dude i was showing u the right path for programming
Right. Gotcha.
I had you pegged as a trolling wanker, but thanks for the confirmation!
|
|
|
|
|
Furty wrote:
I had you pegged as a trolling wanker, but thanks for the confirmation!
Gee have a nice day then
|
|
|
|
|
If it farts like a troll, smells like a troll, and looks like a troll, shouldn't we just castrate it?
|
|
|
|
|
Absolutely not. It would fart, smell and look like a troll even more,
and scream its heart out on top of that.
On the other hand, if it intends to procreate, you would have to
accept these short-term disadvantages, and go for the long-term benefits.
Or act a little more effectively and solve the problem once and forever.
PS: nothing much has changed around here, has it?
|
|
|
|
|
Luc Pattyn wrote: PS: nothing much has changed around here, has it?
Same ol', same ol'. Mind you, I've spent the last month or so working on a bit of Open Source work along with Karl Shifflett, so I've spent less time in the forums as a result.
|
|
|
|
|
No, pretty much every post he's made is from a completely ignorant viewpoint.
|
|
|
|
|
Allah has given us C#. Java is an abomination to Allah, a heretic language. Are you rally suggesting that we ignore the progress that He has granted us? Ignore type-safety? Drop the increased productivity?
That sounds like the arrogance that Iblis would display
As Spock would say, "Live long and prosper"
|
|
|
|