|
Christian Graus wrote: ..references to the .NET 3 dlls, and you just need to add those references.
I thought so too at first but it's not possible when the project is not based on .Net 3 framework from the moment it is created!
You just cant include any dll with the version 3.x.x as it will be disabled!
Please try now to see what I mean, I'm sure you will be surprised as I am now
Create a new solution based on a version less than 3 and try to reference anything from .Net 3.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Oh - there's a setting in 2008 that sets what framework you're building against, it DOES support 2.0. Perhaps the conversion is set to that by default, and you need to change that in the project settings ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Glad to help
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
See, I told ya, there's always a good reason to be optimistic when I see your name in my thread
Thanks Christian!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
I am developing an internet cafe software and i want to know how can i get the total minutes from datetime1 to datetime2
for example:
14 Jun 2008 19:20:15 to 15 Jun 2008 21:53:45
|
|
|
|
|
This will work:
TimeSpan span = t2 - t1;
double minutes = span.TotalMinutes;
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
(datetime2 - datetime1).MinutesTotalMinutes like Greeeg said
Sorry for the mistake
Eslam Afifi
modified on Sunday, June 15, 2008 2:51 PM
|
|
|
|
|
|
in my country, our currency is (Dinar) and we have small units called fils (three decimals)
we have coins 50fils and 100fils
1 Dinar (BD) is 1,000 fils (10 coins)
I want to round to the nearest 50 or 100 fils based on user's setting.. for example:
if the amount is 0.513 and round is 50 then it will be 0.550 but if round to 100 it will be 0.600
if the amount is 1.148 and round is 50 then it will be 1.150 but if round to 100 it will be 1.200
how can i do that?
|
|
|
|
|
This is not rounding; you're taking the ceiling to 0.05 or 0.1 (in case it's not an integer amount of money)
A hint,
0.513 ceiling to 0.05 = 0.5 + 0.05 = 0.55
1.148 ceiling to 0.1 = 1.1 + 0.1 = 1.2
But you want 1.000 to return 1.000 not 1.05 or 1.1 so you'll take that into account. And use decimal not float or double.
Eslam Afifi
|
|
|
|
|
there is a class, say
class a
{
int i,j,k;
}
then, another class is derived as,
class b:a
{
int a,b,c;
}
now how many locations in the memory the object of class b will occupy, i mean wat will be the size of object of class b.
3 or 6 ???
i have tried to use sizeof operator.
But the compiler is giving error !
|
|
|
|
|
|
|
You're welcome.
Eslam Afifi
|
|
|
|
|
Well
I have a problem with converting.
I would like to convert 96.78 to int. I used Convert.ToInt32(total) and it turned out 97. I want my result is 96. I also used String.format but it has the same result.
|
|
|
|
|
Do you always want the value rounded down? Then use Math.Floor :
Convert.ToInt32(Math.Floor(total)
modified 12-Sep-18 21:01pm.
|
|
|
|
|
(Int32)96.78 will return 96, as desired.
|
|
|
|
|
I'm looking for an implementation or example or even just the logic for what must be an extremely common scenario:
Suppose we have N objects (where N is large). These objects are being accessed over time, but the pattern of access changes. Some are more popular at one time of the day, another i more popular at another time.
I would like to have a list of the top M (M << N) most requested objects for the last T minutes.
Keeping a log of all requests for all objects for the last T minutes is inpractical. Even keeping a list M items long in memory is stretching the friendship. It needs to be fast and efficient.
It doesn't need to be 100% accurate. Just close.
I've got something close based on rolling averages but it's not quite right. I know as soon as the answer is given I'll go 'Why didn't I think of that' but my brain is stuck, possibly because of the Adam Sandler movie I watched last night.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Sounds like you need a Priority Queue[^] (Wikipedia Link[^]), as used in many scheduling algorithms (process creation and much more). Each access to an object in the queue should increase the object's priority (could be a property, like a time stamp).
Or did I misunderstand your problem?
regards
modified on Sunday, June 15, 2008 11:50 AM
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I don't have much experience and this is primitive and slow and it’s certainly not what you’re looking for but here are my thoughts anyway. You have N objects and you want to get the top M of N each T period. I think you would associate an integer with each object and keep them in a list or something. Each time an object is accessed you increase the integer. Each T period you sort them and get the top M instead of maintaining them in a sorted structure.
About the rolling averages, this is the first time I hear about this and I don’t understand it. Doesn’t it depend on storing the last average and calculating a new average based on the current one? It’d be great if you explain it a little. Thank you.
Eslam Afifi
|
|
|
|
|
A moving average (or rolling average) is used when you are accumulating data and you take an average of the short-term data rather than averaging all the data you accumulated. It's a way of "smoothing out" data that can fluctuate wildly when all you really want to know is the short-term trend of the data. There are various ways to approximate and weight the average of the data as it comes in rather than actually re-calculating all the data as it changes.
I've done this a lot when writing stock analysis software. Here[^] is a graph of the last six months of eBay stock values (in blue) with a "10-day moving average" (in red). See how it smooths out the data to show the short term trends?
For the original poster's application, I guess you could use a rolling average if you don't want a particular entry shooting right to the top if you suddenly start using a bunch of times but rather have it slowly drift towards the top if you continue to use it over a period of time.
If you don't like the results your rolling average is giving you, maybe you can try one of the variations like a weighted moving average or an exponential moving average. Try Wikipedia[^]for some of the theory/math.
|
|
|
|
|
Thank you for the reply. The chart of eBay is about days (the set of object) and a value for each day (the blue line) and the 10-day MA (the red line); despite I don't know how it's calculated, I can't see the relation between the average and getting the top M number of days N according to the values
Or do I get it wrong?
Eslam Afifi
|
|
|
|
|
Eslam Afifi wrote: I think you would associate an integer with each object
This requires an entry for every object. What if I have, say, 4 billion objects?
Eslam Afifi wrote: Each T period you sort them and get the top M instead of maintaining them in a sorted structure
Unfortunately this means that your list is, by definition, always out of date (by anything between 0 and T minutes)
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Chris Maunder wrote: This requires an entry for every object. What if I have, say, 4 billion objects?
I didn't realize that N is that big. But like I said, I don't have much experience, but I think you will keep track of how many times an object has been accessed in the past T period. I don't know about rolling average and it'd be great if you point out the relation between it and what you're trying to accomplish.
Chris Maunder wrote: Unfortunately this means that your list is, by definition, always out of date (by anything between 0 and T minutes)
Then I guess you'll keep them in a SortedList or something.
Eslam Afifi
|
|
|
|