|
HL42 wrote: I couldn't find anything like this googling.
None of these[^] fit the bill?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
HL42 wrote: I'm looking for a class in .NET (preferably C#).
What is this class expected to do?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
I have a column called bookedhalls, the value will be stored as Balaji-A,Balaji-C, i written select query as follows
Select * from function where bookedhalls like '%Balaji-A,Balaji-C,%
by using this i will get the row.
Suppose if i give '%Balaji-C,Balaji-A,% i cannot get the row. How to get that row by using
Balaji-C,Balaji-A. Anybody knows please reply.
modified on Friday, September 24, 2010 5:14 AM
|
|
|
|
|
I don't know what this has to do with .NET, it looks more like a Database question.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Your database is not designed correctly if you are storing multiple pieces of data in one column. BookedHalls should probably be a separate table. So the functions table has all the other details of the function including an ID. Then the bookedHalls table has the function ID in it. Then you say select * from function where functionID in (select functionID from bookedHalls where hallName like '%Balaji-A%' or hallName like '%Balaji-C%').
And actually even that is sloppy database design. There should be a halls table and it should contain a hallID, then the bookedHalls would have just a functionID and a hallID. That way your application can have a drop-down with all of the valid halls. And if you got fancy you could even do lookups to make sure a hall isn't in use for a function at the same time.
This kind of thing is referred to as data normalization. You should study it if you are going to create databases.
Please read the guidelines on how to ask a question. That subject line is awful.
|
|
|
|
|
Hi,
I have one more question on VSTS.
Was it really necessary to come up with multiple editions of VSTS like architecture, development, test instead of just one team suite which comprises of all.
Was it because of size.
or is it for the scenario where architects do only designing, developers only code and build and testers only test ... and so based on the role, they need to install only the necessary edition?
Regards,
NetQuestions
|
|
|
|
|
NetQuestions wrote: Was it because of size.
The cynic in me says that it's because of pricing.
|
|
|
|
|
I think someone at MSHQ just got carried away with big team mentality. VS 2010 has a much simpler model where the price scales up with the scope of the install, with a separate track for dedicated testers.
It's all about the money really.
|
|
|
|
|
Hi,
VSTS is a ----------- for managing development on the microsoft .net platform.
Can I say 'VSTS is a means'. I am not sure if I can say 'VSTS is a product' or 'VSTS is a tool' because
it is an integration of products / tools isn't?
Regards,
NetQuestions
|
|
|
|
|
It is the collection of tools for development, not just managing development, so try the following:
"VSTS represents extended versions of Visual Studio .NET. It includes a set of collaboration and development tools for software development process."
- Taken from dotnet spider[^]
|
|
|
|
|
hi,
by collaboration you mean TFS?
Regards,
NetQuestions
|
|
|
|
|
|
The missing part is "complete pain to set up properly".
|
|
|
|
|
|
Hi
If I add a panel graphically in VS2010 I can make it display an image but if I manually add a panel by writing code I can't make it visible. Do I have to associate it to the form?
I have given the manually defined panel an x,y,width and height and I true'ed the visible flag.
Painfully
Tom
|
|
|
|
|
hmmm, I as missing:
// Add the Panel control to the form.
this.Controls.Add(panel1);
RESOLVED
|
|
|
|
|
myForm.Controls.Add(myPanel);
is what either Visual Designer or you have to add to make the Panel show on the Form (assuming reasonable property values have been set, such as Location and Size).
|
|
|
|
|
Hey Thanks,
Will you let me in on how you manipulate the bitmapdata - that is ...working with the two spectrogram sections? I have the panel shown and can fill-in data.
I'm looking and looking and .NET is so huge and hard to get into I think.
I guess I can solve this by copying data around in a loop but that doesn't seem elegant!
Cheers
Tom
modified on Wednesday, September 22, 2010 8:50 PM
|
|
|
|
|
In my simple test I plotted a black sine wave on a yellow background; I did not use BitmapData, I kept a Graphics open on the Bitmap, and just did (plot is the double-buffered Panel):
private void AddNewData() {
int w=plot.Width;
int h=plot.Height;
int x=dataCount%w;
bmg.DrawLine(Pens.Yellow, x, 0, x, h);
int y=(int)(h*(0.5+0.45*Math.Sin(dataCount*0.07)));
if (oldy<0) oldy=y;
bmg.DrawLine(Pens.Black, x, oldy, x, y);
oldy=y;
dataCount++;
}
When you need fast access to the individual pixels of one column, you would not use SetPixel; instead enable unsafe code, do LockBits/UnlockBits, use a byte pointer, and advance it by Bitmap.Stride to go to another row. Examples are plenty, Bob Powell (Google!) has good ones.
|
|
|
|
|
Aaah, ok!
So you are doing a spectrum-analyzer (frequency vs gain) and not a spectrogram (frequency vs. time vs. gain) - like this one:
http://www.youtube.com/watch?v=UcBDSoVs42M[^]
Or am I missing something?
I have the bitmapdata ready and also the FFT data ready to be injected and then I need to move data around inside the bitmapdata to make the shift of the bitmap. I need to do this the fastest way!
for now I will just do it the heavy way using a loop. Would be better though to copy blocks around using a rectangle() suggestions are appriciated!
Thx
Tom
|
|
|
|
|
I wasn't doing any spectrumthingy, I was trying what resembles a curve plotter, or a continuous oscilloscope (one channel), however rather than just line plotting, I used the circular bitmap approach we discussed before (so nothing gets copied by me) and two Graphics.DrawImage().
If the new column needs more than a simple "set entire background"+"set a little foreground line segment", then you probably need to copy in an entire column, hence the LockBits and pointer stuff suggestion. Link.[^]
Turning a bitmap-based oscilloscope into something more complex should not affect flickering, as the panel is double-buffered anyway, so what happens on the screen remains the same.
BTW: nice movie!
|
|
|
|
|
Hi Luc
I'm about to give up on the panel approach and just use the dramimage-method and live with the flickering. Below you can see me panel approach...it does work but it flickers just a much as the drawimage approach.
Do you mind taking a look at my code and tell me what I'm doing wrong? I'm not into the terminology of windows programming so I'd appreciate a no-brainer description on how to do this
My drawing code looks like this:
g = pe.Graphics;
int H = myBitmap.Height;
int W = myBitmap.Width;
Rectangle rect = new Rectangle(0, 0, W, H);
myBitmapData = myBitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, myBitmap.PixelFormat);
IntPtr ptr = myBitmapData.Scan0;
int bytes = myBitmapData.Stride * H;
byte[] rgbValues = new byte[bytes];
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
for (int ii = 0; ii < H; ii++)
for (int jj = (ii + 1) * (3 * W) - 1; jj > (ii * W * 3) + 3; jj -= 3)
{
rgbValues[jj] = rgbValues[jj-3];
rgbValues[jj-1] = rgbValues[jj-4];
rgbValues[jj-2] = rgbValues[jj-5];
}
int offset = W * 3;
for (int counter = 0; counter < H; counter += 1)
{
rgbValues[counter * offset] = (byte)rnd.Next(255);
rgbValues[counter * offset + 1] = (byte)rnd.Next(255);
rgbValues[counter * offset + 2] = (byte)rnd.Next(255);
}
System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes);
myBitmap.UnlockBits(myBitmapData);
myPanel.Location = new Point(XREF, YREF);
myPanel.Width = myBitmap.Width;
myPanel.Height = myBitmap.Height;
myPanel.BackgroundImage = myBitmap;
this.Controls.Add(myPanel);
My panel class (read that double buffering with a panel should be done like this):
public class DoubleBufferPanel : Panel
{
public DoubleBufferPanel()
{
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}
}
Hope to hear from you
Thanks
Tom
|
|
|
|
|
Hi Tom,
1.
in your DoubleBufferPanel constructor, all you need is this.DoubleBuffered = true;
I think it is equivalent to what you have though.
2.
I'm a bit confused by your code:
this.Controls.Add(myPanel);
if that really sits inside the Paint handler you are adding a panel each time, which may result in the Panel being repainted twice, thrice, etc later on, causing unnecessary screen activity, hence flickering.
3.
I'm horified by:
myPanel.BackgroundImage = myBitmap;
What you do here is, whenever the system thinks it needs to repaint the panel you also give it a new background image, causing it to need yet another repaint. So it is probably repainting continuously.
4.
And finally I'm disappointed by:
We already established there was absolutely no need to do that. With a circular bitmap, update "the next" column, then paint both halves at the right position.
In summary:
- create a doublebuffered panel once
- add it to your form once
- never use the BackgroundImage
- have an updateData() method that stores new pixels in one column of the bitmap (I kept a Graphics to do that)
- in your Paint handler, have only two statements, both e.Graphics.DrawImage() with the correct parameters.
Warning: you cannot keep LockBits open forever as DrawImage would then fail, so if you use LockBits, you must call UnlockBits at the end of the column update, otherwise you can't have it painted. You can keep a Graphics open on the bitmap though.
|
|
|
|
|
Hi Luc
Hmmm, maybe I should just realize that I'm not at a sufficient level to pull this off
1. I will try your suggestion also!
2. The reason for doing the this.controls.add(myPanel) was because if I instantiated a panel and didn't do this then I never got to see it in the windows form.
3. This was the only way for me to see the bitmap inside the panel. Searched google and didn't find any other options so I thought this was the right way. what is the right way to do it?
4. Yeah, I'm disappointed too. I read your replies again and again and didn't really understand the circular buffer handling scheme... Guess I should have asked for that explicitly.
If you have the full code I'd be happy to see it.
I'm thinking about going back to OpenGL I think that is easier for me since I once succeeded doing this in that framework.
Correction: I DO understand your circular buffer handling in principle (I basically do it that way every day for audio processing at work) but not within a panel in .NET.
Thanks for your effort
Tom
modified on Saturday, September 25, 2010 11:52 AM
|
|
|
|
|
OK, here are the most relevant chunks of my experiment, all is in the MainForm class; I'll probably crank out another little article by the end of next week:
private Bitmap bmPlot;
private int dataCount;
private BackgroundWorker bgw;
private bool running;
private int oldy=-1;
private Graphics bmg;
private void plotter(object sender, PaintEventArgs e) {
if (bmPlot!=null) {
Graphics g=e.Graphics;
int w=plot.Width;
int h=plot.Height;
int x=dataCount%w;
g.DrawImage(bmPlot, new Rectangle(0, 0, w-x, h), new Rectangle(x, 0, w-x, h), GraphicsUnit.Pixel);
g.DrawImage(bmPlot, new Rectangle(w-x, 0, x, h), new Rectangle(0, 0, x, h), GraphicsUnit.Pixel);
}
}
private void btnStart_Click(object sender, EventArgs e) {
log("btnStart_Click");
btnStop.Enabled=true;
btnStart.Enabled=false;
running=true;
dataCount=0;
oldy=-1;
int w=plot.Width;
int h=plot.Height;
bmPlot=new Bitmap(w, h);
bmg=Graphics.FromImage(bmPlot);
bmg.FillRectangle(Brushes.Yellow, 0, 0, w, h);
plot.Refresh();
bgw=new BackgroundWorker();
bgw.DoWork+=worker;
bgw.ProgressChanged+=reporter;
bgw.WorkerReportsProgress=true;
log("starting bgw");
bgw.RunWorkerAsync();
}
and all the code that belongs to the BGW, which takes care of modifying the bitmap content (one column at a time):
private void worker(object sender, object e) {
while (running) {
AddNewData();
bgw.ReportProgress(0);
Thread.Sleep(30);
}
}
private void reporter(object sender, object e) {
log("reporter");
plot.Invalidate();
}
private void AddNewData() {
int w=plot.Width;
int h=plot.Height;
int x=dataCount%plot.Width;
bmg.DrawLine(Pens.Yellow, x, 0, x, h);
int y=(int)(h*(0.5+0.45*Math.Sin(dataCount*0.07)));
if (oldy<0) oldy=y;
bmg.DrawLine(Pens.Black, x, oldy, x, y);
oldy=y;
dataCount++;
}
|
|
|
|
|