Jump to content

JohnLM

Members
  • Content Count

    350
  • Joined

  • Last visited

Everything posted by JohnLM

  1. JohnLM

    The Advent of Code 2024.

    I was hoping to show a screenshot snippet of my XE7 version of Day-1's puzzle as proof. I mean, I think some of you may like it. As soon as I figure out something with the image, I will post it here. I haven't looked at any of the videos posted here because I don't want to know what the puzzles are until I tackle them as I can if I can. Also, I just read Day-2's puzzle. It is interesting. I have some ideas racing through my head already, and once you see my first puzzle you may be able to figure it out, but I work the night shift and I need to get some sleep.
  2. JohnLM

    The Advent of Code 2024.

    I do not normally do these types of challenges because I am no professional. But, I did an Excel version of Day-1's puzzle fairly quickly. It took a few minutes without any programming involved, so I guess it does not count. But I did an XE7 (windows) version, today, though it took me many hours to complete. I don't have those Services listed on the website, so there is nothing to see from me, source code wise, over there. And, I am proud to say that, "I did it!" for Day-1's puzzle.
  3. I want to create or calculate a unique 8-digit ID (checksum/hash/etc) for variable-sized texts. I am not sure the ID has to be a certain limited length depending on the length of the actual text, but I would like the ID to be as small as possible. I definitely don't want a GUID. EXAMPLE: Name comment ------ -------------------- car neon. sumvac is not my favorite any more but i do like the cooler autom car neon. RESULT: ID Name comment -------- ------ ------------ AT1UW72Z car neon. 0B1UR7PY sumvac is not my favorite any more but i do like the cooler autom AT1UW72Z car neon. I want to add RESULT to a database table. Duplicates are okay since I can use a query to remove them from a query/report run. Or, I can remove them completely (at a later time) and just have unique table entries. But in general, duplicate entries are acceptable. Is there anything already included in Delphi that supports this? I will be working in XE7 and/or 12.2 IDE's. Thanks in advanced.
  4. Solved. . . Thanks @FPiette, your's confirmed what I was getting from another version I was testing, though different values, but the same outcome.
  5. @FPiette I did consider your suggestion, but I could not understand it. I tried a second time after your last post and I still could not understand it, how to use it, etc. I think that "buf" is throwing me off. I'm not that good at pointers. I thought buf was an array and was to hold some bytes, so I tryined to move the string into it and, well, I just don't have the skills for this. I'm an amature programmer, and this is my hobby, and I'm not some wiz-kid know-it-all. So, I'm giving it up your suggestion per your link. its 5:32am and I work the night shift (truck unloading work) and I'm exhausted. However, I found another resource for crc32 and tried that, and it seems to be working. But again, I'm exhausted. I'll play around with it much later. I need sleep.
  6. PS; To clarify: The string (edit1.text) can be any length, from 1-char up to 255-char in length. But the hash value, once converted to a Hex string, I want to be as short as possible, not 255-char. That is for the edit1.text. I want the hash value to be around 8 to 12 chars if possible. But if not, then I want to at least "pad" with zero's.
  7. progress update on this endeavour. . . I've been researching all about Hash and then Hash'ing a string. And I have it sort of working, but there are some issues. The way I understand it, when a hash is created it is a longword, or cardinal or other value, depending on the implementation of the function doing the hash process. So, take for instance the following: // link; https://stackoverflow.com/questions/3690608/simple-string-hashing-function function StrHash(const st:string): cardinal; var i:integer; begin result:=0; for i:=1 to length(st) do result:=result*$20844 xor byte(st[i]); end; This function returns a Cardinal value. Then, I wrote the following to help me see what is going on and how its working for my needs. I do not need any security. It is not that level. procedure TForm1.btnGenClick(Sender: TObject); var s: ansistring; c: cardinal; i: integer; hashLen: integer; begin // c := strhash(edit1.Text); m1.Lines.Add(c.ToString()); // works; // debugging purposes c := StrHash(edit1.Text); // get/calculate the hash and store it in 'c' i:=c; // convert cardinal into integer value so i can intTostr(i) hashLen := length(intTostr(i)); // get the length and store it. (But I want an even number length for the Hex output. // which is next question, "how do I do that?") *** s := inttohex(i,hashLen); // convert the hash value, I into a string m1.Lines.Add(s); // and display it--this will be the ID, the hash of the string, any length, say up to 255-chars end; With regard to the final hash ID, I would like to keep it in a specific length so that the output is clean and not croked/jaggid when I display a bunch in a report/output. So, I thinking that I need to calculate "even" numbers from the hashLen variable. So, if hashLen is 9 I want to add 1 and make it 10. If hashLen is 8, nothing to do. This is what I have so far, and although it does seem work, it has some problems/drawbacks.
  8. JohnLM

    New patch is coming ?

    never mind.. this post deleted by me.
  9. This is so frustrating, every time I reinstall Delphi, I have to do something in order to get the Android functions to work for deployment. I have those familiar 3 triangles, and I just can't remember what I did the last time to resolve it, and I can't find it here where I i know I posted it. Does anyone know what I need to do to clear those yellow triangles in SDK Manager?
  10. update.. resolved! I finally figured it all out and got mobile deployment working for Delphi 12.2 IP 1 once again. FWIW.. it was because I did not tick the "[x] Eclipse Temurin..." during the installation. Also, because I had the different values for the JAVA tab under SDK Manager. I had to change them all to this folder "c:\program files\Eclipse Adoptium\jdk - 17.0.9.9-hotspot\bin\" for both keytool.exe and jarsigner.exe files. And then all compiled/deployed to mobile.
  11. I found it, the link to my original issue with android, and its now resolved. However, I am unable to deploy because of a missing "D:\bin\java.exe" file. Anyone know anything about this and how to resolve ?
  12. specs: Win7, Chrome Version 109.0.5414.120 (Official Build) (64-bit) I was pressing a keyboard shortcut multi-key sequence too quickly (like ctrl+t, etc.) but don't know the key combination because I was doing this in very low light conditions a moment ago and now I can't scroll a webpage up/down/home/end any more. And for all I know this could be a key sequence not documented anywhere. I tried to resolve it by shutting down the Chrome browser but that did not help. Does anyone know what key sequence I need to restore back to normal browser behavior to?
  13. Solved !! Solution: I was calling it Edit mode because my cursor carrot key is blinking as if in Edit mode. But its refered to as 'Navigate pages with a text cursor' that needs to be turned off. I guess I must have pressed F7 when all this happened. It is now back to normal.
  14. JohnLM

    Multi-Threading Example Code

    I am not a Thread guru, though I do browse around as it is something I want to learn eventually. So I tried the code snippet in XE7, but didn't work at first, then took out the "@" (before reading Remy's reply) and although the routine appeared to work, the Label did not get updated. And after looking through the code, I saw that var x was never called/assigned. Then I added x=i and it worked! The Lable now gets updated in real-time, even while dragging the form around the screen during the thread's operation. // Simulate some work by looping and sleeping for i := 1 to 1000 do begin Sleep(10); // Simulate work (1 second per iteration) msg := '# ' + IntToStr(i); x:=i; Synchronize(UpdateUI); // Update UI safely from the main thread end; PS: I made a VCL project.
  15. JohnLM

    Delphi 12.2 TMEMO - indexoutofbounds

    I use the TMemo in Android apps a lot, but due to this issue (I suffer from this as well--Galaxy S10+ phone) I've been holding off compiling to Android via 12.2 Does the Inline Patch 1 from 10-17-2024 fix this issue ? As soon as I can, I will be making an HDD image before I proceed to this Inline Patch 1 process.
  16. As the subject implies, I am just messing around with code snippets found on the web. Some I downloaded from people writing code for various purposes. Anyway... So I have this code snippet that I downloaded and was trying to see what happens. The snippet has the line: IdTCPClient1.writeln('start'); and in another: listbox1.item.add(IdTCPClient1.readln); These two commands do not appear in Indy 10.x for XE7 and D12.2 versions. Have those commands been moved some place else in the IdTCPClient component and where?
  17. Thanks. I think this one works better and a faster response time (searches/lookup etc): One of those files, a .zip of the HTML Help, has been uploaded to this repository.
  18. Because I don't know what version the code snips are until later on in reading the entire discussion. These are google search results. I see a snippet and read what's going on. I try it and see if it works on my main laptop computer which has XE7. And if it doesn't work either I'll keep reading further or try it on Delphi 11.2 or 12.2 as those are the three versions I have. But not all google-found search results include the versions of Indy in those discussions. I am just searching google for info and if code snippets are given I try them out for fun or interest. Not all say the version of Indy, and if I can't find any further info to resolve any issues that I might run into while trying those snippets then I might post a question here on Praxis, or not, and move on. Delphi is my hobby. Sometimes I get *new* ideas from these random google searches and they become hobby projects. In fact, I just started a new project from this as of yesterday, a Client/Server app and it appears to be working okay. First time I ever accomplished this as I always wanted to get a client/server (send/receive text) project working via Indy but failed many times. But not this time. But is it perfect or correct? Probably not. But it works. :) I was meaning to post a few questions because I had many issues, about 18 or more hours worth (I just could not stop). I'm stuck on an issue or two and still working them out. Maybe I'll post a question or two later, if I can't figure it out as it is driving me nuts. Also, I have searched around on all my versions of Delphi (xe7, 11.2 and 12.2) and did not see any documentation or Samples folder for Indy. And the link in the About of the Indy components (when you rightl-click the component in the IDE) do not work on any of those Delphi versions.
  19. JohnLM

    Scroll an image with mouse (Solved)

    I am having trouble figuring this one out. I have a form with a tscrollbox and an timage. In the image1MouseMove event of the timage I have the following code; procedure TForm2.im1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin scrollbox1.vertScrollBar.Position := x; scrollbox1.horzScrollBar.Position := y; end; But it is not what I'd expect. What I am trying to do: 1. Lets say I have screenshot of my desktop and inserted into the timage. 2. And I resize the app's form smaller 3. Using the mouse, I want to click on the image and drag (or pan) around inside the form's scrollbox area so that I can see other parts of the image. What am I doing wrong and how can I fix this? TIA
  20. JohnLM

    Scroll an image with mouse (Solved)

    Thank you @Lajos Juhász for your suggestion. I had tried a few mods late last night but I could not get it to work any better. And thank you @Anders Melander for your suggestion. It is working the way I was hoping. And, I learned a little bit about Delta. Thank you both for your help, it is appreciated!
  21. Specs: Win10, Delphi 12.2 - Installing fresh because previous 12.2 installation did not include Android support. 2nd fresh install, same issue. I've reinstalled 12.2 but have no android support and when I plug the usb cable in, there is no device -- field is blank. Okay, so for sure, I thought I would not have this issue this time around in this latest release, but disappointed that this continues every new version install. What can I do? Please advise.
  22. Update. . . Success and Resolved. Thank you @Z Vadim for the solution. In order to work, I had to search for the "sdkmanager.bat" file and found here: C:\Users\Public\Documents\Embarcadero\Studio\23.0\CatalogRepository\AndroidSDK-2525-23.0.53571.9782\cmdline-tools\11.0\bin\sdkmanager.bat I closed down Delphi 12.2, and made sure I was connected to the internet, and went to that folder and ran the following: sdkmanager.bat "platform-tools" "platforms;android-34" I now have moble development working for Android for the first time in the 12.2 version.
  23. Specs: win10 tablet I am unable to install 12.2 It removed 12.0 but the installation stops at: Platforms availability No more platforms pending to install. Any suggestions?
  24. At the start of the installation is a [Options] button for changing folder locations. And I was trying to install to another drive instead of the standard C: drive. It did not like it, I guess. When I changed it to the default location, the installation went ahead, successfully, about 50 minutes.
×