Registration disabled at the moment Read more...
×


JohnLM
Members-
Content Count
367 -
Joined
-
Last visited
Community Reputation
27 ExcellentTechnical Information
-
Delphi-Version
Delphi 11 Alexandria
Recent Profile Visitors
24074 profile views
-
How do I avoid the error message 'is not a valid date.' ?
JohnLM replied to JohnLM's topic in Databases
TryStrToDate() is Resolved !! Again, sorry for the confusion. I am no database guru. The memo I was referring to are like this: #1. The first one is the originating source, the one from the ms access .mdb file, which contains the Data Type: Memo #2. The second memo type is from the Delphi app, which is a TDBMemo. I am using FireDAC, dbgrid, tfdconnect, tfdquery and dbsource to open/use/edit the ms access database. Anyway, I have resolved the TryStrToDate() issue in the #3 app (where the issue was). I had defined the dbDate as TDate (as you pointed out earlier). And when I changed it to TDateTime, it compiled, and the routine works successfully now. Thank you! -
How do I avoid the error message 'is not a valid date.' ?
JohnLM replied to JohnLM's topic in Databases
Let me try and explain my situation. . . #1. I am pulling the date (mDate) from an MS Access database, "db.mdb" via FireDac. The Data Type is a Date/Time field in that database. #2. But, I have a Delphi app that reads the .mdb file and displays it a certain way for me, and I add new entries through that app on a daily bases. In this app, I have the date formatted as "yyyy-mm-dd, ddd" for readability. I prefer that layout when using this app. screen snippet below. Note, the memo field in this Delphi app shows where I enter multi-line text of activities. I just added these entries for convenience and simplicity of this conversation. #3. Then, in another Delphi app (this is an experimental search db app I am testing) that I just started working on, to search-for-text in the myNotes field for certain text that I entered since its inception, this is the app where I am receiving that EConvertError message while doing the date conversions. I am using the mDate from the db.mdb in #1 in this app, #3. I am displaying it in a search results window like the screenshot below. In this app, #3, I am debugging different parts of this app for ideas on how to accomplish what I want. Using a regular memo control on the form, I am trying to decide on an output layout and what should show as the final results from the found text from the datase memo field from the database in #1, as seen in the output of #2 from the db memo field. So, I am showing a custom formated date as part of the output results in app #3. The issue and this discussion has to do this the mDate being converted in app #3. I hope this explains better my goals and what I am doing with this project at this time. -
How do I avoid the error message 'is not a valid date.' ?
JohnLM replied to JohnLM's topic in Databases
@Remy Lebeau - mdate is a TDate, not a String. So that won't work. Sorry for the confusion. -
How do I avoid the error message 'is not a valid date.' ?
JohnLM replied to JohnLM's topic in Databases
And to be clear, I don't mean Google A-EYE, I mean performing a google search and reviewing the output results from the webpage returned. -
How do I avoid the error message 'is not a valid date.' ?
JohnLM replied to JohnLM's topic in Databases
I did some debugging and the error is EConvertError. And I was able to figure it out before consulting with Google. So, I need to set up a try/except statements. Then, I needed Google show me how to set up a try/except, and make some changes and now have the following codesnippet working. . . try dbDate := StrToDate(qry.FieldByName('mDate' ).AsString); thedate := FormatDateTime('yyyy-mm-dd ddd',dbdate); dateS := thedate; except on E: EConvertError do begin sb1.Panels[0].Text := 'Error: invalid date!'; // <-- a statusbar control end; end; But I'm not sure I need to add a Finally part in this While EOF() End block. But it does work without throwing up an error message and bailing out without any output. -
Specs: Windows 7, Delphi XE7, VCL Whenever my app comes across a date year like 1899, my app throws the error: "12/30/1899 8:00:00 AM' is not a valid date." I need a way to detect certain date(s), like the one above, and when found, I guess I will skip over it and just write "N/A" or something for those items, or else I will get the error mentioned above. Any suggestions of how to detect or avoid this error ?
-
Youtube comments - how are you retreaving them
JohnLM replied to JohnLM's topic in Network, Cloud and Web
Thanks, but I am also already using the YT API. I have been using it for years but thought there was an even faster way of obtaining the larger comments listing. I guess what I am already using is the fastest then, only I am not using JSON. I am just manually parsing the json response because I am accustom to doing that way and json is not easy for me. I was originally using a web scrapper method but it was tedious when there were hundreds or more of comments. And when I learned about the YT API, I started using that but I couldn't figure out how to obtain more than the 100 item limit, so I went back to using the scrapper and made various updates to it whenever I had time to fine-tune it. But years later I had figured it out how to use the YT API to go past the 100 item limit and started using it--see image below. -
I was wondering. . . Is there any apps (for Windows) that can retrieve all comments from a given Youtube video ? And how quickly can it be received ? And, has anyone used it or uses it currently ? I've been wanting to download or extract Youtube comments for a number of purposes. What I'm looking for is how *fast* can comment's be retrieved, not how to do it myself. I've written a few code snippets to pull it once I have a video in view and it can be very tedious, especially when there are replies and when the comments are in the thousands. And sometimes I can't read them on screen because there are too many and/or I run out of memory or something. I'm wondering how people are doing it without issues and how fast they can pull thousands.
-
SPECS: Windows 7, Delphi XE7, FMX, Galaxy S10+ phone, Android version 12 I want to create an Android app that will accept a clipboard image via menu-select of "copy to clipboard" so that I can paste it into my custom-made app that I want to accept and display in a window on an Android phone. I'd like the image to be "pinched" enabled in order to inlarge the size of the image as well. This is the situation: For instance, when I am Google searching on the phone, there are times when, if I hold down the pen (or my finger) on a certain spot on the phone, a short popup menu will display and offer me to copy-image-to-clipboard. Other times, I may screen-grab as an image to the clipboard via (Power-button+Vol-Down buttons). I want my app to grab what is in the clipboard and paste it into my app so that I can see it, and maybe crop some of it if necessary, then put it back into the clipboard so that I can paste it into a Message for texting back to the recipient. In my app, I mainly want to be able to see the image and be able to enlarge it if necessary, though cropping it would be a bonus. Is this possible and how would I go about it?
- 1 reply
-
- delphi xe7
- image
-
(and 2 more)
Tagged with:
-
A slight change of plans. The original goal was to create a list of values that I could use to parse strings based off a main or master string--for databases and other uses. So, something like a header with fields would have worked for the visual aid. But headers don't always give the true char-length. It is the actual line of text that matters most in these situations. However, during the process of development, I decided I wanted to have something visual. And I managed to get a working version late last night after my initial post here on this forum. But I did not post it up here. I decided that a short video demo would suffice. It took some time for me to figure out and I will post that later on. Until then. Today, working on it some more, I realize now, that I can turn this into a utility app to parse the strings that I want and build the database in this same process.
- 7 replies
-
- delphi xe7
- trackbar
-
(and 1 more)
Tagged with:
-
I just made some edits to the topic. I did not complete this post. I pressed the [submit] button too quicky. Anyway. In the 2nd method, I have the trackbar and spinedit controls. And below that, I have an editbox also, and below that, two memo's, one for the the strings and another for the value pairs to use in parsing out the strings. And then, I have [Add] and [Del] buttons. I am designing the app to show in real-time, the text I am selecting via the trackbar and spinedit so that I can see the values I need. The real-time feedback will help to show me what I am selecting. If I can get a working demo, I will post it up here. It might be useful in some way or idea for others.
- 7 replies
-
- delphi xe7
- trackbar
-
(and 1 more)
Tagged with:
-
I was wondering if there is a trackbar with two sliders, so that I can use as a min/max setting--i.e., for making text selection ranges. I am not qualified to extend upon the built-in version that comes with Delphi, let alone build one from scratch as a new component. 1st method: I have often come into idea situations with I wish Delphi has one. Today, I had an idea about creating a string utility app to parse strings with (integer) parameters and thought that entering numbers would be a tad bit tedious and then I came up with a trackbar idea, where I build a list of start/end or min/max range and have the app give me the actual position and length position(s) for their values for the string "ABC 123 DEF 456 7GH8 IJKL9". And, given the TrackBarEx below: with the following parameters: TrackBarEx(min=5, max=3) and using those two values, calculate the string to be "123". The trackbarex would return two values, the starting and ending position for the string, per user control. The above is a crude way of explaining what I am trying to do. It may not be as clear or accurate. I would have to calculate the position and distance in the string to get the values of the string position(s) and put those values in a list for me to parse out the string bits. Thus, the following layout of the string, using the trackbarex, I would parse out each of the six text string positions in a list: 1 2 3 123456789012345678901234567890 ABC 123 DEF 456 7GH8 IJKL9 and the returned values would be: 1, 3 ABC 5, 7 123 9,11 DEF 13,15 456 17,20 7GH8 22,26 IJKL9 NOTE: in the above example, the strings "ABC" through "IJKL9" would not be returned. I am just showing that for visual/aesthetics purposes. The trackbarex would contain two sliders and have a minval and maxval that are returned. Not that they are returned but that they are the values of each of the sliders as the user moves them. I would just take those two values and use those to calculate the position within the string. 2nd/alternate method: For now, I have an other method that I am working on right now in hopes to produce the same idea by using one standard TrackBar and a SpinEdit and I would manually set the length of the string to capture every time I move the trackbar to a position. Thus, move trackbar to position 1, set the spinedit to 3, calculate the string and parse it to "ABC". Rinse and repeat for "123", thus move trackbar to position 5, set the spinedit to 3, calculate the string and parse it to "123".., rinse and repeat, . . . and so on.
- 7 replies
-
- delphi xe7
- trackbar
-
(and 1 more)
Tagged with:
-
Delphi project source codes is all on one line
JohnLM replied to JohnLM's topic in Delphi IDE and APIs
Ah, yes.. AdjustLineBreaks() thank you for that. I did not know about that function. I will save the code snippets you provided for future projects. Although I have not tested it, I believe that the later versions of Delphi provide the feature build-in under: \Options\Editor\Line Endings\Inconsistent line endings: [Convert all files to CRLF] The above is in D12.2 on my win10 tablet. So, I would not have to go through the steps you outlined in your previous repy, Remy. The select/copy/paste into win10's notepad would probably work without issues, though I have not tested it. I will update true/false once I get around to testing this. Thanks again for your help, Remy.- 4 replies
-
- delphi xe7
- all-on-one-line
-
(and 1 more)
Tagged with:
-
Delphi project source codes is all on one line
JohnLM replied to JohnLM's topic in Delphi IDE and APIs
When a new project is created, the default pattern is #13#10 (or, #$D#$A) and has been this way for ages. Unless there is a way to by-pass this by setting delphi's environment code to handle #10, I don't know how it could be done. However, I have one theory and that was already explained in my previous post. The developer of CEF4Delphi had probably been using notepad++ or some other editor that uses on #10, and at some point was pushing all the source code into delphi projects, that is, was saving them this way, as #10. And, since Delphi can handle the #10, it went on this way up to this point for the CEF4Delphi project. ill regardless of which editor was used, and the method to transport the source codes, the saved state was using #10 and that is what was pushed into these CEF4Delphi demos. So all the demo's pas files have #10 in them, and Delphi opens them without any issues. If a person goes into the Delphi IDE and select/copy's it to the clipboard to paste into Windows standard notepad, or proceeds to open any of the demos in notepad, notepad will open it as one line because of the missing #13 char for every linefeed before wrapping to the next line, as shown below. For now, I will have to deal with this in my own way. And I have figure out one way to deal with this issue in order to continue using the demo projects as I add or write my own custom functions in them and/or push them into my notepad file of codes snippets. function fix13and10str(sStr: string): string; var s: string; begin s := StringReplace(sStr, #$A, #$D#$A, [rfReplaceAll]); result:= StringReplace(s, #$D#$D#$A, #$D#$A, [rfReplaceAll]); end; // example usage procedure TForm1.btnProcessClick(Sender: TObject); var s: string; begin s := Fix13And10Str(clipboard.AsText); m1.Lines.Add(s); end; I will figure out a way to fix this the code (above) to handle a source file copied to the clipboard to process when copying whole source codes from the Delphi IDE that could potentially be hundreds of lines. For now, I am on the right track. For the record, I do not use notepad++ and I am not saying it is bad or anything. I just never found uses for it up to this point.- 4 replies
-
- delphi xe7
- all-on-one-line
-
(and 1 more)
Tagged with:
-
Specs: Delphi XE7, VCL, Windows 7 So, while working in a new (isolated) project to figure out a better function() to use in one of my projects (SimpleBrowser), I stumbled upon a problem. And the subject says it all. I need to pull a custom function that I wrote from the SimpleBrowser project and work on it as a separate project. So, I select and copy it to the clipboard and then paste it into a new delphi project. The code snippet is pasted correctly in the IDE. However, when I selected and copied that code again from that new project and pasted it into notepad (because for every new function I create, I added to my "delphi code snippet" file) all the source code are on one line. If I follow that same process but copy from the original project, I get the same issues, all the source codes are on one line--there is no carriage returns, no formating, etc.. I tried to figure out why this is happening, and I can only assume that something unique was set in the IDE of this demo project, "SimpleBrowser" but I can't figure it out. This SimpleBrowser is a demo from the "CEF4Delphi" project. The folder is: "..\CEF4Delphi\WebView4Delphi\demos\Delphi_VCL\SimpleBrowser" Does anyone have any clues as to what is going on ?
- 4 replies
-
- delphi xe7
- all-on-one-line
-
(and 1 more)
Tagged with: