|
Why dont you show us what you've already tried, and specifically what problems you are experiencing, and im sure someone will help you out with your homecollege work.
|
|
|
|
|
well my main problem is i dont know if its possible and whether i shud use sql or c#
i can get a count of days between the datesin sql but thats not much good to me really as it doesnt take care of the duplicate days problem
|
|
|
|
|
There are so many ways to do this. Without knowing the full problem, you could use something like this (pseudo):
Add Injury (passing in start date and end date)<br />
if start date = end date then<br />
Check to see if the start date has already been added into your collection.<br />
If not, add it in and exit routine<br />
<br />
set date = start date<br />
while date is less than or equal to end date<br />
Check to see if the date has already been added into your collection.<br />
If not, add it in.<br />
date = date + 1 (hint - you need to use AddDays for this).<br />
end while
By doing this, you can easily track the dates that the player has been injured.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
would it be ok to use a DataTable as the collection of dates and if so then is it as simple as compare each date to each cell in datatable to see if it is already in there
|
|
|
|
|
It would probably easier to use something like a Hashtable
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i have never worked with hashtables before do they have some advantage over a datatables
|
|
|
|
|
Well, they do have a key that you can look up.
For instance:
private Hashtable _myTable = new Hashtable();<br />
<br />
public void AddItem(string value)<br />
{<br />
if (_myTable.Count > 0 && !_myTable.ContainsKey(value))<br />
_myTable.Add(value, value);<br />
}
Then, in your code you could do:
AddItem("Hello");<br />
AddItem("Hello 2");<br />
AddItem("Hello");
The list will only contain Hello and Hello 2. The last item will not be added.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
thanks alot for the help its appreciated i ended up using an arrayList to store the dates for each injury but ill def have a look at the hashtables
thanks again
private ArrayList AddDaysInjuredToArray(DateTime startDate, DateTime endDate, ArrayList dateList)
{
//*** set arraylist = to arraylist of days returned
dateList = AddDatesInBetween(startDate, endDate, dateList);
//*** sort arraylist making it easier to find duplicates
dateList.Sort();
//*** remove duplicates
for (int i = dateList.Count - 2; i >= 0; i--)
{
if ((DateTime)dateList[i] == (DateTime)dateList[i+1])
dateList.RemoveAt(i+1);
}
//*** return arrayList containing list of days injured with no duplicates
return dateList;
}
private ArrayList AddDatesInBetween(DateTime startDate, DateTime endDate, ArrayList dateList)
{
//*** start with day after startDate as startDate is not to be counted
DateTime newDate = startDate.AddDays(1);
//*** while newDate before endDate
while (newDate < endDate)
{
//*** add newDate to arraylist
dateList.Add(newDate);
//*** set newDate to next date
newDate = newDate.AddDays(1);
}
//*** return arrayList containing list of days injured
return dateList;
}
|
|
|
|
|
Hello All.
Some of you may have come across the problem when you have folder and file names in hebrew.
the problem is that the hebrew file name is replaced with it's parent folder when reading it into a string.
for example:
let's say i have a folder called c:\temp\סתם
and under this folder i have a file called משה.txt
when i read (using FileOpenDialog or any other technique) this full path into a string i expect to get:
c:\temp followed by a folder named סתם and a file named משה.txt but what you get is c:\temp\סתם\משה.txt
Does anyone know how to handle this?
Cheers
|
|
|
|
|
hi friends,
in my project i have to display a set of photos stored in a folder dynamically to the web page,
wat we did is that we have stored the path of a destination folder into a single column in SQL server and then we have to retrive all the photos stored in that specifeid folder to the web page....
i'm able to get the photos stored in it,
so can anyone help me out
thank you,
|
|
|
|
|
so what is the problem if you use the image control and
change the ImageUrl Property ??
Tamimi - Code
|
|
|
|
|
ya..thanks for reply..
but i have to get the url of each image dynamically and i have to diaplay all the images in that page
the page must look like the image galleries in the movie websites..
for example when you go for the wallpaers of a movie the corresponding images are loaded into the page..
that kind of output i want..
can u tell me how can i do it..
possible give me an example code...
|
|
|
|
|
do you know how to use the Repeater control ?? if you...
format your repeater as you wish, then on the ItemDataBound event
set the urls for you images
fell free to post again
Tamimi - Code
|
|
|
|
|
can you explain with an example for using the repeater control for my problem
|
|
|
|
|
And man no need to repost the same question in multiple forums..
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
I am invoking the delegates asynchronously(using Begin Invoke).
These delegates are not invoked in the invocation order .
How to make this delegate to raise in the invocation order.
Thanks in Advance
Sangeetha
|
|
|
|
|
I'm not sure you can control the order in which delegates are invoked.
Instead you could use a System.Timers.Timer object (which will execute on a thread pool thread) and a synchronized list of work items. You add work items to the list and the timer routine takes them off again.
|
|
|
|
|
Hi!
How can I achieve following in oracle with command?
select .. from .. where name in (:paramter)
THank you in advance!
|
|
|
|
|
i want to call matlab functions in c# program?is there any way to do it?
thanx
|
|
|
|
|
http://www.codeproject.com/dotnet/matlabeng.asp
does that help?
Russ
|
|
|
|
|
Clickety[^]
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorp sihT ?sgub naem ayaddahW
|
|
|
|
|
Hi all,
I want my Console.WriteLine(...) output to be saved in a text file AS WELL AS displayed on the console screen.
I know how to get the output to go to the text file instead of the screen (use Console.SetOut to the stream provided by a new StreamWriter, say). But I can't get the output to go to BOTH!
I am probably being very stupid, and there is a simple answer, but all the google hits discuss the situation where you want the output to go to the text file instead of the console window.
Thanks for anything you can suggest!
Russ
|
|
|
|
|
How can we change the color of the scroll bar?
Thanks in advance.
Mandar
|
|
|
|
|
hi mandar,
try in this way
active-scroll-bars {
scrollbar-face-color: red;
scrollbar-track-color: blue;
}
regards,
Rahi
|
|
|
|
|
Whether you want to generate a dynamic function, write a dynamic algorithm or want to handle delegate inline, anonymous functions have always been at your service. However one area where in anonymous function lacking is, making a recursive call. Since it does not have function signature it’s not possible to make recursive call, at lease not directly. This article shows you how to achieve that.
See complete blog:
http://aamironline.com/blog/2006/10/29/recursive-call-with-anonymous-function.xml[^]
|
|
|
|