Re: [Lazarus] Can't enter negative values in to TFloatSpinEdit

2013-11-13 Thread zeljko

On 11/13/2013 12:14 AM, Bart wrote:

Possibly related to http://bugs.freepascal.org/view.php?id=23266 ?
If not the same, please open a bugreport on the bugtracker.


No, he is using qt ws


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Lukasz Sokol
On 12/11/13 22:52, Bart wrote:
 On 11/12/13, waldo kitty wkitt...@windstream.net wrote:
 
 you do not need any of the above if you change

  Days := (DaysPerMonth(M1, IsLeapYear(Y2)) - D1) + D2 ;

 to

Days := (DaysInAMonth(Y2,M1) - D1) + D2;

 
 I did not know about DaysInAMonth.
 I just went coding and created that function because I needed it.
 
 I can see it uses the exact kind of logic I did...
 
 outside of this, what you came up with is almost exactly what i worked my
 way
 down to as i was working on my own solution... it took me a while and then
 when
 i saw your post, i was astonished at how the mind works at times :LOL:
 
 Yes, nice.
 
 Hope anyone actually can use this.
 
 Bart
 
 --

I vote for this to be accepted into (FP)DateUtils unit.

-L.
 



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Lukasz Sokol
[snip]

All this, should be planned to use 64 bit Unix Timestamps already ;)
(year 2038 is not that long away)


-L.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread John Landmesser

On 13.11.2013 02:33, waldo kitty wrote:


actually, i have in some cases... let's ask this question and see what 
your charts and routines return as the result... assuming your format 
is DD.MM....


Date1 := 01.01.2000
Date2 := 01.01.2000

should be 0 (zero), right?

then

Date1 := 01.01.2000
Date2 := 02.01.2000

should be 1 (one), right?

in this case, what i (and bart, too) wrote, we're not counting the 
starting day but we are counting the ending day... this rule stays in 
effect throughout the entire process... my head still aches from 
rummaging about doing this... it was good exercise and one i remember 
being given on a test many years back to determine one's coding 
level... at that time, the code was being done in dBase II/III/IV ;)


i will have to dig deeper and see what is crossing things up for count 
from 29.02.2000 to 28.02.2001... i see bart has posted a fix which i 
have not yet had a chance to compare with my code or run thru the 
tests i included in my posting...


the real question is this:

  what do we count? the starting day, the ending day, both days or 
neither day?


then we have another question:

  is dayM in monthY a one month difference to dayM in monthX and
  monthZ? monthX, monthY, monthZ are any three consecutive months
  in linear order within one year or crossing two years

once the rules are chosen, then we have something to work with...



I'm just a hobbyist, never went to university to study computer science.

We don't need to invent the wheel again, because others have solutions 
for that!


Perhaps its solved in  The Art of/Computer Programming/ from Donald E. 
Knuth?


I don't have such books and i don't know if i'd have the chance to 
understand such a book?!!


Yesterday i was running windows on this PC and tried MS Visual Studio 
2008 Help.
That showed me ( - DateDiff ) a Tutorial from a MS-India guy that 
delivered code to calculate DateDiff.


I'm now running Linux but perhaps i reboot later to look again?

Bart delivered code that calculates 29.02.2000 to 28.02.2001 = 1 Year.
And that looks reasonable to me!

Bart wrote:

I would actually say that in this particular case the diff is 1 Year...
(11 M + (28 days in feb in a non-leapyear = 1M) = 12M = 1 Y.

Bart


Soon we'll have working DateDiff function and my question will be 
answered in the end!

Thanks guys!!


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread waldo kitty

On 11/13/2013 3:53 AM, Lukasz Sokol wrote:

[snip]

All this, should be planned to use 64 bit Unix Timestamps already ;)
(year 2038 is not that long away)


agreed but that is dependent on what TDateTime does since it is built on that 
like other existing time and date routines ;)


at one point i was using int64 instead of word but i got tired of having to 
continually convert because of existing routines using word... and yeah, i do 
know that they can roll over and cause problems there...


--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Digest, Vol 70, Issue 35

2013-11-13 Thread Lex Edmonds
This is my first post on this mailing list, so please bear with me.
I used to do date calculations like this in the '80s when I was writing
Real Estate software.

On Tue, 12 Nov 2013 20:33:00, waldo kitty wrote:

 [...]
 the real question is this:

what do we count? the starting day, the ending day, both days or
 neither day?


There are two types of days-between-dates calculations: Inclusive and
Exclusive.

Generally, the starting day should be considered the first day of the
calculation.

With an Inclusive calculation, the ending day is counted.
With an Exclusive calculation, the ending day is not counted -- it is
considered to be the first day of the following period.

In Real Estate for example, date calculations are Inclusive.
So a 1-week rent payment that starts on Monday 1 January 2007 ends on
Sunday 7 January 2007.
Therefore an Inclusive DateDiff calculation between 1/01/2007 and 7/01/2007
would return 7 days.
Whereas an Exclusive calculation would return 6 days.

Similarly, when calculating a person's age.
A baby born on 1/01/2007 would be 7 days old on 7/01/2007.

As I recall, Exclusive dates seem to be more applicable to financial
calculations.
For example, an Exclusive DateDiff calculation between 1/01/2007 and
1/04/2007 would return 3 months (not 3 months and 1 day).

then we have another question:

is dayM in monthY a one month difference to dayM in monthX and
monthZ? monthX, monthY, monthZ are any three consecutive months
in linear order within one year or crossing two years

 once the rules are chosen, then we have something to work with...


This is a topic that has some tricky boundary conditions.

Generally the rule is easy for days 1-27 in every month:
The Inclusive DateDiff between day M in month 1 and Day M-1 in month 2
returns 1 month.
e.g. between 28/01/2007 and 27/02/2007.

However the rules get muddy with days 28-31. i.e. the last few days of
every month.

For example, an Inclusive DateDiff calculation between 29/01/2007 and
28/02/2007 should return 1 month.
In my opinion, an Inclusive calculation
between 30/01/2007 and 28/02/2007 should also return 1 month.
And so should an Inclusive calculation between 31/01/2007 and 28/02/2007.

In fact, we used to call these calendar months to differentiate them from
other months that might always be defined as having perhaps 30 days.

So as you see, there is no real hard answer to your question. It probably
depend on what you are trying to achieve.

Lex
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread waldo kitty

On 11/13/2013 5:19 AM, John Landmesser wrote:

On 13.11.2013 02:33, waldo kitty wrote:


actually, i have in some cases... let's ask this question and see what your
charts and routines return as the result... assuming your format is 
DD.MM....

Date1 := 01.01.2000
Date2 := 01.01.2000

should be 0 (zero), right?

then

Date1 := 01.01.2000
Date2 := 02.01.2000

should be 1 (one), right?

in this case, what i (and bart, too) wrote, we're not counting the starting
day but we are counting the ending day... this rule stays in effect throughout
the entire process... my head still aches from rummaging about doing this...
it was good exercise and one i remember being given on a test many years back
to determine one's coding level... at that time, the code was being done in
dBase II/III/IV ;)

i will have to dig deeper and see what is crossing things up for count from
29.02.2000 to 28.02.2001... i see bart has posted a fix which i have not yet
had a chance to compare with my code or run thru the tests i included in my
posting...

the real question is this:

  what do we count? the starting day, the ending day, both days or neither day?

then we have another question:

  is dayM in monthY a one month difference to dayM in monthX and
  monthZ? monthX, monthY, monthZ are any three consecutive months
  in linear order within one year or crossing two years

once the rules are chosen, then we have something to work with...



I'm just a hobbyist, never went to university to study computer science.


i never went to school for any of my computer skills, either... i'm self taught 
in both hardware and software ;)



We don't need to invent the wheel again, because others have solutions for that!


then why does this thread exist? O:)


Perhaps its solved in  The Art of/Computer Programming/ from Donald E. Knuth?

I don't have such books and i don't know if i'd have the chance to understand
such a book?!!


i don't know as i do not have that book... but since you have the three routines 
available, can you please post what they return for the two cases above??


[...]

Bart delivered code that calculates 29.02.2000 to 28.02.2001 = 1 Year.
And that looks reasonable to me!


but it is not, not really... 29.02 only comes around once every four years... 
29.02.leapyear to 28.02.leapyear+1 is one day short of a year... if you were 
born on 29.02.1960, have you celebrated your birthday 13 or 53 times? :)



Bart wrote:

I would actually say that in this particular case the diff is 1 Year...
(11 M + (28 days in feb in a non-leapyear = 1M) = 12M = 1 Y.

Soon we'll have working DateDiff function and my question will be answered in
the end!
Thanks guys!!


i can, however, agree with the reasoning bart has given above... do you agree 
with it? is that what you want to see?


which of the following is what you want to see??

2000-02-29 to 2001-02-28 is0 yrs   11 mos   27 days  (original)

2000-02-29 to 2001-02-28 is0 yrs   11 mos   28 days  (bart's fix)

2000-02-29 to 2001-02-28 is1 yrs0 mos0 days  (actually desired?)



--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Local CHM help files or web based?

2013-11-13 Thread Kostas Michalopoulos
For a very simple help (f.e. for a small program or utility) you can
also use LazHelp to embed the documentation in your application:
http://badsector.github.io/lazhelp/

Note that i haven't updated for a while so it might not compile
cleanly (it does compile though). Also i'm going to move it eventually
to some other place since i'm (slowly) migrating away from Git and
GitHub to self-hosted Fossil repositories.


On Tue, Nov 12, 2013 at 2:20 PM, Richard Mace richard.m...@gmail.com wrote:
 Hi all, I'm just about to start writing help files for my application but I
 can't work out whether to use web based ones or local c h m ones any ideas
 welcome?

 Richard


 --
 ___
 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] DateDif function needed

2013-11-13 Thread John Landmesser

On 13.11.2013 14:02, waldo kitty wrote:


We don't need to invent the wheel again, because others have 
solutions for that!


then why does this thread exist? O:)


