Jump to content

JohnLM

Members
  • Content Count

    288
  • Joined

  • Last visited

Everything posted by JohnLM

  1. Because I have arthritis in my fingers, they can be twitchy at times, and during debugging I can go past the point I want to debug and when that happens, other Units open up and I get lost and loose my focus. Its become quite irritating. Say I am begging within the scope of a tbutton, and there may be 7 lines of code. I don't want the debugging to continue outside that range or else it will continue loading various Units and that is creating extra work for me and causing me frustration. procedure TForm1.Button1Click(Sender: TObject); begin 1 2 -- debugging started via F8. 3 4 5 6 7 -- stop debugging after this. so if i press F8, debugging will not continue to step past it 7. 8 9 end;
  2. I am currently using Delphi XE7. I forgot to mention that. Apparently, there is no switch to turn off debugging after a certain point within a given code block that I may be currently working on. I saw this: {$D-} But that only works before a routine/function/procedure call. I can't insert it between some code within a routine. And it doesn't seem to work when I tried. Oh well. I guess I can only do one thing that will help a little, and that is to use the following idea shown below using i:=i; multiple times, that in the event I do over-press the F8 key, I will catch it in time in order to stop myself from pressing F8 any further. procedure TForm1.Button1Click(Sender: TObject); var i: integer; begin 1 * 2 -- begin debug breakpoint - i have a breakpoint set it. and i press F8 to setp through the lines of code. . . 3 4 5 6 7 -- end debug breakpoint . . .until i reach this line, i want the debugging to stop 8 9 i:=i; 11 i:=i; 12 i:=i; 13 i:=i; 14 i:=i; 15 end;
  3. JohnLM

    The Advent of Code 2024.

    @corneliusdavid, ah, now I understand, since I am not a member of AoC, nor registered participant. I am an outsider just playing along as best I can. Also, I found this website: https://jeroenheijmans.github.io/advent-of-code-surveys/ I did not see any Delphi / Pascal language mentioned. Looks like there are very few people (including myself--day1 and 2 puzzles solved) in this language tackling AoC.
  4. JohnLM

    The Advent of Code 2024.

    Sorry Cornelius, I don't understand you point on "input file". what is it? And for different users? Anyway. I was not sharing my source code, if that is what you mean. Actually, I would be ashamed to show it. Also, I see no reason why I can not show my output log or report or final outcome, not when the website already shows it in their instructions. >> Also, don't post the puzzle text input I don't understand what you are saying. I'm getting ready to work on the Day-03 puzzle--I took a cellphone screenshot of the instructions and read it last night at work--It seems easy enough. Just some parsing of the string. And I read (on reddit) that people were getting double-lines and were processing it wrong. And, no--I am not looking for answer on how to solve it or any other puzzle. I would not read those if they are available, though those are in another language that I don't understand, nor how to read anyway. Also, question: where are the second parts I keep reading about? I read bits here and there about part 1 and part 2. But I don't see them in any of the days I have seen aready, 1-3. Or do you have to be at the website at a certain time to see it? I don't know.
  5. JohnLM

    The Advent of Code 2024.

    Update. . . I have finally completed the Day-02 puzzle. I started on these puzzles a week later, so I am behind, not to mention, slow. Because I am a thorough type person, for me, the tricky parts were in determining what items were: Increasing, Decreasing, Inc/Dec, or the Same (c for 'center'), and capturing the value amounts for the Inc/Dec etc., and then reporting those as detail in the final report. I just need to clean up the output view and make a few changes to the UI and Report view. Hopefully, I will show the results later today.
  6. JohnLM

    The Advent of Code 2024.

    No, no sorting. But I did spot another error. But is not a bug. I miss-used the Random() function. I should have set it as Random(1,9) and not Random(9). Because of that, I am getting 0's included in the randomized lists in the report for Day-1's puzzle. The 0's were not in the instructions on the website. A slight oversite on my part. But, it still passes as a success.
  7. JohnLM

    The Advent of Code 2024.

    Re: Day 2 puzzle I believe I have that part worked out. This is not code, it is just my way for me to keep track of the logic for Inc/Dec directions, visually and mentally. { given the array for levels [1 3 2 4 5 ] 1 and 3 = low to high is increase (RT) 3 and 2 = high to low is decrease (LT) } But there are twists as you said. And I believe I am in that twist. . . 3 hours 10 minutes into this. I keep a timer on when I start/stop/pause work via the Android clock app. My skills in if/then Logic are poor. But as long as I meet up with success, I will survive another project. What is part 2 that you are talking about? Another puzzle? I don't look at other puzzles until I have completed the current one I am working on.
  8. JohnLM

    The Advent of Code 2024.

    Yes, I agree about the solutional changes. But I sometimes veer past it in my hair-pulling while debugging alternative solutions. Oh, I just started Day-2, half an hour ago. I've got up to the point of generating the random values for filling in the levels list and a few other tid-bits. And, now about to start the real challenge of how to determine what level(s) are safe and unsafe. Should take me many more hours to solve. . . can't wait!
  9. @Anders Melander, thanks to your code above (Posted December 23, 2021) and a slight modification to allow me to use images screenshotted to the clipboard, I was able to create my first animated GIF file in Delphi XE7.
  10. JohnLM

    The Advent of Code 2024.

    Okay, I found a way to create animated GIF files in Delphi XE7 via TGIFImage, thanks to @Anders Melander for his how-to codesnippet in another post here, where I modified the code slightly in order to create the GIF file via images I screenshotted (ctrl+alt+prt sc) to clipboard and to the delphi app. I set the animation (5 frames) to a limit of 5 iterations only, then it stops. Advent of Code 2024 - Day 01 - Historian Hysteria - in Delphi XE7 - completed LF and RT are random lists of numbers generated DST is the list of results from the LF and RT lists, and Total Distance is the summation of DST.
  11. JohnLM

    The Advent of Code 2024.

    Ahh, I just spotted a typo. Should be RT, not RF. Anyway. . . I forgot to explain my resolve of this puzzle. Column LF and RT are randomly generated, then calculated in the DST (distance) column via the [Generate] which generates random numbers for both LF/RT columns, and then I calculate (I sum each value in DST) the Total Distance (in the DST column) below those columns. I should have labeled that section. Oh well.. I can't do everything perfectly! 😞
  12. JohnLM

    The Advent of Code 2024.

    I set the animation (5 frames) to a limit of 5 iterations only, then it stops. ** I removed the gif because it was tacky to see a watermark from a trialware. I will investigate an alternate method to create my own, maybe delphi can do it, just need to figure out how to accept a list of bitmapt/png images, delay and loop and save as .gif file.
  13. 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.
  14. 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.
  15. 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.
  16. Solved. . . Thanks @FPiette, your's confirmed what I was getting from another version I was testing, though different values, but the same outcome.
  17. @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.
  18. 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.
  19. 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.
  20. JohnLM

    New patch is coming ?

    never mind.. this post deleted by me.
  21. 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?
  22. 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.
  23. 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 ?
  24. 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?
  25. 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.
×