|
Has anyone seen a program that will tell you the FLOPS of a processor in C#?
|
|
|
|
|
I'm having a slight problem with flags. I downloaded a small class from CP called Task Scheduler. It contains an enum called DaysOfTheWeek. This enumeration contains all the seven days of the week. This enumeration has the Flag option set to on and as i read somewhere, multiple flags can be passed at once by using the pipe operator (|). Now the class contains a function which takes the enumeration DaysOfTheWeek as a parameter. When I have to call the function, I can easily do so by writing
TestFunction(DaysOfTheWeek.Monday)
That was easy. Now, I have seven check boxes on my form called chkSunday, chkMonday....chkSaturday. Now, I have to call the function by passing the flags which in turn depend on the check boxes that are selected. For example, if the user has selected chkMonday and chkSunday, I would call the function like this
TestFunction(DaysOfTheWeek.Monday | DaysOfTheWeek.Sunday)
This is where the the problem lies. i can't possibly write a set of if else statements that take into account all the possible combinations of checkboxes being selected and appropriately calling the function. How do I do this?
I thought of this but it doesnt work:
<br />
TaskScheduler.DaysOfTheWeek enmDays;<br />
if (chkSunday.Checked == true)<br />
enmDays = enmDays | DaysOfTheWeek.Sunday;<br />
if (chkMonday.Checked == true)<br />
enmDays = enmDays | DaysOfTheWeek.Monday;<br />
if (chkTuesday.Checked == true)<br />
enmDays = enmDays | DaysOfTheWeek.Tuesday;<br />
if (chkWednesday.Checked == true)<br />
enmDays = enmDays | DaysOfTheWeek.Wednesday;<br />
if (chkThursday.Checked == true)<br />
enmDays = enmDays | DaysOfTheWeek.Thursday;<br />
if (chkFriday.Checked == true)<br />
enmDays = enmDays | DaysOfTheWeek.Friday;<br />
if (chkSaturday.Checked == true)<br />
enmDays = enmDays | DaysOfTheWeek.Saturday;<br />
TestFunction(enmDays);<br />
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Mridang Agarwal wrote: i can't possibly write a set of if else statements that take into account all the possible combinations of checkboxes being selected and appropriately calling the function.
Yes, you can. It's only 128 combinations. I can very well understand if you don't want to do it, but it's clearly possible to do.
---
b { font-weight: normal; }
|
|
|
|
|
Why not just use a loop?
ArrayList checkBoxes = new ArrayList();
chkSunday.Tag = DaysOfTheWeek.Sunday;
checkBoxes.Add (chkSunday);
...
chkSunday.Tag = DaysOfTheWeek.Saturday;
checkBoxes.Add (chkSaturday);
DaysOfTheWeek selectedDays = DaysOfTheWeek.None;
for (int nDay=0; (nDay < checkBoxes.Count); nDay++) {
CheckBox cb = checkBoxes[nDay] as CheckBox;
if (cb.Checked) {
if (selectedDays == DaysOfTheWeek.None)
selectedDays = (DaysOfTheWeek) cb.Tag;
else
selectedDays |= (DaysOfTheWeek) cb.Tag;
}
} /ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
There isn't a DaysOfTheWeek.None . What do I do now?
|
|
|
|
|
Make up your own enum (eg: MyDayOfTheWeek ) or use a set of days of the week, where the empty set implies "no day selected".
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
bool checkMonday = true;
bool checkTuesday = true;
bool checkWednesday = true;
bool checkThursday = false;
bool checkFriday = false;
bool checkSaturday = false;
bool checkSunday = true;
DaysOfTheWeek day=(DaysOfTheWeek)0x00;
day |= (DaysOfTheWeek)((checkMonday ? 0x01 : 0x00) << Convert.ToInt32(DaysOfTheWeek.Monday));
day |= (DaysOfTheWeek)((checkTuesday ? 0x01 : 0x00) << Convert.ToInt32(DaysOfTheWeek.Tuesday));
day |= (DaysOfTheWeek)((checkWednesday ? 0x01 : 0x00) << Convert.ToInt32(DaysOfTheWeek.Wednesday));
day |= (DaysOfTheWeek)((checkThursday ? 0x01 : 0x00) << Convert.ToInt32(DaysOfTheWeek.Thursday));
day |= (DaysOfTheWeek)((checkFriday ? 0x01 : 0x00) << Convert.ToInt32(DaysOfTheWeek.Friday));
day |= (DaysOfTheWeek)((checkSaturday ? 0x01 : 0x00) << Convert.ToInt32(DaysOfTheWeek.Saturday));
day |= (DaysOfTheWeek)((checkSunday ? 0x01 : 0x00) << Convert.ToInt32(DaysOfTheWeek.Sunday));
TestFunction(day);
-- modified at 22:12 Wednesday 29th March, 2006
|
|
|
|
|
hi!
I'm doing a project in image processing. I have implemented sobel edge detection.But the edge is not thin.
I tried to implement canny edge detection. But I don't understand how to do non maximum suppression.If anyone has canny edge detection implemented please please share it.
any edge tracking algorithm for thinning the edges will be helpful.
signing off is preci
|
|
|
|
|
|
Thankyou Ravi.
I have already been to the links the you have specified.I have also implemented canny edge detection in vb.net but the results are not good, meaning the edges are not thin (preferably a single line of pixels).
Is there some way to do that? Non maximum suppression is not very helpful. If you know how to track the edges please help.It's urgent.
signing off is preci
|
|
|
|
|
Sorry, my knowledge of image processing resembles the null set.
That being said, have you seen the Rothwell[^] method? Any better than Sobel and canny?
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi again!
I have worked around the problem.I added some new conditions and some new ideas and the results were good.But I still work to do.I greatly appreciate your help. Thank you
again!!
signing off is preci
|
|
|
|
|
I want to get computer name, but i dont know how to do.
help me!
Thanks a lot
superdragon
|
|
|
|
|
I have found it, i used SystemInformation.ComputerName to get computername
superdragon
|
|
|
|
|
i have chekedlistbox, it has some items in it,when it runs, after checking some items, i want to indecate which items is checked, but i dont know what properties to indicate that.
please help me to solve it.
Thanks for helpings.
superdragon
|
|
|
|
|
i have found it. Thanks everyone!
superdragon
|
|
|
|
|
I'm not even sure how to ask this but i've got a problem that has me stumped and i'm hoping someone can shed some light on it.
I've got a winform application written in c# 2.0 that has most of it's content and controls wired to a remote sql server 2000 database. now there is one specific control tha is acting weird on another computer it's a standard NumericUpDown Control when the form it belongs to is shown it's min and max value as well as it's current value are set based on criteria from the main form. now i've run the program on windows xp, xp 64 and server 2003 enterprise on my computer and it works fine in all of them. but when i took it to the computer it was supposed to be run on after the install ran it installed the .net framework and registered everything with caspol. Now once the program is run and everything else works fine but when the form with the numericupdown control is loaded the numericupdown control has some arbitrary negative number passed to it like -17 or -16 and i have no clue why it would do that on one xp pro machine and not on another.
Anyway i hope someone can at least point me in the right direction
Thanks
Ryan
|
|
|
|
|
Hi, I have a problem as follow:
I'm developing a application on PocketPC using C#, I have a file .wav on PC, but I don't know how to add this file to my application ( so that this file is deployed to PocketPC with my application).
Can you help me?
Thanks,
Hung.
Hung
|
|
|
|
|
Dear all,
I am trying to get the target location data a shortcut file on a desktop. I managed to get to the desktop using Environment.GetEnvironmentVariables() and can retrieve the shortcut file but can not find the way to retrieve the target location. Could anyone please help? Thank you!
|
|
|
|
|
If you use Shell interface function CreateShortcut with name of existing link as argument - created WshShortcut object will be filled with shortcut information.
sample:
IWshShell ws = new IWshRuntimeLibrary.WshShell();
string shortcutFile = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\" + "ToDo.txt.lnk";
IWshShortcut sc = (IWshShortcut)ws.CreateShortcut(shortcutFile);
after that sc.TargetPath will contain link target. Of course, if you have ToDo.txt shortcut on your desktop .
Don't forget to add reference to %system32%\\wshom.ocx and add "using IWshRuntimeLibrary;"
Hope that helps.
____________________________________________
Robin Panther http://www.robinland.com
|
|
|
|
|
Thank you very much for your reply.
The shortcut files already exist on the desktop so I just need to read? the file property
to get the target location. I have looked at IWshShortcut before and only found how to create a shortcut file.
Unless ws.CreateShortcut(shortcut) works for existing shortcut files too?
Thank you !
-- modified at 3:25 Thursday 30th March, 2006
|
|
|
|
|
I think my mistake
(IWshShortcut)ws.CreateShortcut(shortcut) doesn't create a shortcut file on the desktop.... silly me.
Thank you for your help!!!
-- modified at 3:35 Thursday 30th March, 2006
|
|
|
|
|
I have a Service which is installed already. If I need to change the startuptype of the service how Can I do that using C#?
I know that before Installing the service we can set the starttype property to set the StartType as automatic or manual. But after installing the service if want to change how should I do it?
Thanks
King
|
|
|
|
|
Hi,
i have a combobox (dropdown style not dropdownlist) and a i have
to open a form when i click on the text, but not when i click on the
arrow or when i select a item.
how can i do? some one have any idea?
thanks, cliffer
|
|
|
|
|
on comboBox1_SelectedIndexChanged event call form
example:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
Form f = new Form();<br />
f.Height = 150;<br />
f.Width = 150;<br />
f.Show();<br />
}
_____________________
Proud to be Albanian
_____________________
|
|
|
|