I'll try to find what the usual way is to handle these problems: c++ 
Libraries for example?!






i don't know as i do not have that book... but since you have the 
three routines available, can you please post what they return for the 
two cases above??


I don't have my test app anymore, changed it a lot last days to follow 
the discussion, but perhaps you have a look at my post from 12.11.2013,  
21:56




[...]

Bart delivered code that calculates 29.02.2000 to 28.02.2001 = 1 Year.
And that looks reasonable to me!


but it is not, not really... 29.02 only comes around once every four 
years... 29.02.leapyear to 28.02.leapyear+1 is one day short of a 
year... if you were born on 29.02.1960, have you celebrated your 
birthday 13 or 53 times? :)


That depends on the country , you're living, see 
http://en.wikipedia.org/wiki/February_29#Births





Bart wrote:

I would actually say that in this particular case the diff is 1 Year...
(11 M + (28 days in feb in a non-leapyear = 1M) = 12M = 1 Y.
Soon we'll have working DateDiff function and my question will be 
answered in

the end!
Thanks guys!!


i can, however, agree with the reasoning bart has given above... do 
you agree with it? is that what you want to see?


I'm not the one to decide, but i need a function which provides widely 
accepted results!

I'll google again.



which of the following is what you want to see??

2000-02-29 to 2001-02-28 is0 yrs   11 mos   27 days (original)

2000-02-29 to 2001-02-28 is0 yrs   11 mos   28 days  (bart's fix)

2000-02-29 to 2001-02-28 is1 yrs0 mos0 days  (actually 
desired?)






--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] write watch breakpoint to field inside object

2013-11-13 Thread Felipe Monteiro de Carvalho
Hello,

I managed to add a write watch to my variable VarA which is an
instance of a class and it works fine following instructions here:
http://wiki.freepascal.org/IDE_Window:Breakpoints

But actually I would like to watch when a field inside the class is
modified. Any way to do that? I tried setting the variable to watch as
VarA.MyField but it doesn't work =/

Is it possible somehow? I wonder how this works, will it stops at all
variables which are valled VarA? There is not enough information to
establish a particular one, I guess...

I am searching for a memory corruption, so I would like to breakpoint
when a code writes into a variable ...

thanks,
-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Lazarus 1.2RC1 Ctrl-F9 not working

2013-11-13 Thread Richard Mace
Hi All,
Running the latest RC in stock Xubutu 12.04 and Ctrl-F9 doesn't work, but
if you select compile from the menu, it works fine.

Any ides?

Richard
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread waldo kitty


NOTE: subject fixed to indicate the actual topic ;)

On 11/13/2013 6:24 AM, Lex Edmonds wrote:

This is my first post on this mailing list, so please bear with me.
I used to do date calculations like this in the '80s when I was writing Real
Estate software.

On Tue, 12 Nov 2013 20:33:00, waldo kitty wrote:

[...]

   the real question is this:

   what do we count? the starting day, the ending day, both days or neither
   day?



There are two types of days-between-dates calculations: Inclusive and Exclusive.

Generally, the starting day should be considered the first day of the 
calculation.

With an Inclusive calculation, the ending day is counted.
With an Exclusive calculation, the ending day is not counted -- it is considered
to be the first day of the following period.


agreed and as you note later, two different types of the base... either true 
interval or calendar interval...



In Real Estate for example, date calculations are Inclusive.
So a 1-week rent payment that starts on Monday 1 January 2007 ends on Sunday 7
January 2007.
Therefore an Inclusive DateDiff calculation between 1/01/2007 and 7/01/2007
would return 7 days.
Whereas an Exclusive calculation would return 6 days.


agreed...


Similarly, when calculating a person's age.
A baby born on 1/01/2007 would be 7 days old on 7/01/2007.


true :)


   then we have another question:

   is dayM in monthY a one month difference to dayM in monthX and
   monthZ? monthX, monthY, monthZ are any three consecutive months
   in linear order within one year or crossing two years

   once the rules are chosen, then we have something to work with...



This is a topic that has some tricky boundary conditions.


the boundaries are what we are trying to determine ;)


Generally the rule is easy for days 1-27 in every month:
The Inclusive DateDiff between day M in month 1 and Day M-1 in month 2 returns 1
month.
e.g. between 28/01/2007 and 27/02/2007.


yes...


However the rules get muddy with days 28-31. i.e. the last few days of every
month.


yes... in calendar counting, a full month is recorded when DoM1 = EoM2


For example, an Inclusive DateDiff calculation between 29/01/2007 and 28/02/2007
should return 1 month.
In my opinion, an Inclusive calculation between 30/01/2007 and 28/02/2007 should
also return 1 month.
And so should an Inclusive calculation between 31/01/2007 and 28/02/2007.


openOffice 4 seems to agree with you when using calendar counting ;)

the first 12 are leapyear and the last six are non-leapyear...

Start   End DaysMonths   Months
(interval)   (calendar)
2000-01-27  2000-02-28  32  11
2000-01-28  2000-02-28  31  11
2000-01-29  2000-02-28  30  01
2000-01-30  2000-02-28  29  01
2000-01-31  2000-02-28  28  01
2000-02-01  2000-02-28  27  00

2000-01-27  2000-02-29  33  11
2000-01-28  2000-02-29  32  11
2000-01-29  2000-02-29  31  11
2000-01-30  2000-02-29  30  01
2000-01-31  2000-02-29  29  01
2000-02-01  2000-02-29  28  00

2001-01-27  2001-02-28  32  11
2001-01-28  2001-02-28  31  11
2001-01-29  2001-02-28  30  01
2001-01-30  2001-02-28  29  01
2001-01-31  2001-02-28  28  01
2001-02-01  2001-02-28  27  00



In fact, we used to call these calendar months to differentiate them from
other months that might always be defined as having perhaps 30 days.

So as you see, there is no real hard answer to your question. It probably depend
on what you are trying to achieve.


i think that the existing routines are two variations on interval (inclusive 
and exclusive) and this discussion is about getting calendar routines in 
place... so far we seem to have something close to a working 
CalendarDateDiff(D1,D2: TDateTime) :)



--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus 1.2RC1 Ctrl-F9 not working

2013-11-13 Thread Mattias Gaertner
On Wed, 13 Nov 2013 15:05:20 +
Richard Mace richard.m...@gmail.com wrote:

 Hi All,
 Running the latest RC in stock Xubutu 12.04 and Ctrl-F9 doesn't work, but
 if you select compile from the menu, it works fine.
 
 Any ides?

Check your short cuts in your system settings. They take precedence
over any normal application like the IDE.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] write watch breakpoint to field inside object

2013-11-13 Thread Martin

On 13/11/2013 14:54, Felipe Monteiro de Carvalho wrote:

Hello,

I managed to add a write watch to my variable VarA which is an
instance of a class and it works fine following instructions here:
http://wiki.freepascal.org/IDE_Window:Breakpoints

But actually I would like to watch when a field inside the class is
modified. Any way to do that? I tried setting the variable to watch as
VarA.MyField but it doesn't work =/

Is it possible somehow? I wonder how this works, will it stops at all
variables which are valled VarA? There is not enough information to
establish a particular one, I guess...

I am searching for a memory corruption, so I would like to breakpoint
when a code writes into a variable ...



What type is the field?

It works here.

Couple of points:
- You must use global for scope. Unless your object var VarA is a 
global var).
Otherwise varA will go out of scope, and gdb has no idea there are 
other refs to the object.


- You must delete, and create again, after every run. In order to work 
around gdb scope of VarA the IDE translates the expression to a pointer. 
That may not be valid on the next re-run


- You can only set the watch, if all vars involved are in scope: e.g the 
ide can show the value in watches window


Otherwise: logfile please
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] [ANN] ZBoleto - Bank payment slips generator.

2013-11-13 Thread silvioprog
Hello,

This announce is about a Brazilian project written in Free Pascal, for
generating Bank payment slips (in Brazil, it is called as Boletos
bancários).

Link to the project page:

http://silvioprog.github.io/zboleto

Supported banks:

. Banco do Brasil;
. Bradesco;
. Caixa Econômica Federal;
. HSBC;
. Itaú;
. Banco Real;
. Santander;
. SICREDI;

Samples:

http://brookframework.org/plugins/zboleto/exemplos.html

Details about license, support, bugs, donations etc. can be found on the
project page.

Enjoy! (y)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] write watch breakpoint to field inside object

2013-11-13 Thread Martin

On 13/11/2013 15:47, Martin wrote:


What type is the field?

It works here.

Couple of points:
- You must use global for scope. Unless your object var VarA is a 
global var).
Otherwise varA will go out of scope, and gdb has no idea there are 
other refs to the object.


- You must delete, and create again, after every run. In order to work 
around gdb scope of VarA the IDE translates the expression to a 
pointer. That may not be valid on the next re-run


- You can only set the watch, if all vars involved are in scope: e.g 
the ide can show the value in watches window


