-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
How do I delete a row in a database with FireDAC?
programmerdelphi2k replied to JohnLM's topic in Databases
implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var LSQLText: string; begin LSQLText := Format('delete from MyTable where MyField=%s', { } [ { } StringGrid1.Cells[StringGrid1.Col, StringGrid1.Row] { } ]); // ShowMessage(LSQLText); end; end. LSQLText := Format('delete from MyTable where MyField=%s', { } [ { } StringGrid1.Cells[StringGrid1.VisibleColCount, StringGrid1.VisibleRowCount] { } ]); // ShowMessage(LSQLText); StringGrid1.Cols[1].Text := 'MyQRcode'; // LSQLText := Format('delete from MyTable where %s=%s', { } [StringGrid1.Cols[1].Text.Trim, { } StringGrid1.Cells[StringGrid1.VisibleColCount, StringGrid1.VisibleRowCount] { } ]); // ShowMessage(LSQLText); -
Send a file from a Delphi VCL program using WhatsApp Cloud API
programmerdelphi2k replied to lior I's topic in Network, Cloud and Web
I believe that you have 2 problems now: 1) send a file by Whatsapp; 2) your glasses is broken -
How do I delete a row in a database with FireDAC?
programmerdelphi2k replied to JohnLM's topic in Databases
look, StringList class in general (grid, stringlist, etc...) is not aware data... it just know itself data, like: strings, pointers, properties, etc... then, when you move between record (if using Livebinding, for example), it's it who receive the info about record changes, then the stringGrid is updated. said this, you can: 1) use the BindSourceDB to get your info about your records, because it is like a Datasource regular to datasets... many properties and methods with same functions BindSourceDb.Dataset.Field.... 2) to delete any record, you can use your Query component with qr.Sql.Text:="delete from tablex where fieldX = nValue"; qr.EXECUTE; it's ready! -
hi @PeterBelow I think that is not necessar so much code for this task! you need just: open the file and scan "sequencially" the buffer (with your size desired) the sequecial reads you can do with: here I'm going to use "FileOpen(...)" directly (MSWindows) to avoid using any unnecessary stream class over here! FileOpen(...), FileSeek(...), on end... FileClose(...) with this functions, your task (read) it's done! Once you've found your pattern by comparing each buffer read, then you can update your buffer and save it in another file for this purpose! the "compare" procedure you can use any one that desire, or create yourself; if ByteX[ i ] = ByteY [ i ] then ... to avoid problems with original file, just write the changes in another file!!! compare this buffer with your pattern assign new values to buffer found write new buffer content in your file temp for example close fileS opened and created! I have my code with a little bit lines: +/-16 lines to sequencial reads, does not matter size file! 21 + 17 lines to compare bytes: divided in 2 procedures
-
Validate data against a set of rules
programmerdelphi2k replied to karl Jonson's topic in Algorithms, Data Structures and Class Design
for sure, you needs create a "class" to specific case! then, you can use it in any other similar case! a little skeleton... unit uMyPeoples; interface type TMyPeoples = class private FFirstName: string; // ... another fields... // function GetFirstName: string; procedure SetFirstName(const Value: string); protected public constructor Create; destructor Destroy; override; // function ValidMyCurseDate(const ADate, AMin, AMax: TDate): boolean; // property FirstName: string read GetFirstName write SetFirstName; // // ... another propreties to another fields end; implementation { TMyPeoples } constructor TMyPeoples.Create; begin end; destructor TMyPeoples.Destroy; begin inherited; end; function TMyPeoples.GetFirstName: string; begin result := FFirstName; end; procedure TMyPeoples.SetFirstName(const Value: string); begin if (Value = '....') then FFirstName := Value; end; function TMyPeoples.ValidMyCurseDate(const ADate, AMin, AMax: TDate): boolean; begin result := (ADate >= AMin) and (ADate <= AMax); end; end. the rest... you can use your SQL query to valid all records readed! -
Display of bmp and jpeg images is poorer quality in Windows 11
programmerdelphi2k replied to Martin Liddle's topic in General Help
here my sample, simple to load... BMP or JPEG or GIF or any other types allowed on TPictures class!!! uses GIFImg; procedure TForm1.Button1Click(Sender: TObject); var Pic: TPicture; begin Pic := TPicture.Create; try Pic.LoadFromFile('d:\ABitmap.bmp'); Image1.Picture.Assign(Pic); // Pic.LoadFromFile('d:\AJPEG.jpeg'); Image2.Picture.Assign(Pic); // Pic.LoadFromFile('d:\AGIF.gif'); Image3.Picture.Assign(Pic); finally Pic.Free; end; end; -
Display of bmp and jpeg images is poorer quality in Windows 11
programmerdelphi2k replied to Martin Liddle's topic in General Help
I think that your problem can be on: converting your JPEG to BMP, or inverse: try this procedures: https://helloacm.com/how-to-convert-jpeg-to-bmp-and-bmp-to-jpeg-in-object-pascal-delphi/ review your "Stretch draw" procedure too! -
Display of bmp and jpeg images is poorer quality in Windows 11
programmerdelphi2k replied to Martin Liddle's topic in General Help
I think that you need to say more about: what components/classes used to load/show the pictures? what components/classes used to print it? what "your" code used with above? -
for sure, use the O.S. options, because I dont needs worry about create the "whells" if you target O.S. have a "scheduler", use it. naturally, this is more in the control of the O.S. than from your app! if you want have "control" over all, create a app!
-
FireDac variable column length overflow
programmerdelphi2k replied to Jeff Steinkamp's topic in Databases
https://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Stan.Option.TFDFormatOptions.StrsTrim look in your component to query the properties about field size on Fields editor -
no no no... my "zip" is about "compressing and decrease the amount of data to be written to memory or disk" you talk about "zip... it", not me!
-
@David Schwartz for sure, I think that you understand my fun-session! 🙂 now, what you exactly want to say with "what is the shortest bit of code that would let you download a file?"... I see something very intriguing in this question! I explain: Even if the client (programmer) types just a single word- (command) like "downloadMyFilePlease('Hello.mp3')" (let's not consider the filename for now), what happens behind the scenes is realized by the operating system, at least!!! And, in this context, the operating system accessed its library of commands to download... and these commands were coded by someone, who wrote tens, or thousands of lines of code so that "such a task" could be carried out successfully or no!!! So, what exactly would be the definition of the smallest amount of bits to perform the file download? You mean: the smallest amount of bits encoded by you or the operating system as a whole? I ask for the simple reason: if you don't code, then someone else will have to code for you!!! Or am I wrong?
-
[Warning]: Include file not found: OBSIDIUM_ENC_START in line
programmerdelphi2k replied to Stano's topic in MMX Code Explorer
NOTE: A warning about use of "folders of the System", like "Program files"!!! as "folder system" always needs "admin privilegies", it's a common scenary have this access denied when try create new files, like when "building/compiling" your project! sometimes there are not any critical error-message! simply the files it's not created and the IDE report some other message for that situation! as general rule: DONT INSTALL YOUR PROJECTS, or any other that needs to be re-compiled/re-builded in "Program files" or other that needs any Admin priviligies! create a new directory for this cases! like: C:\MyProjects\MySDKs -
[Warning]: Include file not found: OBSIDIUM_ENC_START in line
programmerdelphi2k replied to Stano's topic in MMX Code Explorer
if the file was not found on project-folder, then, you'll always needs in "Search path" in your project (Project->Options->Compiling...->Search...) or in IDE (Tools->Language->Delphi->Library Path... but here, it's for when needs in all projects like when installing new packages, libs,etc...) search all "*.INC" and see where it is in (folder), normally, it will be in "sources" folder! if the project have many *.DPK, then, you have that updates it too! See a example, if you dont want changes your Project-Options: -
[Warning]: Include file not found: OBSIDIUM_ENC_START in line
programmerdelphi2k replied to Stano's topic in MMX Code Explorer
find some option to config your project on MMX, or, in your Delphi project --- Project -> Options -> Compiling -> "Search path" .... and define where is the source files!!! -
Send a file from a Delphi VCL program using WhatsApp Cloud API
programmerdelphi2k replied to lior I's topic in Network, Cloud and Web
JPG or PDF it's all bits to computer, then, what the difference to Whapsapp? -
Multiple Simultaneous Connections with TidFTP
programmerdelphi2k replied to Brian Warner's topic in Network, Cloud and Web
maybe, it would be better some like this: type TMyThreadDownload = class(TThread) //.... + all definitions necessary private FileToDownload:string; // URL + filename protected procedure Execute; public constructor Create.... destructor Destroy;override.... // property FileToDownload:string read FFileToDownload write FFileToDownload; end; implementation ... other definitions constructor Create; begin FreeOnTerminate:=true; // not use MyThread.Free on button1 end; procedure TMyThreadDownload.Execute; // my sample to HTTP, but you can port it to FTP class!!! var MyClientHttp: TIdHTTP; //or any other class to downloads MyIOHandler:TIdSSLIOHandlerSocketOpenSSL; MyStream:TFileStream; begin // create IOHandler + definitions // create MyClientHtpp + definitions // create your MyStream + definitions try try MyClientHttp.Get( FFileToDownload, MyStream); // MyStream.SaveToFile('...'); except // what to do ? end; finally // release objects created end; end; then, you usage: Button1 click: var MyThread:TMyThreadDownload; begin // if you want on loop, then just loop it! // MyyThread:=TMyThreadDownload.Create; MyThread.FileToDownload:= 'xxx'; MyThread.Start; end; -
Multiple Simultaneous Connections with TidFTP
programmerdelphi2k replied to Brian Warner's topic in Network, Cloud and Web
you can see this way: client side: each thread will works like a "separated software"! then, each software should have your credencials, as well as, your file to download/upload server side: it's another history! -
(replicable w/ source) Why do I always get Access Violation every time I rebuild ANY component? (Current solution is to Restart Delphi.. Why??)
programmerdelphi2k replied to Al T's topic in FMX
here, RAD 11.2 Alexadria does not cause this error! see my tips above! -
my tip for "zip" your infos: memory or disk! many know about ZLib compress in Delphi usage, TCompressXXXX = ok! now add this: take your info in string format, like using Base64 convertion ( dont worry about size.... final-string = source + 1/3(source) --- dont worry, continue reading... after convert your string in Base64, convert it in "bytes" --- here the magic flowing... (many equal digits will be "the point" to elimate duplicates) after this, compress it using your ZLib class it's ready! you can get until "90% off" (or more) as result! I have tested with text, bitmap, and other types! bitmap 8MBytes stay with 1.x MBytes same that the type is already compress by default, like GIF, JPEG, etc.. you can reduce it more! there are no losses, because the real-data it's not affected!
-
Create multiple instances of tApplication with multiple MainThreads?
programmerdelphi2k replied to microtronx's topic in VCL
"A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. Each process is started with a single thread, but can create additional threads from any of its threads"... https://learn.microsoft.com/en-us/windows/win32/procthread/multiple-threads then, in fact, there is just one "main", the rest is co-adjuvant process -
Create multiple instances of tApplication with multiple MainThreads?
programmerdelphi2k replied to microtronx's topic in VCL
I know about loop, I came form "Clipper summer87" the same "principle" is used in GUI app... a looping "REPEATing" until end message! -
Create multiple instances of tApplication with multiple MainThreads?
programmerdelphi2k replied to microtronx's topic in VCL
look, each "TApplication" represent a "application = process" on memory! then, have many "TApplication" means have many process of same process (or be: clones)... but at end, all clones will be the same app! what you can do is: many forms and changes one or other to be "the main-Form", but not all at same time! -- because, you cannot have 2 or more "main-Forms" in the same application! -
Delphi 11 uses designide270.bpl instead of designide280.bpl and won't let me replace it!
programmerdelphi2k replied to Al T's topic in Delphi IDE and APIs
try create a "new session" on Registry for your RAD Studio using: https://docwiki.embarcadero.com/RADStudio/Sydney/en/IDE_Command_Line_Switches_and_Options BDS.exe /r NewName ..... other params -
the minor code for me is: open Chrome and paste the url