|
I think you need to get a beginner's book on c#/.NET
But here you go.
public class MyClass
{
static Random s_random = new Random();
public int[,] IntArray = new int[10,10];
public MyClass()
{
for(int x = 0; x< 10; x++)
{
for(int y = 0; y < 10; y++)
{
IntArray[x, y] = random.Next(1, 1000);
}
}
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder();
for(int x = 0; x< 10; x++)
{
for(int y = 0; y < 10; y++)
{
if(y>1)
sb.Append(", ");
sb.Append(IntArray[x, y].ToString());
}
sb.Append(Environment.NewLine);
}
}
}
public static void Generate()
{
MyClass array = new MyClass();
Console.Write(array.ToString())
} Opacity, the new Transparency.
|
|
|
|
|
I want to know that if we want to insert a second video while playing first video (eg. a news strip while broadcasting video seen in the channels). How would i do that?
There are two type of ads.
1) Strip scrolling at the bottom of screen
2) L shaped ad.
Any help will be appreciated...
|
|
|
|
|
Process each frame and compose the new frame as necessary (e.g., overly an ad over the video). Add the processed frames to the output video.
|
|
|
|
|
Can You please elaborate. You may take me a complete noob in the world of C#. But i have to advise/supervise this project in detail...
Can you refer me to some article or somewhat a sample (code will be appreciated) for this.
Thanks
|
|
|
|
|
I gave you the high level solution. Break the problem down into smaller components and try to solve each of them yourself. If you have trouble, then come back here and ask another question. And by "here", I mean "Code Project", not this specific question... any new question should be asked as a new question, not as a reply to this post. Here is an example of how you might break it down:
1) A video is composed of frames.
2) Each frame is an image.
3) Images can be modified, such as by adding an overlay.
4) The overlay will be another image or video.
5) If a video, each frame is composed of an image (see item #2).
6) If an image, just overlap that image on the frame image.
7) You will need some means of indicating transparency.
8) You will need some means of recombining the frames you create into a new video.
9) You will want to keep the audio from the first video.
I imagine Google will help with a lot of that.
|
|
|
|
|
why is it that when i click the Close (X) button in my windows form the window just closes and but the application does not exit. help help. it doesn't have any event. can i override any method concerning that.?
|
|
|
|
|
a WinForm app will exit when you somehow close the main form (typically the one passed to Application.Run) provided there are no busy foreground threads anymore, so if you started extra treads (Thread, ThreadPool, BackgroundWorker, ...) they should either be flagged IsBackground=true or somehow terminate.
That is exactly what background means: not prohibiting app exit.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Sweet.
I think you just solved a problem that has been ignored plaguing me for months.Opacity, the new Transparency.
|
|
|
|
|
You can use the Application.ShutdownMode[^] property to control how your app behaves when the Form is closed, or use Application.Exit() after you close the form. "A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi all,
I am trying to create a large square matrix using visual C# to do linear algebra calculations
e.g. transpose, inverse, solve the system etc
Can anyone help me with eh code required to even set this up? How do create the matrix and generate random values for each element? I am totally new to C#.
Iman
|
|
|
|
|
I recommend you create a List of lists to make a 2D matrix. You can use the Random class to generate random numbers for you. That should be enough info to get you started. To fill in simple details (like how to use a for loop), I recommend you read a book on C#. Good luck.
|
|
|
|
|
I agree on the book.
As far as the matrix goes, this is an instance where I'd prefer an actual 2D array, as it is going to be used for inversion, LU decomposition, or whatever method known to mankind in order to solve a system of linear equations. Sparse matrices may benefit from a different structure, but that is not part of programming 101.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Tuesday, February 23, 2010 10:36 PM
|
|
|
|
|
its good to study programming logic but you have to start with some basic programming and then to advace..
matrix operations very handy with C#
you can refer following code for generating matrix 10 X 10 order,
public static void Generate()
{
//Declaring Array
int [,]Arry=new int[10,10];
//Random Class
Random random = new Random();
string str = string.Empty;
//Loop ith element
for (int i=0; i<10; i++)
{
//loop jth element
for (int j = 0; j < 10; j++)
{
//get random number between 1 and 1000
Arry[i, j] = random.Next(1, 1000);
//printing elements a00,a01,a02....
Console.Write(Arry[i, j].ToString()+" ");
}
Console.WriteLine();
}
Console.Read();
}
Read books and tutorials.. and general programming concepts then you can be a king!!
|
|
|
|
|
Thanks that is a great help
|
|
|
|
|
What would be the code to display the matrix in an excel file?
This is totally cool. I am ready Headfirst C# now any other beginning programming books recommended?
Iman
|
|
|
|
|
Iman Mohtashemi wrote: What would be the code to display the matrix in an excel file?
That is a new question. If you need to ask a new question, as it as a new question rather than a reply in the thread for the existing question.
Iman Mohtashemi wrote: any other beginning programming books recommended?
Figure out which areas you'd like to read about, then get a book on it. Since you asked about Excel, perhaps you'd be interested in Microsoft .NET Development for Microsoft Office or one like it.
|
|
|
|
|
I’m trying to get a Microsoft.Office.Interop.Excel.Application refrence from a Process that identifies a running Excel.exe
This is where I am…
System.Diagnostics.Process[] apps = System.Diagnostics.Process.GetProcessesByName("EXCEL");
foreach (System.Diagnostics.Process p in apps)
{
Microsoft.Office.Interop.Excel.Application thisApp = ?????????????;
}
I haven’t been able to find any answers to this question (but have found a few others that asked it). Any ideas?
Thank you for your time,
Matt
|
|
|
|
|
|
I have the following code that converts a lower case alphabetical character (a-z) to upper-case (A-Z):
if (letter >= 97 && letter <= 122)
{
ascii -= 32;
letter = (char)ascii;
}
The problem is I think the cast for "letter" is affecting the performance as I am looping through a text of around 5 million characters.
Someone suggested a "lookup table" but I do not know what it is , possibly a Dictionary type?
Can anyone offer some advise for this problem?
Thanks!
|
|
|
|
|
Why not just use ToUpper ? I know the language. I've read a book. - _Madmatt
|
|
|
|
|
.ToString().ToChar() could takes up allot of performance?
Thanks anyway :P
|
|
|
|
|
I didn't say to use ToString.
Char.ToUpper[^] I know the language. I've read a book. - _Madmatt
|
|
|
|
|
System.Char.ToUpper(x)
Can't really get any faster than that. No need to convert to string first.
Hope this helps
|
|
|
|
|
Ok I will use that, beats the casting anyway :P
|
|
|
|
|
thebuzzwright wrote: Someone suggested a "lookup table" but I do not know what it is , possibly a Dictionary type?
An array of chars, indexed by the char you want to uppercase
Also, I thought that comparisons on chars were perfectly valid?
The cast for letter shouldn't matter that much. But why are "ascii" and "letter" not the same variable?
|
|
|
|