Re: [fpc-pascal] http://wiki.freepascal.org/ web site is totally blank

2019-06-06 Thread DaWorm
There was a thread yesterday about issues with the servers.  This may be
related.

Jeff

On Thu, Jun 6, 2019 at 4:58 AM Dennis  wrote:

> Does it only happen to me?
>
> Dennis
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] unexpected termination with no errors

2019-05-15 Thread DaWorm
Isn't that negative number 0xC005 in hex?  If that's the case, it's an
Access Violation and not Disk Full.

Jeff.

On Wed, May 15, 2019 at 11:44 AM James Richters <
ja...@productionautomation.net> wrote:

> It's a simple single thread console app.   I found my problem...  years
> ago I implemented a batch file to run my program in the test environment to
> help be with debugging... and what it does is redirect the errors to a file
> so that if flashed by real quick, I would be able to just look at the
> file.   Then I just echo the file to the screen, and if I detect an error,
> I also pause so I can see it.This a common solution to the windows
> limitation of not be capable directing STDERR to console AND to a file.
>
> Well the file wasn't reporting the error and it wasn't on the screen... it
> looked like a normal exit, BUT it was actually giving me the proper
> report... unfortunately the error was the one thing that my batch file
> could not possibly display  EInOutError: Disk Full   DOH!!!  With the
> disk full my log file could only show up to but not including the error...
> because it could not write anymore on a full disk... I still don't have a
> great solution for this... I see methods of implementing something like a
> Tee function on windows, but the problem is I don't want ALL the output to
> go to the log, I only want STDERR to go to the log file and the
> screen...  not my output I am sending with the CRT unit that sends colored
> text for various purposes.  This is such a pain with windows to accomplish
> this seemingly simple task.Anyway I know what the problem is and can
> put in something to detect it.  Maybe I will just check if the errorlevel
> is negative and if so write a suggestion to the screen that disk full may
> have caused this and then pause since I can't necessarily write
> anything to the file.
>
> Does anyone know what the errorlevel for EInOutError: Disk Full is
> -1073741819,   (I'm not sure it's always that number... ) is this on
> purpose?, or a bug?, or a side effect of the disk being full so it can't
> generate the correct error code?   if it was a normal errorcode I would
> have got that on my screen but since it's less than zero it got treated
> like a normal exit I did fix my batch file to treat anything less than
> zero as an error. so it doesn't really matter, I just didn't know they
> could be negative, but I'm curious why this strange errorlevel.
>
> Jim
>
>
> -Original Message-
> From: fpc-pascal  On Behalf Of
> Karoly Balogh (Charlie/SGR)
> Sent: Wednesday, May 15, 2019 9:17 AM
> To: FPC-Pascal users discussions 
> Subject: Re: [fpc-pascal] unexpected termination with no errors
>
> Hi,
>
> On Wed, 15 May 2019, James Richters wrote:
>
> > Has anyone encountered anything like this before or know how I can
> > make sure I always get the maximum amount of debugging info when my
> > program crashes?
>
> Is it a subthreaded app?
>
> The only case when I noticed something similar (under Linux though), when
> a certain subthread throws an exception, it just silently disappears
> without any further handling. It doesn't throw any exception, unless you
> wrap the entire Execute method in a try-except.
>
> (Sidenote: I've been pondering for a while if I should report this as a
> bug. I think the RTL should put a try-except around there, to show a
> stacktrace on unhandled exceptions, just like the main thread dying does,
> but who knows which Delphi de-facto standard behavior would that violate,
> so meh...)
>
> In Linux/Darwin (on x64/ARM at least), only the thread causing the problem
> dies, no clue what happens under Windows. Maybe this helps.
>
> Charlie
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC code to migrate Outlook PST file to MBOX format?

2019-01-09 Thread DaWorm
Use the tool that gives you the flat view, then create mail filters in
Thunderbird to move messages to the appropriate folders, and then apply the
filters to the existing messages.  It may take a while to build the
filters, but you'd want to do that anyway so that new messages go to the
right place.

Jeff.

On Wed, May 23, 2018 at 8:19 AM Bo Berglund  wrote:

