|
Hey,
Thanks, actually, I wanted to mention RegEx in my question but I wasn't sure I needed it in my case, can you tell me though how to reference the library in full cuz I can only get System.Text.RegularExpressions but not the .RegEx it doesnt branch anymore from that, besides, can you kindly link me to a good tutorial/reference to using RegEx.
Thanks mate!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
If you use the RegularExpressions namespace, RegEx is a class with static methods which he is calling.
The O'Reilly book 'mastering regular expressions' is the best resource available on the topic.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: O'Reilly book...
Hmmm, I should get one today, thanks Christian!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Still cant get it , I tried to play around with it but I screwed it..
Listen, I'm sorry but can you get me ip address alone out of the following??
Received: from [82.114.186.143] xxxxxxxxxxxxxxxx
Thanks again mate!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Well, I don't know much at all about Regex, but it seems to me that you'd try to find out if there's a way to say "give me everything between the brackets". There must be a wildcard character that does this. The example provided earlier that shows how to get everything between the '#' characters would give you a stepping off point.
Be a programmer, and work it out.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
i have added an Enum as a property in a class then attach that class to PropertyGrid. It shows a combobox in PG but problem is that whenever i select any item from that combobox, its text keep blank. I used a TypeConverter for that class. Anybody know how to solve this ?
here is code
class ProperyConverter : TypeConverter
{
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context,
object value, Attribute[] filter)
{
return TypeDescriptor.GetProperties(value, filter);
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
}
[TypeConverter(typeof(ProperyConverter))]
class ABC
{
object[] data;
public ABC(object[] data)
{
this.data = data;
}
public override string ToString()
{
return data[0].ToString();
}
public MYEnum AAA
{
get { return (MYEnum)Convert.ToInt32(this.ToString()[0]); }
set { setValue(0, ((int)value).ToString()); }
}
}
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Please post the code, it should work the way you described
Regards,
Lev
|
|
|
|
|
first post updated
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
The problem seems to be in your property getter/setter.
I've changed the code and it works great (don't know you setdata func, so I just assigned the stuff):
get { return (MYEnum)Convert.ToInt32(data[0]); }
set { data[0] = value; }
BTW, getting the value of data, via ToString() is not that good, you've got the private data anyway
BTW2, you do not have any checks on the array, what if I init the ABC class with empty array?
Regards,
Lev
|
|
|
|
|
Lev Danielyan wrote: BTW2, you do not have any checks on the array, what if I init the ABC class with empty array?
setValue() have everything
Lev Danielyan wrote: get { return (MYEnum)Convert.ToInt32(data[0]); }
nope, you cannot Convert direct from object to int32 AFAIK because its type string...
Lev Danielyan wrote: I've changed the code and it works great
what you mean by works great ? doest it shows the selected enum or still blank ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Xmen wrote: nope, you cannot Convert direct from object to int32 AFAIK because its type string...
It is not string in your code, it is object. Convert.Toint32 has an overloaded version to get object, even if it didn't it will work if you have strings or any other types that toint32 "understands".
Xmen wrote: what you mean by works great ? doest it shows the selected enum or still blank ?
When I ran you code the current selection was blank, but it wouldn't let me choose any other option (when i was clicking on any combo item it wasn't "fixing" it as current selection), in the code I posted the initial selection was also blank but it was keeping the selection from combo items. Isn't it what you wanted?
Regards,
Lev
|
|
|
|
|
Lev Danielyan wrote: but it was keeping the selection from combo items.
i dunno what are excatly you saying but my problem is just that its not showing selected item, eg when you select an item from combobox, it get appear infront of dropdown arrow. But this time in PG its not happening, when i select item, it does some calculations but doest appear selected(infront of dropdownbutton)
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hmm , it appears on my side (screen[^])
Maybe there are problems in the code you haven't posted?
Regards,
Lev
|
|
|
|
|
did you change the Type Converter ?
here is the screen of mine, blank even after selecting
http://img95.imageshack.us/my.php?image=62694072re0.png[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i found the problem + solution
Convert.ToInt32(this.ToString()[0])
this.ToString()[0] string is returning a char and then when Convert class convert that char to ascii value to the value it has and that Enum do not has that value thats why its blank.
while if i use this.ToString().Substring(0,1) it works
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I still don't get why are you getting the internal data via ToString.
This is not the right thing to do.
Quoting MSDN "This method returns a human-readable string that is culture-sensitive", not more, you better redesign your class to get rid of this
Regards,
Lev
|
|
|
|
|
Lev Danielyan wrote: I still don't get why are you getting the internal data via ToString.
hehe because you didnt read code carefully, the code needs to rip one char from string then convert it to int then Enum. eg here is my string "1234"
i dont need 1234 as number, i'll need 1, 2, 3 and 4, so without converting it to string it wont happen. And i use this.ToString() because its same as data[..............].ToString(), i didnt use it because the line will be larger because i use some calculation to get the index.eg.
Override ToString()
{
return data[long .............. calculation].ToString();
}
Now which is better in appearing
Convert.ToIn32(data[long .............. calculation].ToString().Substring(0,1)); // long calculation again, breaking OOPS rule
or
Convert.ToIn32(this.ToString().Substring(0,1));
both does same, just last one calls one more method that is this.ToString() and i dont think its a bad idea
hope you got me
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Ok, I got you now, but you can as well use a property, or some other method, which doesn't mean to be overriden. But hey, it's you code
Regards,
Lev
|
|
|
|
|
Lev Danielyan wrote: But hey, it's you code
hehe, dude i override because when i attach that class to propertygrid, then it will show that string as value. If i dont then there will be my classname "MyNamespace.ClassName"
hope you got me again
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Oops, sorry, my code was setting the initial choice also.
For example, for the following ABC class initialization:
propertyGrid1.SelectedObject = new ABC(new object[] {"0","1"});
and for following MYEnum enum:
enum MYEnum {
op1,
op2
}
I was getting op1 as initial selection in property grid
Regards,
Lev
|
|
|
|
|
I have a project server 2007. using its event handler i want to run "notepad" against some perticular event (trigerred by project professional). The project server is running an eventing service, under the user "domainAdmin", that processes the event handlers registered to the project server. Event handler is written as a class library and the generated dll is registered in the project server's event handler. Following is the code which launch the notepad exe in the task manager but without any window ....
public override void onpublish(PSContextInfo ps, ProjectPostPublishEventArgs e)
{
SecureString ssPwd = new SecureString();
foreach ( char c in "password" )
ssPwd.Append(c);
Process myProcess = new Process();
myProcess.StartInfo.FileName = "Notepad.exe";
myProcess.StartInfo.CreateNoWindow = false;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.StartInfo.LoadUserProfile = true;
myProcess.StartInfo.Domain = "myDomain";
myProcess.StartInfo.User = "domainAdmin"; // domain administrator
myProcess.StartInfo.Password = ssPwd;
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
myProcess.StartInfo.UseShellExecute = false;
myProcess.Start();
}
Any help ???
Madni
|
|
|
|
|
Is this running as a Windows Service? If so, you need to goto the Services MMC and check the box under that service that says something like Allow Desktop Interaction. That should do the trick.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
thanks for reply, ... yes the event handler is running as a service. I couldn't find in its properties where to check the box to allow interaction with the desktop. can you please guide .. thanks
Madni
|
|
|
|
|
Windows Services run under a different desktop than the one the user sees. Any window or process launched from that service will appear on that alternate desktop. There is no "switch" to throw to see that desktop.
Like the other poster said, there's an option to allow the service to interact with the desktop, but, this may not be a good idea to turn on. This opens possible security concerns with a service being allowed different permissions than the user that is logged in.
Also, what if there is no user logged into the machine?? What's this code going to do in the event it never gets a response?? How will this service track the number of Notepad instances that it launched?? Yada, yada, yada, ... Basically, if your service needs to interact with the user, it's best done through interprocess communication between the service and a seperate interface app that the user launches, not through "Allow interact with desktop".
|
|
|
|
|
Dear Dave thanks for reply, I've tried this via interprocess communication as well. but that didn't work either. I created separate console based executable, responsible for launching notepad, and launched console from within the event handler. The problem persisted with the same results; the console exe appears in the task manager without its appearance... any help
Madni
|
|
|
|
|