Re: [Lazarus] Support for SQLite virtual table?
On Tue, 18 Dec 2012, Krzysztof wrote: A virtual table means you will handle storage. So I think you must always implement all methods required to handle that ? After creating virtual table it should working like normal table (with joining etc) handled by TSQLite3Dataset. That it worked on PostgreSQL. You mean a temporary table ? I'm not an expert, but this is IMHO a completely different concept. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Support for SQLite virtual table?
On Tue, 18 Dec 2012, Krzysztof wrote: Hi, Reffering to this article: http://www.sqlite.org/vtab.html ... I'm trying to create virtual table. But before call standard CREATE VIRTUAL TABLE, some module must be created first. FPC has method sqlite3_create_module() but it return 0: var m: sqlite3_module; c: cint; begin FillByte(m, SizeOf(m),0); c := sqlite3_create_module(dsContacts.SqliteHandle, 'test_module', @m, nil); SqliteHandle is assigned. But type sqlite3_module looks strange. It is dummy, without fields. Can I somehow create dummy module with pure SQL syntax? I don't need stuff to which the module is used. A virtual table means you will handle storage. So I think you must always implement all methods required to handle that ? That said: probably, the module struct was not implemented because h2pas encountered an error when translating the headers. This needs to be fixed, please enter a bug report. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Master/detail relationships: what am I missing?
On Mon, 17 Dec 2012, Reinier Olislagers wrote: Hi all, I've been looking into how to use master/detail setups in Lazarus (aka tables with foreign keys). Based on Delphi docs I started writing up & testing this: See also http://docwiki.embarcadero.com/RADStudio/XE3/en/Establishing_Master-detail_Relationships_Using_Parameters Use one connection, 1 transaction, but 2 queries, 2 data sources Example from the Firebird EMPLOYEE database (as used in the SQLDB Tutorials): - a CUSTOMER table with an integer primary key CUST_NO and other fields - a SALES table with a CUST_NO integer field that is a foreign key linking to the CUST_NO field in the CUSTOMER table - a master query selects from the CUSTOMER table - a detail query that selects from the SALES table In the detail query: - set the database property as usual - set the datasource property to point to the master datasource - in the query SQL, use a WHERE query to limit the select; use a parameter with the name of the field in the master table SELECT * from SALES WHERE SALES.CUST_NO=:CUST_NO FPC will now see this as a reference to the current value of CUST_NO in the CUSTOMER (master) query. This is made possible by the fact that the master datasource keeps track of the current record for the master query Make sure that the master query is open before the detail query so it can look up fields. No need for further code, e.g. to specify default values for the SALES.CUST_NO field when adding records. This is wrong. There is a need. This should still be specified. I get the form with a combobox for the master field and details grid to run without issue and can insert items in the detail grid but the foreign key to the master table is null for that record. Correct. You must enter these values yourself in the AfterInsert of the detail dataset. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Difference between Delphi 2010 / Lazarus
On Fri, 14 Dec 2012, Mattias Gaertner wrote: On Fri, 14 Dec 2012 11:30:31 +0100 (CET) michael.vancann...@wisa.be wrote: On Fri, 14 Dec 2012, Jorge Gonçalves wrote: >> >> What does "Calculated" do? >>> >> >> Judging from the Delphi code, it is no longer used. The GetCalculated >> returns >> >> > Yes i know. > The problem surges when we read the dfm. The reader will give one exception > that the property is unknown. > If we try to remove the property from the file, Delphi will introduce them > again, next time we edit the datamoudule. You can install an unknown property event handler in TReader: OnPropertyNotFound But that requires that you are able to choose which reader is used, because now you cannot: I've long wanted to install a hook so you can select which reader/writer is used in TStream.ReadComponent. Maybe the lazarus implementation offers a hook ? Maybe you mean in unit lresources.pp: LRSObjectReaderClass: TLRSObjectReaderClass=TLRSObjectReader; LRSObjectWriterClass: TLRSObjectWriterClass=TLRSObjectWriter; Something like it, and also the hooks you posted in your other reply. I think that the 2 variables you post above can be moved to the classes unit: ObjectReaderClass and ObjectWriterClass. These should then be used in the TStream.ReadComponent and TStream.WriteComponent. That's what I meant with the 'install a hook'. Once it is in place, the LCL can simply set these hooks, and remove any custom hooks you made. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Difference between Delphi 2010 / Lazarus
On Fri, 14 Dec 2012, Jorge Gonçalves wrote: What does "Calculated" do? Judging from the Delphi code, it is no longer used. The GetCalculated returns Yes i know. The problem surges when we read the dfm. The reader will give one exception that the property is unknown. If we try to remove the property from the file, Delphi will introduce them again, next time we edit the datamoudule. You can install an unknown property event handler in TReader: OnPropertyNotFound But that requires that you are able to choose which reader is used, because now you cannot: I've long wanted to install a hook so you can select which reader/writer is used in TStream.ReadComponent. Maybe the lazarus implementation offers a hook ? Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Difference between Delphi 2010 / Lazarus
On Fri, 14 Dec 2012, Kostas Michalopoulos wrote: What does "Calculated" do? Judging from the Delphi code, it is no longer used. The GetCalculated returns function TField.GetCalculated: Boolean; begin Result := FFieldKind = fkCalculated; end; And setcalculated does: procedure TField.SetCalculated(Value: Boolean); begin if Value then FieldKind := fkCalculated else if FieldKind = fkCalculated then FieldKind := fkData; end; So it can safely be ignored. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [fpc-pascal] G+ community for Free Pascal and Lazarus
On Tue, 11 Dec 2012, Graeme Geldenhuys wrote: Hi Everybody, Google created a new Community feature in Google+. Below is a link to a community dedicated to Free Pascal and Lazarus. https://plus.google.com/communities/114860965042324270757 If you are on Google+, feel free to visit and join. The community was setup by Marc Hanisch and already has 76 members. Hopefully this will be a nice neutral discussion area with less anal moderation. Not exactly a "nice neutral" post :-) There is also a Delphi community for those interested: https://plus.google.com/communities/114860965042324270757 The two links are the same ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] toolbar and toolbutton issues
On Wed, 5 Dec 2012, zeljko wrote: On Wednesday 05 of December 2012 15:33:49 Graeme Geldenhuys wrote: - I used a set of 24x24 PNG images, but the images get clipped in the ImageList Property Editor. Right and Bottom of images are clipped in the image preview area. It looks like the ImageList is hardcoded to 16x16 images only! Why the 16px size limit? Afaik TImageList have width and height properties. Set them to 24 and it will be ok. Correct. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] toolbar and toolbutton issues
On Wed, 5 Dec 2012, Graeme Geldenhuys wrote: On 2012-12-05 14:33, Graeme Geldenhuys wrote: See attached screenshot showing the clipping and resize issues. More notes… * image size: It seems the ImageList doesn't auto-detect the size of the images I added, and I added them all at once using multi-select. This is a consequence of the below. You must first set the width and height, then the individual images will be cropped to that width and height. * image size: I took a chance and set the ImageList.Width & .Height properties. At first glance I thought that was just the width and height of the TImageList component (eg: like found in TLabel or TButton), but apparently that controls the image sizes. Better property names would probably have been ImageWidth and ImageHeight. These names are dictated by Delphi compatibility. * Looking at the screenshot I sent, Toolbar.Transparent = False, yet the Toolbar seems transparent, because the the TForm.Color = clMoneyGreen. You see the green color in the designer and at runtime. Changing the Toolbar.Transparent property makes no difference. Maybe GTK/Qt doesn't support that ? Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TMySQL51Connection: Keep connection alive
On Wed, 5 Dec 2012, Andrey Smyntyna wrote: Hello. I need some explanation of how to do persistent connection to MySQL database and restore it if it has broken. In my test project I have created TMySQL51Connection component with KeepConnection property set to True and additionaly before making any database operations I check connection availability like below: if not dm.mysql.Connected then dm.mysql.Connected := True; But sometimes I anyway get connection error with the fact that MySQL server is present and available in network. As far as I know, the 'Keepconnection' is not functional. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] HTTP and POP3 client components
On Wed, 5 Dec 2012, Michael Schnell wrote: On 12/05/2012 12:38 PM, michael.vancann...@wisa.be wrote: That said, the advantage of having these classes visual is nearly non-existent. Yep. But it shows what the user is supposed to access (very useful when he did not (yet) find the appropriate docu or example) Code completion ? There are lots of comments, so the IDE should give you hints. In fact I rather easily did get it working. QED :-) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] HTTP and POP3 client components
On Wed, 5 Dec 2012, Michael Schnell wrote: More talk to myself... It does install but when installing it the IDE says it has no "register", thus no visual components are created. But it does have "published" properties ?!?!?! Search for synapse visual packages. The synapse classes are not visual. There is a package that has visual counterparts. That said, the advantage of having these classes visual is nearly non-existent. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] off topic [Re: New user interface for future major releases of Lazarus]
On Tue, 4 Dec 2012, Felipe Ferreira da Silva wrote: Well, thank you, guys! Anyway, even if this is not a suitable idea and there is not so much demand for this, I'll still continue to contribute with components and with the discussion about dynamic packages... and keep working secretly on this :) The idea is suitable. There is demand for it; Just make sure it is optional. The suggestion of Martin Friebe to put it in packages, is still the way to go, I think. I'm sure you will get fast responses to specific questions if you decide to implement it yourself. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] New user interface for future major releases of Lazarus
On Tue, 4 Dec 2012, Felipe Ferreira da Silva wrote: I would like to propose and discuss about a new graphical user interface for the next major releases. Nowadays, most of the RAD tools use a docked interface(MonoDevelop, Delphi, VS), and in some cases they are stylish(like the recent Visual Studio versions). I think that a better-looking IDE would not just make the programming task more pleasant, but also could attract more people to Pascal. I know about the existence of AnchorDocking package for a docked IDE, but I think that if such feature were built-in, the IDE could be improved with appropriated features for a docked app - and since the forms would be still undockable, the user could switch back to the "Delphi7-like" interface. My propose is ask if you guys would mind if I work on some projects with a different interface and made in Lazarus(of course) to you evaluate. I'm good at create components and customize to give them a stylish appearance like in the case of VS. But I would like to know from you guys first. As long as you can completely undo it, I don't see why not. Not everyone is comfortable with the so-called docked interface. Tastes in what is considered a 'modern gui' change every so-and-so years. It's not because an interface has been around for a while that it is less good. I work with Delphi XE, and reverted completely to the D7 look, including the 'old' component palette. Even my windows 7 has the 'classic' look. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Fatal: Circular unit reference between units
On Wed, 21 Nov 2012, Eric Kom wrote: Good day all, Please I got a problem regarding units. To use components from unit1 called mainWindow, I included the header unit1 inside unit2 called loginScholarly. During build process, the above message occurred: loginscholarly.pas(19,42) Fatal: Circular unit reference between loginScholarly and mainWindow Well, you're not supposed to do this. Probably mainWindow already uses loginScholarly. In general, units should not use each other, it is bad design. Now, you can solve this by moving one of the units from the interface uses section to the implementation section. You'll have to decide which one. In general, however, it is better to move common parts to a separate unit, and let both units use that third unit. Michael. Thanks -- Kind Regards Eric Kom System Administrator - Metropolitan College _ / You are scrupulously honest, frank, and \ | straightforward. Therefore you have few | \ friends./ - \ \ .--. |o_o | |:_/ | // \ \ (| Kom | ) /'\_ _/`\ \___)=(___/ 2 Hennie Van Till, White River, 1240 Tel: 013 750 2255 | Fax: 013 750 0105 | Cell: 078 879 1334 eric...@kom.za.net | eric...@metropolitancollege.co.za www.kom.za.net | www.kom.za.org | www.erickom.co.za Key fingerprint: 513E E91A C243 3020 8735 09BB 2DBC 5AD7 A9DA 1EF5 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] ODBC-problems
On Tue, 20 Nov 2012, Reinier Olislagers wrote: On 20-11-2012 13:40, michael.vancann...@wisa.be wrote: On Tue, 20 Nov 2012, Reinier Olislagers wrote: On 20-11-2012 12:23, Koenraad Lelong wrote: On 20-11-12 12:13, Koenraad Lelong wrote: In Win7 64 bit only the system DSN of Firebird works. Sorry, should be user DSN works, system DSN does not work. As you're using 32 bit Lazarus, just to be sure: please confirm the DSNs you are using are defined in the 32 bit ODBC control panel (using 32 bit Firebird ODBC drivers), not the 64 bit ones... That error message seems to indicate some bitness mismatch between application<>ODBC<>ODBC driver That's what I wanted to establish. Yep, thought so when you wrote that post ;) The best solution IMHO is to work fully in 64-bit: Firebird Lazarus Windows. and not to attempt mixing things. Well... I'd say: even on Win64, keeping Firebird Lazarus 32 bit is better (unless memory etc requires 64 bit compilation) as 64 bit embedded Firebird on Win64 will give - unexpected exceptions or - just won't work (http://bugs.freepascal.org/view.php?id=21581) Those can be fixed with Sergei's SEH build (-dTEST_WIN64_SEH) though. The problem is not so much Lazarus, but ODBC. We've had strange reactions on a 64-bit system depending on the 32/64 version of the drivers installed... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] ODBC-problems
On Tue, 20 Nov 2012, Reinier Olislagers wrote: On 20-11-2012 12:23, Koenraad Lelong wrote: On 20-11-12 12:13, Koenraad Lelong wrote: In Win7 64 bit only the system DSN of Firebird works. Sorry, should be user DSN works, system DSN does not work. As you're using 32 bit Lazarus, just to be sure: please confirm the DSNs you are using are defined in the 32 bit ODBC control panel (using 32 bit Firebird ODBC drivers), not the 64 bit ones... That error message seems to indicate some bitness mismatch between application<>ODBC<>ODBC driver That's what I wanted to establish. I think it is a problem of 32/64 bit mismatch, it is not the first time I encounter this on Windows 64-bit. :-) The best solution IMHO is to work fully in 64-bit: Firebird Lazarus Windows. and not to attempt mixing things. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] ODBC-problems
On Tue, 20 Nov 2012, Koenraad Lelong wrote: Hi, I'm trying to use a Pervasive-database via ODBC. In Lazarus, I seem unable to set up the connection so I first tried with a Firebird connection. There also I have problems. In Windows' ODBC-configuration-appication I made a user DSN to the Firebird server. Testing gives OK. Trying to contact it via lazarus gives is OK. Then I tried to do the same with a system DSN. There I have a problem, see the image. I tried to do the same with the Pervasive driver, but there I have the problem for both user-DSN and system DSN. Am I doing something wrong ? Is this on a 64-bit system ? And if so, are you programming 32-bit or 64-bit? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] DUint application
On Mon, 19 Nov 2012, Antonio Fortuny wrote: Hi folks. Do you think that a FPCUnitTest application could deal with TDataModues ? I ask this question bacause when the next statement is executed: Application.CreateForm(TDM, DM); I get a runtime exception (EStreamError) telling that Failed to initialize component class "TDM": No streaming method available. Try adding the lresources unit to your program's uses clause. That should help. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Just finished SQLdb Tutorial3 - request for corrections for 3, 2 & 1
On Fri, 16 Nov 2012, Reinier Olislagers wrote: Hi list, I've just finished writing SQL DB Tutorial3 http://wiki.lazarus.freepascal.org/SQLdb_Tutorial3 I just finished reading. Good job. The more info, the better ! Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Removing a character from string
On Mon, 12 Nov 2012, Richard Mace wrote: Michael, Thanks. What would be the best way of finding the position of char in a string (Windows only) Pos(C,S); Where C is the char and S the string. See http://www.freepascal.org/docs-html/rtl/system/pos.html Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Removing a character from string
On Mon, 12 Nov 2012, Richard Mace wrote: Hi all, I was sure there was a function to do this, but I can't seem to find it. How would I remove a character from a string? if P is the position: Delete(S,p,1); Note that if S is an UTF-8 string, and at p there is a unicode control code, this will give unexpected results... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Cannot debug app (gdb errors)
On Fri, 9 Nov 2012, Leonardo M. Ramé wrote: On 2012-11-09 15:27:36 +0100, michael.vancann...@wisa.be wrote: On Fri, 9 Nov 2012, Leonardo M. Ramé wrote: On 2012-11-09 15:20:45 +0100, michael.vancann...@wisa.be wrote: On Fri, 9 Nov 2012, Leonardo M. Ramé wrote: On 2012-11-09 15:10:21 +0100, Martin wrote: On 09/11/2012 14:11, Leonardo M. Ramé wrote: Hi, I'm having some problems since a couple of days. I cannot start my app from the IDE, I get the same errors with or without debug information. My setup is this: Ubuntu 12.04 Linux 3.2.0-33-generic #52-Ubuntu SMP Thu Oct 18 16:29:15 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04 My locale and LC_Type are es_AR. Here's the content of the debug window: which version of fpc do you use? have you recently upgraded? Try stabs or dwarf. do NOT (NEVER) smart link for debugging, see wiki dbg setup your GDB crashes while reading the symbol table (reading all, while looking for a symbol that does not exist, But if this one was skipped, it would crash later.) This is an issue all versions of gdb have. The IDE has no influence on this. FPC (and the linker) generate the debug info. On a related note. your gdb is localized. the ide usually has no problem, since most messages needed by the ide are still english. It may have small functionality deduction. IIRC not showing exception messages is one possible effect. Thanks Martin, I'm using FPC rev 22945 and Lazarus 39266 (from today). BTW. Does anyone know how to force GDB to ignore localization?. Set LC_Type to C ? How?, for example, creating a shell script to launch Lazarus?, I don't want to change the LC_Type for the whole system. Not the IDE: Create a script that sets the variable, exec's the debugger and then point the IDE to the script instead of pointing it straight to gdb. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus Michael, here's the script I made (note I've exported LC_TYPE and LC_CTYPE because I don't know which one gdb reads): export LC_TYPE=C export LC_CTYPE=C /usr/bin/gdb Put an exec before this, like: exec /usr/bin/gdb This will replace the shell command with the gdb process. I expect something like this: #!/bin/sh export LC_TYPE=C export LC_CTYPE=C exec /usr/bin/gdb Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Cannot debug app (gdb errors)
On Fri, 9 Nov 2012, Leonardo M. Ramé wrote: On 2012-11-09 15:20:45 +0100, michael.vancann...@wisa.be wrote: On Fri, 9 Nov 2012, Leonardo M. Ramé wrote: On 2012-11-09 15:10:21 +0100, Martin wrote: On 09/11/2012 14:11, Leonardo M. Ramé wrote: Hi, I'm having some problems since a couple of days. I cannot start my app from the IDE, I get the same errors with or without debug information. My setup is this: Ubuntu 12.04 Linux 3.2.0-33-generic #52-Ubuntu SMP Thu Oct 18 16:29:15 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04 My locale and LC_Type are es_AR. Here's the content of the debug window: which version of fpc do you use? have you recently upgraded? Try stabs or dwarf. do NOT (NEVER) smart link for debugging, see wiki dbg setup your GDB crashes while reading the symbol table (reading all, while looking for a symbol that does not exist, But if this one was skipped, it would crash later.) This is an issue all versions of gdb have. The IDE has no influence on this. FPC (and the linker) generate the debug info. On a related note. your gdb is localized. the ide usually has no problem, since most messages needed by the ide are still english. It may have small functionality deduction. IIRC not showing exception messages is one possible effect. Thanks Martin, I'm using FPC rev 22945 and Lazarus 39266 (from today). BTW. Does anyone know how to force GDB to ignore localization?. Set LC_Type to C ? How?, for example, creating a shell script to launch Lazarus?, I don't want to change the LC_Type for the whole system. Not the IDE: Create a script that sets the variable, exec's the debugger and then point the IDE to the script instead of pointing it straight to gdb. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Cannot debug app (gdb errors)
On Fri, 9 Nov 2012, Leonardo M. Ramé wrote: On 2012-11-09 15:10:21 +0100, Martin wrote: On 09/11/2012 14:11, Leonardo M. Ramé wrote: Hi, I'm having some problems since a couple of days. I cannot start my app from the IDE, I get the same errors with or without debug information. My setup is this: Ubuntu 12.04 Linux 3.2.0-33-generic #52-Ubuntu SMP Thu Oct 18 16:29:15 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04 My locale and LC_Type are es_AR. Here's the content of the debug window: which version of fpc do you use? have you recently upgraded? Try stabs or dwarf. do NOT (NEVER) smart link for debugging, see wiki dbg setup your GDB crashes while reading the symbol table (reading all, while looking for a symbol that does not exist, But if this one was skipped, it would crash later.) This is an issue all versions of gdb have. The IDE has no influence on this. FPC (and the linker) generate the debug info. On a related note. your gdb is localized. the ide usually has no problem, since most messages needed by the ide are still english. It may have small functionality deduction. IIRC not showing exception messages is one possible effect. Thanks Martin, I'm using FPC rev 22945 and Lazarus 39266 (from today). BTW. Does anyone know how to force GDB to ignore localization?. Set LC_Type to C ? Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Getting X Window handle ?
On Tue, 6 Nov 2012, Hans-Peter Diettrich wrote: Michael Van Canneyt schrieb: How can I get access to the low-level X window handle (id) of a TWinControl on Linux ? It's not so problematic. Look at qtx11.inc in lcl/widgetset/qt or in gtk2widgetset.inc (there's IFDEF X11 or similar) which gets X11 TWindow from GdkWindow. Actually, it is in gtk2proc, FormToX11Window :-) Thanks. The function could accept a TWinControl instead of TCustomForm I would think. AFAIK X11 only supports handles for top level windows, managed by the window manager. This is not correct. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is this the best way to add TIFF support to imgviewer?
On Thu, 18 Oct 2012, Reinier Olislagers wrote: (repost from the forum, no response there, so trying my luck here) Am trying to extend the Lazarus examples\imgviewer application with .tiff support. Is this[1] the best way to add tiff support to the Lazarus imageview demo application? Normally, including fpreadtiff.pas in the uses clause should be enough ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Please define "delphi compatibility"
On Sun, 14 Oct 2012, Joost van der Sluis wrote: On Thu, 2012-10-11 at 11:55 +0200, Sven Barth wrote: Am 10.10.2012 18:42, schrieb Florian Klämpfl: Am 10.10.2012 16:11, schrieb Bart: I would even go into the opposite direction and adjust Delphi's attribute syntax: to a more Pascal like: === hypothetical example === type TSomeClass = class property SomeProperty {...} attributes [Some3rdAttribute('a', 'b')]; end attributes [SomeAttribute(1, 2, 3), SomeOtherAttribute]; === hypothetical example === I don't know if you participated in the discussion about this feature before I started the first implementation. But we discussed this then. I decided not to do it, for the simple reason that I don't need it since I'm doing this for an application that has to be compiled by both Delphi and fpc. And as I was the one who implemented it, I had to decide. But feel free to add this syntax to objfpc mode. This can be done on the parser level only. And it's simpler then the 'Delphi' syntax as it does not need to remember the attribute until it parses the next statement. (Which is off course why the Delphi-class-attributes-syntax is not a Pascal syntax at all) And if Joost isn't fast enough with his attributes branch I might do that indeed ;P In fact that branch works completely, as far as I know. I have to add some more tests, and maybe some checks here and there. But the attributes do work. What stops you from merging this to trunk ? Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpWeb and OnReplaceTag
On Fri, 12 Oct 2012, patspiper wrote: Hi, Can the output of a THTMLPageProducer be processed by a function similar to TFPTemplate.OnReplaceTag? AFAIK, Delphi has that feature. Currently it can not. It would mean adding a template. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Please define "delphi compatibility"
On Wed, 3 Oct 2012, Graeme Geldenhuys wrote: [based on my suggestion about changes to the TDBNavigator component] What is Lazarus's take on "delphi compatibility"? Does that mean... a) Lazarus simply makes it easy to move Delphi projects to Lazarus - a once off process, and only in that specific direction. That's all I would sign up for, where visual things are concerned. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Version info
On Tue, 18 Sep 2012, patspiper wrote: On 18/09/12 10:21, michael.vancann...@wisa.be wrote: Yes. But as I wrote in another mail in this thread: I have a modified version of that unit that works for Linux as well; I use it in production. Here is the relevant part for non-windows: uses resource, elfreader, versiontypes,versionresource; Type TVersionQuad = Array[1..4] of Word; Function GetFileVersion (Const AFileName : string; Var Version : TVersionQuad) : Boolean; Var RS : TResources; E : TElfResourceReader; VR : TVersionResource; I : Integer; begin RS:=TResources.Create; try E:=TElfResourceReader.Create; try Rs.LoadFromFile(AFileName,E); finally E.Free; end; VR:=Nil; I:=0; While (VR=Nil) and (INil); if Result then For I:=1 to 4 do Version[i]:=VR.FixedInfo.FileVersion[I-1]; Finally RS.FRee; end; end; Better yet would probably be to commit it in FPC SVN. I'll look into that as well :-) Your implementation of reading the file resources differs a little from Paul's (http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100723/8db6b97e/attachment.ksh). Are there any merits for each one? His version starts with a handle, which requires loading the module. I am not sure (as in: I simply do not know) whether you can load an executable or DLL without running them and obtain the correct handle. Mine simply starts from a filename. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Version info
On Tue, 18 Sep 2012, Antonio Fortuny wrote: FPC and Lazarus WiKi do only talk about the compiled target, not how to extract resource data from other files. Of course, they have to be compiled with FPC. The fileinfo unit in FPC has this ability. Michael. yep but only for Windows (and WinCE), not Linux as they call GetFileVersionInfoSizeA and GetFileVersionInfoSizeW in version.dll to read the resource data information Yes. But as I wrote in another mail in this thread: I have a modified version of that unit that works for Linux as well; I use it in production. Here is the relevant part for non-windows: uses resource, elfreader, versiontypes,versionresource; Type TVersionQuad = Array[1..4] of Word; Function GetFileVersion (Const AFileName : string; Var Version : TVersionQuad) : Boolean; Var RS : TResources; E : TElfResourceReader; VR : TVersionResource; I : Integer; begin RS:=TResources.Create; try E:=TElfResourceReader.Create; try Rs.LoadFromFile(AFileName,E); finally E.Free; end; VR:=Nil; I:=0; While (VR=Nil) and (INil); if Result then For I:=1 to 4 do Version[i]:=VR.FixedInfo.FileVersion[I-1]; Finally RS.FRee; end; end; Better yet would probably be to commit it in FPC SVN. I'll look into that as well :-) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Version info
On Tue, 18 Sep 2012, Antonio Fortuny wrote: Le 17/09/2012 16:57, Alexsander Rosa a écrit : Do you have control over this other program? When I need this for my own software, I usually add a "--version" command line option. When called with "--version" the program outputs the version and terminate. Ok, sounds good. But, again, what I need is the version of another program or library which cannot be executed, just read. Let's put it in another way. As Lazarus seems to glue the version information with the compiled result (as resource data), how can I retrieve this information from any other file ? FPC and Lazarus WiKi do only talk about the compiled target, not how to extract resource data from other files. Of course, they have to be compiled with FPC. The fileinfo unit in FPC has this ability. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Parsing command line options
On Mon, 10 Sep 2012, J.A. de Vries wrote: On 2012-09-10 15:19, patspiper wrote: Your message is a very good example why the whole splitting and escaping approach was abandonned. Every issue was considered to be "just add this, since then it works for me now", but after multiple years of such changes, there are still corner cases left. Separating based on unquoted spaces is the 1st step. The 2nd step is to remove the 1st and last matching quote from each parsed parameter (even on *nix). The 3rd step is to add each parameter using TProcess.Parameters.Add. It is kind of a middle ground though I definitely support your suggestion if doable. Parsing a command line is a can of worms! Might I make a suggestion? Why try and invent the wheel ourselves? There's a very good library named getopts that has been used by masses of programmers for years now. Maybe we could learn from that and re-implement the choices made in there? We have this unit (getopt, it is documented?). But the code for that is for the receiving end, i.e. used by the program that is started. Not for the program that starts another program. The main problem is the Windows API, which has only 1 string in which to pass all command-line options. The started program simply gets this string, and must split it into options. How this string is split (quotes, spaces, whatnot) depends on the started program and is governed by custom. It may be using getopts, or something else. (Look at the GetParamStr routine in the system unit to see how Delphi does it). On Unix-like systems, there is simply no problem: At the API level, Options are passed in an array of strings. Whether or not there are quotes, spaces or whatnot in this string, is irrelevant: the strings are passed on as-is and need no interpretation. What causes confusion on unix systems is the use of a shell (bash, csh, sh): It receives commands from the user as a single line. It must split a command-line into the various elements that make up the array used in the Unix API. To be able to do so, the shell needs quotes. The API itself does not need it. The TProcess interface has been reworked so it conforms more to the Unix API, since it is easier to convert that to something that Windows understands than vice versa. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Charset in TSdfDataSet
On Thu, 6 Sep 2012, Roberto P. wrote: 2012/9/6 GLBX [snip] when working on that project of mine, I was in a hurry and I couldn't go deeper in understanding things (like the double conversion through UTF16, thanks Mattias). At that time I was also UNABLE to save back to csv through the sdf dataset, even with readonly = false, putting the db in edit/append and posting the changes it looked somehow a reader-only dataset. A quick (and maybe unefficient or dirty) trick to get around it has been to use: - a TSDFDataset to read the CSV file (my separtor was non-standard) - copying it to a TMemDataset which can be manipulated really fast - place a TCSVExporter component on the form (install in the palette from the dbexport package) connected to the TMemDataset When you're done with editing and posting, you can simply call TCSVExporter.Execute to save it to CSV. An alternative (that I couldn't explore due to the limited amount of time I had) might be this one: http://wiki.freepascal.org/CsvDocument which supposedly reads and writes, either randomly (in memory) or sequentially, a CSV file. Yes, but if you read that page carefully, you will see that "Both UTF-8 encoding and windows-xxx codepages can be used with CsvDocument library. The library uses string type for all string operations and will not do any encoding conversion for you. Keep in mind though that Excel does not support CSV files in UTF-8." So you will experience the same problems. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Writing application that sends things into facebook
On Tue, 4 Sep 2012, Ludo Brands wrote: Ludo, If you want to and your license allows it to, we can add your OAuth2 code to my existing fpctwit repository (if possible perhaps rename it to fpcoauth) with some big caveats in the readme about oauth2 being not one standard but many etc... Regards, Reinier aka BigChimp Thanks, I have already created a google code repo for it. I'm cleaning up the demo app and adding some instructions to the code. Probably today I'll upload the code and publish the link. It really is Oauth2 according to Google and the re-usability for other Oauth2 protocols is limited to picking up some ideas and very little code. The bulk of the code is calendar api related and class hierarchy from/to json streaming using rtti (which can be re-used in other apps). It also includes a tool to assist in the creation of class definitions starting from the Google specs (json resource representation). So very little in common with fpctwit/plurk. I have been looking for this for ages, this is almost a dream come true. Now I can throw away my own code. :-) Where did you find the google specs in machine-usable form ? Did you try other than calendar APIs with your tool to assist in creation of class definitions ? I am particularly interested in user provisioning. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Proprietary vs Open Source mentality
On Mon, 3 Sep 2012, Michael Schnell wrote: On 09/03/2012 12:35 AM, Graeme Geldenhuys wrote: So if I get hit by a bus tomorrow, tough sh*t to all of you, my work will be lost forever. What weird mentality. I just got hit by a very bad (for me) example for this: "FreeCommander". Since many Years I use (a legal payed for copy of) TotalCommander (called WinCommander before), which is a program done with Delphi. I now would love to use it in Linux, as I moved most of my activities there. In fact there is a free clone of TotalCommander called FreeCommander ( http://www.freecommander.com/index.htm ). AFAIK, same also is done in Delphi and so it would be rather easy to use Lazarus to port it to Linux. But seemingly they don't provide the source code :-( . You can try "double commander". It is written in Lazarus. There is another one, but I cannot remember the name of it. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Delphi post-XE3 roadmap
On Mon, 27 Aug 2012, Michael Schnell wrote: On 08/24/2012 10:36 PM, Marco van de Voort wrote: I read that as that there will be ref counted objects, not that all objects will be ref counted per se. -- Ok, but if there are reef-counted objects what is the point in not using them Because you may suddenly cause bugs in code that was previously not there. Using ref. counted objects requires that you respect certain rules. (for instance, do not use untyped pointers). If your code does not respect these rules, you may find that your program will not work any more. I switched from Delphi 7 to Delphi XE. One of the things that no longer worked, were strings. It took us up to 8 months after the initial release of our Delphi XE-compiled program to get rid of all bugs. And we had to revert in many places to explicitly using ansistrings. So for all those people shouting for a new string type: be warned that there may be a lot of side effects... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Question about fcl-web Request's Handled variable
On Thu, 23 Aug 2012, Leonardo M. Ramé wrote: On 2012-08-23 10:17:57 +0200, michael.vancann...@wisa.be wrote: On Wed, 22 Aug 2012, Leonardo M. Ramé wrote: As I'm looking for a way to handle Cookies in an automatic/global way, instead of checking for cookie existence in every action request, I was looking into TFPWebModule.onRequest method. If I don't set Handled := True in that method, will the request continue to the Action Request handler?. If yes, I could inherit all my webmodules from a common ancestor, with it's onRequest method containing Cookie handling code. That is the idea of having the handled param. Great!, you guys have thought about every single problem a programmer could face, I'm amazed. The secret is simple: We are programmers ourselves, and we use fcl-web ourselves :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Question about fcl-web Request's Handled variable
On Wed, 22 Aug 2012, Leonardo M. Ramé wrote: As I'm looking for a way to handle Cookies in an automatic/global way, instead of checking for cookie existence in every action request, I was looking into TFPWebModule.onRequest method. If I don't set Handled := True in that method, will the request continue to the Action Request handler?. If yes, I could inherit all my webmodules from a common ancestor, with it's onRequest method containing Cookie handling code. That is the idea of having the handled param. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] WST - not working
Hello, Did you already update your WST copy again to the latest subversion ? Inoussa looked at your problem and made some adjustments, which should fix the problem. If it does not, please send the WSDL, a request and response XML so I can forward it to him. Michael. On Wed, 22 Aug 2012, Ian Godman wrote: I have been trying to get a web services client to work with WST and Lazarus. The web-service is written in Java using CXF. Other client work with this web-service without issue. Tracing through the Lazarus code it appears that the XML is being received and parsed but when trying to read the results the DOM object is empty. I have asked about this before and got a few replies from people saying that WST worked for them, beginning to think they were lucky! I am unable due to lack of Lazarus experience to go further which means that unfortunately I will have to use a different language. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web Service Toolkit issue
Hi, Inoussa has looked into the matter, and made some adjustments. Can you please test again from the latest SVN ? If that doesn't fix it, please send me the WSDL in private, so I can forward it to him. Michael. On Wed, 8 Aug 2012, Ian Godman wrote: I have upgraded from SVN and get the same results :-( Ian On 08/08/12 12:24, michael.vancann...@wisa.be wrote: On Wed, 8 Aug 2012, Ian Godman wrote: I am using the Web Service Tool kit and have problems with "Hello World". By tracing in debug mode I have found the following: SOAP Envelope is being received - saved the by adding the line: rsps.SaveToFile('ians.saved'); at line 239 of soap_formater.pas. This gives: http://schemas.xmlsoap.org/soap/envelope/";> http://example.org/";> Hello fred_test In base_soap_formater around line 1550 it is looking for the "helloResponce" in the scope "http://example.org/"; so it should find that scope is "ns1" but it does not find it. At line 1552 nmspcSH = the empty string. At line 1574 strNodeName = 'helloResponse' and findNode return nil so we have no result ! I am using version 0.5 of the WST which is the newest I can find though from 2007! Well, that is VERY old. This probably explains the problems you are experiencing ! Last change date is 2012-07-19 2012-01-10 You can upgrade from SVN: https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/wst/trunk If you do, do not forget to re-generate the sources from the wsdl. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpWeb long process progress
On Tue, 14 Aug 2012, Leonardo M. Ramé wrote: I have code which does exactly that. It's used in production. It's unix-only, however (it relies on fork and exec). If you're interested, I can send you the code. Michael. Yes please, send me the code. Sent in private mail. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpWeb long process progress
On Tue, 14 Aug 2012, Leonardo M. Ramé wrote: On 2012-08-14 09:47:41 +0200, Michael Schnell wrote: AFAIK, a web application uses the plain old standard mechanism, a web server uses to work with a CGI application. it start the application and when same ends, the web server retrieves its output and sends it to the browser. So the web application just does not live long to be able to wait for anything. To create a longer living web enabled process it takes a lot more effort. You can try several approaches: - purely propriety: Use a second process (a long living daemon) and have the web application communicate with same (e.g. via TCP/IP or Pipe) - fast CGI: here the (Apache) Web Server does exactly this communication on it's own account - ISAPI: here a (Microsoft) Web server communicates with a DLL My colleagues do a combination of (1) and (3) with one of their (Delphi) project very successfully: They created a very simple ISAPI DLL (using RemObjects to do the ISAPI communication) They created a Windows service and used RemObjects (using the "Windows Message" transport) to have the ISAPI DLL communicate with the service. (RemObjects is a commercial product that is specified to work as well with Delphi as with FreePascal.) -Michael Thanks Michael, I'm testing a different approach, based on a temporary file. It works this way: 1) The client asks for a TaskId, for example 1234. 2) With the TaskId generated by the server, the client calls a CGI method called runLongTask(myTaskId). This method writes a temporary file which name is the taskId. 3) The client can ask for status by using a method called getTaskStatus(myTaskId). This way I can run a long task without having to create a daemon. That is exactly what I do. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpWeb long process progress
On Mon, 13 Aug 2012, Leonardo M. Ramé wrote: On 2012-08-13 15:15:56 -0700, leledumbo wrote: How can I send responses by intervals? AFAIK that's not the way web application works. It's the client that should be querying the server in a regular interval (using AJAX request perhaps). The server can track current progress status and return that right away when asked. Yes, I know that, but I thought Lazarus have something easy to develop such process. The way I'm thinking of implementing is this: 1) The client app asks the server (a CGI process) for a process ID, for example 123, by calling getProcId. 2) Using this ID, the client calls the time-consuming task, passing the ID. for example, runTask(Id). At this time, the server launches a program passing the ID for the task. This must be a multi-thread program, because it can be asked for running many tasks, and can be asked for the status of each task. The program only finishes when the last task is ended. 3) The client calss a getProcStatus(ID) method. The server, using IPC or Pipes, asks the already-launched process for its status. I have code which does exactly that. It's used in production. It's unix-only, however (it relies on fork and exec). If you're interested, I can send you the code. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] timer in a console application
On Fri, 10 Aug 2012, Andrea Mauri wrote: Il 10/08/2012 13:01, michael.vancann...@wisa.be ha scritto: The fptimer unit has a timer that can be run in the main thread of an application, in a console application. I tried using fptimer in my objects but it seems that it does not work as expected. See the simple code below, a console app using a tfptimer to stop the execution of a procedure, but the ontimer event is never called. You must call checksynchronize at regular intervals in the main thread. How you do this, depends on your application. If your main thread controls the time limits then this can be used to control another thread(s) which do(es) the calculations. Must I use in some way the threads? I never used threads, so I don't know exactly what to do. FPTimer uses a thread to generate the timer events using synchronize. The main thread needs to call checksynchronize at an interval smaller than the timer slice, obviously. Somethin like: procedure TMyApplication.DoCalculation(i: integer); begin write(i, '-'); while not fStopExecution do begin CheckSynchronize; inc(i); end; writeln(i); end; Just add Cthreads if you are on linux. On Windows, you don't need to do anything. Michael. program Project1; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes, SysUtils, CustApp, fpTimer { you can add units after this }; type { TMyApplication } TMyApplication = class(TCustomApplication) protected procedure DoRun; override; private fStopExecution: boolean; fTimer: TFPTimer; procedure StopExecution(Sender: TObject); procedure DoCalculation(i: integer); public constructor Create(TheOwner: TComponent); override; destructor Destroy; override; procedure WriteHelp; virtual; end; { TMyApplication } procedure TMyApplication.DoRun; var ErrorMsg: String; i, n: integer; begin // quick check parameters ErrorMsg:=CheckOptions('h','help'); if ErrorMsg<>'' then begin ShowException(Exception.Create(ErrorMsg)); Terminate; Exit; end; // parse parameters if HasOption('h','help') then begin WriteHelp; Terminate; Exit; end; { add your program here } n:= 10; for i:= 0 to n do begin fStopExecution:= False; fTimer.StartTimer; DoCalculation(i); fTimer.StopTimer; end; // stop program loop Terminate; end; procedure TMyApplication.StopExecution(Sender: TObject); begin fStopExecution:= True; end; procedure TMyApplication.DoCalculation(i: integer); begin write(i, '-'); while not fStopExecution do inc(i); writeln(i); end; constructor TMyApplication.Create(TheOwner: TComponent); begin inherited Create(TheOwner); StopOnException:=True; end; destructor TMyApplication.Destroy; begin inherited Destroy; end; procedure TMyApplication.WriteHelp; begin { add your help code here } writeln('Usage: ',ExeName,' -h'); end; var Application: TMyApplication; begin Application:=TMyApplication.Create(nil); Application.Title:='My Application'; Application.fTimer:= TFPTimer.Create(nil); Application.fTimer.Interval:= 1000; Application.fTimer.OnTimer:= @Application.StopExecution; Application.Run; Application.Free; end. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] timer in a console application
On Fri, 10 Aug 2012, Andrea Mauri wrote: Dear all, I have a console application that performs calculations iteratively on different objects. I would like to set a time limit for the calculation on a single object. i.e. calculation starts on object 1, in order to start calculation on object 2 the calculations on object 1 must be finished or the time limit for the calculation on a single object is reached. if the calculation time limit is reached I would like to stop calculation on object 1 and pass to object 2 and so on for all the objects. The fptimer unit has a timer that can be run in the main thread of an application, in a console application. If your main thread controls the time limits then this can be used to control another thread(s) which do(es) the calculations. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web Service Toolkit issue
Well. Without access to the actual webservice it's hard to say anything useful at this point. I can only repeat that I use WST to consume several webservices, none of them written in WST: .NET, Remobjects and even Java spring... I've forwarded your request to Inoussa; maybe he can do something more. Michael. On Wed, 8 Aug 2012, Ian Godman wrote: I have upgraded from SVN and get the same results :-( Ian On 08/08/12 12:24, michael.vancann...@wisa.be wrote: On Wed, 8 Aug 2012, Ian Godman wrote: I am using the Web Service Tool kit and have problems with "Hello World". By tracing in debug mode I have found the following: SOAP Envelope is being received - saved the by adding the line: rsps.SaveToFile('ians.saved'); at line 239 of soap_formater.pas. This gives: http://schemas.xmlsoap.org/soap/envelope/";> http://example.org/";> Hello fred_test In base_soap_formater around line 1550 it is looking for the "helloResponce" in the scope "http://example.org/"; so it should find that scope is "ns1" but it does not find it. At line 1552 nmspcSH = the empty string. At line 1574 strNodeName = 'helloResponse' and findNode return nil so we have no result ! I am using version 0.5 of the WST which is the newest I can find though from 2007! Well, that is VERY old. This probably explains the problems you are experiencing ! Last change date is 2012-07-19 2012-01-10 You can upgrade from SVN: https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/wst/trunk If you do, do not forget to re-generate the sources from the wsdl. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web Service Toolkit issue
On Wed, 8 Aug 2012, Ian Godman wrote: I am using the Web Service Tool kit and have problems with "Hello World". By tracing in debug mode I have found the following: SOAP Envelope is being received - saved the by adding the line: rsps.SaveToFile('ians.saved'); at line 239 of soap_formater.pas. This gives: http://schemas.xmlsoap.org/soap/envelope/";> http://example.org/";> Hello fred_test In base_soap_formater around line 1550 it is looking for the "helloResponce" in the scope "http://example.org/"; so it should find that scope is "ns1" but it does not find it. At line 1552 nmspcSH = the empty string. At line 1574 strNodeName = 'helloResponse' and findNode return nil so we have no result ! I am using version 0.5 of the WST which is the newest I can find though from 2007! Well, that is VERY old. This probably explains the problems you are experiencing ! Last change date is 2012-07-19 2012-01-10 You can upgrade from SVN: https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/wst/trunk If you do, do not forget to re-generate the sources from the wsdl. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Deploying application with librarys
On Tue, 7 Aug 2012, Krzysztof wrote: Hi, I have application which use openal.dll / openal.so library. On windows this is easy and clear. I just put all files into InnoSetup installer and my application find DLL in own directory. But what with linux? I have installation script which: - Copy executable to /usr/bin - Copy icons to /usr/share/icons - Add application to desktop menu bo copying .destkop file to /usr/share/applications I also have uninstall script which delete those files. But don't know what to do with openal.so library. Should I copy it to /usr/lib directory? But what if: - This library already exists (installed e.g by apt-get install libopenal) and my uninstall script try to delete it? - This library doesn't exists an my install script copy it to lib directory and then user try to install it by apt-get install libopenal. What will happen? Can I create some my application dir in /usr/bin where I copy all files with librarys and only my application manage those librarys? BTW: How linux librarys works? I mean, how portable application works. If I run executable from unzipped folder, this application find .SO library in that folder? (like on windows) Or must I create run.sh script which export this path? You should not do it like this. Never every copy files to /usr/lib or so. If the user decides to install openal later, it will conflict with your install. If your app requires openal/sdl or whatever, make sure that these libraries are installed through the packaging system. Either make a debian/rpm package, and add it to the dependencies. If you want to create a script that installs it anyway, make sure it installs in to /opt/yourprogram/ with directories bin lib Libraries go into lib. Then create a startup shell script in /opt/yourprogram/bin that adds /opt/yourprogram/lib to the LD_LIBRARY_PATH environment variable, after which it starts the real binary. (the installer should create this script) Make a symlink to this shell script in /usr/bin or /usr/local/bin. It's by far the easiest system. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web-services
Hi, In the generated hello.pas, try changing 'literal' to 'document' in the following calls: mm.SetOperationCustomData( sUNIT_NAME, 'HelloWorldPortType', 'hello', 'FORMAT_Input_EncodingStyle', 'literal' ); mm.SetOperationCustomData( sUNIT_NAME, 'HelloWorldPortType', 'hello', 'FORMAT_OutputEncodingStyle', 'literal' ); Michael. On Mon, 6 Aug 2012, Ian Godman wrote: Hi I have been having an issue with a "Hello World" web service. The first issue was Lazarus throwing an error when processing the response. This was chased down to chunking. Having disabled the chunking on the web-service no error is thrown. The trouble is now there are no results either! I have generated the Lazarus code using the Web Service Toolkit and importing the WDSL (attached). My code that makes use of the generated classes is: program webservice; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes, { you can add units after this } hello, hello_proxy, soap_formatter, logger_extension, fpc_http_protocol; {$R *.res} var service : HelloWorldPortType; serviceText : hello_Type ; responce : helloResponse ; begin FPC_RegisterHTTP_Transport(); Register_hello_ServiceMetadata(); WriteLn('Web Services Toolkit'); WriteLn(); service := wst_CreateInstance_HelloWorldPortType(); serviceText:= hello_Type.create(); serviceText.arg0:='fred_test'; WriteLn( 'making service request' ); responce:=service.hello(serviceText); if (responce=nil) then WriteLn( 'have NO service responce' ) else WriteLn( 'have service responce' ); end. The web service is written in Java and has a single string parameter which is returned appended to the text "Hello ". Example retuned (taken using SOAPUI) http://schemas.xmlsoap.org/soap/envelope/";> http://example.org/";> Hello George With the chunking enabled I get an error referring to an unexpected character before the '<' which suggests to me that the response is being processed. But when the chunking is removed I no longer get the error and the response is null. Any ideas ? I dont want to have to use C ! -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Inno Setup no longer supports Windows 95, Windows 98, Windows Me
On Fri, 3 Aug 2012, Henry Vermaak wrote: On 03/08/12 09:43, Graeme Geldenhuys wrote: HI, On 2 August 2012 18:38, Reinier Olislagers wrote: Ehmm.. I'm trying to contain myself, but WHY does Lazarus 1 and 1+ even support Win9x/ME anymore? Because not everybody feels the need to "fix" what isn't broken. Why Lol, you owe me a new keyboard. No updates for 6 years from MS, no journalling filesystem (no ntfs). Stop talking out of your backside. I personally think it's immoral to support these operating systems. People should be forced away from them for their own good (security wise), since they obviously know no better. By supporting them, you just drag out the process. The problem is very practical: Graeme comes from South Africa. His clients are schools, distributed over South Africa and probably the rest of Africa as well. Upgrading costs money. These people simply do not have the money to upgrade. For westerners, upgrading is natural; we (mostly) do not think about the cost. The clients of Graeme could of course obtain illegal copies of Windows and upgrade like that. Well, they want to play it fair, and that means: remain on an old version because they cannot afford the new one. An additional problem is probably that their hardware is so old that the newer versions of Windows simply don't run on it. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus 1.0 release candidate 1 available for download
Wonderful job, guys ! Michael. On Wed, 1 Aug 2012, Mattias Gaertner wrote: The Lazarus team is glad to announce that Lazarus 1.0RC is available for download at the SourceForge download page: http://sourceforge.net/projects/lazarus/files/ Choose your CPU / OS / distro and then the 1.0RC1 directory. Minimum requirements: Windows: 98, 2k, Vista, 7, 32 or 64bit FreeBSD/Linux: gtk 2.8 or qt4.5, 32 or 64bit Mac OS X: 10.4, LCL only 32bit, non LCL apps can be 64bit This release has been built with fpc 2.6.0 (the former release 0.9.30.4 was built with that too). The svn tag is http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_0_RC1 Please, let me know if you find any problems with these release candidates. Also let me know if you installed it without any problem. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] OpenSUSE KDE keeps stealing my IDE shortcuts
On Mon, 30 Jul 2012, Graeme Geldenhuys wrote: On 30 July 2012 14:27, wrote: Here it is 'System settings - Computer Administration - Keyboard & Mouse - Standard Keyboard Shortcuts' (or global keyboard shortcuts). Are you running OpenSuse as well? or some other KDE distro like Kubuntu? The reason I ask, is because my OpenSuse doesn't have that "menu navigation" structure you list. But I did find the "Standard Keyboard Shurtcuts" option, but I triple checked, and nowhere is there any mention of Ctrl+F4 as a keybinding. :-( Damn, this is frustrating - and a waist of my time! I hate change. I run Kubuntu since several years. I dropped Asus as hardware, though. Never managed to get it working decently with linux. :/ But as usual, YMMV. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] OpenSUSE KDE keeps stealing my IDE shortcuts
On Mon, 30 Jul 2012, Graeme Geldenhuys wrote: Hi, I've been forcefully pushed to change Linux Distros (from Ubuntu to OpenSUSE). I've been running the very stable Ubuntu 10.04 LTS for very long. But I recently upgraded to a new system, and 10.04 seems to lack some hardware support. The latest (K)Ubuntu 12.04 is damn unstable (random total system freezes - the mouse doesn't even move), and I absolutely hate the Unity interface. Gnome 3 is no better. Unfortunately switching the desktop to something like JWM doesn't help because of the system freezes - which seems to be a unstable OS (kernel) issue. So I'm trying OpenSUSE 12.1 (64-bit), and so far the OS is stable, but KDE is still something to get used to. Anyway, to get to the point. I have installed (copied) all my old development folders to the new system, and setup FPC as I normally had it. Compiling Lazarus IDE, and my other projects works as expected. What is happening though, is that KDE (I think) is stealing my keyboard shortcuts, so they don't work in Lazarus IDE (compiled with LCL-GTK2) or MSEide for that matter. eg; Ctrl+F4 to close an editor file doesn't work, and I am forced to use the mouse. Anybody know where in KDE do I look for global keyboard shortcuts, so I can disable Ctrl+F4 usage in KDE? I've already looked in "System Settings -> Shortcuts and Gestures", and searched for Ctrl+F4, but nowhere do I see an existing entry. Where else can I look? Does this happen to other KDE users too? Here it is 'System settings - Computer Administration - Keyboard & Mouse - Standard Keyboard Shortcuts' (or global keyboard shortcuts). Surprised to hear you have problems with Kubuntu 12.04. I run it myself, didn't experience any problems, my laptop is up and running since months. Maybe a problem with the X drivers ? I never use the 'recommended' nvidia drivers, always a previous version. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web-services
On Wed, 25 Jul 2012, Ian Godman wrote: X-MULE_SESSION: rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ2MzQyYjU4ZS1kNjY2LTExZTEtOWRmYS1iOTFmY2RkY2U0ZTBwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9QAHhxAH4ACXh4 http.method: POST Content-Type: text/xml; charset=UTF-8 X-MULE_ENCODING: UTF-8 Transfer-Encoding: chunked Connection: close http://schemas.xmlsoap.org/soap/envelope/";>http://example.org/";>Hello George I miss the following at the start: But normally this should not hurt. The error means that there is an illegal character at the start of the returned stream. This error is raised by the XMLRead routines. It is then masked by a WST error (which, I think, is a design error of WST). I suspect the illegal character is a BOM marker (I had similar experiences in the past). If so, you should configure your server not to return a BOM Marker. Maybe SOAPUI can handle it, but XMLRead probably can't. (although, I managed to crash Java webservices by sending a BOM Marker in a request...) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web-services
On Wed, 25 Jul 2012, Ian Godman wrote: I have been able to test my web service with SOAPUI and it responds without error, giving it the parameter 'George' I get: http://schemas.xmlsoap.org/soap/envelope/";> http://example.org/";> Hello George How ever when I run in Lazarus i get the following The logs written by the web service indicate that it is receiving the request and processing it correctly - the log out put is the same as that seen when successfully calling the service from SOAPUI. I have used WST to generate the classes from the same WSDL as used with SOAPUI. Any ideas ? Project webservice raised exception class 'EXMLReadError' with message: in 'stream:' (line 1 pos 145): root element is missing The line indicates that there is something missing in the response. Is the webservice somehow publicly available so someone else can test ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Cannot connect Firebird server
On Wed, 25 Jul 2012, Sławomir Cabaj wrote: W dniu 2012-07-25 12:40, michael.vancann...@wisa.be pisze: On Wed, 25 Jul 2012, Sławek wrote: Hello, I'd like to start a new life (after Delphi) with Lazarus IDE but got into trouble with basic Firebird connection procedure :( Error message: Cannot load default Firebird clients (fbembed.dll or gds32.dll) ?? System Win7,64bit,home Firebird 2.5/32bit installed on local machine from zip package; database located on local machine Lazarus 32bit, 0.9.30.4 Any hints ? First, make sure that fbclient.dll is in the PATH Then, try adding InitialiseIBase60('fbclient.dll'); as the first line in your program source. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus Putting "InitialiseIBase60('fbclient.dll');" generated "Identifier not found InitialiseIBase60" Yes, you must of course add the Ibase60dyn unit to the uses clause. I forgot to mention that. but it works when fbclient.dll is located in SysWOW64 directory ! That particular problem happens often :) Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Cannot connect Firebird server
On Wed, 25 Jul 2012, Reinier Olislagers wrote: On 25-7-2012 12:40, michael.vancann...@wisa.be wrote: On Wed, 25 Jul 2012, Sławek wrote: Hello, I'd like to start a new life (after Delphi) with Lazarus IDE but got into trouble with basic Firebird connection procedure :( Error message: Cannot load default Firebird clients (fbembed.dll or gds32.dll) ?? System Win7,64bit,home Firebird 2.5/32bit installed on local machine from zip package; database located on local machine Lazarus 32bit, 0.9.30.4 Any hints ? First, make sure that fbclient.dll is in the PATH Ah yes, that's of course a neat solution for a dev PC... hadn't thought about that ;) It must be true on a client PC as well. Then, try adding InitialiseIBase60('fbclient.dll'); as the first line in your program source. AFAIU, via fpc\packages\ibase\src\ibase60.inc, fbclient.dll should be searched automatically, as well as gds32.dll; in newer FPC (at least since revision 20112) fbembed.dll would be searched (though unfortunately not first in the sequence) Wouldn't InitialiseIBase60 be superfluous? That's why I added 'then'. It's only the second option. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Cannot connect Firebird server
On Wed, 25 Jul 2012, Sławek wrote: Hello, I'd like to start a new life (after Delphi) with Lazarus IDE but got into trouble with basic Firebird connection procedure :( Error message: Cannot load default Firebird clients (fbembed.dll or gds32.dll) ?? System Win7,64bit,home Firebird 2.5/32bit installed on local machine from zip package; database located on local machine Lazarus 32bit, 0.9.30.4 Any hints ? First, make sure that fbclient.dll is in the PATH Then, try adding InitialiseIBase60('fbclient.dll'); as the first line in your program source. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] How does Lazarus find SQLite?
On Wed, 25 Jul 2012, Mark Morgan Lloyd wrote: Alexander Klenin wrote: I see. Based my incorrect conclusion that Lazarus itself uses SQLite I was hoping to guarantee its presence for the demo. I'll just write in the demo documentation that it is required :) Applies to any database: has to be installed, and naming/symlinks need to be correct. I thought that at one time there was a proposal that an initialisation call should be able to specify a library's exact name. It is so, but a default is used when the library is first needed, if if was not loaded with an explicitly specified name. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web-services
On Thu, 19 Jul 2012, Ian Godman wrote: On 19/07/12 14:28, michael.vancann...@wisa.be wrote: On Thu, 19 Jul 2012, Ian Godman wrote: Hi I am trying to get Lazarus to connect to a Java based web service. The web service is in Java because its on an existing webserver and will provide information and services etc from that site. I am using Apache CXF and Jersey for the web services. With Jersey I have a working restful webservice, with CXF I have been able to build the service but not the client. I have used WST to generate the classes from the WSDL which appears to work well. However when I try to run the client I get the following exception: Project webservice raised exception class 'EserviceConfigException' with message invalid parameter: 'AProtocolData' Searching Google I found that the solution was to add soap_formatterto my uses which I have done but still get the same error. I have changed to use the wst_CreateInstance_HelloWorldEasy (always start with 'hello world' :-) ) and teh invalid parameter error goes away to be replaced with Project webservice raised exception class 'EXMLReadError' with message: in 'stream:' (line 1 pos 145): root element is missing Can you post the response from the server ? You can make the response visible on the console by adding the logger_extension unit to your uses clause. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus The service is not being called, Lazarus code is failing before the request is made so there is no server response. Well, you get a read error. Reading is normally done only when you get a response. Did you specify an end point (address) when you create the service ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Web-services
On Thu, 19 Jul 2012, Ian Godman wrote: Hi I am trying to get Lazarus to connect to a Java based web service. The web service is in Java because its on an existing webserver and will provide information and services etc from that site. I am using Apache CXF and Jersey for the web services. With Jersey I have a working restful webservice, with CXF I have been able to build the service but not the client. I have used WST to generate the classes from the WSDL which appears to work well. However when I try to run the client I get the following exception: Project webservice raised exception class 'EserviceConfigException' with message invalid parameter: 'AProtocolData' Searching Google I found that the solution was to add soap_formatterto my uses which I have done but still get the same error. I have changed to use the wst_CreateInstance_HelloWorldEasy (always start with 'hello world' :-) ) and teh invalid parameter error goes away to be replaced with Project webservice raised exception class 'EXMLReadError' with message: in 'stream:' (line 1 pos 145): root element is missing Can you post the response from the server ? You can make the response visible on the console by adding the logger_extension unit to your uses clause. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Splitting a sentence into words??!
On Wed, 27 Jun 2012, Reinier Olislagers wrote: Splitting a string with a sentence into words shouldn't be hard, should it? See the strutils unit. WordCount, ExtractWord: http://www.freepascal.org/docs-html/rtl/strutils/extractword.html http://www.freepascal.org/docs-html/rtl/strutils/wordcount.html They can be used to create the functions you want. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Loading an library from thread on Ubuntu 12.04 64bit.
On Fri, 15 Jun 2012, fred f wrote: Hi guyz, I have been fighting few hours to solve the problem which occurs on Ubuntu 12.04 64bit. The same code works find on U12.04 32bit or U10.04 32 or 64bit. It is about loading an library (it doesn't matter which one, all behave the same) from thread. When I call the same code without threading then it works fine. It raises an access violation and when built with all checks in project options, then it crashes on LoadLibrary() with Range error. The range error by itself has little meaning, since it works in non-threaded apps. I would not concentrate on that. It sounds like a bug in the dl library shipped with U12.04 64bit. Maybe you can try to load all needed libraries before spawning your threads. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Pasting components
On Wed, 13 Jun 2012, Mattias Gaertner wrote: Hi all, Pasting components now keeps the references between multiple pasted components. If the pasted components are renamed their captions are now updated as well. Great news. That one has been long in the tracker :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Erro: undefined symbol
On Tue, 29 May 2012, Antonio Fortuny wrote: Hi All. Maybe I'm coming back with an old thing but I can't get rid of it. I've compiled and installed a new package (UIB): no problem anywhere. Then I begin to use the package into a new project. I've just added the package to the project and nothing else. At the compilation I get the error messages: UibDataSet.lpr(20,1) Error: Undefined symbol: THREADVARLIST_UIBDATASET UibDataSet.lpr(20,1) Error: Undefined symbol: VMT_UIBDATASET_TUIBDATASET UibDataSet.lpr(20,1) Fatal: There were 2 errors compiling module, stopping Line 20 is the end. of th lpr. No components have been used yet neither any unit from the new package. I didn't find any solution for it on the net and removing *.ppu and *.o does not solve the problem. Neither does the change from {$mode objfpc} (my default) to {$mode DELPHI}. Removing debug options in linker doe not solve the problem. There are no other *.ppu nor *.o from the package anywhere in the target PC. Do you include the unit UIBDATASET in the uses clause? Do you actually use something from the unit ? if not, try to do so. It looks like the compiler decided that the UIBDATASET unit uses threadvars, and includes them in the global list of threadvars, but then sees that you don't actually use the unit, so does not include the unit in the link script. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] usability: please not focus the messages window, only bring to front
On Mon, 21 May 2012, zeljko wrote: On Monday 21 of May 2012 17:02:49 michael.vancann...@wisa.be wrote: On Mon, 21 May 2012, zeljko wrote: On Monday 21 of May 2012 16:41:34 michael.vancann...@wisa.be wrote: On Mon, 21 May 2012, Bernd wrote: 2012/5/21 Martin : Have you checked the options? There is an option, that if set will focus the message window. Options / Desctop See my original message. It tried both. It does not do what the option says in both cases (checked or unchecked) In my experience, focus handling of the IDE on linux is seriously messed up. It has never worked decently. I spend a lot of time looking for all the various IDE windows :/ (and that's on a Kubuntu, not Xubuntu) Kubuntu ? Have you tried focus stealing prevention on/off ? Never tried. But now I set it to 'off'. At first sight, it does not change anything. I expect that if I activate the main Lazarus window, that all other windows are also activated. This is not so (although I'm not sure it is supposed to happen in Lazarus ?). Are you joking ? If you activate main lazarus window then only active window is lazarus main window. There's no chance to have 2 active windows of same application at the same time (we'll it is if TCustomForm.Active says that it's active but really it isn't). I should have been more careful in my wording: I don't want the others to be active (I know only one window can be active), but I do want them to be raised over non-lazarus windows. I have typically one or more terminals, a browser and a VMWare open besides lazarus. I can raise the main lazarus window, but then I must still go and look for other IDE windows. By automatically raising these when the main window becomes active, this would reduce my search time :-) (I already started working with 1 terminal with many tabs, just to reduce the number of open windows on my desktop) In each case, when compiling, the messages window is neither raised nor focused. Qt and gtk2 raises active window and they will not focus anything explicitly. If LCL says please focus that control, then control will be focused.BUT if you focus message window (eg. by mouse click) and next time when it's raised it's possible that it'll grab focus, but again because of lcl I guess. The original question was about raising/focusing the messages window when compiling. On my PC neither happens, so the value of the abovementioned checkbox in the settings dialog becomes meaningless ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] usability: please not focus the messages window, only bring to front
On Mon, 21 May 2012, zeljko wrote: On Monday 21 of May 2012 16:41:34 michael.vancann...@wisa.be wrote: On Mon, 21 May 2012, Bernd wrote: 2012/5/21 Martin : Have you checked the options? There is an option, that if set will focus the message window. Options / Desctop See my original message. It tried both. It does not do what the option says in both cases (checked or unchecked) In my experience, focus handling of the IDE on linux is seriously messed up. It has never worked decently. I spend a lot of time looking for all the various IDE windows :/ (and that's on a Kubuntu, not Xubuntu) Kubuntu ? Have you tried focus stealing prevention on/off ? Never tried. But now I set it to 'off'. At first sight, it does not change anything. I expect that if I activate the main Lazarus window, that all other windows are also activated. This is not so (although I'm not sure it is supposed to happen in Lazarus ?). In each case, when compiling, the messages window is neither raised nor focused. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] usability: please not focus the messages window, only bring to front
On Mon, 21 May 2012, Bernd wrote: 2012/5/21 Martin : Have you checked the options? There is an option, that if set will focus the message window. Options / Desctop See my original message. It tried both. It does not do what the option says in both cases (checked or unchecked) In my experience, focus handling of the IDE on linux is seriously messed up. It has never worked decently. I spend a lot of time looking for all the various IDE windows :/ (and that's on a Kubuntu, not Xubuntu) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] toolbar buttons (Windows vs GTK2)
On Thu, 10 May 2012, Graeme Geldenhuys wrote: On 10 May 2012 13:49, William Oliveira Ferreira wrote: Should be another Unity Issue? I'm not running Unity, I'm running Ubuntu 10.04 LTS which pre-dates Unity. It's a standard Gnome desktop, and all other GTK2 applications display icons just fine in toolbars. I run Kubuntu 10.04, lcl-gtk2, and the images look the same as in Graeme's screenshot. So it is not a Unity problem. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Function to get the mimetype from a file extension
On Wed, 9 May 2012, Felipe Monteiro de Carvalho wrote: On Wed, May 9, 2012 at 4:15 PM, wrote: Distribute a mime.types from a unix box with your app and load this in the fpmimetypes unit using the provided function. That's what I do on Windows. By far the easiest solution :) My code is the LCL, so I cannot do that without forcing all LCL-CustomDrawn-Android users to deploy this file. I think I will steal the code from TurboPower iPro and put it somewhere in LazUtils. On windows it looks in the registry. Good luck with that on Android :-) For other OSes there are about 4 or 5 mime types defined. Not really useful. So my suggestion is probably still the best. I don't see why you'd need to force this on all users, only the ones that need mime types need the file ? Or you could convert it to an include file that just registers all more or less known types in fpmimetypes.pp. Then people can include this include file and be done with it. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Function to get the mimetype from a file extension
On Wed, 9 May 2012, Graeme Geldenhuys wrote: On 9 May 2012 14:51, wrote: It is used by fcl-web. On linux, it loads /etc/mime.types. I don't know the exact format of that file, I guessed "mime type name" then "file extension list" Correct. But on my Ubuntu 10.04 that file has many lines only showing the "mime type name" with no extension mentioned. So how reliable is that file really? Based on my personal experience: very. I've had this file in use since 18 years at least, since the first NCSA webserver installations. I know Linux (at least Gnome) uses magic numbers (first 2-4 bytes of a file) to detect the real file type without looking at the file extension. A webserver does not do that. It uses the mime file. the 'file' command looks at the magic numbers, but for example KDE looks at the extension. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Function to get the mimetype from a file extension
On Wed, 9 May 2012, Felipe Monteiro de Carvalho wrote: On Wed, May 9, 2012 at 2:51 PM, wrote: FPC contains this unit: fpmimetypes.pp It is used by fcl-web. On linux, it loads /etc/mime.types. On windows not yet, I must still look up how to do this. I just opened "adb shell" and there is no such file in my HTC Wildfire. I'd really like a standard list here. As less system-dependent as possible. Distribute a mime.types from a unix box with your app and load this in the fpmimetypes unit using the provided function. That's what I do on Windows. By far the easiest solution :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Function to get the mimetype from a file extension
On Wed, 9 May 2012, Felipe Monteiro de Carvalho wrote: Hello, I need this now and after some Googling I couldn't find anything. So I was wondering, maybe we already have this somewhere in FPC or Lazarus? If not it might be something to consider adding to LazUtils. FPC contains this unit: fpmimetypes.pp It is used by fcl-web. On linux, it loads /etc/mime.types. On windows not yet, I must still look up how to do this. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Embarcadero vs Lazarus/FPC (Oracle vs Google)
On Tue, 8 May 2012, Felipe Monteiro de Carvalho wrote: On Tue, May 8, 2012 at 3:15 PM, wrote: IP is much like the church and its universal truths in the middle ages. I thought we got rid of those shackles, now we get other ones. Instead of church, we have large corporations. -1 please leave Christianism out of your rant. I wrote church, not christianism. That's a world of difference. I have no problems with individual christians and their belief. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Embarcadero vs Lazarus/FPC (Oracle vs Google)
On Tue, 8 May 2012, Andrew Brunner wrote: On Tue, May 8, 2012 at 7:31 AM, Graeme Geldenhuys wrote: On 8 May 2012 14:07, Andrew Brunner wrote: Oracle is telling google that that it is UNACCEPTABLE for google to take creative ownership over Java. This problem goes far beyond copying of some API. Google as made and Oracle product - and Oracle is not happy. This does not apply here. Orcale and google are widely adopted and highly funded. I repeat Delphi has changed ownership 3 times SINCE FPC and or Lazarus and came to be. Google recently stole Java from Oracle. Their claim is with much merit. google has been stealing IP left and right. They have to be stopped. Stealing IP ? That depends on your point of view. My view is that IP itself is theft. The concept of IP is fundamentally flawed. Knowledge should be free for all, and not 'owned' by someone for mere monetary gain. IP is much like the church and its universal truths in the middle ages. I thought we got rid of those shackles, now we get other ones. Instead of church, we have large corporations. If someone found a cure for all kinds of cancer, and kept it for himself using the IP umbrella, I'd label him a criminal against humankind and send him to trial in The Hague. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Postgresql listen/notify
On Tue, 8 May 2012, Mark Morgan Lloyd wrote: Leonardo M. Ramé wrote: Hi, does sql-db allows to capture PostgreSql notify events?. If yes, how?. Indirectly. You have to set it up using the TPQConnection.Handle since this has long-term persistence, and have to make direct API calls *not* ExecuteDirect() since that uses a temporary handle. It works, but is sensitive to transient network failures etc.: the server end can forget, so it's wise to have a fallback mechanism. I don't know whether it should be treated as a candidate for an extension to the sql-db API, since as far as I know there's something comparable (implemented very differently) on Firebird but nothing else. Well, that and a backup/restore API for those engines supporting it. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Embarcadero vs Lazarus/FPC (Oracle vs Google)
On Tue, 8 May 2012, Graeme Geldenhuys wrote: Hi, I'm following the trial between Oracle vs Google and wondered about the following... Judge Alsup told the jury to assume API's are copyrightable - something Alsup still has to determine later during trial. Now if he does rule that API's are copyrightable, how will this affect the Lazarus and Free Pascal projects? Both the latter projects copy Embarcadero's API's verbatim. Well, not verbatim. There are differences. Now, if he so judges, that would mean the end of the wine, samba and many other open or closed source projects. I suspect that this would be taken to a higher court by the FSF and other organisations as Redhat, Linux.org. They would all have to close shop after such a ruling. In each case, we are not US-based; a ruling by a US judge does not affect us. At worst it would mean FPC/Lazarus cannot be used in the US. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Inserting images in mysql records
On Fri, 4 May 2012, Hugues Moisy wrote: Hi all, I'm trying to insert gif file content into a blob field in a mysql database. Insertion process works, but the size of the data inserted is cut to 64 Kbytes, so the images are cut and impossible to read (crash), except those that are less than 64KB. my function is this : conn := getConnection(_TypeConnection); query.DataBase := conn; query.UsePrimaryKeyAsKey:=false; query.SQL.clear; query.SQL.Add('update volumepage set page_image = :image, image_filename = :imgname where volume_id = :vol and page_index = :page'); query.Params.ParamByName('vol').Value:=pVolumeId; query.Params.ParamByName('page').Value:=pPageIndex; query.Params.ParamByName('image').LoadFromFile(pFileName,ftBlob); query.Params.ParamByName('imgname').Value:=pFileName; query.ExecSQL; could somebody explain me the origin of the problem : is it a problem in the database, or in the LoadFromFile ? It depends on the type of field you created in the database. If it is a 'Text' field, then I think Mysql limits the content to 64k bytes. sqldb by itself does not impose limits, as far as I know. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Object inspector hints ?
On Mon, 30 Apr 2012, Mattias Gaertner wrote: On Mon, 30 Apr 2012 10:03:41 +0200 (CEST) Michael Van Canneyt wrote: Hi, The lazarus code editor shows tooltip hints about identifiers; It gets those from the sources or even fpdoc. Is there any reason why the object inspector would not be able to offer the same hints ? Properties and events are also just identifiers after all. Right click on OI: enable Show hints Unbelievable... How many years this gem remained hidden from me. You can learn everything there is to know about lazarus in a week, and yet after many years, it can still surprise you. ( (c) Gandalf ) Thanks. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TImage - Getting image properties in 'canvas space'
On Thu, 19 Apr 2012, Martin Schreiber wrote: On Thursday 19 April 2012 09:52:30 michael.vancann...@wisa.be wrote: On Thu, 19 Apr 2012, Graeme Geldenhuys wrote: On 19 April 2012 00:04, Alberto Narduzzi wrote: An interface to a class (or its concept, anyway) is there for a reason. And you should adhere to. I may also say that if you need to access a protected, or private for what is worth, member of a (library...) class, then you should revise your code... because either you're using the wrong class, or your problem can be solved in a different, possibly more elegant, and surely more OO compliant way ;-) I totally disagree... :) type // Friend class to get access to protected methods THackCustomEdit = class(TCustomEdit); The Hack says it all. Here you are working outside regular OOP rules. The correct way would have been an implementation for each descendent of TCustomEdit. You just took a shortcut. Nothing wrong with that by itself, but basing an argument about general OOP rules on a shortcut implementation is incorrect reasoning. In a system with stricter rules, you would have had to solve it differently. May I repeat the idea of "friend units"? You can already use class helpers. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TImage - Getting image properties in 'canvas space'
On Thu, 19 Apr 2012, Graeme Geldenhuys wrote: On 19 April 2012 00:04, Alberto Narduzzi wrote: An interface to a class (or its concept, anyway) is there for a reason. And you should adhere to. I may also say that if you need to access a protected, or private for what is worth, member of a (library...) class, then you should revise your code... because either you're using the wrong class, or your problem can be solved in a different, possibly more elegant, and surely more OO compliant way ;-) I totally disagree... :) type // Friend class to get access to protected methods THackCustomEdit = class(TCustomEdit); The Hack says it all. Here you are working outside regular OOP rules. The correct way would have been an implementation for each descendent of TCustomEdit. You just took a shortcut. Nothing wrong with that by itself, but basing an argument about general OOP rules on a shortcut implementation is incorrect reasoning. In a system with stricter rules, you would have had to solve it differently. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess, UTF8, Windows
On Mon, 16 Apr 2012, waldo kitty wrote: On 4/15/2012 05:25, Michael Van Canneyt wrote: On Sun, 15 Apr 2012, Jürgen Hestermann wrote: When I go to "http://svn.freepascal.org/svn/fpcdocs/trunk"; it is empty. I just found out that active scripting is required for this web page (I use the FireFox NoScript plugin). Is there a reason for this? You are wrong. No scripting is needed for this page. It is simply not meant for viewing in a browser, it returns XML used by a SVN client. If you want to browse the repository, use the viewvc interface: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/?root=docs http does not denote that a browser is the default and main client to use for viewing this data?? that's a new one on me :? :( It does not. HTTP denotes a client/server communication protocol. Nowhere does the HTTP protocol specify that the content must be displayable. It just happens to be the protocol used by a browser. And if the payload is HTML, then the browser can display it directly. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TProcess, UTF8, Windows
On Mon, 16 Apr 2012, Jürgen Hestermann wrote: Michael Van Canneyt schrieb: When I go to "http://svn.freepascal.org/svn/fpcdocs/trunk"; it is empty. I just found out that active scripting is required for this web page (I use the FireFox NoScript plugin). Is there a reason for this? You are wrong. No scripting is needed for this page. Well, if I look at this page with FireFox with scripting disabled I see nothing (white page). If I allow scripting for "freepascal.org" I see directory structure (beginning with "trunk"). So it seems to make a difference whether I have scripting enabled or not. I suspect that the fact that the server returns XML, not HTML, confuses the NoScript plugin. If you look at the page source, you'll see there is absolutely no Javascript present. Just XML. And it is not shown in my browser either although I do not have the NoScript plugin. It is simply not meant for viewing in a browser, it returns XML used by a SVN client. Ok. If you want to browse the repository, use the viewvc interface: Well, I don't "want" it. I am just following hints that Hans-Peter gave me. It seems to be an odyssey just for changing documentation. The easy way is simply to report a bug in the bugtracker. Then I'll look at it and either reply or correct the documentation. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] RE : Development of other revision control
On Thu, 12 Apr 2012, Ludo Brands wrote: IIUC, the SVN package (plugin) lets people use SVN with their Lazarus project, e.g. check in and out his project code from within the IDE. Yes, a developer might be interested in doing more with SVN, but managing his project source code in SVN would be the most important thing, right? IIUC, that's already possible with the SVN component. If I read your mails right, you're actually interested in this part, right? What is missing is the functionnality to create a new repository from the current project. That would the biggest value add of an integrated version control plugin. Explorer plugins like TortoiseSVN don't know what a lazarus project is (or any other project) and can only create new repositories from a complete directory tree. This means: weeding out unnecessary, non-source files from the directory, add whatever third party code needed which is not already under version control and then create a repository from the directory and check it out again to make it a working copy. The IDE knows the project and its dependencies and could make this step very easy for the user. Adding or deleting a file to/from a project and doing the same in the repository would also be a logical extension. And this is the reason I disabled version control in Delphi. I often do a rename of a file, and then this mechanism bites you in the leg more than it helps. If subversion (or whatever) automatisms are added, please make sure the behaviour can be fine-tuned to a high degree. I agree that the initial repository setup is a very good thing, but for the rest I prefer that the IDE does not try to be too smart. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Callback and Threads problem
On Fri, 6 Apr 2012, Leonardo M. Ramé wrote: On 2012-04-06 14:39:10 +0200, michael.vancann...@wisa.be wrote: On Fri, 6 Apr 2012, Leonardo M. Ramé wrote: I have a similar problem to this: http://www.lazarus.freepascal.org/index.php?topic=10571.0 My main program launches a thread, that loads a shared library, then execute a function who receives as a parameter a pointer to a callback function and an instance of the caller, as this: procedure TMythread.execute; begin ... // external function runcode(@MyCallBack, @Self); ... end; procedure MyCallback(const Result: PAnsiChar; const ACaller: pointer); cdecl; var lCaller: TMythread; begin // the parameter ACaller is used because callbacks can't be of type // procedure of object. lCaller := TMyThread(ACaller); lCaller.TestVar := Result; // <--- Ok. lCaller.ListOfThings.Add; // <--- SIGSEGV IMHO the problem is not in threads. You cannot pass objects to libraries or vice versa. The VMTs will differ. Michael. But, I'm passing the object as a pointer that is received as (void *) and returned back to the callback as a parameter, the library doesn't touch it. Even in this case I can't pass an object?. Ah. In that case you can, yes. Is the calling convention correct ? Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Callback and Threads problem
On Fri, 6 Apr 2012, Leonardo M. Ramé wrote: I have a similar problem to this: http://www.lazarus.freepascal.org/index.php?topic=10571.0 My main program launches a thread, that loads a shared library, then execute a function who receives as a parameter a pointer to a callback function and an instance of the caller, as this: procedure TMythread.execute; begin ... // external function runcode(@MyCallBack, @Self); ... end; procedure MyCallback(const Result: PAnsiChar; const ACaller: pointer); cdecl; var lCaller: TMythread; begin // the parameter ACaller is used because callbacks can't be of type // procedure of object. lCaller := TMyThread(ACaller); lCaller.TestVar := Result; // <--- Ok. lCaller.ListOfThings.Add; // <--- SIGSEGV IMHO the problem is not in threads. You cannot pass objects to libraries or vice versa. The VMTs will differ. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TIBConnection LoginPrompt
On Fri, 6 Apr 2012, Koenraad Lelong wrote: On 06-04-12 10:14, Koenraad Lelong wrote: Hi, How does one use the LoginPrompt of a TIBConnection ? I set it to True and then started my app. There is no loginprompt-form, but an error the user/password is not defined. I'm still using Lazarus 0.9.30/fpc 2.4.2. Thanks for any hints. Koenraad Lelong. Hi, I tried this with lazarus 0.9.30.4/fpc 2.6.0. This gives the same problem. If you want it to do something, you must set the OnLogin handler of your connection component. LoginPrompt is an ill-advised attempt at Delphi compatibility. It's evil; do not use it. Always first do a login, and then set the connection parameters and connect. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange dependency of units
On Thu, 5 Apr 2012, Michael Schnell wrote: On 04/05/2012 04:45 PM, Michael Van Canneyt wrote: Exactly. That is called 'polling' windows... ... You have a strange definition of polling. Polling = Checking something at regular intervals. Sorry for being tense, but what has been described (and acknowledged by you) is _not_ doing something at regular intervals. The API only returns when a message arrives. some might come in some microsecond intervals and then there might be a gap of days. To me this is not "regular intervals". Can you try to open your mind a bit and get the spirit of the definition ? Please ? Then try this: Polling = Asking or checking something. This is as opposed to 'interrupts', where you're not asking, but where the environment interrupts whatever you're doing and forces you to handle the event right there and then. The 'regular intervals' you seem to insist on, means you just put a timeout on the time you wait for your answer when polling. Qt/GTK/X11 allow for this design as well. So there is a possibility to feed user events to the queue in GTK ? If so, I don't understand why the GTK Widget Type (other than the Windows Widget Type) implements additional (an) queue(s) in Pascal code. (I never took a look at QT.) Just add a file descriptor to the main loop mechanism, and write something to it from wherever you want to send an event. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpdocmanager questions & crash
On Thu, 5 Apr 2012, Reinier Olislagers wrote: On 5-4-2012 15:26, michael.vancann...@wisa.be wrote: On Thu, 5 Apr 2012, Reinier Olislagers wrote: On 5-4-2012 14:56, michael.vancann...@wisa.be wrote: On Thu, 5 Apr 2012, Reinier Olislagers wrote: On 5-4-2012 14:35, michael.vancann...@wisa.be wrote: On Thu, 5 Apr 2012, Reinier Olislagers wrote: Then why is fpdocmanager in Lazarus, not in FPC - I thought fpcdocs should be maintainable with FPC only without requirement for Lazarus, but I might be mistaken... Do the current fpdoc toolset maintainers agree with FPDocmanager projects replacing makefiles? And when will this replacement happen? I am in a position to answer this one: The FCL/RTL docs will have a fpdoc project file, as soon as the necessary support for it has migrated to the fixes branch. I have set up and tested these files (albeit only on linux). The fpdoc project file format is documented already. Good news! Where is the fpdoc project file format documented? in the fpdoc documentation: fpdoc.tex, obviously :-) Oh joy ;) Thanks; Lyx seems to be able to open it, so I'm happy ;) A happy user !! Quick, we must stuff him and put him in a museum !! Michael. As long as it's on alcohol ;) I have plenty of vodka and pastis available ;) More seriously, if you want to have a hand in testing (+asking newb questions) on Windows, you have my email address... Not sure I catch your drift ? You want me to test on windows with your help, or do you want me to help you when you're testing on Windows ? The former is not going to happen, but the latter may happen :-) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpdocmanager questions & crash
On Thu, 5 Apr 2012, Reinier Olislagers wrote: On 5-4-2012 14:56, michael.vancann...@wisa.be wrote: On Thu, 5 Apr 2012, Reinier Olislagers wrote: On 5-4-2012 14:35, michael.vancann...@wisa.be wrote: On Thu, 5 Apr 2012, Reinier Olislagers wrote: Then why is fpdocmanager in Lazarus, not in FPC - I thought fpcdocs should be maintainable with FPC only without requirement for Lazarus, but I might be mistaken... Do the current fpdoc toolset maintainers agree with FPDocmanager projects replacing makefiles? And when will this replacement happen? I am in a position to answer this one: The FCL/RTL docs will have a fpdoc project file, as soon as the necessary support for it has migrated to the fixes branch. I have set up and tested these files (albeit only on linux). The fpdoc project file format is documented already. Good news! Where is the fpdoc project file format documented? in the fpdoc documentation: fpdoc.tex, obviously :-) Oh joy ;) Thanks; Lyx seems to be able to open it, so I'm happy ;) A happy user !! Quick, we must stuff him and put him in a museum !! Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpdocmanager questions & crash
On Thu, 5 Apr 2012, Reinier Olislagers wrote: On 5-4-2012 14:35, michael.vancann...@wisa.be wrote: On Thu, 5 Apr 2012, Reinier Olislagers wrote: Then why is fpdocmanager in Lazarus, not in FPC - I thought fpcdocs should be maintainable with FPC only without requirement for Lazarus, but I might be mistaken... Do the current fpdoc toolset maintainers agree with FPDocmanager projects replacing makefiles? And when will this replacement happen? I am in a position to answer this one: The FCL/RTL docs will have a fpdoc project file, as soon as the necessary support for it has migrated to the fixes branch. I have set up and tested these files (albeit only on linux). The fpdoc project file format is documented already. Good news! Where is the fpdoc project file format documented? in the fpdoc documentation: fpdoc.tex, obviously :-) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange dependency of units
On Thu, 5 Apr 2012, Michael Schnell wrote: On 04/05/2012 02:05 PM, Hans-Peter Diettrich wrote: AFAIR there exists a noGUI widgetset, which implements the message processing (for Timer...) in a non-GUI application. Last time I checked the noGUI Widget Type did not support TTimer or Thread-generated Events (e.g. TThread.Synchronize(), TApplication.QueuAsyncCall() ) which both are essential to construct event driven applications TThread.Synchronize works perfectly in any kind of application outside of the LCL. The main thread just has to call CheckSynchronize at regular intervals. (which is what the LCL does for you). Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] fpdocmanager questions & crash
On Thu, 5 Apr 2012, Reinier Olislagers wrote: The FPDocManager has no platform dependencies. The only external dependency currently is the fpcdocs Makefile, which should be replaced by fpdoc projects, supplied and maintained by the FPC/fpdoc people. Then why is fpdocmanager in Lazarus, not in FPC - I thought fpcdocs should be maintainable with FPC only without requirement for Lazarus, but I might be mistaken... Do the current fpdoc toolset maintainers agree with FPDocmanager projects replacing makefiles? And when will this replacement happen? I am in a position to answer this one: The FCL/RTL docs will have a fpdoc project file, as soon as the necessary support for it has migrated to the fixes branch. I have set up and tested these files (albeit only on linux). The fpdoc project file format is documented already. That said: If FPDocmanager has some private extensions to the fpdoc project file format (or uses another file altogether), they will not be included. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SetEnv on Linux 64bit
On Wed, 4 Apr 2012, Honza wrote: 2012/4/4 : I do not agree with this interpretation. First of all, you are calling execv() in your code, not execve(). That libc changes this to execve() is IMHO not permissible. So all bets and conclusions are off from that point onwards. Why not permissible? The POSIX specs describe what the semantics and/or effects of executing a defined function are. The semantics and effects of libc's execv() are what is said about it in POSIX. I don't see any 'off' conclusion derivable ;-) Secondly, we interpret differently 'external variable environ'. (note the 'external'). For me this clearly means the original environment as passed on to the current process. From the moment main() starts executing, environ is the process current environment. Initially, as it was passed, after any mutation well, that mutated state. No copy of the original environment of a process exists anywhere in the process nor in the kernel. I think you'll find that the environment block is copied as soon as you add a new environment variable. Since the original environment as passed by the kernel is not in the heap, so how could you add something to it, except by copying the array of pointers and enlarging it ? What happens to it in a library, is currently open for speculation. A copy might still exists, though not necessarily, in the originating process, but that is anyway not accessible by the new/now executing process (modulo shmem etc.). Also the 'external variable' is just a reference to the C specification, i.e. that's the way C says to the linker to find the variable defined elsewhere, not in this compilation unit/produced object code. I agree a C person might interpret it like that. Which probably is what happens if you'd call the execv() kernel function, although that would need testing. I can perhaps save someone's time, as there's no execv() kernel call. There's only execve() and that's why a POSIX compliant libc calls execve() with the current value of environ. I stand corrected on this front. Thirdly, the 2 referenced pages clearly indicate that the whole environment handling is hairy at best in corner cases like this. Perhaps, not relevant to us, IMO. And lastly: We on purpose do not follow Libc; Otherwise we'd simply have built the whole RTL on top of it. So we are not under any obligation to mimic its behaviour. No one said so. Actually that's just fine. The discussion went about various claims from various people that in POSIX the environment is either immutable at all, or the mutations are not visible in libraries, or not inherited on exec() - we (you and me) were not discussing FPC at all, IMO. Yes. I was sloppy in my terminology. AFAICS, all the above claims were not true. Actually it's the first time ever I saw such claims, as mutating environment in a POSIX program, because of child process inherits that by default, is so common, that I have never even thought before of a possibility it could be otherwise, so I wanted to verify, to my own benefit, "how that stuff I never really looked into actually works" ;-) I think the confusion came from the original posters request to modify the 'global environment', which - I hope you'll agree - is not possible on Posix, as the environment is passed on from process to process using execve. So, my conclusions: * The SetEnvironment() call on windows will do something totally different than what happens under Posix, and the Windows behaviour cannot be mimicked. Which is why it isn't in sysutils. * A posixy SetEnv() could be implemented for the Unix layer, to mimic Libc. But I think it would not be usable for libraries, since the environment copy of the RTL would not be shareable with the library without pulling in the C memory manager. At best it could be used to be passed on to a new process. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SetEnv on Linux 64bit
On Wed, 4 Apr 2012, Honza wrote: 2012/4/4 : Output of strace: brk(0) = 0x21a5000 brk(0x21c6000) = 0x21c6000 write(1, "a2: MYVALUE\n", 12a2: MYVALUE ) = 12 execve("./b.out", [0], [/* 57 vars */]) = 0 brk(0) = 0x189e000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) As you can see, it uses execve() behind the scenes to be able to pass the modified local environment. This is libc-specific behaviour. I think I cannot agree. IMO its a POSIX specified behavior. libc, at least in this case, just implements the POSIX specs: http://pubs.opengroup.org/onlinepubs/007904975/functions/exec.html And as the ouptut of executing a.out shows, libc implements it correctly: "For those forms not containing an envp pointer ( execl(), execv(), execlp(), and execvp()), the environment for the new process image shall be taken from the external variable environ in the calling process.", which libc achieves by calling execve() with the current environ, effectively just filling the prescribed default. I do not agree with this interpretation. First of all, you are calling execv() in your code, not execve(). That libc changes this to execve() is IMHO not permissible. So all bets and conclusions are off from that point onwards. Secondly, we interpret differently 'external variable environ'. (note the 'external'). For me this clearly means the original environment as passed on to the current process. Which probably is what happens if you'd call the execv() kernel function, although that would need testing. Thirdly, the 2 referenced pages clearly indicate that the whole environment handling is hairy at best in corner cases like this. And lastly: We on purpose do not follow Libc; Otherwise we'd simply have built the whole RTL on top of it. So we are not under any obligation to mimic its behaviour. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SetEnv on Linux 64bit
On Wed, 4 Apr 2012, Honza wrote: 2012/4/4 : Not the current. The EXTERNAL variable environ, i.e. the one that the kernel passed on, which cannot be modified. You can only modify your local copy. 14:00 myname@tux64:~/tmp/c$ ls a.c b.c 14:00 myname@tux64:~/tmp/c$ cat a.c #include #include #include main() { char *e = getenv("MYVAR"); printf("a1: %s\n", e); setenv("MYVAR", "MYVALUE", 1); e = getenv("MYVAR"); printf("a2: %s\n", e); execv("./b.out", NULL); } 14:00 myname@tux64:~/tmp/c$ cat b.c #include #include main() { char *e = getenv("MYVAR"); printf("b: %s\n", e); } 14:00 myname@tux64:~/tmp/c$ gcc -o a.out a.c && gcc -o b.out b.c && ls a.c a.out b.c b.out 14:00 myname@tux64:~/tmp/c$ ./a.out a1: (null) a2: MYVALUE b: MYVALUE 14:00 myname@tux64:~/tmp/c$ Output of strace: brk(0) = 0x21a5000 brk(0x21c6000) = 0x21c6000 write(1, "a2: MYVALUE\n", 12a2: MYVALUE ) = 12 execve("./b.out", [0], [/* 57 vars */]) = 0 brk(0) = 0x189e000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) As you can see, it uses execve() behind the scenes to be able to pass the modified local environment. This is libc-specific behaviour. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SetEnv on Linux 64bit
On Wed, 4 Apr 2012, Honza wrote: 2012/4/4 : Thank you for the help. Unfortunately I'm now confused even more. I believe it's my fault, not yours. You can always modify them (it's just data in memory), but modifying them will only change your private view of the variables. The changes you make will not propagate to libraries or newly started processes. If "library" means a .so (or .dll, but Windows are not that much of a Posix system), then it is in in-process space, so I would think the change *does* propagate, i.e. the change is observable by a call to getenv() from inside a library function. About started processes see below. Typically, libraries will read the environment variables at startup. Any subsequent change to the environment will not have any effect. Therefor it makes no sense to change them, and the FPC runtime does not allow it. If we did allow it, people would expect DOS/Windows like behaviour, which we simply cannot provide. If you read the second part of the provided URL, you'll see that the POSIX group recognises that the behaviour of setenv() is problematical. The URL points - for restrictions - to the exec function http://pubs.opengroup.org/onlinepubs/007904975/functions/exec.html Where it says: "For those forms not containing an envp pointer ( execl(), execv(), execlp(), and execvp()), the environment for the new process image shall be taken from the external variable environ in the calling process." The extrn char **environ (just environ from now on) points to the environment variables of the executing process. Setenv may mutates this environment. The various forms of exec do have either explicit envp, so one can create any required environment vars set, or pass the current environ, effectively enabling the inheritance of the (posibly mutated) environment as an option. The other forms, w/o envp, are defined to do exactly that, i.e. they will use the current environ as their environment vars pointer, Not the current. The EXTERNAL variable environ, i.e. the one that the kernel passed on, which cannot be modified. You can only modify your local copy. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SetEnv on Linux 64bit
On Wed, 4 Apr 2012, Honza wrote: 2012/4/3 Michael Van Canneyt : On Tue, 3 Apr 2012, waldo kitty wrote: On 4/3/2012 09:57, michael.vancann...@wisa.be wrote: On Tue, 3 Apr 2012, fred f wrote: I need to set up LIBOVERLAY_SCROLLBAR=0 on Ubuntu 64bit, but there LIBC is not supported and therefore I am looking for SetEnv which I can use on 64bit Linux. SysUtils contains only GetEnvironmentVariable, but not Set... That's not how it works on Unix/Linux. You must always set up environment variables before a program starts. When starting a process, the environment for that process is started and is then immutable for the duration of the process. ewww... so no "fancy" capabilities like we could do in the old DOS days where we could change the base environment as well as cloning it with changes for child processes??? if so, that's blows several of my porting projects up :? :( Not possible on Posix platforms. Now I'm confused. AFAICS (http://pubs.opengroup.org/onlinepubs/007904975/functions/setenv.html) Posix setenv() allows a process to mutate its environment variables. I probably misunderstood something, can someone enlighten me please? You can always modify them (it's just data in memory), but modifying them will only change your private view of the variables. The changes you make will not propagate to libraries or newly started processes. Therefor it makes no sense to change them, and the FPC runtime does not allow it. If we did allow it, people would expect DOS/Windows like behaviour, which we simply cannot provide. If you read the second part of the provided URL, you'll see that the POSIX group recognises that the behaviour of setenv() is problematical. The URL points - for restrictions - to the exec function http://pubs.opengroup.org/onlinepubs/007904975/functions/exec.html Where it says: "For those forms not containing an envp pointer ( execl(), execv(), execlp(), and execvp()), the environment for the new process image shall be taken from the external variable environ in the calling process." Etc etc etc. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus