Re: [Lazarus] Possible bug passing a TStringList to a function.
En/na Dave Coventry ha escrit: Hi, If I pass a TStringList to a function: function TSLFunctn(myTSL: TSltringList):integer; var i: integer; begin Result:=0; for i:=0 to myTSL.Count-1 do //---fails here begin Result+=strtoint(myTSL.Strings[i]); end; end; The function fails when I try to assign quantify myTSL.Count. works here (without the typo) However, this works: function TSLFunctn(myTSL: TSltringList):integer; var i: integer; internalTSL: TStringList; begin internalTSL:= TStringList.Create; internalTSL:=myTSL; this is: 1) a memory leak (you create a stringlist then ignore it, losing the pointer) 2) exactly the same as before (a stringlist variable, as any other class, is actually a pointer, so if you use := both are pointing at the same object, if you want to make a copy you have to use assign, provided that the class implements it correctly) Result:=0; for i:=0 to internalTSL.Count-1 do //---works begin Result+=strtoint(internalTSL.Strings[i]); end; internalTSL.Free; and here you are freeing the original stringlist, not the locally created one. Bye -- Luca Olivetti Wetron Automatización S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007 ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] is it me or a bug that i ve been fighting?
compared to a textmode version that's only 2K ;) :lol: How can I create a 2K executable with fpc? Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Error when create a main window
2009/1/20 Carlos German Tejero german_tej...@yahoo.com.ar: Hi, i'm using lazarus v0.9.27 r18334 i386-win32-win32/win64 and fpc 2.2.3 on a WindowsXP64. I try to port a delphi program to lazarus/fpc, but when create then main window, the program raise an exception. The exception raise in Win32WSControls unit: {$ifdef WindowsUnicodeSupport} if UnicodeEnabledOS then Window := CreateWindowExW(FlagsEx, PWideChar(WideString(pClassName)), //--- Return 0 PWideChar(Utf8Decode(WindowTitle)), Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil) else Window := CreateWindowEx(FlagsEx, pClassName, PChar(Utf8ToAnsi(WindowTitle)), Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil); {$else} Window := CreateWindowEx(FlagsEx, pClassName, PChar(WindowTitle), Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil); {$endif} if Window = 0 then begin raise exception.create('failed to create win32 control, error: '+IntToStr(GetLastError())); //-- Raise then exception end; ... The attached file error.txt is a backtrace. Any help or suggestion are welcome Sorry my null english. If you continue to run it, what is the exception message (or the GetLastError)? Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Possible bug passing a TStringList to a function.
It's work at my computer I used WinXP SP3 and Lazarus 0.9.26 beta This my code... do you miss something ? function TSLFunctn(myTSL: TStringList):integer; var i: integer; begin Result:=0; for i:=0 to myTSL.Count-1 do //---fails here begin Result+=strtoint(myTSL.Strings[i]); end; end; procedure TForm1.Button1Click(Sender: TObject); var a:TStringList; begin a:=TStringList.Create; a.Add('1'); a.Add('2'); ShowMessage(inttostr(TSLFunctn(a))); end; =INTOSOFT ALEXIO CHAOS darmawan_sugia...@yahoo.com Yahoo Messager = --- On Tue, 1/20/09, Luca Olivetti l...@wetron.es wrote: From: Luca Olivetti l...@wetron.es Subject: Re: [Lazarus] Possible bug passing a TStringList to a function. To: General mailing list lazarus@lazarus.freepascal.org Date: Tuesday, January 20, 2009, 12:02 AM En/na Dave Coventry ha escrit: Hi, If I pass a TStringList to a function: function TSLFunctn(myTSL: TSltringList):integer; var i: integer; begin Result:=0; for i:=0 to myTSL.Count-1 do //---fails here begin Result+=strtoint(myTSL.Strings[i]); end; end; The function fails when I try to assign quantify myTSL.Count. works here (without the typo) However, this works: function TSLFunctn(myTSL: TSltringList):integer; var i: integer; internalTSL: TStringList; begin internalTSL:= TStringList.Create; internalTSL:=myTSL; this is: 1) a memory leak (you create a stringlist then ignore it, losing the pointer) 2) exactly the same as before (a stringlist variable, as any other class, is actually a pointer, so if you use := both are pointing at the same object, if you want to make a copy you have to use assign, provided that the class implements it correctly) Result:=0; for i:=0 to internalTSL.Count-1 do //---works begin Result+=strtoint(internalTSL.Strings[i]); end; internalTSL.Free; and here you are freeing the original stringlist, not the locally created one. Bye -- Luca Olivetti Wetron Automatización S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007 ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] is it me or a bug that i ve been fighting?
Zitat von waldo kitty wkitt...@windstream.net: Martin Friebe wrote: Anyway, unless you are willing to spent time on debugging the issue your self, and go into the depth of the Connector code, this will probably be of little help. i've finally been able to work out the following... MySQLConnection: TMySQL50Connection; TMySQL50Connection = Class(TConnectionName); TConnectionName = class (TSQLConnection) TSQLConnection = class (TDatabase) TDatabase = class(TCustomConnection) TCustomConnection = class(TComponent) TComponent = class(TPersistent,IUnknown,IInterfaceComponentReference) TPersistent = class(TObject) it works out that MySQLConnection.Close is TCustomConnection.Close but if i hover the mouse over Close in Procedure Close; in the public section of the TCustomConnection definition stuffs, the editor wants to point to the textfile close routine Close(var t:Text); which definitely isn't the same thing :( The hint window shows the next declaration. For example: MySQL50Connection.Close; When the mouse is over 'Close' it will show TCustomConnection.Close, because TConnectionName and TSQLConnection don't have a 'Close'. When the mouse is already over a declaration, then it shows the next declaration with this name, so you can see what this declaration hides. For example when the mouse is over the procedure Close; of TCustomConnection then it will show the 'Close' procedure of the system unit. and with all of the searching i've done, i still don't see anything that indicates where i can actually lay eyes on the code for TCustomConnection.Close Move editor cursor over 'procedure Close;' of TCustomConnection and press Ctrl+Shift+Down. It will take you to procedure TCustomConnection.Close; begin Connected := False; end; Do Ctrl+Click on 'Connected' and it will jump to property Connected: Boolean read GetConnected write SetConnected; Do Ctrl+Click on 'SetConnected' and it will jump to procedure SetConnected (Value : boolean); virtual; Since this is a virtual method it might be overloaded. But in this case it isn't. So press Ctrl+Shift+Down to jump to the method body. And so forth ... nor do i see anything indicating that it is assigned to another routine going by another name :? now i know why i much prefer the old-style procedural coding methods :P If you get the stack backtrace you can mail it and hope some one knows about... i still don't know what this involves :( http://wiki.lazarus.freepascal.org/Creating_a_Backtrace_with_GDB Mattias ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Few features for Lazarus editor
I agree, multiple windows with code is way better than split panes. When debugging code (whether mine or others), I have had occasion to use 3 or 4 windows of the same file for reference - one may be showing an enumeration, a couple showing related functions and then the last is the one I actually move about and type in. I've found debugging without this in Laz to be more cumbersome. Alas, I've not delved into the code to look at ways to solve it, and it would require some time to be able to assess what contribution I could make, by which time those who are more familiar with the code will probably have sorted it! [I'm not using that as a cop out for not contributing! I'm close to putting up a patch to solve an LCL issue :-)] DSP Hans-Peter Diettrich wrote: ik schrieb: 1. Multiple spliting (and close the split) the editor to horizontal and vertical views Better: multiple edit windows, as Delphi has. That can work, the thing is, that I really hate jamping using bookmarks, and I like to see things in front of me to work better. I work better when I can place independent windows across the entire desktop, including multiple monitors. Splitting a window is not a solution. DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Error when create a main window
failed to create win32 control, error: 1407 2009/1/20 Vincent Snijders vincent.snijd...@gmail.com 2009/1/20 Carlos German Tejero german_tej...@yahoo.com.ar: Hi, i'm using lazarus v0.9.27 r18334 i386-win32-win32/win64 and fpc 2.2.3 on a WindowsXP64. I try to port a delphi program to lazarus/fpc, but when create then main window, the program raise an exception. The exception raise in Win32WSControls unit: {$ifdef WindowsUnicodeSupport} if UnicodeEnabledOS then Window := CreateWindowExW(FlagsEx, PWideChar(WideString(pClassName)), //--- Return 0 PWideChar(Utf8Decode(WindowTitle)), Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil) else Window := CreateWindowEx(FlagsEx, pClassName, PChar(Utf8ToAnsi(WindowTitle)), Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil); {$else} Window := CreateWindowEx(FlagsEx, pClassName, PChar(WindowTitle), Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil); {$endif} if Window = 0 then begin raise exception.create('failed to create win32 control, error: '+IntToStr(GetLastError())); //-- Raise then exception end; ... The attached file error.txt is a backtrace. Any help or suggestion are welcome Sorry my null english. If you continue to run it, what is the exception message (or the GetLastError)? Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus -- Carlos Germán Tejero ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Error when create a main window
2009/1/20 Carlos German Tejero german_tej...@yahoo.com.ar: failed to create win32 control, error: 1407 If you continue to run it, what is the exception message (or the GetLastError)? This means: ERROR_CANNOT_FIND_WND_CLASS 1407 0x57F Cannot find window class. Does your lpr call Application.Initialize before it calls Application.CreateForm? Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Error when create a main window
NO, Application.Initialize is never called!!! Thanks Vincent, this is a very old delphi 3 program that i want port. Thanks again 2009/1/20 Vincent Snijders vincent.snijd...@gmail.com 2009/1/20 Carlos German Tejero german_tej...@yahoo.com.ar: failed to create win32 control, error: 1407 If you continue to run it, what is the exception message (or the GetLastError)? This means: ERROR_CANNOT_FIND_WND_CLASS 1407 0x57F Cannot find window class. Does your lpr call Application.Initialize before it calls Application.CreateForm? Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus -- Carlos Germán Tejero ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Possible bug passing a TStringList to a function.
Darmawan, When I put your code into my machine, it works fine. Odd, because it is in more than one place where I've used the same technique and they all fail at the same place. But at least it would appear to be a problem with my coding, rather than a bug in Lazarus, and it's not too difficult to work around. Incidently my machine is AMD64 running Ubuntu 8.10 (Intrepid) and using build v0.9.27 r17479 x86_64-linux-gtk 2 (beta) ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Error when create a main window
2009/1/20 Carlos German Tejero german_tej...@yahoo.com.ar: NO, Application.Initialize is never called!!! Thanks Vincent, this is a very old delphi 3 program that i want port. Thanks again You are not the first. Googling for lazarus error 1407 gives among others: http://www.mail-archive.com/laza...@miraclec.com/msg18921.html Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] is it me or a bug that i ve been fighting?
Op maandag 19-01-2009 om 18:29 uur [tijdzone -0500], schreef waldo kitty: Martin Friebe wrote: Anyway, unless you are willing to spent time on debugging the issue your self, and go into the depth of the Connector code, this will probably be of little help. i've finally been able to work out the following... MySQLConnection: TMySQL50Connection; TMySQL50Connection = Class(TConnectionName); TConnectionName = class (TSQLConnection) TSQLConnection = class (TDatabase) TDatabase = class(TCustomConnection) TCustomConnection = class(TComponent) TComponent = class(TPersistent,IUnknown,IInterfaceComponentReference) TPersistent = class(TObject) it works out that MySQLConnection.Close is TCustomConnection.Close but if i hover the mouse over Close in Procedure Close; in the public section of the TCustomConnection definition stuffs, the editor wants to point to the textfile close routine Close(var t:Text); which definitely isn't the same thing :( You can find the code in the fpc-code-dir under packages/fcl-db/src/base/database.inc. What primarily happens is that doDisConnect is called. and with all of the searching i've done, i still don't see anything that indicates where i can actually lay eyes on the code for TCustomConnection.Close nor do i see anything indicating that it is assigned to another routine going by another name :? Take a look at TDatabase.DoDisconnect in the same file. It first closes all queries which are linked to this dataset, and thereafter it closes all transactions. So try to close those yourself before you close the database-connection. See where it goes wrong... now i know why i much prefer the old-style procedural coding methods :P If you get the stack backtrace you can mail it and hope some one knows about... i still don't know what this involves :( Run the application in gdb, and when the crash occurs, type 'bt' on the gdb-prompt. But you must have the fcl-db package compiled with debug-information for it to make any sense. If you really want to try, add the fcl-db/src/base fcl-db/src/sqldb fcl-db/src/dbase and fcl-db/src/sqldb/mysql paths to your compiler-options path and rebuild your application within Lazarus. That way you can 'step' into the fcl-db sources... Joost. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Linux
Hello, I have never used Linux before, but it is becoming an important development target platform for us now. After installing Ubuntu 8.1 with gnome desktop I was quite surprised that the user interface felt quite slugish. The same machine with XP works as expected. It is hard to believe for me that Linux would be any slower than XP. - Is there a way to speed up Ubuntu? (drivers, other GUI ...) (:Yes, I know it is not a Lazarus specific question:) - What Linux distro's are the recommended targets for Lazarus apps? - Is there any real difference from the developers point of view? Regards, Leslie___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linux
What does work slower ? The GUI (if so it might be because some wrong configuration or wrong driver) Something else ? What was installed on the machine ? if there are many daemons and services running, it will make things slower ... Ido 2009/1/20 c...@freemail.hu: Hello, I have never used Linux before, but it is becoming an important development target platform for us now. After installing Ubuntu 8.1 with gnome desktop I was quite surprised that the user interface felt quite slugish. The same machine with XP works as expected. It is hard to believe for me that Linux would be any slower than XP. - Is there a way to speed up Ubuntu? (drivers, other GUI ...) (:Yes, I know it is not a Lazarus specific question:) - What Linux distro's are the recommended targets for Lazarus apps? - Is there any real difference from the developers point of view? Regards, Leslie ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] DCPCrypt maintainer and patch?
Hi, I just noticed while trying to use DCPCrypt package in a fpGUI based application that the dcplazarus.lpk pulls in the LCL package. So even though you can use Lazarus to write non-LCL applications, you can't use DCPCrypt Lazarus Package as such. The solution is simple. Create 2 lazarus packages. One package (dcp.lpk) contains only DCPCrypt units. The second package, dcplazarus.lpk, contains the dcpreg.pas unit that registers DCP with Lazarus IDE. Only the latter package requires LCL dependency. Could anybody make that change in the downloadable DCPCrypt from Lazarus CCR site? Otherwise, how do I submit a patch for the Lazarus CCR site? Also, couldn't dcpcrypt become part of FCL packages? I noticed there is already a Blowfish unit in FCL-Base directory. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linux
2009/1/20 c...@freemail.hu: Hello, I have never used Linux before, but it is becoming an important development target platform for us now. After installing Ubuntu 8.1 with gnome desktop I was quite surprised that the user interface felt quite slugish. The same machine with XP works as expected. It is hard to believe for me that Linux would be any slower than XP. this is like saying a ford focus weighs less than a bmw 7-series. ubuntu does have a lot of stuff you probably don't use and google will give you tips on getting it faster. you can always just use another distro (e.g. debian). xubuntu is also supposed to be easier on resources. there are distros that specifically focus on slower hardware, too. - Is there a way to speed up Ubuntu? (drivers, other GUI ...) (:Yes, I know it is not a Lazarus specific question:) - What Linux distro's are the recommended targets for Lazarus apps? - Is there any real difference from the developers point of view? there may be some issues with different versions of the widgetset you choose to use, but i'm sure people on this list will be able to help you. henry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] DCPCrypt maintainer and patch?
2009/1/20 Graeme Geldenhuys graemeg.li...@gmail.com: Hi, I just noticed while trying to use DCPCrypt package in a fpGUI based application that the dcplazarus.lpk pulls in the LCL package. So even though you can use Lazarus to write non-LCL applications, you can't use DCPCrypt Lazarus Package as such. Yes, we promote the LCL in every possible way, even by lock in. The solution is simple. Create 2 lazarus packages. One package (dcp.lpk) contains only DCPCrypt units. The second package, dcplazarus.lpk, contains the dcpreg.pas unit that registers DCP with Lazarus IDE. Only the latter package requires LCL dependency. Could anybody make that change in the downloadable DCPCrypt from Lazarus CCR site? Otherwise, how do I submit a patch for the Lazarus CCR site? You can send me a new zip (with a new version number) and update http://wiki.lazarus.freepascal.org/DCPcrypt. Also, couldn't dcpcrypt become part of FCL packages? I noticed there is already a Blowfish unit in FCL-Base directory. That kind of questions should be asked on the fpc-pascal mailing list. Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] DCPCrypt maintainer and patch?
On Tue, Jan 20, 2009 at 3:24 PM, Vincent Snijders vincent.snijd...@gmail.com wrote: Yes, we promote the LCL in every possible way, even by lock in. :-) Nice tactics! You can send me a new zip (with a new version number) and update http://wiki.lazarus.freepascal.org/DCPcrypt. Expect an email in a short while. Thanks Vincent. That kind of questions should be asked on the fpc-pascal mailing list. OK, I posted the question there. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linux
Specifying exactly what parts are slow could help us identify it. What is your PC's Specs? Ubuntu 8.1 is a newer OS by about 7 years to XP ( http://en.wikipedia.org/wiki/Windows_xp), so it might have some underlying assumptions about your hardware. It could be that you have a high-end graphics card, and don't have decent drivers. Also ubuntu are now starting to use a fair bit of transparency, and other special 2d graphics (warping, flying in windows etc.) On Tue, Jan 20, 2009 at 3:02 PM, Henry Vermaak henry.verm...@gmail.comwrote: 2009/1/20 c...@freemail.hu: Hello, I have never used Linux before, but it is becoming an important development target platform for us now. After installing Ubuntu 8.1 with gnome desktop I was quite surprised that the user interface felt quite slugish. The same machine with XP works as expected. It is hard to believe for me that Linux would be any slower than XP. this is like saying a ford focus weighs less than a bmw 7-series. ubuntu does have a lot of stuff you probably don't use and google will give you tips on getting it faster. you can always just use another distro (e.g. debian). xubuntu is also supposed to be easier on resources. there are distros that specifically focus on slower hardware, too. - Is there a way to speed up Ubuntu? (drivers, other GUI ...) (:Yes, I know it is not a Lazarus specific question:) - What Linux distro's are the recommended targets for Lazarus apps? - Is there any real difference from the developers point of view? there may be some issues with different versions of the widgetset you choose to use, but i'm sure people on this list will be able to help you. henry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus -- o__ ,_./ _ (_)_\(_)___ ...speed is good ___ I believe five out of four people have a problem with fractions. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] DCPCrypt maintainer and patch?
On Tue, Jan 20, 2009 at 02:24:16PM +0100, Vincent Snijders wrote: Also, couldn't dcpcrypt become part of FCL packages? I noticed there is already a Blowfish unit in FCL-Base directory. That kind of questions should be asked on the fpc-pascal mailing list. fpc-devel might be better (in the future, since G. already posted) ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linux
Am Dienstag, 20. Januar 2009 13:29:45 schrieb c...@freemail.hu: - Is there a way to speed up Ubuntu? (drivers, other GUI ...) right driver for the Graphiccard? What Linux distro's are the recommended targets for Lazarus apps? deb-based (Debian,Ubuntu etc) rpm-based (Red Hat,Suse etc) http://distrowatch.com/ Is there any real difference from the developers point of view? the packaging ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] is it me or a bug that i ve been fighting?
Joost van der Sluis wrote: Op maandag 19-01-2009 om 18:29 uur [tijdzone -0500], schreef waldo kitty: it works out that MySQLConnection.Close is TCustomConnection.Close but if i hover the mouse over Close in Procedure Close; in the public section of the TCustomConnection definition stuffs, the editor wants to point to the textfile close routine Close(var t:Text); which definitely isn't the same thing :( You can find the code in the fpc-code-dir under packages/fcl-db/src/base/database.inc. What primarily happens is that doDisConnect is called. hummm... ok... and with all of the searching i've done, i still don't see anything that indicates where i can actually lay eyes on the code for TCustomConnection.Close nor do i see anything indicating that it is assigned to another routine going by another name :? Take a look at TDatabase.DoDisconnect in the same file. It first closes all queries which are linked to this dataset, and thereafter it closes all transactions. ok... well, the query is closed by my code after the variables are loaded with the data... then we attempt to close the connection via a routine that all will use to close the connection... this routine does two things... transaction.active := false; connection.close; is it enough to set transaction.active:=false? i note there's no transaction.close... in any case, the error pops up when the connection.close is called... so, i'd say that, yes, i've closed the query and the transaction before attempting to close the connection... also, could it be that because i'm not using a datasource that is causing the problem? So try to close those yourself before you close the database-connection. See where it goes wrong... by the above, i am, aren't i?... in fact, here's code... MySQLConnection: TMySQL50Connection; CompanyDataSQLQuery: TSQLQuery; SQLTransaction: TSQLTransaction; the CompanyEdit_co_* fields are all TEdits... procedure TkimsForm.LoadCompanyData(Sender: TObject); begin if MySQLConnection.Connected then begin ShowStatus('Connected #1'); CloseConnection(Sender); end; if not MySQLConnection.Connected then ShowStatus('NOT Connected #1'); MySQLConnection.DatabaseName := 'foo'; MySQLConnection.HostName := 'bar'; MySQLConnection.Password := 'fubar'; MySQLConnection.UserName := 'snafu'; ShowStatus('Connecting to database ' + MySQLConnection.DatabaseName + '...'); MySQLConnection.Open; // If we're connected, retrieve our company info if MySQLConnection.Connected then begin ShowStatus('Connected'); ShowStatus('Opening query...'); CompanyDataSQLQuery.Open; if CompanyDataSQLQuery.Active then begin CompanyDataSQLQuery.First; ShowStatus('Query ACTIVE and at first record...'); while not CompanyDataSQLQuery.EOF do begin ShowStatus('Loading data from row...'); CompanyEdit_co_name.text := CompanyDataSQLQuery.FieldByName('co_name').AsString; CompanyEdit_co_address1.text := CompanyDataSQLQuery.FieldByName('co_address1').AsString; CompanyEdit_co_address2.text := CompanyDataSQLQuery.FieldByName('co_address2').AsString; CompanyEdit_co_city.text := CompanyDataSQLQuery.FieldByName('co_city').AsString; CompanyEdit_co_state.text := CompanyDataSQLQuery.FieldByName('co_state').AsString; CompanyEdit_co_postal.text := CompanyDataSQLQuery.FieldByName('co_postal').AsString; CompanyEdit_co_phone.text := CompanyDataSQLQuery.FieldByName('co_phone').AsString; CompanyEdit_co_fax.text := CompanyDataSQLQuery.FieldByName('co_fax').AsString; CompanyEdit_co_contact.text := CompanyDataSQLQuery.FieldByName('co_contact').AsString; CompanyEdit_co_taxpercent.text := CompanyDataSQLQuery.FieldByName('co_taxpercent').AsString; CompanyEdit_co_commission_rate1.text := CompanyDataSQLQuery.FieldByName('co_commission_rate1').AsString; CompanyEdit_co_commission_rate2.text := CompanyDataSQLQuery.FieldByName('co_commission_rate2').AsString; CompanyEdit_co_commission_percent1.text := CompanyDataSQLQuery.FieldByName('co_commission_percent1').AsString; CompanyEdit_co_commission_percent2.text := CompanyDataSQLQuery.FieldByName('co_commission_percent2').AsString; CompanyDataSQLQuery.Next; end; ShowStatus('Closing query...'); CompanyDataSQLQuery.Close; end; if not CompanyDataSQLQuery.Active then ShowStatus('Query NOT ACTIVE'); end; if MySQLConnection.Connected then begin ShowStatus('Connected #2'); CloseConnection(Sender); end; if not MySQLConnection.Connected then ShowStatus('NOT Connected #2'); end; procedure TkimsForm.CloseConnection(Sender: TObject); begin // The SQLTransaction gets activated automatically, but before we can close // the connection we have to set the SQLTransaction.Active to false. if SQLTransaction.Active
Re: [Lazarus] is it me or a bug that i ve been fighting?
waldo kitty wrote: procedure TkimsForm.CloseConnection(Sender: TObject); begin // The SQLTransaction gets activated automatically, but before we can close // the connection we have to set the SQLTransaction.Active to false. if SQLTransaction.Active then begin ShowStatus('Deactivating SQLTransaction...'); SQLTransaction.Active := False; SQLTransaction. end; whoops... the SQLTransaction. line is not supposed to be there... i had placed it while looking to see if there was a SQLTransaction.Close option and forgot to remove it before copy'n'paste to the message :? -- NOTE: NEW EMAIL ADDRESS!! _\/ (@@) Waldo Kitty, Waldo's Place USA __ooO_( )_Ooo_ telnet://bbs.wpusa.dynip.com _|_|_|_|_|_|_ http://www.wpusa.dynip.com |_|_|_|_|_| ftp://ftp.wpusa.dynip.com _|_Eat_SPAM_to_email_me!_YUM!__|_ wkitty42 -at- windstream.net --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 090120-0, 01/20/2009 Tested on: 1/20/09 15:42:58 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linux
c...@freemail.hu schrieb: I have never used Linux before, but it is becoming an important development target platform for us now. After installing Ubuntu 8.1 with gnome desktop I was quite surprised that the user interface felt quite slugish. The same machine with XP works as expected. It is hard to believe for me that Linux would be any slower than XP. Most machines ship with special Windows drivers, starting from the chipset and reaching to the graphics card. Actually I cannot make work properly an XP from a distribution for a different machine, lacking the appropriate drivers for the new machine. The new machine only comes with Vista drivers, support even for other Windows versions is poor to non existent. The same for Linux distros, which may not include the machine specific drivers. I found XP very hardware dependent, since I've had to replace the graphics card on an older machine - XP now fails to start even in safe or VGA mode. A W2K installation on the same machine had no problems to switch to the new hardware. - Is there a way to speed up Ubuntu? (drivers, other GUI ...) (:Yes, I know it is not a Lazarus specific question:) You should make sure that all required drivers are available for your favorite system, *before* buying a new machine. Lazarus cannot make the OS work faster ;-) Or you install the host system, as shipped with the machine, and run other systems in virtual machines. Then you can find out how other systems behave on your machine, without hardware dependencies. You also have a chance to e.g. test your applications on different target systems. I create a new VM for every major software project, so that I can save and restore the project together with the entire environment. No more problems with multiple FPC/Lazarus or Delphi versions, when each development system is installed in a dedicated VM :-) DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] is it me or a bug that i ve been fighting?
Mattias Gärtner wrote: Move editor cursor over 'procedure Close;' of TCustomConnection and press Ctrl+Shift+Down. ahhh, that's one i hadn't discovered... i did figure out the CTRL-Click thing when i had the CTRL pressed inadvertently while hovering over an item and saw that it changed to a link :P so, following along a slightly different path (DoDisconnect pointed to by Joost), i've come to the following in database.inc... procedure TDatabase.DoDisconnect; begin Closedatasets; Closetransactions; DoInternalDisConnect; if csloading in ComponentState then FOpenAfterRead := false; FConnected := False; end; Closedatasets, Closetransactions, and DoInternalDisConnect are all pointed as being in db.pas and the first two, Closedatasets and Closetransactions both come to code blocks with CTRL-Shift-Down but DoInternalDisConnect does not :? it is defined in db.pas as Procedure DoInternalDisConnect; Virtual;Abstract; and the IDE doesn't want to show me anything about it when i hover over it so now i don't know where to look further :( on a whim, i went tromping about and have found an empty DoInternalDisConnect routine in packages/fcl-db/src/sqldb/sqldb.pp procedure TSQLConnection.DoInternalDisconnect; begin end; and another in packages/fcl-db/src/sqldb/mysql/mysqlconn.inc procedure TConnectionName.DoInternalDisconnect; begin inherited DoInternalDisconnect; mysql_close(FMySQL); FMySQL:=Nil; ReleaseMysql; end; which would seem to want to take me to ReleaseMysql from packages/mysql/src/mysql.inc... perhaps i have the wrong idea about database apps?? in all of my coding years, the only time i've ever maintained an open connection to the database was way back in my days as a dBaseIII/dBaseIV coder working with relational databases... this was before and just as SQL stuffs started coming along... heck, what we call tables today were called databases back then ;) with that in mind, should i be maintaining a connection to the mysql database the whole time my app is running and only close it when i close my app? what about for situations where the database server may not allow persistent connections and may close the connection after some minutes? FWIW: this will be a relational type database app in that there is projected to be 4 other tables beside the company data table... three of those tables will be related into the 4th by unique (to each of the 3 tables) id numbers in three different columns of the 4th table... yeah, for those who are quick on the draw, the 4th table is for sales made by each employee (one table) to each customer (another table) for each inventory item (the 3rd table)... and all this just to be able to get to the point of implementing the custom math to calculate the final sale price, tax and employee commission for the sale... call it an exercise in reinventing the wheel, eh? :P -- NOTE: NEW EMAIL ADDRESS!! _\/ (@@) Waldo Kitty, Waldo's Place USA __ooO_( )_Ooo_ telnet://bbs.wpusa.dynip.com _|_|_|_|_|_|_ http://www.wpusa.dynip.com |_|_|_|_|_| ftp://ftp.wpusa.dynip.com _|_Eat_SPAM_to_email_me!_YUM!__|_ wkitty42 -at- windstream.net --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 090120-0, 01/20/2009 Tested on: 1/20/09 17:13:17 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linux
After installing Ubuntu 8.1 with gnome desktop I was quite surprised that the user interface felt quite slugish. Odd, I've built several Ubuntu systems from 7.10 and 8.04 and 8.10 and I've been happy with the speed. Three of the systems are Mythtv boxes and they do a fine job of HDTV. - Is there a way to speed up Ubuntu? Are we talking graphics being too slow? Does the system have an ATI or NVidia graphics card? If so you may want to try the ATI or NVidia drivers for your machine. Google ubuntu envy script and read Alberto's page. Go to synaptic and add the envy script. Run it. Good luck. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Peter Williams wants to chat
--- Peter Williams wants to stay in better touch using some of Google's coolest new products. If you already have Google Mail or Google Talk, visit: http://mail.google.com/mail/b-fed1edcfda-f157580a56-dfc8b499f696e158 You'll need to click this link to be able to chat with Peter Williams. To get Google Mail - a free email account from Google with over 2,800 megabytes of storage - and chat with Peter Williams, visit: http://mail.google.com/mail/a-fed1edcfda-f157580a56-7fc89dc420 Google Mail offers: - Instant messaging right inside Google Mail - Powerful spam protection - Built-in search for finding your messages and a helpful way of organising emails into conversations - No pop-up ads or untargeted banners - just text ads and related information that are relevant to the content of your messages All this, and it's yours for free. But wait, there's more! By opening a Google Mail account, you also get access to Google Talk, Google's instant messaging service: http://www.google.com/talk/intl/en-GB/ Google Talk offers: - Web-based chat that you can use anywhere, without a download - A contact list that's synchronised with your Google Mail account - Free, high quality PC-to-PC voice calls when you download the Google Talk client Google Mail and Google Talk are still in beta. We're working hard to add new features and make improvements, so we might also ask for your comments and suggestions periodically. We appreciate your help in making our products even better! Thank you, The Google Team To learn more about Google Mail and Google Talk, visit: http://mail.google.com/mail/help/intl/en_GB/about.html http://www.google.com/talk/intl/en-GB/about.html (If clicking the URLs in this message does not work, copy and paste them into the address bar of your browser). ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus