|
THE QUESTION IS HOW? how can I map it .. I need a simple code/process for that please
|
|
|
|
|
there is a command in xp, use it like this :
net use k: \\friendscomputer\c\public
run it using Process.Start
|
|
|
|
|
Teach me like a kid. e/g/ go to command prompt. Please how
|
|
|
|
|
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "net.exe";
psi.Arguments = "use k: //friendsname/sharename";
Process.Start(psi);
|
|
|
|
|
The way stancrm has suggested should work, but you need to have that path set to share on the target computer. I don't think (or atleast would hope) you can do that with any code from your computer for security reasons
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Disclaimer: This separate yet related to a question I posted in the LINQ forum, but since its regarding a different issue (ListBox) it can't be considered cross posting.
I'm sure this is a simple issue, but I'm completely stumped.
Essentially, what I'm trying to do is have people move items between ListBoxes which are bound to Lists. One ListBox contains the items selected by the from the full list and the other contains the rest of the items from the full list, where originally, the second list box contained the full list (on the assumption that the user has not made any selections)
here's the code:
List<RCH.EL.EMR.Allergies> AllAllergies
{ get; set; }
List<RCH.EL.EMR.Allergies> RemainingAllergies
{ get; set; }
List<RCH.EL.EMR.Allergies> PatientAllergies
{ get; set; }
private void ResolveAllergies()
{
RemainingAllergies = AllAllergies.Except(PatientAllergies).ToList();
}
protected override void BindListBoxes()
{
lstAllergies.DataSource = RemainingAllergies;
lstAllergies.DisplayMember = "AllergyAr";
lstAllergies.ValueMember = "ID";
lstPatientAllergies.DataSource = PatientAllergies;
lstPatientAllergies.DisplayMember = "AllergyAr";
lstPatientAllergies.ValueMember = "ID";
}
private void btnAddLeft_Click(object sender, EventArgs e)
{
PatientAllergies.Add((RCH.EL.EMR.Allergies)lstAllergies.SelectedItem);
ResolveAllergies();
lstAllergies.Refresh();
lstPatientAllergies.Refresh();
BindListBoxes();
}
private void btnAddRight_Click(object sender, EventArgs e)
{
PatientAllergies.Remove((RCH.EL.EMR.Allergies)lstAllergies.SelectedItem);
ResolveAllergies();
lstAllergies.Refresh();
lstPatientAllergies.Refresh();
BindListBoxes();
}
As you can see, the Lists (not ListBoxes) are of the exact same type, so why the heck isn't the ListBox named lstPatientAllergies not binding properly? By that I mean that I can see that the lstPatientAllergies.DataSource has the proper number of elements and indeed the proper elements, but the lstPatientAllergies.Items is empty and always equals 0.
Ideas?
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Try this:
Add two BindingSource Components to your Form (remainderBindingSource and patientBindingSource, for my mods below)
protected void BindListBoxes()
{
this.remainderBindingSource.DataSource = RemainingAllergies;
lstAllergies.DataSource = this.remainderBindingSource;
lstAllergies.DisplayMember = "AllergyAr";
lstAllergies.ValueMember = "ID";
this.patientBindingSource.DataSource = PatientAllergies;
lstPatientAllergies.DataSource = this.patientBindingSource;
lstPatientAllergies.DisplayMember = "AllergyAr";
lstPatientAllergies.ValueMember = "ID";
}
private void btnAddLeft_Click(object sender, EventArgs e)
{
patientBindingSource.Add((RCH.EL.EMR.Allergies)lstAllergies.SelectedItem);
remainderBindingSource.Remove((RCH.EL.EMR.Allergies)lstAllergies.SelectedItem);
}
I'm sure that a man of your calibre can work the rest out.
Hope this helps!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Will do, but why the heck did this happen in the first place? I'm flabbergasted and befuddled.
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Conceivably you could also do this by deriving your own collection class:
<pre>
public class AllergyCollection : List<RCH.EL.EMR.Allergies>
{
}
</pre>
or better yet:
<pre>
public class AllergyCollection : BindingList<RCH.EL.EMR.Allergies>
{
}
</pre>
and then implementing the <code>IRaiseItemChangedEvents</code> interface, but it's one heck of a lot of work, and <code>BindingSource</code> does it all already.
<blockquote class="FQ"><div class="FQA">Mustafa Ismail Mustafa wrote:</div>but why the heck did this happen in the first place</blockquote>
The problem is that the <code>DataSource</code> property of the <code>ListBox</code> is <b>probably</b> implemented like this:
<pre>
public object DataSource
{
get
{
return this.datasource;
}
set
{
if (this.datasource != value)
{
this.datasource = value;
// now do loads of stuff that only happens if the datasource is a different object
}
}
}
</pre>
in your case, setting the <code>DataSource</code> to the same object (albeit modified) means the test fails and nothing is changed.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: and then implementing the IRaiseItemChangedEvents interface, but it's one heck of a lot of work, and BindingSource does it all already.
That's why I opted for the ready solution of the list box, before I encountered that snag.
Henry Minute wrote: The problem is that the DataSource property of the ListBox is probably implemented like this:
I don't think so, the reason being I actually tried setting the DataSource to null and then resetting it the List<t> I had, and it still wouldn't work.
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Mustafa Ismail Mustafa wrote: I don't think so, the reason being I actually tried setting the DataSource to null and then resetting it the List I had, and it still wouldn't work.
Interesting!!
I'm wrong again. In that case I have no clue. Computers, hey.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: I'm wrong again.
Don't sweat it, I'm wrong more often than not
Henry Minute wrote: Computers, hey. Laugh
Yep.
Sometimes, I wonder why I didn't listen to my mom and turned out a surgeon or carried on to study Organic Chemistry as a major!
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Works like clock-work
Mucho thank you!
But WHY DID that strange occurrence happen?
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
See my reply to your previous message, sorry about the formatting, I bollixed up the HTML Tags Checkboxes.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Can someone help me on how to match an entered string to a regex pattern?
I'm creating a program that would parse a for loop statement and check if the entered for loop statement is correct or not. So far I've been able to split that statement and pass it into an array. I then pass it again to a string variable after i put the splitted statement into that array. My only problem is how to check if the entered for loop statement is correct? I've been trying lots of pattern matching codes from the web but none of them have worked so far. The deadline will be next week but until now there hasn't been any progress.
My pattern isn't done yet too because i can't make a pattern that would match the >=, <= relational operators and the '--', '++' unary operators.
To make things easier, this is my code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
namespace MachineProblem
{
class Program
{
static void Main(string[] args)
{
string passedStatement = " ";
string[] stringHolder = null;
GetStatement(stringHolder, ref passedStatement);
SyntaxVerifier(stringHolder, ref passedStatement);
Console.Read();
}
public static void GetStatement(string[] arrayBox, ref string statement)
{
Console.WriteLine("Write an example of a for loop statement: ");
statement = Console.ReadLine();
foreach (string token in Tokenizer(arrayBox, statement))
{
}
}
public static string[] Tokenizer(string[] strBox, string tokenizeStatement)
{
strBox = null;
Regex strTokenizer = new Regex(@"([\;\(\)\ \\])");
for (int i = 0; i < strTokenizer.Split(tokenizeStatement).Length; i++)
{
strBox = strTokenizer.Split(tokenizeStatement);
}
return strBox;
}
public static void SyntaxVerifier(string[] arrayString, ref string passedsyntax)
{
string pattern = @"(for\s*[\(]\s*int\s*[a-zA-Z\d]*\s*=\s*[\d]*\s*;\s*[a-zA-Z\d]*\s*[\<\>]\s*[\d]\s*;\s*[a-zA-z\d]*\s*[\-(1)])";
string stringStatement = "for(int x=0; x<5; x++) Console.WriteLine(\"Hello\")";
foreach (string words in arrayString)
{
stringStatement = words;
stringStatement.Trim();
}
}
}
}
Thanks in Advance for those who could help
|
|
|
|
|
I have not tried to parse a for loop before but if I was to do it I would start by extracting the data between the for loops brackets (ensure you get the matching close bracket).
Then I would split it into three parts (using string.Split method with a semi-colon)
Then attempt to parse each part individually...
There also seems to be a number of things you may have overlooked such as; int is not the only valid datatype, the variable may be declared elsewhere thus meaning no datatype should be present, variable names can contain more than leters, there are more evaluation options than > and < etc...
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I forgot to include that my parser program is created to parse just a simple for loop statement. it doesn't have to cover all of the possible examples of a for loop statement. We were instructed to only have one line statement after the for loop syntax meaning we don't have to include the open and close curly brackets.
example:
for(int abc989 = 10; abc989 >= 0; abc989--) Console.WriteLine("*");
or
for(int abc989 = 0; abc989 < 50; abc989++) Console.WriteLine("HelloWorld\n");
Those example are the only ones we can do at the moment since we're not in compiler design yet. We were given this kind of machine problem to apply one data structure which is a parse tree.
|
|
|
|
|
gamer1127 wrote: We were given this kind of machine problem to apply one data structure which is a parse tree.
Then why don't you use a parse tree, rather than try to force a regex to do the work?
forLoop
|--------------|--------------------------------------------------|
"for" LoopConstruct Statement
|-------|------|-----|--------|------|------|
"(" Init ";" EndCond ";" Step ")"
etc.
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
|
|
|
|
|
I agree - RE's are really the wrong tool for this job, unless your lecturer/tutor is insisting you use them (although I'd be wondering why).
You say you're "not into compiler design yet" on your course, but I presume it's coming up eventually, and when it does you don't want to start off down the wrong road.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Do you know any good source that i can read about parse tree?
|
|
|
|
|
Google
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
hehehe....i'm doing it right now...but i can't determine if that source is good or not...
|
|
|
|
|
http://en.wikipedia.org/wiki/Parsing[^]
THis looks useful - got by googling 'parse tree compiler'
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
I am implementing a SerializationBinder.
In public override Type BindToType(string assemblyName, string typeName) I am passed type name such as:
<code>System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</code>
Which I like to decompose in:
typename: System.Collections.Generic.Dictionary
2 generic type argument
assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
typename: System.Int32
assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
typename: System.String
Is there some utility class which will do that for me?
Or an article with some parser?
Any link?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Well, I'm a complete beginer with Irony ( Irony[^] ),
so I don't know if I would manage to do something with it.
Nonetheless it is so easy to use that I was able to guess / write this following type name parser in 90 minutes...
[Language("Type FullName", "1.0", "serialization type name")]
public class TypeNameGrammar : Grammar
{
public TypeNameGrammar()
: base(true)
{
var typeName = new NonTerminal("TypeName");
this.Root = typeName;
var ident = new IdentifierTerminal("identifier");
var number = new NumberLiteral("number", NumberFlags.IntOnly);
var token = new IdentifierTerminal("token", "0123456789", "");
var optionalGenericType = new NonTerminal("GenericPart");
var optionalAssembly = new NonTerminal("Assembly");
var typeParameters = new NonTerminal("TypeParameters");
var fullName = new NonTerminal("fullname");
var aversion = new NonTerminal("aversion");
var acult = new NonTerminal("acult");
var atok = new NonTerminal("atok");
typeName.Rule = fullName + optionalGenericType + optionalAssembly;
optionalGenericType.Rule =
Empty
| Symbol("`") + number + "[" + typeParameters + "]";
optionalAssembly.Rule =
Empty
| Symbol(",") + fullName + "," + aversion + "," + acult + "," + atok;
typeParameters.Rule =
typeParameters + "," + "[" + typeName + "]"
| Symbol("[") + typeName + "]";
fullName.Rule =
fullName + "." + ident
| ident;
aversion.Rule = Symbol("Version=") + number + "." + number + "." + number + "." + number;
acult.Rule = Symbol("Culture=") + ident;
atok.Rule = Symbol("PublicKeyToken=") + token;
}
}
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|