Also, it may not work, if the fields type is declared inline
  AFoo: array of integer;
because the IDE needs the name of the type for a typecast in the gdb 
expression generated


Solution: declare a named type



Dynamic Arrays, may only watch the reference, not the data




Otherwise: logfile please
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session 




--
___
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] write watch breakpoint to field inside object

2013-11-13 Thread Felipe Monteiro de Carvalho
 Also, it may not work, if the fields type is declared inline
   AFoo: array of integer;
 because the IDE needs the name of the type for a typecast in the gdb
 expression generated

It is array of SomeStructure declared inline indeed ... I'll try to
change to a named type, thanks.

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Jürgen Hestermann

Am 2013-11-13 16:22, schrieb waldo kitty:
 A baby born on 1/01/2007 would be 7 days old on 7/01/2007.
 true :)

Realy?
That would mean that a baby born on 2007-01-01 10:00
is two days old on 2007-01-02 10:00?
To me this seems wrong because after 24 hours is only one day old.
A simple substraction should give the difference (7-1 or 2-1).

Also, a baby born on 2007-01-01 is one year old on 2008-01-01 (not two).
It has its first birthday.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread waldo kitty

On 11/13/2013 9:37 AM, John Landmesser wrote:

On 13.11.2013 14:02, waldo kitty wrote:



We don't need to invent the wheel again, because others have solutions for that!


then why does this thread exist? O:)


I'll try to find what the usual way is to handle these problems: c++ Libraries
for example?!


i was being facetious thus the smiley ;)


i don't know as i do not have that book... but since you have the three
routines available, can you please post what they return for the two cases
above??


I don't have my test app anymore, changed it a lot last days to follow the
discussion, but perhaps you have a look at my post from 12.11.2013,  21:56


i know that feeling... i've taken to trying to save each in its own project so 
that i still have them to go back to to look over ;)



[...]

Bart delivered code that calculates 29.02.2000 to 28.02.2001 = 1 Year.
And that looks reasonable to me!


but it is not, not really... 29.02 only comes around once every four years...
29.02.leapyear to 28.02.leapyear+1 is one day short of a year... if you were
born on 29.02.1960, have you celebrated your birthday 13 or 53 times? :)


That depends on the country , you're living, see
http://en.wikipedia.org/wiki/February_29#Births


yeah, i've heard that, too... however, my experience shows that it is personal 
preference in many cases... i have several friends born on 29 Feb and some of 
them count every full year as their age but only celebrate on leapyears while 
others only count the leapyears... then there's the one oddball who celebrates 
every year but only counts the leapyears :lol:



Bart wrote:

I would actually say that in this particular case the diff is 1 Year...
(11 M + (28 days in feb in a non-leapyear = 1M) = 12M = 1 Y.

Soon we'll have working DateDiff function and my question will be answered in
the end!
Thanks guys!!


i can, however, agree with the reasoning bart has given above... do you agree
with it? is that what you want to see?


I'm not the one to decide, but i need a function which provides widely accepted
results!


as lex edmonds spoke of, there are two types of calculations... inclusive and 
exclusive where the ending day is counted or not... then there is also whether 
we are looking to use (strict) intervals or calendar intervals... if i have been 
keeping up, you are looking for calendar intervals (based on your post where 
01.01.2000 to 01.08.2001 should be 1 year, 7 months)...


as far as not one to decide... on the contrary... you are the one to decide if 
a routine fits your purposes... as far as accepting a routine to be added to one 
of the libraries distributed with FPC and/or Lazarus, yeah, that's up to someone 
on those teams...



I'll google again.



which of the following is what you want to see??

2000-02-29 to 2001-02-28 is0 yrs   11 mos   27 days (original)

2000-02-29 to 2001-02-28 is0 yrs   11 mos   28 days  (bart's fix)

2000-02-29 to 2001-02-28 is1 yrs0 mos0 days  (actually desired?)


so which one of these are you actually looking for? ;)


--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus 1.2RC1 Ctrl-F9 not working

2013-11-13 Thread Henry Vermaak
On Wed, Nov 13, 2013 at 04:38:28PM +0100, Mattias Gaertner wrote:
 On Wed, 13 Nov 2013 15:05:20 +
 Richard Mace richard.m...@gmail.com wrote:
 
  Hi All,
  Running the latest RC in stock Xubutu 12.04 and Ctrl-F9 doesn't work, but
  if you select compile from the menu, it works fine.
  
  Any ides?
 
 Check your short cuts in your system settings. They take precedence
 over any normal application like the IDE.

XFCE use Ctrl-FunctionKey to select workspaces.  For some reason it
works for me (I only have 8 workspaces, though).

Henry

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] [ANN] ZBoleto - Bank payment slips generator.

2013-11-13 Thread Fabrício Srdic
Great work!

