|
Colin,
Actually my logic avoids the if (x is y) by doing the cast and then comparing for null. So in the entire logic flow only a single cast occurs. However if there is no loop, I find no problem with also checking if (x is y) then do something. the logic is naturally self documenting -- and that takes precedence over performance (in Agile at least).
Michael
|
|
|
|
|
But you are still doing two checks, one before the cast on whether the object is null, and one after the cast to see if it is null due to an invalid cast - Henize was arguing against doing two checks. (I agree with your code and, like I said, It was an odd argument by Henize)
|
|
|
|
|
Hi All,
I'm a tester in a company (and programmer as well), and I have a small bizzare request ...
I'm checking a windows xp system (with admin. permission) and I have a test case that i'm requested not to move mouse or keyboard for 120 minutes (it's hard coded value that can't be changed) in order to see if the password protected screensaver will show up.
I want to write a small utility (C#) that will make the screensaver show up earlier by changing the time of mouse/keyboard not moved or any other solution (changing the system time with some delay didn't worked for me, I guess the screensaver is counting the seconds key/mouse not moved).
Thanks,
I hope someone have an idea.
|
|
|
|
|
Liron,
If I were you I would just wait 120 minutes and go for one or more beers
Gael
|
|
|
|
|
hehehehehe ... I wish ...
Just want ot be a little bit more effective :->
|
|
|
|
|
Liron Hirsch wrote: Just want ot be a little bit more effective
I would rather the program itself be more effective, like being able to change the idle time to something more reasonable. Why leave a computer open for 2 hours? Just how did the developers expect you to test this bit of functionality?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
you are right, but, this is the application for now and i need to handle the problem.
|
|
|
|
|
|
this is an obscure request. If you're lucky you might get something in a day or two. Expecting someone to have it right away is rather naive.
Assuming this is possible at all, I'm dubious, it would almost certainly have to be done via a win32 api call. The proper place to ask for them is the c++ forum.
|
|
|
|
|
dan neely wrote: it would almost certainly have to be done via a win32 api call.
What about bending the space time continuum?
led mike
|
|
|
|
|
That's a hardware implementation not software.
|
|
|
|
|
Agreed, but managers don't know the difference. :->
led mike
|
|
|
|
|
Wow...if something was important enough to protect with a password, leaving it open for 2 hours seems a little naive to me.
I'd just suggest setting up a separate computer (laptop per say) to do that portion of the test while you're working on the other test procedures.
|
|
|
|
|
Or use VMWare / VirtualPC and just leave it minimised
|
|
|
|
|
Whether or not this will work depends upon the method used for keeping track of time in the screensaver app. If it tracks the passage of time internally, then you're screwed.
How to: Get or Set the System Time[^]
[DllImport("kernel32.dll")]
private extern static void GetSystemTime(ref SYSTEMTIME lpSystemTime);
[DllImport("kernel32.dll")]
private extern static uint SetSystemTime(ref SYSTEMTIME lpSystemTime);
private struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
private void SetTime()
{
SYSTEMTIME systime = new SYSTEMTIME();
GetSystemTime(ref systime);
systime.wHour = (ushort)(systime.wHour + 2 % 24);
SetSystemTime(ref systime);
}
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Can we create the object of a class programatically. I want to create the object of a form. It's name is strored in the database. At run time how can i create
the object of that form?
Awaiting for a replay
Regards,
Hari
|
|
|
|
|
hi
i don't see any problem here, try this
if(MyCondition == true)
{
myClass temp = new myClass;
}
hople it will help you...
Tamimi - Code
|
|
|
|
|
Thanks for your replay. Actully i want to create the object of a from, whose name is stored as a string in the databse.It is unknown to me while writing the code. so i can't use 'myClass temp = new myClass;' as you mentioned. Let me have your idea regarding this
Regards
Hari
|
|
|
|
|
All forms inherit from System.Windows.Forms.Form. So just do this, assuming this is an MDI application (which is the only logical architecture to use this in).
...
System.Windows.Forms.Form newForm = Activator.CreateInstance(FormsCollection[requestedForm]);
newForm.MDIParent = this;
newForm.Show();
...
|
|
|
|
|
Look up Type.GetType and Activator.CreateInstance
|
|
|
|
|
hi everybody,
My question deals with xml and xpath use, i have an xml stream as it represented below:
<RESULTAT>
<node>
<DATE_ANNE>2000</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC120</NOM>
</node>
<node>
<DATE_ANNE>2000</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC121</NOM>
</node>
<node>
<DATE_ANNE>2000</MVT_DATE>
<TYPE>T</TYPE>
<NOM>EPAC122</NOM>
</node>
<node>
<DATE_ANNE>2001</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC123</NOM>
</node>
<node>
<DATE_ANNE>2001</MVT_DATE>
<TYPE>O</TYPE>
<NOM>EPAC124</NOM>
</node>
<node>
<DATE_ANNE>2002</MVT_DATE>
<TYPE>P</TYPE>
<NOM>EPAC125</NOM>
</node>
<node>
<DATE_ANNE>2002</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC126</NOM>
</node>
<node>
<DATE_ANNE>2002</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC127</NOM>
</node>
<RESULTAT>
i want to select all node wish have DATE_ANNE = 2000 and TYPE = I i've read in some articles that is possible using this code
string xPathquery="/RESULTAT/node/DATE_ANNE='2006' AND TYPE='I'";
XmlNodeList nodeList = doc.SelectNodes(xpathQuery);
i want to get a list like that
<RESULTAT>
<node>
<DATE_ANNE>2000</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC120</NOM>
</node>
<node>
<DATE_ANNE>2000</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC121</NOM>
</node>
<node>
<DATE_ANNE>2001</MVT_DATE>
<TYPE>I</TYPE>
<NOM>EPAC123</NOM>
</node>
..............
but it doesn't work can some one explain wether it's possible to obtein such result using Xpath in .NET.
best regards!!
|
|
|
|
|
Hi, try
/RESULTAT/node[DATE_ANNE='2000' and TYPE='I']
|
|
|
|
|
great thanks!! it works
|
|
|
|
|
Can I safely assume that if I write a small program in C# that uses SQL Express for its database, that it will run nicely on a pentium III 1.0 GHz with 128 - 256 MB of memory? Or is it wiser to use MS Access instead?
Because all programs I created up until today using C# or .NET in general run on at least a P4 machine with 256 MB memory, which is indeed considerably faster
WM.
What about weapons of mass-construction?
|
|
|
|
|
It's wiser to add a ton more memory.
|
|
|
|