|
Thx for your reply;
I want parse this sentence and some other sentence like this to these segment:
sentence : grandparant(X,Z):-parant(X,Y),parant(Y,Z).
segment : father X Y parant X Y parant Y Z
(variable X,Y,Z,.. must be upercase)
what is the best way?
Note:I think that if i want to use Regex , i must searh some particular expression but i want to parse any expression like above.
modified on Friday, January 22, 2010 4:59 AM
|
|
|
|
|
A regex is probably the easy way:
(?<Parent>(?<PName>\w+)\((?<PX>.+),(?<PZ>.+)\)):-(?<Children>.*)
This does not do the complete job: It breaks it into "Parent" which consists of "PName" and "PX" and "PZ", and "Children" which is everything else. It is pretty simple to expand to break the children down as well, but I don't have the time to do everything for you! Get a copy of Expresso[^]which will help you understand what is going on - it's free and really works well.
Then all you have to do is slide that into your C# and it should do the parse for you!
After that, a bit of validation, and you are away.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
i am having mesh of a man ...
i want to make that mesh to walk based on mouse click of the mouse..
thank's
|
|
|
|
|
You are welcome!
|
|
|
|
|
The table (Password) has only 1 column (Password1) and only 1 row. It is also the PrimaryKey.
I can retrieve the password:
thePassword =
from tt in MainMenu.db.Password
select tt;
try
{
password = thePassword.ElementAt(0).Password1;
...
I am trying to change the value.
if ((from tt in MainMenu.db.Password
select tt).Count() > 0)
{
Password zz = MainMenu.db.Password.Single();
zz.Password1 = newPassword;
try
{
MainMenu.db.SubmitChanges();
}
...
I get the runtime error "A member defining the identity of the object cannot be changed ..."
|
|
|
|
|
as a practice, password column shouldn't be the primary key because you may want to change it later. Also, more than one users can have the same password.
Usually username could be used as a key or simply adding a new id.
Nigel Mackay wrote: I get the runtime error "A member defining the identity of the object cannot be changed ..."
Looks like that you are trying to change the password => primary key..
|
|
|
|
|
Removed the primary key assignment. Still gives same problem.
There is only one password in this app, and it is not there to discriminate between users, it is there because certain dangerous operations require a password so that only competent workers can do them!!
Just think of it as a table that stores only 1 string.
|
|
|
|
|
Found problem. Must have a Primary Key, so added another column to be the primary Key and it works.
|
|
|
|
|
Som Shekhar wrote: Usually username could be used as a key or simply adding a new id.
I suggested you that... You said you tried it?
Nigel Mackay wrote: Found problem. Must have a Primary Key, so added another column to be the primary Key and it works.
|
|
|
|
|
I actually misinterpretted your answer, seeing only the bit about not using password as the primary key, and not adding another column for userID, because I don't need it, as I ony have one password.
I later remembered that inserts, deletes and changes only work if there is a primary key.
So I have a column for primary key with only 1 row in the table. And it will always only be 1 row!!
|
|
|
|
|
You always need an ID as a primary key. Even if you don't need it, always make it a point to add a key. There has to be one column in any table with unique values. Just as a practice. its a good habit.
|
|
|
|
|
Every now and again one forgets
|
|
|
|
|
i'm trying to create a code group for CAS, i created a key file using sn.exe. and assigned that key to the assembly using
[assembly: AssemblyKeyFile(@"C:\caskey.snk")]
and built the project. but when i'm trying to create the code group using the strong name by importing the assembly file it says "The import failed. the assembly does not appear to be valid"
can any one tell me what might be wrong...
|
|
|
|
|
thanx for all who worked on solving my problem, i found the cause, it was version incompatibility.
i used the vs 2008 and framework 2.0 and the mscorcfg.msc was framework 1.1 ,that was the cause ..
|
|
|
|
|
Hi,
How to get a list of all the shared folder and get the share permission for each one?
I tried to use ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_LogicalShareSecuritySetting");
But the line of code above does not return shared folder created by code. If i manually create the folder and set it as Shared folder through windows, the shared folder can be obtain from Win32_LogicalShareSecuritySetting. Just for information, the share and security setting for both folder created through code and manually created is the same. But if the shared folder created using code, it fails to return using Win32_LogicalShareSecuritySetting.
If i use Win32_Share, i'm able to get all the share folders but the problem is i cannot use the method ("GetSecurityDescriptor") below to obtain the AccessMask or the share permission information. It will throw exception because GetSecurityDescriptor is not a method under Win32_Share:
ManagementBaseObject outParamsMthd =
m.InvokeMethod("GetSecurityDescriptor", null, options);
Below is the code snippet to obtain shared folder permission information for user name "Everyone"
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_LogicalShareSecuritySetting");
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
string shareName = m["Name"].ToString();
string shareLocalPath = ShareManager.GetShareLocalPath(shareName);
Console.WriteLine(shareLocalPath);
if (folderPath == shareLocalPath)
{
InvokeMethodOptions options = new InvokeMethodOptions();
ManagementBaseObject outParamsMthd =
m.InvokeMethod("GetSecurityDescriptor", null, options);
ManagementBaseObject descriptor =
outParamsMthd["Descriptor"] as ManagementBaseObject;
ManagementBaseObject[] dacl = descriptor["DACL"] as
ManagementBaseObject[];
foreach (ManagementBaseObject ace in dacl)
{
ManagementBaseObject trustee = ace["Trustee"] as
ManagementBaseObject;
string domain = (string)trustee["Domain"];
if ((string)trustee["Name"] == "Everyone")
{
UInt32 mask = (UInt32)ace["AccessMask"];
string enumMask = System.Enum.Format(typeof(Mask), mask, "g");
if (enumMask.Contains("WRITE"))
{
return true;
}
}
}
}
Thanks in advance
modified on Thursday, January 21, 2010 11:17 PM
|
|
|
|
|
I am sure this is an easy fix, I am not able to run any C# program, that i have compiled at home, on my work machine. I have previously been able to run them on other work computers but this one i cannot. It is a pretty crappy computer running XP. I am sure that it is just an update i am missing. It seems to have .Net 2.0. Can anyone help?
|
|
|
|
|
viciouskinid wrote: It seems to have .Net 2.0.
If you're not sure, you have to make sure. Navigate to C:\Windows\Microsoft.NET\Framework and look to for the folder names. Each will tell you which version of the framework is installed.
You also didn't say which version of Visual Studio you used to write your apps. If it's 2003, then you have to have .NET 1.1 installed. If 2005, .NET 2.0. If 2008, then it depends on your projects settings. 2008 can target 2.0, 3.0, and 3.5.
|
|
|
|
|
You might be referencing a third party dll (not MS) or something which is available on your home computer but not on the 'crappy' one.
Now...bring me that horizon. And really bad eggs...Drink up me hearties, YO HO!
|
|
|
|
|
|
Try to make you're project in .NET 3.0
I have the same issue at a moment, and this solve it
|
|
|
|
|
hi
i have some visual-studio 2008 question
1. is VS2008 can open VS2005 projects ?
2. is it be possible to install VS2008 on mini laptop ? (intel atom, 2G DDR)
3. if VS2008 isnt work, is it take any resource ?
thank's in advance
|
|
|
|
|
1. Yes (it coverts them)
2. Yes (but it may run a little sluggish)
3. No, only drive space.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I have VS2008 Express Editions running on a 1GB atom N270 netbook; yes, the CPU power is limited, however the limited screen size is my main concern for extensive work; such netbook is fine for applying code modifications in the field.
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. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
If you install SQL Server with it, it may take some memory if the server starts automatically. However, you can turn that off using the configuration manager.
|
|
|
|
|
|
hi, in cyber-cafe software I'm currently working on, I store order information in sql. There are some other information that needs to be stored (like; time,duration,price,cash,on/off,total charge AND configuration settings etc.) I look for the best practice without sacrificing the performance. Is the best place to store them Registry, Sql or other?
Thanks in advance
|
|
|
|