Jump to content

skyzoframe[hun]

Members
  • Content Count

    86
  • Joined

  • Last visited

Posts posted by skyzoframe[hun]


  1. Yes, it is just an example.

     

    I wanted to get to the record-element. With the help of pointers. But it is not clear to me how to do it. I have no idea if it will be possible.
    Alternative solution can be a key-parameter, and each sorting record element I can handle with case statement.

     

     

    type
        dmR00 = Record
          	ID : integer;//key-0
          	x,//key-1
          	y,//key-2
          	z : integer;//key-3
        End;
    ...
    dmA00 = TList<dmR00>;
    ...
      
    function Foo.BubbleSort(AList: dmA00; key:byte; out Error: String): Boolean;
      var
        jRec, j1Rec: dmR00;
        i,j : integer;
    begin
      try
        for i := 0 to AList.Count - 2 do
        begin
          for j := 0 to AList.Count - 2 - i do
          begin
            // clear record
            jRec  :=  default(dmR00);
            j1Rec  :=  default(dmR00);
            // fill record
            jRec := aList[j];
            j1Rec := aList[j+1];
            // check record
      
            case key of
              0: begin
              if jRec.ID > j1Rec.ID then
                begin
                  AList[j] := j1Rec;
                  AList[j + 1] := jRec;
                end;
              end;
              1: begin
              if jRec.x > j1Rec.x then
                begin
                  AList[j] := j1Rec;
                  AList[j + 1] := jRec;
                end;
              end;
              2: begin
              if jRec.y > j1Rec.y then
                begin
                  AList[j] := j1Rec;
                  AList[j + 1] := jRec;
                end;
              end;
              3: begin
              if jRec.z > j1Rec.z then
                begin
                  AList[j] := j1Rec;
                  AList[j + 1] := jRec;
                end;
              end;
            end;
      	  end;
        end;
        Result := True; 
      except
      on E: Exception do
        begin
          Error := ('Exception class name = ' + E.ClassName + sLineBreak +
            'Exception message = ' + E.Message);
          Result := False;
        end;
      end;
    end;  

     

     

     

     

     

     

     

     


  2. Greetings everyone,

    I want to sort a tList with some kind of record parameter. Somehow I need to use pointers to get to the record without using the name of the record.

    In this example I am using the name "Rec.x". However, in the future I would like to use "Rec.y", "Rec.z","Rec.ID" or any other record value in the sort. // See below

    In fact, I have never used pointers before.

     

    "function Foo.BubbleSort(AList: dmA00; SomeParameterHere:IsSomething ;out Error: String): Boolean;"

    ...

    " if jRec.SomeParameterHere > j1Rec.SomeParameterHere then"

     

    kind regards Zoltan.K

     

      type
        dmR00 = Record
          ID : integer;
          x,y,z : integer;
        End;
    ...
    dmA00 = TList<dmR00>;
    ...
      
    function Foo.BubbleSort(AList: dmA00; out Error: String): Boolean;
      var
        jRec, j1Rec: dmR00;
        i,j : integer;
    begin
      try
        for i := 0 to AList.Count - 2 do
        begin
          for j := 0 to AList.Count - 2 - i do
          begin
            // clear record
            jRec  :=  default(dmR00);
            j1Rec  :=  default(dmR00);
            // fill record
            jRec := aList[j];
            j1Rec := aList[j+1];
            // check record
            if jRec.x > j1Rec.x then
            begin
              AList[j] := j1Rec;
              AList[j + 1] := jRec;
            end;
          end;
        end;
        Result := True; 
      except
      on E: Exception do
        begin
          Error := ('Exception class name = ' + E.ClassName + sLineBreak +
            'Exception message = ' + E.Message);
          Result := False;
        end;
      end;
    end;  

     


  3. It may not be too late. The example does not work because of the missing codeck pack.

     

    the solution:

    https://stackoverflow.com/questions/28910428/tmediaplayer-error-unsupported-media-file

     

    By Jim McKeeth

    Quote

     

    It appears to be a limitation of Direct X when installed in a VM. I installed a different media codec (the basic k-lite codec pack) and the player worked fine after that without any code changes. Also, filed a bug report so hopefully R&D can address it

     

    the codeck.:

    https://www.codecguide.com/download_kl.htm

     

    Now all examples work fine.

    ..\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\App Tethering\MediaPlayer\
    and even the VideoPlayback sample works.

     

     


  4. 45 minutes ago, David Heffernan said:

    Yes but it's hard to see the relevance. Representable numbers have the form k*2^n. Perhaps you don't actually need exact representability. We don't know what your requirements are. 

    Many irrational numbers must be used in 3D space. my problem is that it has to be stored in memory. usually in float value. which causes an error if I work in six axes


  5. 8 minutes ago, Leif Uneus said:

    First of all, precision depends on the hardware. If you have a 6 axis movement, how accurate is the movement of all those axis?

    Secondly, how is the movement controlled? Resolution? Error in the resolution?

    Last in that chain comes the controlling equipment, speed and other things that might concern the precision.

     

    I want to adapt to the maximum software possibilities within the limits of Pascal.  The hardware constans in this case.( One kind of parameter)


  6. Yes , you are right.

    38 minutes ago, programmerdelphi2k said:

    Definitely not!
    because the expected target (function return) is an "Array", so if the array is empty, there is nothing to expect from its "possible" content (the records), and if there is "content", there will be "records" with values!

     


  7. 26 minutes ago, programmerdelphi2k said:

    because the expected target (function return) is an "Array", so if the array is empty, there is nothing to expect from its "possible" content (the records), and if there is "content", there will be "records" with values! 

    I mean, before you put anything into the array, you have to clear the record, then fill the record. If you don't do so, then there are the opportunity to create redundancy.

     


  8. On 5/2/2023 at 7:11 PM, programmerdelphi2k said:

    var LTableIsActive : boolean; LOldSQL : string; LMyRecordWithValues: TMyRecordWithValues

    In these case, maybe you need one more row.

    LMyRecordWithValues := default (TMyRecordWithValues);

×