> Hi,
> I need to switch away from using Outlook 2003 to something sensible
> like Thunderbird. But when I do I need to keep my mail archive, which
> is stored in multiple very big PST files, each organized in a
> folder-subfolder tree. It covers the time from about 1998 to now..
>
> I have tried to find some working converter software available on
> line, but I have failed. Tried a few but they seem to lack the ability
> to handle the internal folders of a PST file.
> One in particular show the full structure of the PST file I select for
> conversion so it looks like it would work. But in the end there is
> only a flat view of email in Thunderbird when I use the created MBOX
> file.
>
> So now I wonder if there is some FPC code around that I can tailor to
> my needs? It seems a pity that the PST -> MBOX conversion should be
> such a problem
>
> The files are real big so I think I will need the 64 bit capability of
> fpc, which I have installed on my laptop.
>
>
> --
> Bo Berglund
> Developer in Sweden
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Order of Precedence: FPC/Delphi vs Java

2018-10-04 Thread DaWorm
On Thu, Oct 4, 2018 at 4:02 AM  wrote:

> This is one of the most useless collection of floating point myths I
> have seen since a long time.
>


> With rolling a dice you mean, that the comparisons are only
> randomly correct or what)? Since the floating-point numbers
> are well-defined and exact (yes they are, and truncation/rounding
> errors are the results from former computations and/or
> the rounding of non-representable numbers). All operations
> are predictable, so there is no chance for random.
>
>
The random comes from the input, not the output.  If you know the numbers
going in, you know the numbers coming out, certainly.  But you rarely know
the numbers going in , and most people don't know the deep details of what
happens behind the scenes, and so sometimes some of those numbers going in
give you surprising numbers coming out.  Different implementations or
different languages have different details, as well, which can also be
surprising.

So the issue isn't technical, it is language.  What was being said was
vernacular, colloquial, imprecise, just to give you the impression that
__unless you pay attention to the details__ the output you get could look
"random" or appear to be a "crap shoot".  I don't think the original poster
meant that the results were truly random at all, only that if you don't
take care to account for the details, you might get that impression.

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

Re: [fpc-pascal] Pascal Neopixels

2018-07-29 Thread DaWorm
You should be able to use the library from Pascal directly rather than
trying to recreate it from scratch.

Jeff

On Sun, Jul 29, 2018, 10:20 AM Anthony Walter  wrote:

> I'm not sure what would be the correct list for this question since it
> involves writing Pascal code and not Lazarus, so here goes ...
>
> Can anyone offer me any advice or refer me to helpful resources on the
> subject of using Pascal code to control WS2128 led strips
> , or neopixels, from a
> Raspberry Pi?
>
> I've wired up a some neopixels
> 
>  and
> am able to control them by way of PWM (pulse wave modulation) on GPIO 18
> (pin 12 on a Pi 3) using this rpi_ws281x git repository
> . It works great either in C or
> using Python bindings, and I am able to create effects in C code easily.
> But obviously I'd prefer to interface with the neopixels using Pascal.
>
> I've seen some Pascal libraries for both GPIO access, and DMA pin mapping,
> but the communication protocol for controlling neopixels is a bit more
> complex than writing a 24 bit value to a pin. Each pixel can be controlled
> in both brightness and color, though I'm unsure how the wx281x library is
> doing this.
>
> Assuming I was to do this in from scratch  Pascal, that is control the
> colors and brightness of many pixels withing an entire neopixel strip, I
> believe I need to do the following in psuedo code.
>
>   // open device memory
>   fd = open('/dev/mem')
>   // map the file descriptor to the memory address of gpio18
>   gpio18 = mmap(fd, ...)
>   // fd is no longer needed
>   close(fd)
>
>   [ then write to gpio18 in some loop as a data structure ]
>
>   // cleanup
>   unmap(gpio18)
>
> If that psuedo code is the correct way to do things, I would need to know
> what is the offset and page size for PWM GPIO18, what flags to use with
> mmap, and finally what memory locations inside of the gpio18 pointer
> control which pixel, what is the brightness memory location and size, what
> is the color memory location and size for each pixel. Also, is there any
> other memory location inside gpio18 that is of importance or relevance,
> such as an on/off bit?
>
> Does anyone have any insight into this subject that might be useful? After
> I get something that works I'll be sure to share the resulting Pascal code
> and a video plus tutorial.
>
> TIA
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Coercing record fields together

