-
Content Count
3709 -
Joined
-
Last visited
-
Days Won
185
Posts posted by David Heffernan
-
-
I prefer to replace dot or comma with the locale's decimal sep and then use StrToFloat.Â
Â
Although in reality I don't use the Emba conversion functions because they are defective, i.e. not accurate.Â
-
1
-
-
52 minutes ago, Rollo62 said:Stupid question, is it possible that Win and Macos have different format setting ?
Should be standard in both, but maybe isnt.
It depends on the locale rather than the os
-
2 hours ago, weabow said:But my need is to detect the OS parameter. I think there's a bug.
Looks like it. Submit a bug report.
-
Subtract $00401000 from the address and look it up in your detailed map file. But yeah, get madExcept or EurekaLog.Â
-
You are concentrating on the time zone, but that's not your issue at all. When you get time from somewhere, you will be able to convert to UTC because you will know the time zone associated with the time. Your problem seems to be that you want to use an authorative time source. You should do research on that rather than worrying about time zone conversion.Â
-
1
-
-
2 minutes ago, Ian Branch said:Hi Wagner,
Thank you for your suggestion.
My read of "TTimeZone.Local.ToUniversalTime" in the Delphi docs is that it derives the UTC from your Local.
This is no good if the time on your local PC is incorrect.
This isn't what I am after, I am after the actual UTC date/time.
Â
Regards,
Ian
Â
What source do you want to use for the time, given that you've ruled out the local computer?Â
-
11 hours ago, Fr0sT.Brutal said:Quite rude David, he's doing opensource
"I need to have XXX translated to YYY" seems a little abrupt to me.Â
-
What pay rate are you offering?Â
-
Log the floating point control word and see if it is the same in the two programs.Â
-
Use a list view. Part of problem solving is exploring the problem space and finding the best solution, given the pros and cons of all possible options. Deciding on the solution first and then trying to force it to work is not the way to solve problems.Â
-
1
-
-
Nothing fundamentally wrong with your option 1, so long as that is the single place where those string literals are written. The array does have the useful benefit of leading to helpful compiler error when enums extended, as discussed. But yeah, none of these options is especially terrible. I'd actually rate option 2 as the worst.Â
-
4 minutes ago, Mike Torrettinni said:Thanks, very well written!
I think not using magic strings is first step towards your first rule, no?
Â
Â
What's your definition of magic string?Â
-
Speed isn't the issue. The mistake that you make again and again. Maintainability is the only concern here.Â
-
1
-
-
3 hours ago, Lars Fosdal said:20 hours ago, David Heffernan said:Aren't they placed in read only memory?Â
So, the answer is a definitive no.
Yeah, you are right, I just assumed that typed constants would be placed in read only memory, as they are in other tool chains. Oh well.
-
1 hour ago, Fr0sT.Brutal said:Well, any typed const could be modified by pointer
Aren't they placed in read only memory?Â
-
Attribute syntax demands true constantsÂ
-
Given this definition
type Real = Double;
I'd say you don't have much to fear.
Â
Of course, this code doesn't compile.
1 hour ago, bernhard_LA said:y: = x ;
-
1
-
2
-
-
Why do this in a thread? Seems like much complexity for no possible gain.Â
-
2 hours ago, aehimself said:which is picking up ALL window messages, not just the one specified
It's not going to be sent many messages.Â
Â
Can you reproduce the behaviour in a cut down program?
-
10 hours ago, RTollison said:anything about the button is not available to me. the button click (not delphi) basically says call dll that will popup on the screen and allow user to select a date from a calendar.
so my dll is only thing i have available to change. the original dev just created the popup calendar to be in center of the main screen which was ok since multi-screens weren't widely available.
but then i got tasked with updating it and at the time the best i could do was the center of the active window. now i was asked IF i could change it and i said i would see what i could do. And so far it is not looking good.
The setup is pretty opaque for us here. These are the sort of details that matter. Without them it's just guesswork.Â
-
Make a note of the coordinates in the code that handles the button click event, and pass that on to other other code.Â
Â
I'm assuming that you are in control of all of the code.Â
-
1 hour ago, Henry Olive said:But below code WORKS
Num :=Â Ord(Str[1]) - Ord('A') + 1;Â
You should check that Length(Str)=1.
Â
1 hour ago, Henry Olive said:Num := Ord([Low(Str)]) - Ord('A') + 1;
This fails of course, it doesn't compile. But it's not the code that was suggested. You should take more care when copying code.
-
1 hour ago, Henry Olive said:Thank you Vandrovnik, eivind
Â
From an Excel Sheet i get column name ( for example F ) then i need
to convert F to an integer number ( which is 6Â )Â so that i can import
some datas from excel to my dataset.
Â
Str:=Edit1.Text; // Which is D
Num := Ord(PChar(Str)) - Ord('A')+1;
Edit2.Text := IntToStr(Num);
I'm getting 37266172  instead of 4
ÂWbat if there are more than 26 columns?Â
-
Seems like you should be building the GUI in code rather than the designer.Â
StrToFloat () all combinations of decimal separator and lang. settings
in Algorithms, Data Structures and Class Design
Posted
Yeah I don't do a heap allocation. I use a local fixed length array.Â