Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. We are building a Xero API with OAuth2 using the REST components in Delphi Datasnap. We have been following this Xero API flow: https://developer.xero.com/documentation/oauth2/auth-flow but we are encountering issues on Step 3. It gives me all the time an error of 'invalid_client' but when I tested the values in Postman, I was able to retrieved what is expected successfully with no errors. Here is part of the code. RESTClient.BaseURL := 'https://identity.xero.com/'; RESTClient.ContentType := 'application/x-www-form-urlencoded'; RESTRequest.Resource := 'connect/token'; RESTRequest.Params.AddItem('Authorization', Authorization, TRESTRequestParameterkind.pkHTTPHEADER); RESTRequest.Params.AddItem('grant_type', 'authorization_code', TRESTRequestParameterKind.pkREQUESTBODY); RESTRequest.Params.AddItem('code', sAuthCode, TRESTRequestParameterKind.pkREQUESTBODY); RESTRequest.Params.AddItem('redirect_uri', ReDirectURI, TRESTRequestParameterKind.pkREQUESTBODY); RESTRequest.Method := TRESTRequestMethod.rmPOST; RESTRequest.Execute; I am suspecting it was the base64encoding part, but I was able to correct that one and I was able to successfully test the values in Postman. Is there a way, I can retrieve the full URI or REST parameters that is being sent by this component? I want to see is the entire value that is being sent by the RESTRequest. Is this possible? Thank you!
  3. Today
  4. Joseph MItzen

    Best Practices for FireDAC FetchMode/RecordCount Settings

    That depends on the database and the version. For instance, in PostgreSQL < 9.2, a count(*) query would have to perform a sequential scan through the database: MS SQL Server, and now PostgreSQL, can often do index-only scans in situations like this, for much quicker results.
  5. Yesterday
  6. Anders Melander

    More performance Stringgrid sorting algorithm help

    Yes. You are right.
  7. Vandrovnik

    More performance Stringgrid sorting algorithm help

    Test is not changed, just at the beginning instead of i:=0 I would use i:=1; When I start with i:=1 with Data 3, 2, 1, it is as in your example, just first iteration is already done: iteration elements 0 3 2 1 swap and dec ^ 1 2 3 1 i=0: inc ^ ... If Data is 1, 2, 3, it is: iteration elements 0 1 2 3 inc, because List[1] >= List[0] ^ 1 1 2 3 inc, because List[2] >= List[1] ^
  8. Anders Melander

    git workflow question

    It discards changes to all tracked files. Basically it makes sure that what you have on disk matches what's in your branch. You can also do a mixed reset. That moves the index in your commit history but keeps whatever you have on disk. Then there's a soft reset but I can't remember what that does as I never use it. The reason I'm doing a reset is that otherwise pull will do a merge with whatever I have on disk and that isn't what I want. I'm not actually doing anything since my tool does all this for me, but you get the picture. Personally I prefer Atlassian SourceTree. I have Tortoise Git installed as well because there are a few things it does better (Blame for one). I've not tried any of the commercial GUI clients. There was a thread here a few weeks back where different Git clients were discussed.
  9. Anders Melander

    More performance Stringgrid sorting algorithm help

    If you start with i := 1 then the 0 and 1 elements will always be swapped. If you then also change the test for (i = 0) to (i = 1) then the 0 and 1 elements will never be swapped. Try to run it in your head with just three elements in reverse sort order. iteration elements 0 3 2 1 i=0: inc ^ 1 3 2 1 swap and dec ^ 2 2 3 1 i=0: inc ^ 3 2 3 1 ok: inc ^ 4 2 3 1 swap and dec ^ 5 2 1 3 swap and dec ^ 6 1 2 3 i=0: inc ^ 7 1 2 3 ok: inc ^ 8 1 2 3 ok: inc ^ 9 1 2 3 done ^
  10. David Schwartz

    GLAD loader for Delphi

    There's an underlying assumption in most communications that requires you know your audience. People who do not fall into that assumed group won't follow what you're saying. It's like listening to a bunch of "inside jokes". How fun is that when you're not privy to what's happening "inside"? If this were a PRIVATE library and this were a PRIVATE discussion between two people, that's fine. In that case, 100% of the participants know the background context. The "open source" part is irrelevant. The fact is, it's taking place in a PUBLIC LIBRARY. There can be hundreds of people looking at it from all around the world, at different times and with completely different backgrounds and perspectives. Adding a simple line at the top that answers the question "What is this about?" and maybe a link (as was offered above, independently of the content in the library) so people at least know what to look for would really be sufficient. As a participant, if you think it's a private discussion, you're going to think it's implied, so why bother stating the obvious? But everything in github is PUBLIC! In general, that's not a valid assumption for over 99% of the people who might view it other than the one or two others you're communicating with. Making a practice of adding a one-line description that answers the most obvious question everybody new to the page will have, "What is this about?", with maybe a link for more info, hardly requires a doctoral thesis. What it DOES ENABLE is MORE INCLUSION AND PARTICIPATION BY OTHERS, which is supposedly the whole goal of the Open Source movement. You don't need to write a damn book! It's a simple one-line description that answers the question, "What is this about?" and a link to learn more. Otherwise, you're simply having a private conversation in a public forum that very few other people are able to follow. And just to be clear, I'm not saying there's anything wrong with that! But the OP posted a message here ANNOUNCING this open-source project and when I went to look, the first question I had -- "What is this about?" -- was not addressed anywhere! All I saw was bits of a private conversation between two people who knew exactly what each other was talking about, and everybody else was relegated to evesdropping. The popular retort is, "Well Google is your friend!" Hey, this is YOUR announcement! Why do you then say to ask Google if I want more information? Why did you bother to make the announcement in the first place? It's like getting in front of a group of several hundred people and announcing, "Hey, we're having a party!" and someone asks "When?" and you say, "ask Google!" and you walk away. I don't know about you, but I'm not wasting another second thinking about it. And I'm not asking Google because adding the Who, Where, and When part is too much trouble for you to mention after the What. I'm guessing the OP posted that here because he wants people to look at the work, maybe see some value in it, perhaps get involved. But if it cannot answer the basic question, "What is this about?" then what's the point of making the announcement? Ask Google? Really? Why bother making the announcement? No, if you CHOOSE to make a public announcement about something, you owe it to your visitors to have at least one line at the beginning that answers the most obvious question every single one of them is going to have: WHAT IS THIS ABOUT? How much time do you expect others to spend trying to answer that most fundamental question before they just turn and walk away? This is a basic building block of how you include others in conversations or not. It happens at parties and social gatherings all the time -- you wander around, listening in on conversations here and there, to see if there's something interesting to follow or jump in on. If you're like most people, you wander around sampling lots of different conversations, and don't spend much time if you cannot get your bearings on what they're discussing. It's no different in public forums online.
  11. Anders Melander

    More performance Stringgrid sorting algorithm help

    Well now that I've had my fun here's a serious suggestion: type TGridCracker = class(TCustomGrid); procedure SortGrid(Grid: TCustomGrid; ACol: integer; Ascending: boolean); begin var Rows := TList<integer>.Create; Rows.Capacity := Grid.RowCount - Grid.FixedRows; // Populate list with row indices for var i := Grid.FixedRows to Grid.RowCount-1 do Rows.Add(i); // Sort the row indices Rows.Sort(TComparer<integer>.Construct( function(const A, B: integer): integer begin Result := AnsiCompareText(Grid.Cells[ACol, A], Grid.Cells[ACol, B]); if (not Ascending) then Result := -Result; end)); // Move the rows in-place to their new position Grid.BeginUpdate; try var ToIndex := Grid.FixedRows; for var FromIndex in Rows do if (FromIndex <> ToIndex) then TGridCracker(Grid).MoveRow(FromIndex, ToIndex); finally Grid.EndUpdate; end; end; I've not used TStringGrid in decades but I think it might be fast enough if you can get it to compile (I haven't tried). I'm assuming that the protected MoveRow method does what we need (i.e. move a whole row in the grid). It might not though. A minor optimization would be to use a TArray<integer> instead of a TList<integer> but the improvement would be minimal.
  12. Vandrovnik

    More performance Stringgrid sorting algorithm help

    I cannot see why? In first step, "if (i=0) ..." will execute "inc(i)", so we have i=1 and continue with next iteration... while (i < List.Count-1) do if (i = 0) or (List[i] >= List[i-1]) then Inc(i) else
  13. Anders Melander

    More performance Stringgrid sorting algorithm help

    That won't work. You need to start at zero. That's cheating. Then you might as well just optimize it to use TList.Sort
  14. David Schwartz

    git workflow question

    Thanks for this. I'm not clear how on 7, "git reset --hard" clears changes from the working directory. Don't git commands affect the entire repo? (Our repo includes the entire virtual drive, ~850 folders.) What git GUI tool do you prefer? We only have free stuff available, but I did use Tower for a while a couple of years ago. I have the right-click Git GUI option, along with Tortise git. --------- In a more abstract sense, I think what they're trying to accomplish here is to use git for two purposes. One is obviously to keep a version history of our work. They say that if something in Production turns out to be trashed, we need to be able to roll-back to the previous version. What's happening right now (using that sequence I showed above) is that git is reverting things right before we push the files into production, and our changes are lost. Rolling-back doesn't help -- our changes are not in Master. However, I discovered they're still in the local branch, as long as I haven't deleted it. I think it's b/c of something wrong we're doing above. The other purpose is to use git to distribute changes to everybody's local machines so we're all in sync with all of the latest updates. The theory being if one of us gets hit by a proverbial truck (or we catch COVID), someone can come in and start working where they left off because they've got all of the latest files (well, those that were committed and pushed properly, anyway). This has two negative consequences that I've seen. One is that two different people working in the same folder at different times can cause conflicts to arise fore everybody else who never touched anything in those folders. This is a time-related artifact that only happens if you do a pull in the time interval when the conflict arose and was resolved. If you have a team of 50 people and a conflict arises between two of them, I don't see why the other 48 are forced to even see it let alone deal with it on their machines. This is supposedly a "feature" of git. (Maybe this is also a reflection of how we keep pushing stuff to Master instead of maintaining a dev branch. We do quick turnaround stuff on isolated tasks, so dev branches are meaningless.) The second is the complexity added when we're modifying the same files for different tickets that are for independent needs but happen to address data in the same files (and folder). I personally think it would be a whole lot easier to use something like Dropbox for this latter purpose. sorry if I'm sounding redundant, but I hate having to spend my weekends cleaning up messes caused during the week b/c nobody at work seems to know what the problem is (or believe one even exists).
  15. Vandrovnik

    More performance Stringgrid sorting algorithm help

    OK, and when it should work faster, we can always optimize it with starting at i:=1 and using tList<>.Exchange 🙂
  16. Gustav Schubert

    ImageWrapMode.Original and Dpi-Support PerMonitorV2

    Observation 1: If I use PerMonitorV2 then the text of controls like ListView will be sharper. This is why I want to keep using it. Observation 2: I have been able to produce sharp drawings which take advantage of the many pixels of the 4K screen, in PerMonitorV2 mode. Unfortunately the effort is high, in terms of extra code that I need to write for correct layout and manual scaling. At first I thought that the DrawImage method of TImage might have a bug. But by now I have tested out a change - with only partial success. I can make the drawing scale as I want, but it will appear slightly blurred, because it gets upscaled, as with Dpi-Support None. Status: In order to get a sharp drawing I need to leave EMBA code as is and do the additional work. Problem is of course that I cannot and want not do that in in my bigger application for some existing drawings, not now, and maybe never. For now I will go with sharp text and slightly blurred drawings.
  17. Angus Robertson

    how to Properly check if Twsocket Tcp client is still connected ?

    The only reliable way to know if a TCP socket is still connected is to send something to the other end and receive a response. If there is no regular traffic, you really don't know the route still exists, so many technical things can cause a connection to fail without any socket close down being received. If you send something and there is no TCP ACK within several seconds, the data should be resent automatically until finally the socket is closed with an error. If you are designing a protocol that leave sockets open for long periods, best to send something regularly. Angus
  18. dummzeuch

    Filter Exceptions expert and IOS / Android apps

    Thanks, this could solve the problem, but as I said: I cannot test it. I need some volunteers to test this. Any takers? It's just a matter of creating a simple Android, Linux, OSX or IOS application respectively that raises an exception and see what happens. If Mahdi's fix works this will simply display the filter exception dialog, if not, it will crash the IDE. That's simple to distinguish. 😉 I just tried to create a simple Android app to run in the emulator, only to discover that apparently the emulator is no longer supported for debugging. So, that leaves me with trying to install all the stuff necessary to debug on a real device or not give a damn.
  19. That's a way to do. I always prefer using the events for connection and disconnection.
  20. FPiette

    More performance Stringgrid sorting algorithm help

    I suggest to first extract all strings used as key from the grid along with their index and move them in a single buffer (Avoid numerous memory allocation), keeping the pointers into an array (of pointers). Then use a fast algorithm to sort the array of pointers by dereferencing the pointers to access the strings for comparison. Moving only the pointers is the key to fast operation. Once the array is sorted, use the index part to move the grid rows. This will be efficient for a large grid because strings are moved only once to create the array of pointers
  21. Anders Melander

    More performance Stringgrid sorting algorithm help

    Yes it's horrendously slow but if performance isn't important it's nice and short and easy to implement - if you can remember the algorithm. I've used it a few times in throw away production code just because I like its simplicity. Compare to how often people get quicksort wrong when they roll their own.
  22. Mahdi Safsafi

    Filter Exceptions expert and IOS / Android apps

    Please Thomas, check your Gexperts tickets.
  23. Anders Melander

    git workflow question

    I don't do these thing from the command line, so I may be wrong, but it seems to me that you're: Switching the active branch to <ticket-branch-name>. Pulling the remote master onto it. Switching to master. Pulling the remote master again. Merging <ticket-branch-name> into local master. Pushing local master to remote master. I can't understand why you're doing 1-2. In particular #2 seems wrong. I think you may be creating foxtrot merges. Did you forget to commit your changes to <ticket-branch-name> before you switched to master? You haven't specified if your local branches are setup to track the corresponding remote ones. If they're not, and you haven't adjusted your git commands for that, then you might be working with detached heads. Anyway, here's what (I think) I would do: Switch to local <ticket-branch-name>: git checkout <ticket-branch-name> Make my changes... Stage my changes: git add <files> Commit changes to local <ticket-branch-name>: git commit -m "blah blah" Fetch master from remote: git fetch (or just: git fetch --all) Note that you you might need to do git fetch origin master:master depending on if your local master is tracking the remote master or not. Switch to master: git checkout master Clear all changes from working directory: git reset --hard Pull from remote master: git pull origin Merge local <ticket-branch-name> into local master: git merge <ticket-branch-name> Push local master to remote master: git push origin master Again: I don't use the command line so the above is just my understanding of what my GUI tool does for me. If you were using a GUI Git tool it would be much more clear to you what's going on.
  24. Arnaud Bouchez

    More performance Stringgrid sorting algorithm help

    It is also known as "stupid sort". Best algorithm name ever.
  25. is this a correct way to check if the Twsocket client is connected ? if wsocket1 .State = wsConnected then //do something
  26. Anders Melander

    More performance Stringgrid sorting algorithm help

    Funny name you say? How about he optimize it with Gnome sort instead: procedure GnomeSort(List: TList<integer>); begin var i := 0; while (i < List.Count-1) do if (i = 0) or (List[i] >= List[i-1]) then Inc(i) else begin var Swap := List[i]; List[i] := List[i-1]; List[i-1] := Swap; Dec(i); end; end;
  27. dummzeuch

    More performance Stringgrid sorting algorithm help

    That's Bubble Sort you are using, which is not renowned for speed but mostly for the funny name. Maybe it would help to use something faster?
  28. Thank you. I was able to get it working by sending the raw mpeg data into the stream as you described. I had to implement the stream throttling as well to match the bitrate of the mp3 file, otherwise the receiver just choked.
  1. Load more activity
×