2018-07-09 Thread DaWorm
Just because someone is bound to suggest it, might as well be me.

type
TRecA = record
a: string;
b: string;
end;

type
TRecB = record
A: TRecA;
c: integer;
d: integer;
end;

RecB.A := RecA;

Jeff

On Mon, Jul 9, 2018, 12:23 PM Ryan Joseph 
wrote:

> Could I do some RTL magic on a record to loop over its fields and set them
> to another record by name? In the example below I want to set all the
> fields in TRecA to matching named fields in TRecB. Just curious if we can
> do this automatically using RTL.
>
> type
> TRecA = record
> a: string;
> b: string;
> end;
>
> type
> TRecB = record
> a: string;
> b: string;
> c: integer;
> d: integer;
> end;
>
>
> for field in recA.GetFields do
> recB.GetFieldByName(field.name).value := field.value
>
>
> Regards,
> Ryan Joseph
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Connecting to a database from a commandline pascal program

2018-02-16 Thread DaWorm
Wouldn't this...

MyConnection.Create(Nil);
// MyQuery.Create(Nil);

... be more like...

MyConnection := TZConnection.Create();
MyQuery := TQuery.Create();

Then at the end you'd need...

MyQuery.Free();
MyConnection.Free();

Jeff


On Fri, Feb 16, 2018 at 10:25 AM, Terry A. Haimann  wrote:

