Re: [Lazarus] Changes to fpWeb...
On Tue, 1 May 2018, Marcos Douglas B. Santos via Lazarus wrote: but I would appreciate feedback if you have cases where your datamodules no longer behave as they used to (both with LegacyRouting=true or false) Some more improvements to fpweb are planned, but they will not be as invasive as this. Hello Michael, Is there a documentation link to explain all new features? I'm gonna start a new web project and I would like to use them. I will see if I can put something in the wiki. What about the design packages for Lazarus? The wizards continue creating Web Module based applications. A good point. I had not thought of this. I will put it on my todo list. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] About a warning of unused parameter.
On Wed, 2 May 2018 02:19:05 +0200 "Carlos E. R. via Lazarus" wrote: >[...] > function TPINGSend.Checksum6(Value: AnsiString): Word; > begin > Result := 0; > end; You can: a) add a dummy statement: if Value='' then ; b) add an IDE directive: right click on this message in the Lazarus Messages window, Hide message by inserting IDE directive Mattias> > I see on the contextual menu of the warning that I can silence that > warning type on a file (all warnings of that type in that file, not just > the ones I know about): > > {$WARN 5024 off : Parameter "$1" not used} > > Lazarus writes "on"; tried both. Neither work, the warning still appears. It should be "off". I fixed that in trunk. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Changes to fpWeb...
On Tue, May 1, 2018 at 9:59 PM, Marcos Douglas B. Santos wrote: > Hello Michael, > > Is there a documentation link to explain all new features? > I'm gonna start a new web project and I would like to use them. > > What about the design packages for Lazarus? > The wizards continue creating Web Module based applications. > > This is my environment: > Lazarus 1.8.3 r57764 FPC 3.0.4 i386-win32-win32/win64 Actually, I've found the "routing example" and it worked very well in standalone mode in my environment. I can get how it works (the new way) just studying this demo. Thank you. But I still think that we need to have a good documentation for it. Regards, Marcos Douglas -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Changes to fpWeb...
On Fri, Jan 13, 2017 at 7:36 PM, Michael Van Canneyt via Lazarus < lazarus@lists.lazarus-ide.org> wrote: > > Hello, > > I have committed a serious change to the way fpweb handles requests. > > Especially routing of requests was changed. > > The old Delphi style routing worked with Datamodules only. The pattern was > strictly /modulename/actionname or through query variables: > ?module=xyz&Action=nmo > > This old routing is still available by setting the LegacyRouting property > of > webhandler or webapplication (custweb) to true. (the new routing described > below is then disabled) > > The new routing is more flexible in 3 ways. > > - It is no longer required to use datamodules, but this is still supported. > There are now 4 methods that can be used to register a route: > > - Using a callback procedure > TRouteCallback = Procedure(ARequest: TRequest; AResponse); > > - Using a callback event: > TRouteEvent = Procedure(ARequest: TRequest; AResponse) of object; > > - Using an interface > IRouteInterface = Interface ['{10115353-10BA-4B00-FDA5-80B69AC4CAD0}'] > Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); > end; > Note that this is a CORBA interface, so no reference counting. > (although a reference counting version could be added, if desired) > > - Using a router object: > TRouteObject = Class(TObject,IRouteInterface) > Public > Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); > virtual; abstract; > end; > TRouteObjectClass = Class of TRouteObject; > > The object class needs to be registered. The router will instantiate > the >object and release it once the request was handled. > > - Using a datamodule, as it used to be. > > More methods can be added, if need be. > All routes are registered using the HTTPRouter.RegisterRoute method. > it is overloaded to accept any of the above parameters. > > - The router can now match more complex, parametrized routes. > > A route is determined by the path part of an URL; query parameters are > not examined. > > /path1/path2/path3/path4 > > In these paths, parameters and wildcards are recognized: > > :param means that it will match any request with a single part in this > location > *param means that it will match any request with zero or more path parts > in this location > > examples: > > /path1 > /REST/:Resource/:ID > /REST/:Resource > /*/something > /*path/somethiingelse > /*path > > The parameters will be added to TRequest, they are available in the > (new) RouteParams array property of TRequest. > > Paths are matched case sensitively by default, and the first matching > pattern is used. > > The HTTP Modules are registered in the router using classname/* or > defaultmodulename/* > > - A set of methods can be added to the route registration (default is to > accept all methods). > The router will match the request method. If the method does not match, > it will raise an > exception which will result in a 405 HTTP error. > > I have added a demo application. It behaves well, just as the testcases, > but I would appreciate > feedback if you have cases where your datamodules no longer behave as they > used to (both with LegacyRouting=true or false) > > Some more improvements to fpweb are planned, but they will not be as > invasive as this. Hello Michael, Is there a documentation link to explain all new features? I'm gonna start a new web project and I would like to use them. What about the design packages for Lazarus? The wizards continue creating Web Module based applications. This is my environment: Lazarus 1.8.3 r57764 FPC 3.0.4 i386-win32-win32/win64 Best regards, Marcos Douglas -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] About a warning of unused parameter.
Hi, I'm experimenting with doing "ping host" on Lazarus using the Synapse library (http://synapse.ararat.cz/doku.php/download). The code on my side is very simple, I just have to "use pingsend", then basically ping.ping('some host'); I have a little nuisance: building the included library produces a ton of warnings. This thing was last updated on 2012 (release no. 40). For instance, this one: pingsend.pas(137,24) Hint: Parameter "Value" not used The code is different on Windows or Linux, by using {$IFDEF MSWINDOWS} clauses. On Linux, the effective code is; function TPINGSend.Checksum6(Value: AnsiString): Word; begin Result := 0; end; So the warning is true, but I don't see what I can do about it without changing the function definition (I could just not call the function in Linux). I can do: Result := 0; Value:=''; but that just changes the warning to: pingsend.pas(137,24) Hint: Value parameter "Value" is assigned but never used which is of course true. So I wonder if there is something to silence that particular warning alone. Say, yes, I know about that one, shut up. I see on the contextual menu of the warning that I can silence that warning type on a file (all warnings of that type in that file, not just the ones I know about): {$WARN 5024 off : Parameter "$1" not used} Lazarus writes "on"; tried both. Neither work, the warning still appears. Ideas? -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) signature.asc Description: OpenPGP digital signature -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Make of revision 57762 failing under Raspbian
Am 01.05.2018 um 22:26 schrieb Ondrej Pokorny via Lazarus: Please retest with r57764. Yes, now ok. Thanx, Ondrej. Joe -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Make of revision 57762 failing under Raspbian
On 01.05.2018 19:25, Joe via Lazarus wrote: What's wrong? Is it a mistake of the operator or a software bug? Should I file a mantis report? It's my mistake. Please retest with r57764. I may have forgotten more places. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Component editors and related
Am 01.05.2018 um 20:54 schrieb Juha Manninen via Lazarus: Please test with r57763. Excellent, works perfectly! Thank you. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Component editors and related
On Wed, Apr 25, 2018 at 8:56 PM, Werner Pamler via Lazarus wrote: > currently I am porting those JVCL components which look interesting to me > (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/jvcllaz/), > but at the moment I am stuck with the component editor of the TJvOutlookBar. Please test with r57763. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] Make of revision 57762 failing under Raspbian
On Raspberry Pi 3B+ computers under Raspbian Stretch 20180418 with Lazarus 1.6.2 installed I tried to compile the current development revision 57762 of Lazarus. It failed in 'grids.pas', line 4150, with error 'identifier idents no member "Width"'. This I did: (1) Created directory '~/lazarus'. (2) svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus (3) cd lazarus (4) svn update (5) make bigide Screen shot: http://transfer.joepgen.com/MakeFailure.pdf What's wrong? Is it a mistake of the operator or a software bug? Should I file a mantis report? Regards -- Joe -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Note about LCL GetDefaultGlyph
On 01.05.2018 16:48, AlexeyT via Lazarus wrote: + +function GetDefaultGlyph(ResourceName: string; ScalePercent: Integer = 100): TCustomBitmap; +begin + Result := TPortableNetworkGraphic.Create; + if ScalePercent<>100 then + ResourceName := ResourceName+'_'+IntToStr(ScalePercent); + Result.LoadFromResourceName(hInstance, ResourceName); +end; + So for scale 140% func gets suffix _140, but better use suffix _100 (for all values 100..149). 140% can be set in Windows dialog, I think. Same for scale 210%, func gets suffix _210, but should _200. It's your responsibility to supply a valid ScalePercent value. If you want some handling (210 -> 200), do it yourself in your code. The LCL does it as well, see e.g. TLCLGlyphs.GetImageIndex. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] Note about LCL GetDefaultGlyph
+ +function GetDefaultGlyph(ResourceName: string; ScalePercent: Integer = 100): TCustomBitmap; +begin + Result := TPortableNetworkGraphic.Create; + if ScalePercent<>100 then + ResourceName := ResourceName+'_'+IntToStr(ScalePercent); + Result.LoadFromResourceName(hInstance, ResourceName); +end; + So for scale 140% func gets suffix _140, but better use suffix _100 (for all values 100..149). 140% can be set in Windows dialog, I think. Same for scale 210%, func gets suffix _210, but should _200. AT -- Regards, Alexey -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Unknown error codes.
On 2018-05-01 10:48, Rik van Kekem via Lazarus wrote: > > Small test-program will give you a list: > var > I: Integer; > begin > for I := 0 to 99 do > begin > Memo1.Lines.Add(Format('%d - %s', [I, SysErrorMessage(I)])); > end; In fact, it also prints errors beyond 100: program errormessages; uses sysutils; var I: Integer; begin for I := 0 to 200 do begin Writeln(I, ': ', SysErrorMessage(I)); end; end. ... 99: Cannot assign requested address 100: Network is down 101: Network is unreachable 102: Network dropped connection because of reset 103: Software caused connection abort 104: Connection reset by peer 105: No buffer space available 106: Transport endpoint is already connected 107: Transport endpoint is not connected 108: Cannot send after transport endpoint shutdown 109: Too many references: cannot splice 110: Connection timed out 111: Connection refused 112: Host is down 113: No route to host 114: Operation already in progress 115: Operation now in progress 116: Stale NFS file handle 117: Structure needs cleaning 118: Not a XENIX named type file 119: No XENIX semaphores available 120: Is a named type file 121: Remote I/O error 122: Quota exceeded 123: No medium found 124: Wrong medium type 125: Unknown Error (125) 126: Unknown Error (126) So I do not have to check for error range validity myself. Next step would be produce a crash and check the runtime error validity, just in case it matches. :-) Pity the help pages I found (like the one for ioresult) do not mention SysErrorMessage. -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) signature.asc Description: OpenPGP digital signature -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Unknown error codes.
On 2018-05-01 10:48, Rik van Kekem via Lazarus wrote: > On 29-04-2018 23:55, Carlos E. R. via Lazarus wrote: >> It does not list the error 26 I got. >> It is possible that there are different numbers on different operating >> systems? That list seems to be related to Windows, but the link does not >> say. >> > It's always possible to get the text of an OS error via SysErrorMessage(). Ah! I have been looking for such a function for hours. Yesterday I created my own functions to output text, getting the help from several help sources. Ok, Scrap those! > > Also note that the EInOutError codes in the range 0-99 represent OS > error conditions, which are different for Windows and Linux. At least in > Delphi they do. Ok. > > On Linux Showmessage(SysErrorMessage(26)) gives us: > Text (code segment) file busy Yes, it matches. > On Windows it gives: > The specified disk or diskette cannot be accessed. > > Of course a program can generate an runtime error itself via Error(Code) > in which case the code didn't come from the OS and it might mean > something different. Ah. It maybe these: https://freepascal.org/docs-html/user/userap4.html Yesterday I wrote my own Function RunTimeErrorString(I: Word): string; from that list. begin case I of 1: RunTimeErrorString:= 'Invalid function number'; //An invalid operating system call was attempted. 2: RunTimeErrorString:= ' File not found'; //Reported when trying to erase, rename or open a non-existent file. 3: RunTimeErrorString:= ' Path not found'; //Reported by the directory handling routines when a path does not exist or is invalid. Also reported when trying to access a non-existent file. 4: RunTimeErrorString:= ' Too many open files';//The maximum number of files currently opened by your process has been reached. Certain operating systems limit the number of files which can be opened concurrently, and this error can occur when this limit has been reached. 5: RunTimeErrorString:= ' File access denied'; //Permission to access the file is denied. This error might be caused by one of several reasons: ... (I can post it complete if it is of interest) > Small test-program will give you a list: > var > I: Integer; > begin > for I := 0 to 99 do > begin > Memo1.Lines.Add(Format('%d - %s', [I, SysErrorMessage(I)])); > end; :-) > On Windows it gives: > 0 - The operation completed successfully. > 1 - Incorrect function.> 2 - The system cannot find the file specified. > 3 - The system cannot find the path specified. > 4 - The system cannot open the file. > 5 - Access is denied. ... > 99 - > > On Linux it gives: > 0 - Success > 1 - Operation not permitted > 2 - No such file or directory > 3 - No such process > 4 - Interrupted system call > 5 - I/O error ... > 99 - Cannot assign requested address > > So, because of the differences in Windows and Linux it might be best to > always show the SysErrorMessage(code) too (if it is indeed an OS error). > It will generate a much clearer message. Yes, indeed. Thank you! -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) signature.asc Description: OpenPGP digital signature -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Unknown error codes.
On 29-04-2018 23:55, Carlos E. R. via Lazarus wrote: It does not list the error 26 I got. It is possible that there are different numbers on different operating systems? That list seems to be related to Windows, but the link does not say. It's always possible to get the text of an OS error via SysErrorMessage(). Also note that the EInOutError codes in the range 0-99 represent OS error conditions, which are different for Windows and Linux. At least in Delphi they do. On Linux Showmessage(SysErrorMessage(26)) gives us: Text (code segment) file busy On Windows it gives: The specified disk or diskette cannot be accessed. Of course a program can generate an runtime error itself via Error(Code) in which case the code didn't come from the OS and it might mean something different. Small test-program will give you a list: var I: Integer; begin for I := 0 to 99 do begin Memo1.Lines.Add(Format('%d - %s', [I, SysErrorMessage(I)])); end; On Windows it gives: 0 - The operation completed successfully. 1 - Incorrect function. 2 - The system cannot find the file specified. 3 - The system cannot find the path specified. 4 - The system cannot open the file. 5 - Access is denied. 6 - The handle is invalid. 7 - The storage control blocks were destroyed. 8 - Not enough storage is available to process this command. 9 - The storage control block address is invalid. 10 - The environment is incorrect. 11 - An attempt was made to load a program with an incorrect format. 12 - The access code is invalid. 13 - The data is invalid. 14 - Not enough storage is available to complete this operation. 15 - The system cannot find the drive specified. 16 - The directory cannot be removed. 17 - The system cannot move the file to a different disk drive. 18 - There are no more files. 19 - The media is write protected. 20 - The system cannot find the device specified. 21 - The device is not ready. 22 - The device does not recognize the command. 23 - Data error (cyclic redundancy check). 24 - The program issued a command but the command length is incorrect. 25 - The drive cannot locate a specific area or track on the disk. 26 - The specified disk or diskette cannot be accessed. 27 - The drive cannot find the sector requested. 28 - The printer is out of paper. 29 - The system cannot write to the specified device. 30 - The system cannot read from the specified device. 31 - A device attached to the system is not functioning. 32 - The process cannot access the file because it is being used by another process. 33 - The process cannot access the file because another process has locked a portion of the file. 34 - 35 - 36 - Too many files opened for sharing. 37 - 38 - Reached the end of the file. 39 - The disk is full. 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 - The request is not supported. 51 - Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator. 52 - You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name. 53 - The network path was not found. 54 - The network is busy. 55 - The specified network resource or device is no longer available. 56 - The network BIOS command limit has been reached. 57 - A network adapter hardware error occurred. 58 - The specified server cannot perform the requested operation. 59 - An unexpected network error occurred. 60 - The remote adapter is not compatible. 61 - The printer queue is full. 62 - Space to store the file waiting to be printed is not available on the server. 63 - Your file waiting to be printed was deleted. 64 - The specified network name is no longer available. 65 - Network access is denied. 66 - The network resource type is not correct. 67 - The network name cannot be found. 68 - The name limit for the local computer network adapter card was exceeded. 69 - The network BIOS session limit was exceeded. 70 - The remote server has been paused or is in the process of being started. 71 - No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept. 72 - The specified printer or disk device has been paused. 73 - 74 - 75 - 76 - 77 - 78 - 79 - 80 - The file exists. 81 - 82 - The directory or file cannot be created. 83 - Fail on INT 24. 84 - Storage to process this request is not available. 85 - The local device name is already in use. 86 - The specified network password is not correct. 87 - The parameter is incorrect. 88 - A write fault occurred on the network. 89 - The system cannot start another process at this time. 90 - 91 - 92 - 93 - 94 - 95 - 96 - 97 - 98 - 99 - On Linux it gives: 0 - Success 1 - Operation not permitted 2 - No such file or directory 3 - No s