|
using System;
using System.Collections.Generic;
using System.Text;
namespace My practice page
{
class WordPair
{
string[] rightpair = new string[] {"below\tunter", "blue\tgel", "cat\tgelb", "cat\tdie Katze",
"red\trot","the dog\tder Hund","to read\tlesen"};
string [] wrongpair = new string []{"below\trot", "bue\tlesen", "cat\tunter", "red\tgelb",
"the dog\tdie katze"};
}
}
I am a beginner in C# programming and seeking advice.
What I am trying to do here is to build up an application in 4 parts.
Part A.
Which I have already started with the code above, to be an application that has the class WordPair implemented. The application creates a word pair object and calls the method for matching with two different strings-one that produces a match and one that doesn't & to show the results of these matches.
Part B.
An application in the same programme but as part B, that reads in the 'word_list.text' ( that is located in the solution folder). This part to be able to check each line.If the line has a word pair(i.e. two strings separated by a '\t') it puts this string into an ArrayList. If the line does NOT have a word pair, the application put that line into a file 'wrong_lines.txt'(that will be located in the solution folder).This application to count the number of lines without word pairs and reports this number to the user & shows all the input lines in a rich text box. If the word list file is not available, the program to produce an error an appropriate message.
Part C
Trying to have this part of the programme to be an application that reads the wordlist, puts the word pairs into an ArrayList of word pair objects, writes the wrong_lines files, reports on faulty pairs, allows the user to ask for a word and attempt the answer, also tells if the user's answer is correct.
Part D.
This to be a combination of Part A, Part B and Part C.
AM NOT SURE IF AM ON THE RIGHT TRACK WITH THE PART OF MY CODE ABOVE.SEEKING ADVICE ON WHAT COULD BE A BETTER WAY OF WRITING THE RELEVANT CODES.
Ntoki
|
|
|
|
|
This sounds very much like homework to me...
Anyway, I think you should include a property "Word1" and "Word2" (or something more meaningful - can't tell you from your description) in your WordPair class.
To have more than one WordPair you could use List<WordPair> .
Btw., your rightpair array (which you don't need in WordPair IMO) contains several errors: Should be "blue\tblau" and "yellow\tgelb".
Oh, and please stop shouting.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi All,
I am having a ASPX page on whose submission I open a PopUp Window for
sending mails.In the main page I have four hidden variables for
setting the MailTo Mailcc,MailSubject and MailBody fields which I am
getting in my PopUp Window by using
if((document.getElementById("hdnForPOst").value)=="1")
{
document.getElementById("txtTo").value=window.opener.document.getElementById("hdnMailTo").value;
document.getElementById("txtCC").value=window.opener.document.getElementById("hdnMailCC").value;
document.getElementById("txtMailSubject").value=window.opener.document.getElementById("hdnMailSubject").value;
document.getElementById("txtMailBody").value=window.opener.document.getElementById("hdnMailBody").value;
}
hdnForPOst is the variable set for sending mail.
This script I have pasted in a after my controls code.
The problem is that sometimes this code does't execute and I get a
blank popup Window.
I have checked by putting alerts inside script block also.These alerts
also dont execute.It happens only at times and no specific scenario.
Anybody can help please?
Dipti Arora
|
|
|
|
|
Hey Please put this Javascript in a Seperate js file and call this srcipt in your aspx page through src="_ur.js"file and work like that.
First attached it to a default.htm page and see if the scripts works fine then attach the script to your .aspx page.
Regards,
Satips.
|
|
|
|
|
I cant attach it in a script as I have to set values of my child controls from the parent control...after javascript debugging i found that there is a problem in the window.opener....
|
|
|
|
|
Strange one for the experts.... I am using windows 2003, visual studio 2005
I can create and use a single instance performance counter without issue...sort of - will explain later.
I am not able to get a multiple instance performance counter to work. Ther performance counter is added but <no instances=""> are shown so I am not able ot select the performance counter to monitor. The code below that adds an instance runs without throwing an error.
The code:
if (!PerformanceCounterCategory.Exists("JUNK"))
{
CounterCreationData ccd = new CounterCreationData("numberOf", "numbers", PerformanceCounterType.NumberOfItems32);
CounterCreationDataCollection ccdc = new CounterCreationDataCollection(new CounterCreationData[] { ccd });
PerformanceCounterCategory cat = PerformanceCounterCategory.Create("JUNK", "junk category", PerformanceCounterCategoryType.MultiInstance, ccdc);
using (PerformanceCounter c = new PerformanceCounter("JUNK", "numberOf", "instance1", false))
{
c.RawValue = 10;
}
}
using (PerformanceCounter c1 = new PerformanceCounter("JUNK", "numberOf", "instance1", false))
{
for (int i = 0; i < 10; i++)
c1.Increment();
}
A single instance performance counter works but not as expected (the above code, but category marked as single instance and the instance not being specified when creating the counter). The counter is added and I can view in perfmon, but it is not until I have the counter added to perfmon that the incrementing is persisted.
Any ideas?
chilbert
|
|
|
|
|
Additional information: Does anyone know if this could be related to Virtual PC 2007?
chilbert
|
|
|
|
|
Hi all,
Ive been working on a program that does a few easy equations but i am running into problems when i run into larger numbers where the numbers start to crash out. in the source below can you think of aything that i could change to stop this from happening.
secondly some times i have to display some larger numbers but when i convert to string i get it in scientific notation 234230000e^12 type stuff
is there anyway to just display it straight numbers??
below is my source code
Random random = new Random();
float X1, X2, X3, Y1, Y2, Y3;
//STEP3 MAKE RANDOM PNT1
X1 = random.Next(2,10000);
Y1 = random.Next(2,10000);
//STEP2 MAKE PNT2 WITH CONSTANT ( FROM TEXT BOX)
X2 = Convert.ToInt64(textBox7.Text);
Y2 = 0;
X3 = 1;
Y3 = 1;
//STEP4 GET SLOPE FROM PNT1 AND PNT2
float slope = (Y2 - Y1) / (X2 - X1);
float t = random.Next(2,10000);
//STEP5 GET RANDOM POINT ALONG LINE MADE PNT1 AND PNT2
X3 = t + X2;
Y3 = t * slope + Y2;
//OUTPUT TO TEXTBOX
textBox5.Text = t.ToString();
textBox6.Text = slope.ToString();
textBox1.Text = X1.ToString();
textBox2.Text = Y1.ToString();
textBox9.Text = X3.ToString();
textBox8.Text = Y3.ToString();
|
|
|
|
|
numbers have a finite range, if you go over, it breaks.
YEs, string.Format can be used to format number strings.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hey go with the data type of Decimal (or)Numeric instead of Float.
Because for Scientific Notation I usually go with Decimal.
Regards,
Satips.
|
|
|
|
|
For your first issue, change the float (7 digits) to double (15-16 digits). Next for your formatting issue, you can insert with the .ToString("formatting string")
Review this at: http://msdn2.microsoft.com/en-us/library/dwhawy9k(vs.71).aspx
Tim Heney
Meridian ID
theney@clearwire.net
|
|
|
|
|
Hi there! Help me, How to do insert an Equation Editor Object in to my Database? and how to show it on UIs?
|
|
|
|
|
What do you want to store in your database ? It sounds like a UI object, not a DB object.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want insert an Equation from "Equation Editor" of Microsoft Word into richtextBox. Then store content of that richtextBox in my Database.
Or if you have other ways bester, please teach me.thanks
(My english not good....;P)
|
|
|
|
|
Currently I am impersonating the web client by passing their default credentials in my C# code. I can do this by setting my web.config file to impersonate and IIS to Integrated Windows Authentication. BUT, (there's always a "but") some methods require the use of the Anonymous setting in IIS because they are using SYSTEM to perform other functions. Is there any way for me to use Anonymous authentication but also force Integrated Windows Authentication when I want without creating a second webservice?
Thanks,
Mike S.
|
|
|
|
|
Hope the Blog by ScottGu's [^] will help you.
Regards,
Satips.
|
|
|
|
|
You rock Satips! What was in the blog didn't help but it got me going in the correct direction. I found something in one of the replies that spoke about making changes to the web.config file. Upon further investigation I determined that I could force it to deny anonymous access to specific files and folders. It resulted in me adding the <location> element to my web.config file. I can specify that one page relatively so that it will not interfere with current installation procedures. My source came from http://support.microsoft.com/kb/316871. Hopefully this can help others with a similar issue:
<?xml version="1.0" standalone="yes"?>
<configuration>
<system.web>
<authentication mode="Windows" />
</system.web>
<location path="login.asmx">
<system.web>
<identity impersonate="true" />
<authorization>
<deny users ="?" />
</authorization>
</system.web>
</location>
</configuration>
|
|
|
|
|
hi
how to add a combo box (dropdownlist style) to a datagridview Cell?
thanks...hoping for your reply....
regards
jing
|
|
|
|
|
Hope the Article by René Paw Christensen Here[^] in CP will Help you.
Regards,
Satips.
|
|
|
|
|
Hello,
I am using the Managed DirectX implementation. to record and play wmv files.
I want to be able to record and view the real time video in one panel then be able to use another panel to seek back and view the history of the real time video.
I am able to do this no problem if I stop recording first, but not while recording. The file is not seekable if recording.
How would I go about doing this effectively. Or is there another solution that I should be looking at to accomplish this.
Thanks
|
|
|
|
|
There is no way you can hope to have your hard drive writing video as it captures, and at the same time ask it to read back and show a previous portion of the same file. The file is locked for writing, for a start, but there are real performance problems with what you hope to do.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: there are real performance problems with what you hope to do.
I dont really think so: a modern hard disk easily moves around over 100 MB/s;
it has a cache and typically is able to read/write entire tracks at once,
so having one writing stream and one reading stream simultaneously should pose
no problem; furthermore it is what a typical DVD-annex-harddisk recorder does
in "time slip" mode: recording a program while playing same program (or another one)
with a user-selectable delay.
So apart from the file being locked, if a Windows system cant cope, I would not blame
the hardware.
Regards,
|
|
|
|
|
I am doing some video capture work at the moment - AMD processor, dual core, 200 MB HDD, mostly empty, good video card. Trying to capture to WMV, or any compressed AVI, results in choppy video to the point of being unwatchable ( but it captures fine on a notebook ).
So, my mindset at the moment is that there can be issues that are hardware related, although I see you're right about the whole time slip thing.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I guess the problem is getting Windows to do the
necessary things on time every time, which is not easy
(if at all possible) on an OS that does not intend to be real-time.
|
|
|
|
|
Thanks for the input, but do you have a recommendation on what the best way of accomplishing this task?
I am trying to create a video surveillance type program where I am recording actions of a customer, but then be able to rewind to see a specific incident while continuing recording.
I am able to copy the currently recorded video file, but it doesn't contain any indexes.
I am new to directx and never used the sdk before. So maybe I missing some fundamental info on how to use it the best way.
Thanks
|
|
|
|