> Hello,
>
> I am trying to write a command Line Pascal program to connect to a MySQL
> database using the ZeosDBO Library. I am sure I have done something
> stupid.
>
> I have it now so that it will compile, but it crashes as soon as I try
> to modify my TZConnection variable.
>
>
> I have it defined as:
>
> MyConnection:   TZconnection;
>
> And code is defined as:
>
> WriteLn('2');
> MyConnection.Create(Nil);
> // MyQuery.Create(Nil);
> WriteLn('2.0);
> MyConnection := '127.0.0.1';
> WriteLn('2.1');
> MyConnection.Protocol   := 'mysql';
> WriteLn('2.2');
> MyConnection.Database   := 'MyDatabase';
> WriteLn('2.3');
> MyConnection.User   := 'MyUser';
> WriteLn('2.4');
> MyConnection.Password   := 'MyPass';
> WriteLn('2.5');
> MyConnection.Connected := True;
> WriteLn('2.6');
>
> It never hits 2.0, so I believe it is dying on the create. Am I doing
> the create wrong?  I can't find any examples as too doing this, I have
> tried googling it.  Most of the examples I see are doing this from
> Lazarus.  Not from a command line Free Pascal program.
>
> Thanks in advance,  Terry H.
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-16 Thread DaWorm
On Fri, Jun 16, 2017 at 1:49 PM, James Richters <
ja...@productionautomation.net> wrote:

>
> I would like to do something like:
> agg^.Font('%windir%\Fonts\ConsolaB.ttf' ,45 );
>
>
You should be able to use SHGetFolderPath() with CSIDL_WINDOWS.  Not sure
you can always count on Fonts being a subfolder of that, though.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx


You may be able to use CSIDL_FONTS or FOLDERID_Fonts as well.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb762494(v=vs.85).aspx

Not sure if any are defined in FPC, but should be easy to create/import if
not.

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

Re: [fpc-pascal] for loop vs while loop

2017-02-02 Thread DaWorm
On Thu, Feb 2, 2017 at 4:01 AM, Mark Morgan Lloyd <
markmll.fpc-pas...@telemetry.co.uk> wrote:

>
> It's interesting that the real (wallclock) and user times are consistently
> in a different sequence. /If/ the user time is to be believed, there's a
> very small advantage to counting down even if the sequence you want is
> ascending (i.e. test3) rather than simply counting up.


Not looking at the assembly either, but I'd assume it's because you can do
a simple test for zero in the count down case, and have to do a compare
against a value and then test the result on count up, which probably takes
an extra instruction or two.  The optimization can sometimes convert
everything to count down as part of the setup of the loop (I know in Delphi
you'd sometimes see loops run the other way in the debugger when there was
no behavioral change in function).  I guess since in your examples the
final contents of the a variable after the loop exits depends on direction,
then it couldn't do this for the count up loops.  Maybe try again with
Inc(a) in the body?

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

Re: [fpc-pascal] How to increase the range ckeck limit?

2015-07-05 Thread DaWorm
 What do you mean,  your question is not clear ?

Since r is set to 256, the [0..r] probably doesn't work, even with the
range check turned off.  So I assume he's really asking for larger sets.

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

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-09 Thread DaWorm
I would think this part answers that question:  The warning means that no
value has been *explicitly* assigned to these variables (which *may
indicate a logic error* in the code), not necessarily that they contain an
unpredictable value. (emphasis mine)

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

Re: [fpc-pascal] New Get Lazarus Initiative

2015-02-04 Thread DaWorm
Also, please make a ZIP version available for download on Windows.  Many
corporate firewalls completely block downloading EXE files from non-trusted
sites (and getting a site on the trusted list is non-trivial, to say the
least).

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

Re: [fpc-pascal] Can We use CRT and Video Unit in Single Unit In free pascal

2014-06-23 Thread DaWorm
Or you can do the right thing and not use the contents of the video memory
as if it were a variable to be used to check if you have or have not done a
particular thing, which is what it looks like your original code does.

This would require understanding more of what the program you are porting
was intended to do and less of how it did it.  Once you have that, so many
questions answer themselves.

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

Re: [fpc-pascal] fp libraries do not like cmem ?

2014-02-14 Thread DaWorm
Or always allocate and free the buffer in the calling program and load the
contents into the buffer in the dll.  This way you never have to worry
about allocating in one place and freeing in the other.  Windows API does
stuff like this a lot.

In the DLL:

Procedure GetSomeString(StringPointer: Pointer, Var StringLen: Integer);
Begin
  StringLen = CalculateSizeOfString
  if StringPointer != nil then
// copy string to StringPointer
End;

In your App:

Var StringLen: Integer;
AllocedMem : Pointer;
. . .
// Find out how much memory needed
GetSomeString(nil, StringLen);
GetMem(AllocedMem, StringLen);
GetSomeString(AllocedMem, StringLen);
// use the string for whatever you need
. . .
FreeMem(AllocedMem);

Very bad psuedo code there, but it should give you the idea.

To summarize, your app needs to:

1. Call once with nil to get how much memory needed
2. Allocate the memory
3. Call again with pointer to memory
4. Use the allocated memory
5. Free the allocated memory

And your dll function needs to:

1. Check pointer for nil
2. If so, only set the length parameter to the size of memory needed and
exit
3. If not, copy data to pointer as well

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

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-10-06 Thread DaWorm
Thumbs up.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: StrUtils.RomanToInt oddities

2013-09-24 Thread DaWorm
Just a guess here, but I would think there have now been more posts in this
thread than the total number of programs to use this function.  Probably by
a wide margin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

2013-02-18 Thread DaWorm
On Mon, Feb 18, 2013 at 8:02 AM, Lukasz Sokol el.es...@gmail.com wrote:


 Maybe he one and true answer for all of the above would be to have:

 try vs  try
   try   except
 try finally
 except  except
 end;end;
   finally
   end;
 except
 end;

 so with except being optionally allowed either side of 'finally' ?

 I haven't actually tried this, but what would this do?

try
  try
  except
  end;
finally
  try
  except
  end;
end;

If this is what is really desired, is this a good construct?

try
  ...
except
  ...
finally
  ...
except
  ...
end;

  I don't care for the meaning of except looking to be contextual, but is
it really?  Reading that, to me it looks mostly predictable how the logic
would have to work.  I guess the only question is whether the finally code
is executed if the try code has an exception.  If this isn't desired, could
a break be used in the first except to cause the finally to be skipped?

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

Re: [fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

2013-02-11 Thread DaWorm
Lost in the shuffle, wasn't this originally found in Lazarus?  Sounds like
a bug report for incorrect handling of INI files when the config directory
is missing needs to be filed in their bug tracker.

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

Re: [fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

2013-02-11 Thread DaWorm
On Mon, Feb 11, 2013 at 1:48 PM, Giuliano Colla 
giuliano.co...@fastwebnet.it wrote:

 On 02/11/2013 04:45 PM, DaWorm wrote:

 Lost in the shuffle, wasn't this originally found in Lazarus?  Sounds
 like a bug report for incorrect handling of INI files when the config
 directory is missing needs to be filed in their bug tracker.


 INI files and related stuff are part of the fcl library
 (packages/fcl-base), not of the Lazarus library.


Sorry, went back and look, I misread a Lazarus application as the
Lazarus application and thought it was Lazarus itself saving its settings.

As Emily Littella used to say, Never Mind.

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

Re: [fpc-pascal] How to avoid namespace name clashes after USES ?

2012-08-21 Thread DaWorm
Very tedious, but you could create a wrapper unit and/or class for each
library, and expose a prefixed name instead of the original.

Jeff,
On Aug 21, 2012 3:31 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:


 On 20 Aug 2012, at 18:15, Timothy Madden wrote:

  This story is inspired from a real case when *lots* of user code
  suddenly stopped compiling after JDK 1.2 was released, with a new List
  class, which users had to import from a different package until JDK 1.1.
  In this case is wasn't even a third-party library that triggered
  conflicts in existing code, it was the system run-time library. Since
  that story most Java programmers prefer to import and enumerate each and
  every class they use explicitly, instead of importing the package that
  provides the classes

 Importing a single class in Java still requires you to specify the full
 package name, so how would that help preventing compilation failures in
 case a class is moved from one package to another?

  (I believe there is no equivalent feature in Pascal
  that imports only one symbol from a unit).

 Indeed.

  Is there any form of proposal or some alternative to the USES clause,
  that will keep all the imported symbol names qualified by some namespace
  name or by some prefix I choose ?

 Not that I know of.


 Jonas___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal

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

Re: [fpc-pascal] Re: Why is Random(255) some 529x slower compared to Delphi7?

2011-12-08 Thread DaWorm
Why sprinkle ifdefs everywhere?  Change all calls to Random with calls to
FastRandom, and have one ifdef there that uses Random in Delphi and a fast
substitute in FPC.  Still readable, still fast, and you would be done by
now instead of spending so much time arguing about it.  Plus, should Delphi
decide to change their Random call to something slower in the next rev, you
only have to change one routine to switch back to a faster version.  Maybe
later a patch could be worked on to implement FastRandom and BetterRandom
in the RTL, and use some sort of procedure variable to allow Random to call
one or the other.  But you'd probably find the need to do that isn't so
urgent once you've made the other change.

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

Re: [fpc-pascal] ARM STM32F Processor

2011-09-24 Thread DaWorm
You can also use one of the serial ports along with the BOOT0, BOOT1 and
RESET lines to program.  A TTL to RS232 adapter, or FTDI USB chip will also
be needed.  The protocol is easy, took me about a day to get working from
Delphi (using the serial handshake lines as IO to drive RESET and BOOT0).
On Sep 23, 2011 10:30 AM, Roberto P. padovan...@gmail.com wrote:
 2011/9/19 Jeppe Græsdal Johansen jjoha...@student.aau.dk

 Den 19-09-2011 22:20, Roberto P. skrev:

 Hi,

 I think you can get an unbranded (no IAR, no Keil, etc...) flash
 programming tool with a simple (but working) software from ST for about
30
 euros.
 Look here: http://www.st.com/internet/evalboard/product/251168.jsp

 R#

 I'm pretty sure it's still the same closed(and botched) protocol that's
 used, as in the ST-Link emulator on the STM32-Discovery, meaning you can
 only program the target using the ST endorsed IDE's

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



 Hmm... no, you can develop any board of yours and by bringing out the VCC,
 GND and JTAG signals you can connect to the ST-LINK/V2 from ST, which I
 bought for 28 euros.
 Then you can download the STM32 ST-LINK utility from the web page I wrote
 before and flash any program in binary, Intel Hex or Motorola S-Record
 format. It has a graphic and a command-line interface pretty near to
 perfect, for me.

 R#
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: RE : [fpc-pascal] Timezone information in a dataset datetime field?- updated

2011-07-25 Thread DaWorm
On Mon, Jul 25, 2011 at 11:53 AM, Mark Morgan Lloyd
markmll.fpc-pas...@telemetry.co.uk wrote:
 Link below looks directly relevant: it contains polygon data for each
 timezone, subject to knowing the current location.

 http://efele.net/maps/tz/world/

 I've confirmed that files are accessible (i.e. not subscription-only) but
 not investigated the format of the content.

Location may be off too.  All of the online location reporting tool
lists my work machine as being in TX, even though I'm in TN, since all
our networks are routed back to the home office before hitting the
cloud.

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


Re: RE : RE : [fpc-pascal] Installing FPC 2.4.4 for Ubuntu / Mint +otherthoughts

2011-06-15 Thread DaWorm
On Wed, Jun 15, 2011 at 5:08 PM, Ludo Brands ludo.bra...@free.fr wrote:
 We were talking to make fpc easier to install for the average ubuntu user.
 This is as clear as mud for the average user I would say.

Well, one would hope the average developer would be a bit farther
along the learning curve than the average user.  That said, I've
struggled with pinning packages in Ubuntu as well.  The thing is, I'd
never expect packages of the _development_ branch to ever play nice
with the _stable_ packages of the system.

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


Re: Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread DaWorm
On Fri, Apr 1, 2011 at 6:28 AM, José Mejuto joshy...@gmail.com wrote:
 An exception in free is an extreme rare condition, but it could
 happend, and is better that your software stops to work than notify 2
 years later that your 2 zillions of INI files were not written at all
 because the user write a non valid file path.

The test case was an invalid filename.  Is this the primary failure
method?  If so, then check this in the create, or the first write, (or
check any other reasons why writing to the file would fail) and throw
the exception there.  Then you should rarely if ever get to the
destructor with an unwritable file. Sure, someone could change the
permissions on you between the create and the destroy, but how likely
is that?

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


Re: Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread DaWorm
On Fri, Apr 1, 2011 at 9:09 AM, Bart bartjun...@gmail.com wrote:
 The test case was an invalid filename.  Is this the primary failure
 method?

 This was merely to demonstrate the possibility of the destructor failing.

What other things would make the destructor of the TIniFile fail?  It
seems to me like a lot of effort to trap something that will rarely
happen.  You can check for the likely things to go wrong up front
(invalid filename, path doesn't exist, no write permissions, disk
quota full, whatever else seems likely), and that would eliminate
almost anything that could possibly go wrong later (for this
particular component), apart from the aforementioned someone messing
with the file system behind your back.  Sure, it isn't complete, but
it is probably sufficient.

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


Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread DaWorm
On Wed, Mar 16, 2011 at 8:45 AM, Marcos Douglas m...@delfire.net wrote:
 The program was compiled in 32-bits but I have to know what kind of OS
 is running because my program needs to install somethings.

That's why I needed it too.  In my case, my code is always 32 bit, but
to install a smart card NULL driver, I needed to be able to adjust
both the 32 bit registry and the 64 bit registry.  Just adjusting the
32 bit registry wasn't enough.  I also had to make sure the code was
being ran as an administrator.

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


Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread DaWorm
On Wed, Mar 16, 2011 at 11:25 AM, Marcos Douglas m...@delfire.net wrote:
 I also had to make sure the code was
 being ran as an administrator.

 That's nice. Can you share the function?

Again, don't remember where I found this, Google or MSDN probably.
Only tested in Delphi.

function IsAdmin: Boolean;
{ -
  Returns a boolean indicating whether or not user has admin
  privileges. (Call only when running under NT.)

  - }
var
  hAccessToken   : tHandle;
  ptgGroups  : pTokenGroups;
  dwInfoBufferSize   : DWORD;
  psidAdministrators : PSID;
  int: integer;// counter
  blnResult  : boolean;// return flag

const
 SECURITY_NT_AUTHORITY: SID_IDENTIFIER_AUTHORITY = (Value:
(0,0,0,0,0,5)); // ntifs
 SECURITY_BUILTIN_DOMAIN_RID: DWORD = $0020;
 DOMAIN_ALIAS_RID_ADMINS: DWORD = $0220;
 DOMAIN_ALIAS_RID_USERS : DWORD = $0221;
 DOMAIN_ALIAS_RID_GUESTS: DWORD = $0222;
 DOMAIN_ALIAS_RID_POWER_: DWORD = $0223;

begin
 Result := False;
 ptgGroups := nil;
 blnResult := OpenThreadToken( GetCurrentThread, TOKEN_QUERY, True,
   hAccessToken );
 if ( not blnResult ) then
  begin
   if GetLastError = ERROR_NO_TOKEN then
blnResult := OpenProcessToken( GetCurrentProcess, TOKEN_QUERY,
   hAccessToken );
  end;
 if ( blnResult ) then
  try
   GetMem(ptgGroups, 1024);
   blnResult := GetTokenInformation( hAccessToken, TokenGroups, ptgGroups, 1024,
 dwInfoBufferSize );
   CloseHandle( hAccessToken );
   if ( blnResult ) then
begin
 AllocateAndInitializeSid( SECURITY_NT_AUTHORITY, 2,
   SECURITY_BUILTIN_DOMAIN_RID,
   DOMAIN_ALIAS_RID_ADMINS,
   0, 0, 0, 0, 0, 0,
   psidAdministrators );
 {$R-}
 for int := 0 to ptgGroups.GroupCount - 1 do
  if EqualSid( psidAdministrators, ptgGroups.Groups[ int ].Sid ) then
   begin
Result := True;
Break;
   end;
 {$R+}
 FreeSid( psidAdministrators );
end;
  finally
   FreeMem( ptgGroups );
  end;
end;
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread DaWorm
I've used this in Delphi 32 and it seems to work.  Forgot where I
pulled the basic info.  Probably doesn't do much on native 64 bit.

function Is64BitOS: Boolean;
type
  TIsWow64Process = function(Handle:THandle; var IsWow64 : BOOL) :
BOOL; stdcall;
var
  hKernel32 : Integer;
  IsWow64Process : TIsWow64Process;
  IsWow64 : BOOL;
begin
  // we can check if the operating system is 64-bit by checking whether
  // we are running under Wow64 (we are 32-bit code). We must check if this
  // function is implemented before we call it, because some older versions
  // of kernel32.dll (eg. Windows 2000) don't know about it.
  // see http://msdn.microsoft.com/en-us/library/ms684139%28VS.85%29.aspx
  Result := False;
  hKernel32 := LoadLibrary('kernel32.dll');
  if (hKernel32 = 0) then RaiseLastOSError;
  @IsWow64Process := GetProcAddress(hkernel32, 'IsWow64Process');
  if Assigned(IsWow64Process) then
   Begin
IsWow64 := False;
if (IsWow64Process(GetCurrentProcess, IsWow64)) then
 Result := IsWow64
   end;
  FreeLibrary(hKernel32);
end;

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


Re: Re[4]: [fpc-pascal] Text scan in text files - (was: Full text scan - PDF files)

2010-11-02 Thread DaWorm
On Tue, Nov 2, 2010 at 11:45 AM, Marcos Douglas m...@delfire.net wrote:

 If I found a match, I need to know which page the
 token was found...


That may prove most difficult, since I doubt your pdf to text will preserve
that very well.

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

Re: [fpc-pascal] TEventLog.FileName location: Change default file location for filename without change unit code.

2010-09-21 Thread DaWorm
On Tue, Sep 21, 2010 at 9:39 AM, Michael Van Canneyt mich...@freepascal.org
 wrote:

 begin
   Result:=ChangeFileExt(Paramstr(0),'.log');
 end;

 Function TEventLog.DefaultFileName : String;


On Windows, this can be problematic.  Win7 for sure, usually Vista, and any
version of Windows that has had its security tightened won't let you write
files into the application folder.

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

Re: [fpc-pascal] PC/SC

2010-09-01 Thread DaWorm
Project Jedi has translations for Delphi.  I don't know how easily
they could be used for Linux and the PC/SC Lite used there, but it
could be a helpful start.

If you don't mind me asking, which Mifare reader supports PC/SC?  I
use both chipcard and Mifare readers, but hadn't seen a PC/SC Mifare
reader before.

Jeff.

On Wed, Sep 1, 2010 at 4:12 PM, Johann Glaser johann.gla...@gmx.at wrote:
 Hi!

  For a project with wireless chip cards (MiFare) I'm using a reader which
  is accessed via the PC/SC interface. Did anybody write a Pascal unit to
  translate the C header files?

 Is this for linux or windows ?

 I'm working on Linux.

 Thanks
  Hansi


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

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