[lazarus] SQLite 3 datetime and timestamp
Hi all! two things: 1) a (possible) improvement to sqlite3ds; 2) the old problem with dates and time 1) I found a sqlite database that uses the TIMESTAMP data type, but this is not directly supported by the Tsqlite3Dataset written by Luiz. I added the if-else checks in sqlite3ds.pas for this type, which refers to ftTimestamp of TFieldType in db.pas. And I also added db.DefaultFieldClasses[ftTimeStamp] := TDateTimeField at run-time, because in db.pas it is defined as nil (and I didn't want to recompile it). So, now my app can understand a timestamp field as a TDateTime instead of a string... 2)and here comes the problem! The code: var d: TDateTime; .. d := database.FieldByName('birthday').asDateTime; ... will always store the zero date: 30 Dec 1899 why ? Being urgent, at the moment I am reading the dates as strings by using the date or datetime function of SQLite in the query, i.e.: SELECT date(birthday) AS string_birthday FROM people; and then parsing them with the powerful functions in the freepascal RTL, but I would like to understand this once for all. Can anyone help ? Thanks !! R# _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Serial Comm Support Windows
Florian Klaempfl wrote: May I add this to the rtl? Luis Hilario modified FPC's Unix serial.pp unit for use under windows (which I have not tested). You can refer to the following post: http://www.mail-archive.com/lazarus@miraclec.com/msg15211.html I presume it would fall under FPC's modified LGPL. But I will email him anyway to get his approval. His post mentions 2 additional issues: 1- SerOpen return value of 0 or -1 in case of error. 2- Unix/termios and Windows/DCB structures are different. Maybe a common structure should be used to have cross-platform support? Stephano _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Serial Comm Support Windows
Jeff Steinkamp wrote: I do not think that will be a problem, although I was not the one who posted that link. After looking at the content of the file, it look quite similar to the serial.pas using I use with windows on Delphi. Do you mean it is tainted code? _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] SQLite 3 datetime and timestamp
Hi all! two things: 1) a (possible) improvement to sqlite3ds; 2) the old problem with dates and time 1) I found a sqlite database that uses the TIMESTAMP data type, but this is not directly supported by the Tsqlite3Dataset written by Luiz. I added the if-else checks in sqlite3ds.pas for this type, which refers to ftTimestamp of TFieldType in db.pas. And I also added db.DefaultFieldClasses[ftTimeStamp] := TDateTimeField at run-time, because in db.pas it is defined as nil (and I didn't want to recompile it). So, now my app can understand a timestamp field as a TDateTime instead of a string... 2)and here comes the problem! The code: var d: TDateTime; .. d := database.FieldByName('birthday').asDateTime; ... will always store the zero date: 30 Dec 1899 why ? Being urgent, at the moment I am reading the dates as strings by using the date or datetime function of SQLite in the query, i.e.: SELECT date(birthday) AS string_birthday FROM people; and then parsing them with the powerful functions in the freepascal RTL, but I would like to understand this once for all. Can anyone help ? Thanks !! R# _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon TMemo with invisible font
On Nov 18, 2007 8:00 PM, James Chandler Jr [EMAIL PROTECTED] wrote: Hi Tom You do great work! Here is a symptom which might be related (or not). Am only mentioning it because this also had an invisible font issue. Am busy in Win32 right now, and will trace the issue further (if it still exists) when I can get back to carbon in a few weeks. I had four TPaintBoxes in a TPanel, which are graphic views for an audio wave display, a location timestrip, a chord strip, and a piano-roll note strip. Not all paintboxes are erased to the same background color at the start of their OnPaint procs. The drawing in all paintboxes is a mixture of lines, rectangles, and text, of various colors. Some Text drawing used transparent mode, and some did not. This multiple TPaintBox in a TPanel would draw correctly in Win32. On Carbon, it appeared that PaintBox canvas properties were somehow 'leaking' into the parent TPanel canvas, and affecting other TPaintBox OnPaints. The symptom was that some text would draw with the canvas background color (of some other paintbox) rather than the current paintbox Font color. This happened even if I would explicitly set TFont properties before each and every TextOut, in each OnPaint proc. If the background of all the TPaintBoxes had been the same, it would have been completely invisible text. But since the background of the most problematic paintbox was clButtonFace, and some other TPaintBoxes had a clWhite background, I was getting white-on-gray text, rather than the desired black-on-gray text. It may have had something to do with the transparent property leaking between canvases. Dunno. I 'fixed' it on the carbon target, by calling Application.processmessages between each of the TCanvas OnPaint procedures. I think this was flushing the screen after each OnPaint and avoiding transparency or some other property from 'leaking' between canvases. But the gratuitous calling of ProcessMessages slows donw the screen update, so it is just a temporary hack. When I can get back to carbon, will send a bug report with example, if the issue remains. Tobias' reported issue seemed similar, I just thought this example might be related. Here is another 'invisible text' issue-- The default size of Win32 TLabel seems vertically smaller by a pixel or two, than the text rectangle which Carbon likes to draw into. If the TLabel has a default background color and font color, it draws the TLabel correctly in spite of the size discrepancy. In that mode, apparently a TLabel is able to 'overdraw' the control bounds and successfully put un-clipped text onscreen. But for instance if the TLabel Color is black, and the TLabel Font color is green (any non-default color combination would probably show the same bug), then all you get is a black square with no text, if the TLabel is not tall enough to fully contain the text. The fix for that issue was to make the TLabel a few pixels taller than the default size for Win32, and then it draws green on black just fine. That is a minor issue. It may be that carbon refuses to draw any text at all in certain modes, if the destination rectangle isn't tall enough. So there may not be a realistic fix. Perhaps if a fix was attempted, it would involve automatically growing the TLabel (or shrinking the TFont) if the Label is too small to contain the text. It is just that such minor issues take time to diagnose/fix, and makes the thing a little less 'cross platform'. But since carbon likes to draw controls more 'spread out' than Win32, it might be that manual form re-spacing is unavoidable labor when moving code from Win32 to carbon. The minor labor of re-spacing a form is so much less than 'writing from scratch' when moving between platforms. jcjr Hi, sorry that I have found some time for this issue so late. I have tested it with latest SVN and I was unable to reproduce those problems you have reported. Please retest them and if they persist report them into bug tracker, optimally upload sample application and screenshots. Don't forget to add OS version. Thanks, Tom _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Fatal: Can't find unit *** used by Lazarus when build lazarus with my own package
The ide do not insert the new packages and units (in project file) automatically. I have to go in project inspector and add packages manually. Sorry my english. Em Dom, 2007-12-02 às 01:02 +0100, Mattias Gaertner escreveu: On Thu, 29 Nov 2007 16:13:18 +0300 Andrey Gusev [EMAIL PROTECTED] wrote: I have tried to install my own Component's package, which use (also myown) runtime package: Lazarus - lazCal(TCalendarGraphic component) - BllCore(runtime support). At lazarus building i got BllCore.pas(74,12) Fatal: Can't find unit Bllcore used by Lazarus. In which path (from many tunables in lazarus) i must prescript BllCore's units directory. BllCore, BllMath (also used by lazCal), lazCal packages was all compiled (separately) succesfully. Has this been fixed? Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Serial Comm Support Windows
- Original Message - From: Stephano [EMAIL PROTECTED] To: lazarus@miraclec.com Sent: Sunday, December 02, 2007 05:11 Subject: Re: [lazarus] Serial Comm Support Windows Jeff Steinkamp wrote: I do not think that will be a problem, although I was not the one who posted that link. After looking at the content of the file, it look quite similar to the serial.pas using I use with windows on Delphi. Do you mean it is tainted code? _ No it's not tainted. It is similar to the unit I use, which has been around for many years and was released into the public domain back around Delphi 2 or 3. Jeff _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] Drawing a spiral
Hi, How do I change this code to draw a spiral using the standard Canvas.LineTo that only takes Integer X Y co-ordinates? I did it before, but for the live of me I can't get it right now! :-) eg: Draw(100, 100); procedure TForm1.Draw(X, Y: Integer); var Theta: Single; begin Theta := 0; Image.Bitmap.MoveToF(X, Y); while Theta 15 * 3.1415926535 do begin Image.Bitmap.LineToFSP(X + Cos(Theta) * Theta, Y + Sin(Theta) * Theta); Theta := Theta + 0.2; end; end; Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Drawing a spiral
How do I change this code to draw a spiral using the standard Canvas.LineTo that only takes Integer X Y co-ordinates? I did it before, but for the live of me I can't get it right now! :-) [CUT] I don't know how to help you, Graeme, but maybe this link can be useful for you (even if I think you alreayd got it): http://www.efg2.com/Lab/Library/Delphi/Graphics/Math.htm Antonio -- Antonio Sanguigni alias slapshot -- GioveLUG (Linux User Group) - http://www.giovelug.org Edupup (Educational distro) - http://www.edupup.org
Re: [lazarus] Drawing a spiral
Graeme Geldenhuys wrote: Hi, How do I change this code to draw a spiral using the standard Canvas.LineTo that only takes Integer X Y co-ordinates? I did it before, but for the live of me I can't get it right now! :-) eg: Draw(100, 100); procedure TForm1.Draw(X, Y: Integer); var Theta: Single; begin Theta := 0; Image.Bitmap.MoveToF(X, Y); while Theta 15 * 3.1415926535 do begin Image.Bitmap.LineToFSP(X + Cos(Theta) * Theta, Y + Sin(Theta) * Theta); Bitmap.Canvas.LineTo( Round(X + Cos(Theta) * Theta), Round(Y + Sin(Theta) * Theta) ): (or do I miss something here ?) No that you only get a spiral with max radius = 15 here. If yo want to draw it in a 100x100 box, with x,y as center: Bitmap.Canvas.LineTo( Round(X + Cos(Theta) * Theta * 50 / 15), Round(Y + Sin(Theta) * Theta * 50 / 15) ): Marc _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Drawing a spiral
Hi Marc, I'm trying to duplicate what Felipe did months ago with Graphics32. See attached image. I have now implemented Wu's anti-aliased line drawing algorithm in fpGUI and wanted to recreate that example. :-) My spirals seem to be way to big or lob sided (one side expands more than the other). I'll try what you said and report back. Thanks, - Graeme - On 02/12/2007, Marc Weustink [EMAIL PROTECTED] wrote: Bitmap.Canvas.LineTo( Round(X + Cos(Theta) * Theta), Round(Y + Sin(Theta) * Theta) ): (or do I miss something here ?) No that you only get a spiral with max radius = 15 here. If yo want to draw it in a 100x100 box, with x,y as center: Bitmap.Canvas.LineTo( Round(X + Cos(Theta) * Theta * 50 / 15), Round(Y + Sin(Theta) * Theta * 50 / 15) ): Marc attachment: Screenshot_3.png
Re: [lazarus] Re: Lazarus-0.9.24: SIGSEGV in TOpenDialog
Marco Alvarado wrote: So, is there any other option appart from DebugLn(), that works? AFAIK not. Marc Regards! -Marco 2007/12/1, Marc Weustink [EMAIL PROTECTED]: Marco Alvarado wrote: It's a Win32 API function: http://msdn2.microsoft.com/en-us/library/aa363362.aspx Outputs a string to the debugger. Lazarus is able to catch those messages, although the output in Lazarus is pretty dirty, and is somehow difficult to read. Correction, lazarus does not catch that output. It's gdb which does. Lazarus doesn't intrepret these mesages, so you will find them among other debugger output. I don't call this support, it just happens to be there. I supposed DebugLn would work the same way, Nope, it is a replacement for writeln, for cases where there is no stdout. but no :( Hope someday DebugLn will be connected to the debbuger. It won't. And since I cannot destinct gdb output from console output, there is no way to show the output on the console (like debugln output). Marc _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Fatal: Can't find unit *** used by Lazarus when build lazarus with my own package
On Sun, 02 Dec 2007 11:17:58 -0300 Osvaldo TC Filho [EMAIL PROTECTED] wrote: The ide do not insert the new packages and units (in project file) automatically. I have to go in project inspector and add packages manually. The IDE adds the package when you add one of its components to a form of the project. What other automatism do you have in mind? Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Fatal: Can't find unit *** used by Lazarus when build lazarus with my own package
* Mattias Gaertner [EMAIL PROTECTED] [Sun, 2 Dec 2007 01:02:48 +0100]: On Thu, 29 Nov 2007 16:13:18 +0300 Andrey Gusev [EMAIL PROTECTED] wrote: I have tried to install my own Component's package, which use (also myown) runtime package: Lazarus - lazCal(TCalendarGraphic component) - BllCore(runtime support). At lazarus building i got BllCore.pas(74,12) Fatal: Can't find unit Bllcore used by Lazarus. In which path (from many tunables in lazarus) i must prescript BllCore's units directory. BllCore, BllMath (also used by lazCal), lazCal packages was all compiled (separately) succesfully. Has this been fixed? See #10310 ussue. It has solved by distibution BllCore and BllMath packages to two different his owned directories - that Vincent Snijders hint. After this action, lazarus have compiled cleanly, and all three packages (lazCal,BllMath,BllCore) have installed and functional. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Fatal: Can't find unit *** used by Lazarus when build lazarus with my own package
On Mon, 03 Dec 2007 01:30:48 +0300 Andrey Gusev [EMAIL PROTECTED] wrote: * Mattias Gaertner [EMAIL PROTECTED] [Sun, 2 Dec 2007 01:02:48 +0100]: On Thu, 29 Nov 2007 16:13:18 +0300 Andrey Gusev [EMAIL PROTECTED] wrote: I have tried to install my own Component's package, which use (also myown) runtime package: Lazarus - lazCal(TCalendarGraphic component) - BllCore(runtime support). At lazarus building i got BllCore.pas(74,12) Fatal: Can't find unit Bllcore used by Lazarus. In which path (from many tunables in lazarus) i must prescript BllCore's units directory. BllCore, BllMath (also used by lazCal), lazCal packages was all compiled (separately) succesfully. Has this been fixed? See #10310 ussue. It has solved by distibution BllCore and BllMath packages to two different his owned directories - that Vincent Snijders hint. After this action, lazarus have compiled cleanly, and all three packages (lazCal,BllMath,BllCore) have installed and functional. Ah, I see. It is on my todo list to add a check if packages overlap. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Docking
On Sun, 02 Dec 2007 02:56:04 +0100 huisvuil [EMAIL PROTECTED] wrote: While developing i noticed i'm looking frequently for lost windows like the search results and i end up resizing ad moving the editor window to get back to the window. So i started looking for docking and i found an anchordocking example but couldn't get that to work (or didn't understand how it worked). Later, i came across the following docking panel from the Open Perl IDE released under MPL license. It has been written in object pascal and it contains a dockingpanel.pas, that has been ported into the the examples i found on torry. I have no idea how this docking compares to the one used in the samples. Open Perl IDE: http://open-perl-ide.sourceforge.net/ Ported + examples (including compiled demo): http://www.torry.net/pages.php?s=79 (DockPanel Professional v.3.1) Would this be a usable/reliable docking mechanisme for Lazarus? (Its not really a big issue, but i do truely miss window docking) I just took a quick look: - It does not work with TForm, but only with the TDockPanel descendants. - It does not compile with LCL, because of missing IDockManager. Probably some more things are missing. So I was not able to test it. Maybe you can describe what it can, what not under Delphi? Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] Movable Tabs on Code Editor
First, nice job on the new features of code templates in 0.9.24. I was also wondering if there were any plans to add the ability to move the tabs around on the code editor. Sometimes its very convenient to have to related files open with the tabs next to each other. And not to be greedy, but a Close All Other Tabs item on the short cut menu for tabs would be very nice as well. All in all however, very nice work on the IDE. I can see why some people are switching to Lazarus/Freepascal exclusively for OP programming. -- Warm Regards, Lee My wife is better at Guitar Hero than I am and it's really irritating. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] SQLite 3 datetime and timestamp
Roberto Padovani wrote: Hi all! two things: 1) a (possible) improvement to sqlite3ds; 2) the old problem with dates and time 1) I found a sqlite database that uses the TIMESTAMP data type, but this is not directly supported by the Tsqlite3Dataset written by Luiz. I added the if-else checks in sqlite3ds.pas for this type, which refers to ftTimestamp of TFieldType in db.pas. And I also added db.DefaultFieldClasses[ftTimeStamp] := TDateTimeField at run-time, because in db.pas it is defined as nil (and I didn't want to recompile it). So, now my app can understand a timestamp field as a TDateTime instead of a string... 2)and here comes the problem! The code: var d: TDateTime; .. d := database.FieldByName('birthday').asDateTime; ... will always store the zero date: 30 Dec 1899 why ? It's necessary to see the changes you made. To add a new type is necessary to modify InternalInitFieldDefs, GetFieldData and SetFieldData Being urgent, at the moment I am reading the dates as strings by using the date or datetime function of SQLite in the query, i.e.: SELECT date(birthday) AS string_birthday FROM people; and then parsing them with the powerful functions in the freepascal RTL, but I would like to understand this once for all. Here's how sqlite works (for good and bad): - You can create tables with any field type: TIMESTAMP, TIME_STAMP, QWERTY etc - In any of this field type you can store anything: a integer, a float, a string Many sqlite managers make assumptions (each one create its own convention). Examples: BOOLEAN will store TRUE or FALSE strings, DATE will store 02-12-2007. This is completely random. So program X can store DATE as 02-12-2007 but program Y will store as 02/12/2007. The program Z, worried with memory stores as 02122007 but program W is more smart so will store as 021207. Supporting these conventions it would lead to code bloat and performance issues and someone would always ask hey my DATE format is not supported, please do it. In other words, sqliteds, as it was designed, has the objective of add a way to fpc programs to use sqlite as a database backend. So it does. It was not designed for access data files created with other managers or frameworks. See as a balance between feature and code size/performance. Any design taken has advantages and disadvantages. In the sqliteds case, the decision was to trend to code simplicity, privilege the most common cases in detriment of not so common. If you come until here, don't be pessimist. Some solutions: - Don't forget is open source. You can modify to fill your needs. I can help with this. Send what you already did. - If you don't want to modify sqliteds file directly you can write descendants. - Try sqlitepass and sqldb/sqlite3. I vaguely remenber of sqlitepass to support timestamp. I don't know about sqldb. - If you just want to import the data of a strange db file (you won't need to access directly this file all time) than convert to the sqliteds format (Double). I already started a program that does this but not finished. I can also help you. Luiz _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Fatal: Can't find unit *** used by Lazarus when build lazarus with my own package
- Original Message - From: Mattias Gaertner [EMAIL PROTECTED] To: lazarus@miraclec.com Sent: Sunday, December 02, 2007 4:29 PM Subject: Re: [lazarus] Fatal: Can't find unit *** used by Lazarus when build lazarus with my own package On Sun, 02 Dec 2007 11:17:58 -0300 Osvaldo TC Filho [EMAIL PROTECTED] wrote: The ide do not insert the new packages and units (in project file) automatically. I have to go in project inspector and add packages manually. The IDE adds the package when you add one of its components to a form of the project. Yes, but this is currently broken, see http://www.freepascal.org/mantis/view.php?id=10234 Jesus Reyes A. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Movable Tabs on Code Editor
On 03/12/2007, Lee Jenkins [EMAIL PROTECTED] wrote: I was also wondering if there were any plans to add the ability to move the tabs around on the code editor. Sometimes its very convenient to have to related files open with the tabs next to each other. That feature has been around long before 0.9.24! No, you can't drag the tabs, but if you right click in the editor window you can select Move editor left or Move editor right.:-) Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives