Jump to content

david_navigator

Members
  • Content Count

    67
  • Joined

  • Last visited

Everything posted by david_navigator

  1. I have some data that is stored in rows, but I need in columns e.g Instance Setting Value ========================================== 1 Fuel Level 10 1 Oil OK True 1 Water OK False 1 Temperature Hot 2 Fuel Level 5 2 Oil OK True 2 Water OK False 2 Temperature Warm 3 Fuel Level 100 3 Oil OK false 3 Water OK true 3 Temperature Cold Fuel Oil Water Temperature Level Ok Ok ================================================== 10 True False Hot 5 True False Warm 100 False True Cold So the instance field groups the data together and the Setting field describes the Columns and the Value field the data for that intersection. Of course at design time I have no idea how big an instance might be. It could have as little as two settings or maybe as many as 20 (I doubt it would ever be larger than that) The database I'm using has no support for Pivoting data. I could write the transformation in SQL, but that'd be horribly slow to execute. I need to be able to display the data to the end user in a grid format and so I thought a DevExpress Pivot grid might do the job, but that only seems to like numeric data at the intersection - unless I misunderstand how it works. Are there any other solutions available, Google didn't really help (maybe I'm searching on the wrong terms) or is this something that's fairly easy to code (to run efficiently) ? David
  2. david_navigator

    Transforming Data (Pivot ?)

    Yes, got it working with the Pivot Grid. If I add some Custom Summary code, then it does what I want 🙂 procedure TForm50.cxDBPivotGrid1Field3CalculateCustomSummary(Sender: TcxPivotGridField; ASummary: TcxPivotGridCrossCellSummary); begin with ASummary do begin if Records.Count >0 then begin Custom := GetValue(Records[0]); end else Custom := ''; end; end; I was also hoping that the TcxPivotGridSummaryDataSet would create a dataset that reflects the grid e.g Fuel Oil Water Temperature Level Ok Ok ================================================== 10 True False Hot 5 True False Warm 100 False True Cold but is seems to just export the same dataset as the source of the Pivot grid. Will need to do some more playing with that. i.e Instance Setting Value ========================================== 1 Fuel Level 10 1 Oil OK True 1 Water OK False 1 Temperature Hot
  3. david_navigator

    Transforming Data (Pivot ?)

    The number settings in a dataset is determined by the user, not the developer. The number of different datasets is also determined by the user. As the developer I have to come up with a row -> column solution that will work for any dataset the user designs.
  4. david_navigator

    Transforming Data (Pivot ?)

    No this was a simplification. There are also many data sets e.g the original sample shown is storing data about an engine, there maybe a similar dataset storing say electrical data. There are [user defined] rows per instance and actually the number of rows can vary between datasets As the table will be filtered by dataset, they're not really relevant to the solution. Since I posted the original Question I have got further with DexExpress's Pivot Grid, so it maybe that it is the prefered solution. Dataset Instance Setting Value ========================================== 1 1 Fuel Level 10 1 1 Oil OK True 1 1 Water OK False 1 1 Temperature Hot 1 2 Fuel Level 5 1 2 Oil OK True 1 2 Water OK False 1 2 Temperature Warm 1 3 Fuel Level 100 1 3 Oil OK false 1 3 Water OK true 1 3 Temperature Cold 2 1 Voltage A 240 2 1 Voltage B 380 2 1 Current A 10 2 1 Current B 30 2 1 Warning Light On 2 1 Filter Colour Red 2 2 Voltage A 440 2 2 Voltage B 120 2 2 Current A 180 2 2 Current B 30 2 2 Warning Light On 2 2 Filter Colour Blue
  5. david_navigator

    Has anyone tried running Delphi on Windows ARM?

    Is it only me that thinks it's funny that it's faster to run Windows via an emulator on a non-native platform, than it is to run Windows directly on Intel ?
  6. david_navigator

    IOS SIMULATOR ON SYDNEY 10.4

    It's certainly not robust enough for commercial use, but as a hobbyist it allowed me to get an experimental app to the apple store without any real apple device. I now have a powerful macbook and other than the speed and the lack of occasional unexplained crashes, the user experience is pretty much the same.
  7. david_navigator

    IOS SIMULATOR ON SYDNEY 10.4

    If you're just playing and experimenting, then you could try a hackintosh - it's what I used until I had some real work that would justify buying a real mac - that said, it was slow and prone to crashing, but as it was just my own time being wasted, I didn't really mind.
  8. david_navigator

    Learning Delphi

    Depends how much you want to invest (time & money). When I on boarded a new (to programming) developer many years ago, I started off by giving him small project to play with, searching through books/Google gave him the info he needed to write the code, but it was sometime after that I realised that there were fundamentals about developing code missing from his knowledge e.g he had no idea that the concept of break points & watches existed, so was littering his code with showmessages when trying to debug.
  9. It's not just 64 bit - smtpQuit : PostMessage(Form1.Handle, WM_REMOVEOBJ, Integer(Sender), 0); + smtpQuit : PostMessage(Form1.Handle, WM_REMOVEOBJ, WPARAM(Sender), 0); as discussed here,
  10. Can you use the in built delphi REST Debugger to help ?
  11. The following code (which has been in my 32 bit app for about 10 years) has just started to throw a range check error for one tester. All I can think of is that the cast of TObject to an Integer is the issue, but in that case why would it only affect one user ? The only difference between this user and others is that he's running under WINE, but I don't know why that would make a difference ? procedure TEqlistFrm.VenueEditMainKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin PostMessage(Handle, CM_SEARCH, Integer(Sender), Key); end;
  12. david_navigator

    Range Check Error ERangeError

    Thanks. That did indeed reproduce the error and also proved that the fix worked. Many thanks
  13. david_navigator

    Range Check Error ERangeError

    Thanks. That makes sense. So now I need to update all of his code 🙂
  14. david_navigator

    Range Check Error ERangeError

    If I was 100% certain that this was the reason for the RangeCheck error, then obviously I'd update the code and spend a load of time testing there were no side effects, but is it ? As I said the code's been like this for 10 years, it's code that executes around the world 1000's of times a day and I've only had a report from one user.
  15. david_navigator

    Range Check Error ERangeError

    32bit It's a colleagues code who's currently on furlough so I'm a bit hesitant to change the code, especially as 1. there are 44 instances where Sender is cast as an Integer and I don't know if they'll be any "gotchas" ? 2. I don't even know if this is the reason for the ERangeCheck as I can't reproduce.
  16. david_navigator

    Reverse method walker

    When I need to fix a bug in a method I try and think through all the places in the code that use that method, so that I can design my fix correctly (and then the tests won't fail), however as projects get bigger and methods inevitably call other methods, that gets harder and harder. I tend to manually recursively use grep, e.g grep for calls to this method and then grep for calls to the methods that call this method etc etc, but that's time consuming and boring. Does anyone know of any tool that can analyse a project and then show all the paths to a specific method ? Ideally with some kind of family tree like output e.g so if I had to fix Display Value, I would have a reminder of all the places that relied on that method.
  17. david_navigator

    Reverse method walker

    odd, same link takes me to
  18. david_navigator

    Reverse method walker

    Odd. I just get a page with a load of flags. Maybe you need a login to get a price ?
  19. david_navigator

    Reverse method walker

    Looks great. Any idea of the cost as the web site doesn't even give a clue 😞
  20. david_navigator

    What is Comment Member(s) ?

    What does Text Tools | Comment Member(s) do ? I can't see it in the documentation. Thanks David
  21. david_navigator

    What is Comment Member(s) ?

    Ah thanks. I was looking for something to comment out the whole of a class in one go.
  22. Not sure if something has changed in 10.4.2 but the following code works under 10.3 but not 10.4.2. The problem is the line move(temp[1],Buffer^, length(temp) * sizeof(WideChar)); which raises an exception if LoginMessage is empty. Stepping through, temp = #0 which I'm guessing is why move(temp[1].... fails, but why would it have worked previously (different compiler settings ) ? procedure TnxdsrPluginCmdHandler.nmLoginMessage(var aMsg: TnxDataMessage); var error: TnxResult; Buffer: PWideChar; BufLen: SmallInt; temp: WideString; reply: TnxnmServerlogonRpy; begin BufLen := high(Reply.Buffer) + 1; Buffer :=AllocMem(BufLen); try if assigned(PluginEngine) then temp := WideString(TnxdsrServerPlugin(PluginEngine).LoginMessage) else temp := ''; move(temp[1],Buffer^, length(temp) * sizeof(WideChar)); error := 0; BufLen := Length(Buffer); reply.buflen := buflen; copymemory(@reply.buffer, buffer, Buflen * sizeof(WideChar)); assert(buflen = length(buffer), 'Data Checking data Lengths differ'); except reply.BufLen := 0; error := DBIERR_NOSERVERSW; end; Cheers David
  23. david_navigator

    Help debugging code please

    Actually it's code buried deep in a third party component and I only looked at it because it started to error with D10.4.2 As I said, it worked (well at least functioned) correctly for the past 10 years under various versions of Delphi (up to 10.3) >Why use Move and CopyMemory? They do the same job. Pick one and use it consistently. I thought one dealt with overlapped memory & one didn't ? Though no idea why the original code used both. I guess the 2 min fix to test that Test is not an empty string is going to turn in to a major rewrite.
  24. david_navigator

    Help debugging code please

    Absolutely. I can see why the code fails and how to fix it, what I don't understand is why it's been working for 10 years. This routine is called 100's of times a day and Temp is virtually always an empty string, but the exception only started when I compiled the app with D 10.4.2, so I suppose my question is, why ? Maybe there's a compiler setting which has a different default in 10.4.2 ?
  25. david_navigator

    Enumerating Windows Sounds

    Is there a better way to get the list of Windows sounds as displayed in this Sounds dropdown without simply enumerating the contents of the %windir%\Media folder ?
×