thanks a lot!
Em 13/11/2013 13:53, silvioprog silviop...@gmail.com escreveu:

 Hello,

 This announce is about a Brazilian project written in Free Pascal, for
 generating Bank payment slips (in Brazil, it is called as Boletos
 bancários).

 Link to the project page:

 http://silvioprog.github.io/zboleto

 Supported banks:

 . Banco do Brasil;
 . Bradesco;
 . Caixa Econômica Federal;
 . HSBC;
 . Itaú;
 . Banco Real;
 . Santander;
 . SICREDI;

 Samples:

 http://brookframework.org/plugins/zboleto/exemplos.html

 Details about license, support, bugs, donations etc. can be found on the
 project page.

 Enjoy! (y)

 --
 Silvio Clécio
 My public projects - github.com/silvioprog

 --
 ___
 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] DateDif function needed

2013-11-13 Thread Reimar Grabowski
On Tue, 12 Nov 2013 22:00:39 +0100 (CET)
Michael Van Canneyt mich...@freepascal.org wrote:

 Seeing this, I can't help but think that the approximation approach
 may not be such a bad idea after all :D

Can you elaborate what the approximation is? I fail to see it.
1 julian year = 365.25 days of 86400 SI seconds each.
Of course there are lots of other definitions for year but if FPC uses the 
julian one the value is exact and no approximation. And it is one of the year 
definitions that make sense as a unit of time (in contrast to calendar year ...)

R.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Lazarus 1.2 RC1

2013-11-13 Thread Samuel Herzog
Hi,

just to let you know.
I opened all 110 projects in the examples folder and tried to compile them. (on 
win xp sp1)
Congratulation, there were only a very few projects with problems:

checkbox:        Problem with writlen in TForm1.CheckBoxClick    Runerror 103   
 File not open
speedtest:        S := TFileStream.Create('../images/penguin.xpm', fmOpenRead); 
    missing file penguin.xpm    Unable to open file
canvastest:      Rotate image does not look ok.    Press „Show Image Dialog“ 
and then „Rotate Image“    
dbeditmask:      problem on startup.     12/09/2003 is not a valid date format  
  
grid_semaphor:  problem when opening lfm, because some components must be 
installed before.        
lazfreetypetest:  problem on startup. Exception „can not activate“        Line 
249 in ttfile.pas    cannot open font (TT_Error 8) „arial.ttf“

Regards,
Sam
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Release Candidate 1 of 1.2

2013-11-13 Thread Mark Morgan Lloyd

== Why should everybody (including you) test the release candidate? ==


I've just compiled 1.2 RC1 for GTK2 on a clean x86 Linux system using 
2.6.2, running an older version of Debian (lenny). I notice that the 
icons on the toolbar don't appear until either the pointer is moved over 
them, or one of the non-current tabs is clicked. The last 1.1 I built 
was fine, but I admit that wasn't very recent.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread John Landmesser

On 13.11.2013 18:31, waldo kitty wrote:

On 11/13/2013 9:37 AM, John Landmesser wrote:

On 13.11.2013 14:02, waldo kitty wrote:


We don't need to invent the wheel again, because others have 
solutions for that!


then why does this thread exist? O:)


I'll try to find what the usual way is to handle these problems: c++ 
Libraries

for example?!


i was being facetious thus the smiley ;)


Ok, i can't read them :--((


as far as not one to decide... on the contrary... you are the one to 
decide if a routine fits your purposes... as far as accepting a 
routine to be added to one of the libraries distributed with FPC 
and/or Lazarus, yeah, that's up to someone on those teams...



Background to my question about DateDiff():

I wrote a little app for my Win Box in office:

if i klick on it, windows shuts down; Space  klick reboots and F1  
klick shows me a message box, telling me how long i have to stay in 
Office to fullfill the 8 h 30 min working time. Now i have my pension, 
starting 01.08.2018 and i thought: would be nice to know in this message 
box how many Years, Month, days left?!!


That how the story begins ... and lazarus would be better, if there 
exists a function DateDiff.


Meanwhile i googled again and learned. 29.01.2000 until 28.01.2001 is 0 
Y 11 M and 30 D in Libereoffice and MS Office 360.


I' ll look later in my Win on this computer to look what MS Access 97 
tells me.


What about Databases like mysql, Oracle, Firebird. I'm shure they have 
such a function.


.. lots to search for .. hihi ... my cooking is ready ... see you :-))


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Debugging Wince shows NO debugger output

2013-11-13 Thread Chris Kelling
As a work around, try using showmessage(variable.field):

That will at least let you see what's in the variable at that point, and 
program execution should stop until you hit OK.  

-Chris

