Re: [fpc-pascal] exitproc?

2014-08-05 Thread Tomas Hajny
On Tue, August 5, 2014 02:00, waldo kitty wrote:

 back in the [g]?olden days of TP6, i used to be able to set an exitproc
 procedure that would be executed any time my program exited for any
 reason...
 something like

exitproc := @myexitproc;

 is this still able to be done easily? does it work even if there's an
 untrapped
 exception?

Yes.

Yes, as long as the exception is handled (caught) by the RTL.

Tomas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] TImage : how to avoid flickering when changing image

2014-08-05 Thread Dennis Poon
every few seconds, I want the same TImage  to load a different jpg file 
but now it flickers whenever

TheImage.Picture.LoadFromFile('new.jpg');

How do I avoid the flickering?

Dennis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TImage : how to avoid flickering when changing image

2014-08-05 Thread Henry Vermaak
On Tue, Aug 05, 2014 at 07:06:43PM +0800, Dennis Poon wrote:
 every few seconds, I want the same TImage  to load a different jpg
 file but now it flickers whenever
 TheImage.Picture.LoadFromFile('new.jpg');
 
 How do I avoid the flickering?

I assume you're on Windows.  Have you tried to set DoubleBuffered to
True?  I didn't use TImage, but I remember having to put the PaintBox
onto a panel and set panel.DoubleBuffered to True to stop the
flickering.

Henry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TImage : how to avoid flickering when changing image

2014-08-05 Thread Henry Vermaak
On Tue, Aug 05, 2014 at 12:19:22PM +0100, Henry Vermaak wrote:
 On Tue, Aug 05, 2014 at 07:06:43PM +0800, Dennis Poon wrote:
  every few seconds, I want the same TImage  to load a different jpg
  file but now it flickers whenever
  TheImage.Picture.LoadFromFile('new.jpg');
  
  How do I avoid the flickering?
 
 I assume you're on Windows.  Have you tried to set DoubleBuffered to
 True?  I didn't use TImage, but I remember having to put the PaintBox
 onto a panel and set panel.DoubleBuffered to True to stop the
 flickering.

P.S.  This is the wrong list for Lazarus questions.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] exitproc?

2014-08-05 Thread leledumbo
 is this still able to be done easily?

No difference I guess:
http://www.freepascal.org/docs-html/rtl/system/exitproc.html
However, this is better:
http://www.freepascal.org/docs-html/rtl/system/addexitproc.html

 does it work even if there's an untrapped exception?

Just try it



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/exitproc-tp5719871p5719877.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] exitproc?

2014-08-05 Thread waldo kitty

On 8/5/2014 3:29 AM, Tomas Hajny wrote:

On Tue, August 5, 2014 02:00, waldo kitty wrote:


back in the [g]?olden days of TP6, i used to be able to set an exitproc
procedure that would be executed any time my program exited for any
reason...
something like

exitproc := @myexitproc;

is this still able to be done easily? does it work even if there's an
untrapped
exception?


Yes.

Yes, as long as the exception is handled (caught) by the RTL.


do you mean that it cannot be a unhandled exception with ''crash'' and 
heaptrace dumping the thousands of left-behind memory blocks that weren't 
deallocated?? that's what i'm trying to get past... i want to see the error and 
unhandled exceptions but i really want to properly deallocate the 4+ * 5 
records on the heap instead of having to either wait for heaptrace to finish 
dumping them or forcibly closing the task or (in the worst cases) rebooting the 
entire machine...


this is a console app based on tapplication (mainly for parameter parsing 
capability) and i have no clue (yet) how to catch exceptions and deal with them 
properly...


additionally, this last time i had to deal with this, fpc 2.6.4 release for OS/2 
was dieing with unknown error 110 (IIRC) during runtime... i finally 
determined this to be from trying to reset a file that didn't exist where the 
path was pointing to... goofy error on my part that i fixed by fsplitting the 
pattern and adding the directory portion back to the initial directory path 
being used... in any case, i thought i should also mention this so that it can 
be corrected so it is not unknown any more ;)


--
 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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] exitproc?

2014-08-05 Thread waldo kitty

On 8/5/2014 12:51 PM, leledumbo wrote:

is this still able to be done easily?


No difference I guess:
http://www.freepascal.org/docs-html/rtl/system/exitproc.html
However, this is better:
http://www.freepascal.org/docs-html/rtl/system/addexitproc.html


thanks for the pointers! i was extremely tired when i wrote my original post... 
16 hours editing (reformatting) a wikipedia table and researching the hundreds 
of entries in it can really make one's eyes cross :/



does it work even if there's an untrapped exception?


Just try it


i will try... hopefully i won't have to do anything to execute my existing 
procedures and i'll be able to stop manually executing them in my code as they 
should be executed automatically by using this method...


--
 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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] http://free-pascal-develop.nabble.com/ ?

2014-08-05 Thread fredvs
Hello.

For fpc-general it exists :
http://free-pascal-general.1045716.n5.nabble.com/

Nable is  a easy to use forum-web site.

Does it exist a nabble web page for fpc-develop (with all fpc-devel
archives) ?

Thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/http-free-pascal-develop-nabble-com-tp5719880.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] best? safest? fastest?

2014-08-05 Thread waldo kitty


i suspect this is going to be like the long-standing joke of

  cheap, fast, stable: choose two


over the years, i've seen two schools of code for dealing with dates... years, 
specifically... one school is string based and the other is math based... both 
have their faults and pluses...


eg: string based fault : prepend '19' to single digit year value
math based fault : 2003 - 1900 = 103 (3 is intended result)

so what i have is satellite tracking two line element files... these files 
contain an epoch for the numbers contained in the TLE... the epoch is laid out as


  YYdoy.frac-doy == 14211.03356282

where

  YY : 1 or 2 digit year without century ('62' or ' 3' or '05')
  doy : day of year, 1, 2 or 3 digits, jan 1 is day 0 ('  0' or ' 15' or '020')
  frac-doy : 8 digit fractional day of the year

what i'm needing to do is to choose a route to make the year portion four digits 
so that historical TLEs can be used... the program makes a comparison of the 
epoch to determine which of two is newer... the newer one is placed into the 
in-memory database for later usage... working with historical TLEs from 1957 to 
1999 mandates four digit years be used or historical TLEs will override TLEs 
from 2000 to 2056 since 00 thru 56 are less than 57 (1957 first launch)...


previous to any processing, the epoch taken from the TLE in the file is 
processed so that leading blanks in the epoch are replaced with zeros... today's 
epochs don't really need this as creation and processing methods have evloved 
over the years... this is done as a precaution for those times when processing 
historical TLEs which have not been converted to having leading zeros instead of 
blanks (aka spaces)...


we've launched over 4 objects and there are possibly hundreds or thousands 
of TLEs for each one... at least one site is known to have over 9 million TLEs 
in their database... these routines are executed for each and every TLE loaded 
as we fill our in-memory database...


finally (yeah i know, but i thought the history and methodology was important) 
my questions, as the subject alludes to, are which of the following methods 
would you choose? why? would you choose another method? why?


all input is greatly welcomed! as always, thanks for your time and attention! :)

{**}
{**}

// make sure we have the full four digit year for the epoch!
// eg: 14211.03356282 becomes 2014211.03356282 which is 2014-07-30 00:48:19.827

// method 1 (string manipulation)
if (Integer_Value(MyEpochStr,1,2)  57) then // first 
launch in 1957
  MyEpochStr := FloatToStrF('20'+MyEpochStr,ffFixed,16,8)// value  
57 so year is 21st century (2000 thru 2056)

else
  MyEpochStr := FloatToStrF('19'+MyEpochStr,ffFixed,16,8);   // value 
is = 57 so year is 20th century (1957 thru 1999)
MyEpoch:= Real_Value(MyEpochStr,1,Length(MyEpochStr));   // convert 
to real for mathmatical comparison


{**}

// method 2 (combination string and math??)
if (Integer_Value(MyEpochStr,1,2)  57) then // first 
launch in 1957
  MyEpochStr := FloatToStrF(Real_Value(MyEpochStr,1,Length(MyEpochStr)) + 
200,ffFixed,16,8)

else
  MyEpochStr := FloatToStrF(Real_Value(MyEpochStr,1,Length(MyEpochStr)) + 
190,ffFixed,16,8);
MyEpoch:= Real_Value(MyEpochStr,1,Length(MyEpochStr));   // convert 
to real for mathmatical comparison


{**}

// method 3 (math manipulation)
MyEpoch:= Real_Value(MyEpochStr,1,Length(MyEpochStr));   // convert 
to real for mathmatical comparison
if (int(MyEpoch / 1000)  57) then   // first 
launch in 1957
  MyEpoch := (MyEpoch / 1000 + 2000) * 1000  // value  
57 so year is 21st century (2000 thru 2056)

else
  MyEpoch := (MyEpoch / 1000 + 1900) * 1000; // value 
is = 57 so year is 20th century (1957 thru 1999)
MyEpochStr := FloatToStrF(MyEpoch,ffFixed,16,8); // store to 
MyEpochStr for later use (16 characters!)


{**}
{**}



support routines for the above:


  Function Integer_Value(buffer : string; start, length : integer) : integer;

  var
MyResult : integer = 0;
answer   : integer - 0;

  begin
buffer := Copy(buffer,start,length);
Convert_Blanks(buffer);
if buffer = '' then
  buffer := '0';
Val(buffer,answer,MyResult);
if MyResult = 0 then
  Integer_Value := answer
else
  Integer_Value := 0;
  end; // Function Integer_Value


  Function Real_Value(buffer