Information in this message is intended for sole use of the recipient unless 
otherwise noted. 

 On Nov 13, 2013, at 15:40, GREP eperg...@outlook.com wrote:
 
 Hi 
 I could not get the breakpoints to work, I googled a lot, tried all the
 suggestions
 unsuccessfully. 
 After a full day of trial I ended up that now the project does not show 
 anything in the Debugger output window.
 
 I have this setup
 Windows XP, lazarus 1.0,12, svn 42478
 (installed with the exe provided)
 (sorry for the spanish legends, but regrettably when I installed lazarus 
 I did not find an option for choosing the language, it took it by default
 from geographical origin)
 
 http://free-pascal-lazarus.989080.n3.nabble.com/file/n4034315/debug1.jpg 
 
 http://free-pascal-lazarus.989080.n3.nabble.com/file/n4034315/debug2.gif 
 
 http://free-pascal-lazarus.989080.n3.nabble.com/file/n4034315/debug3.gif 
 
 with Level1 and nothing else checked
 The project build with no apparent problems, except the breakpoints don't
 work
 (there are no blue dots, and when I click on a line to add a breakpoint, it
 shows a
 red circle with a ? inside)
 Any help please?
 
 
 
 
 --
 View this message in context: 
 http://free-pascal-lazarus.989080.n3.nabble.com/Debugging-Wince-shows-NO-debugger-output-tp4034315.html
 Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.
 
 --
 ___
 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] Debugging Wince shows NO debugger output

2013-11-13 Thread GREP
Hi 
I could not get the breakpoints to work, I googled a lot, tried all the
suggestions
unsuccessfully. 
After a full day of trial I ended up that now the project does not show 
anything in the Debugger output window.

I have this setup
Windows XP, lazarus 1.0,12, svn 42478
(installed with the exe provided)
(sorry for the spanish legends, but regrettably when I installed lazarus 
I did not find an option for choosing the language, it took it by default
from geographical origin)

http://free-pascal-lazarus.989080.n3.nabble.com/file/n4034315/debug1.jpg 

http://free-pascal-lazarus.989080.n3.nabble.com/file/n4034315/debug2.gif 

http://free-pascal-lazarus.989080.n3.nabble.com/file/n4034315/debug3.gif 

with Level1 and nothing else checked
 The project build with no apparent problems, except the breakpoints don't
work
(there are no blue dots, and when I click on a line to add a breakpoint, it
shows a
red circle with a ? inside)
Any help please?




--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Debugging-Wince-shows-NO-debugger-output-tp4034315.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Michael Van Canneyt



On Wed, 13 Nov 2013, Reimar Grabowski wrote:


On Tue, 12 Nov 2013 22:00:39 +0100 (CET)
Michael Van Canneyt mich...@freepascal.org wrote:


Seeing this, I can't help but think that the approximation approach
may not be such a bad idea after all :D


Can you elaborate what the approximation is? I fail to see it.
1 julian year = 365.25 days of 86400 SI seconds each.
Of course there are lots of other definitions for year but if FPC uses the 
julian one the value is exact and no approximation. And it is one of the year 
definitions that make sense as a unit of time (in contrast to calendar year ...)


The approximation is that the calculation is based on a difference in the 
number of days.

The number of days is then divided by an average number of days per month, 
in order to get a number of months.


Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread waldo kitty

On 11/13/2013 1:42 PM, Reimar Grabowski wrote:

On Tue, 12 Nov 2013 22:00:39 +0100 (CET)
Michael Van Canneyt mich...@freepascal.org wrote:


Seeing this, I can't help but think that the approximation approach
may not be such a bad idea after all :D


Can you elaborate what the approximation is? I fail to see it.
1 julian year = 365.25 days of 86400 SI seconds each.


from dateutil.inc (line ~64)...

Const

  { Average over a 4 year span. Valid for next 100 years }
  ApproxDaysPerMonth: Double = 30.4375;
  ApproxDaysPerYear: Double  = 365.25;



Of course there are lots of other definitions for year but if FPC uses the
julian one the value is exact and no approximation. And it is one of the
year definitions that make sense as a unit of time (in contrast to calendar
year ...)


the problem is that knowing the (eg) YearsBetween or YearsSpan does not easily 
lend itself to being able to determine the remainder Months, Days, Hours, 
Minutes, Seconds... the same with MonthsBetween or MonthSpan... Days is known 
and can be used for the other finer values but you also cannot use it to build a 
months or years value that works out properly with the other values...




--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Debugging Wince shows NO debugger output

2013-11-13 Thread Martin

On 13/11/2013 20:40, GREP wrote:

Hi
I could not get the breakpoints to work, I googled a lot, tried all the
suggestions
unsuccessfully.
After a full day of trial I ended up that now the project does not show
anything in the Debugger output window.

I have this setup
Windows XP, lazarus 1.0,12, svn 42478



Not sure, never done wince.

But you can try and sent a log 
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session


Maybe something stands out.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Bart
On 11/13/13, John Landmesser joh...@online.de wrote:
 I'm just a hobbyist, never went to university to study computer science.

So am I.
(For my background, see my userpage on the wiki)

 We don't need to invent the wheel again, because others have solutions
 for that!

Of course we don't have to.
I just gor intrigued by the (at that time already) long thread, and
since no-one gave a solution, I just went for it and gave it my try.

Just because it is fun to do.

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus 1.2RC1 Ctrl-F9 not working

2013-11-13 Thread Bart
On 11/13/13, Mattias Gaertner nc-gaert...@netcologne.de wrote:

 Check your short cuts in your system settings. They take precedence
 over any normal application like the IDE.

On my Fedora 18 / KDE Ctrl+F9 does something weird to the windows that
I cannot really describe or give a name.
I'm too lazy to look it up and disable it.

(On my old Suse 10.0 disabling system setting for Ctrl+F9 took me 2
days to find...)

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread John Landmesser

On 13.11.2013 23:14, Bart wrote:

On 11/13/13, John Landmesser joh...@online.de wrote:

I'm just a hobbyist, never went to university to study computer science.

So am I.
(For my background, see my userpage on the wiki)


Found your userpage , read it with great interest.
Your experience with Lazarus sounds fimiliar to me ( Delphi 5, Delphi 
2010 -- horrible ) and now Lazarus, that fits my needs!


I will use your version of DateDiff, thank you!!!

Perhaps it can become a part of FreePascal, that is missing such a 
function.


... the end of this thread is near?

.. perhaps.

I got an answer to my question.

Regards,

John

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread waldo kitty

On 11/13/2013 5:14 PM, Bart wrote:

On 11/13/13, John Landmesser joh...@online.de wrote:

I'm just a hobbyist, never went to university to study computer science.


So am I.
(For my background, see my userpage on the wiki)


i probably should set something, too... while i have an account on the wiki and 
have done a little bit of editing, i haven't set much of any background type of 
information...



We don't need to invent the wheel again, because others have solutions
for that!


Of course we don't have to.
I just gor intrigued by the (at that time already) long thread, and
since no-one gave a solution, I just went for it and gave it my try.

Just because it is fun to do.


a brother from a different mother! howdy, brother! :) O:)

i'm still working on it, too :lol:  i had thought i found a spreadsheet that 
would give the answers so as to compare with my output... the first thing i had 
to do, though, was set a max(a1,a2) and min(a1,a2) so that the lower date was 
placed first and the higher second as our code does but while i got the same 
answers for numerous tests, some returned a negative number in the sheet :(


so besides that, i've been trying to work my way, manually, through and count on 
a calendar... so far, everything seems to come out but not with the original 
code you and i posted and not with your fix... i had to go a bit deeper for the 
corners... anyway, i'm still whacking away at it and hope to maybe get something 
completed for the community... but it is slow and the columns of numbers just 
meld together at time when manually counting from the almanac %)


--
NOTE: No off-list assistance is given without prior approval.
  Please keep mailing list traffic on the list unless
  private contact is specifically requested and granted.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Patrick Chevalley

Hi,


So the difference between 2007-01-01 12:00 and 2008-01-01 12:00 ist
*not* one year?


No, the base definition of the year is not a digit change, but the time 
it take to the Earth to return at the same point of its orbit around the 
Sun.

This is actually 365.2422 days, and this is named the tropical year.
The julian year of 365.25 is a convenient approximation still in use 
despite the julian calendar was abrogated some 400 years ago.


All this efforts are to bypass the problem with the calendar year (the 
one you mention) because it is sometime 365 and sometime 366 days. This 
is a totally unacceptable definition when you need an homogeneous time 
scale.


So all depend of the use you need for your application  and it must be 
admitted that one set of definition/function is not sufficient and every 
one must be careful when using time period.


For me the very simple functions as implemented if FPC are sufficient, 
the most important here is Delphi compatibility. And you need to provide 
your own if you need something more specific, such writing a calendar 
application.


Patrick


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Jürgen Hestermann

Am 2013-11-13 19:42, schrieb Reimar Grabowski:
 1 julian year = 365.25 days of 86400 SI seconds each.
 Of course there are lots of other definitions for year but if FPC uses the 
julian one the value is exact and no approximation


So the difference between 2007-01-01 12:00 and 2008-01-01 12:00 ist *not* one 
year?
It's only 365,00 days and therefore not a full year according to your 
definition.
But this it totaly wrong.
Same day same time of one year and the next should always be a one year 
difference.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DateDif function needed

2013-11-13 Thread Michael Schnell

On 11/14/2013 07:19 AM, Jürgen Hestermann wrote:


But this it totaly wrong.
As is defining a meter by the count stretched rubber bands: 1 2, 3, 4 or 
5  All numbers are true and all are wrong :-) :-) :-)


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus