Re: [fpc-pascal] BSON formatter

2020-05-07 Thread Andreas Schneider

Am 2020-05-07 15:26, schrieb Ryan Joseph via fpc-pascal:

The amount of redundant information being sent around is ridiculous.
Mainly, the spec gives no way for the client to cache results and
refer to them later in various requests. We're literally sending
around mega bytes of data for no reason whatsoever, except lazy
programmers I guess.

Computers just keep getting slower and slower sometimes it feels...


That's the normal approach now. Why should you optimize anything if
you can simply buy better hardware? So I end up with a machine ten
times as fast as a few years ago and still cannot run much more in
parallel than back then, because even calendar apps are now written
with a full browser stack (looking at electron here).

As someone who still is happy when a GUI is a statically compiled
app that is < 10MB and doesn't take more than that as memory when
starting up, I am disgusted by the current "state of the art"
development. It's no longer an art.

(I am even more pissed off about this on my smartphone. Why does
a messenger app have to be 100 MB in size?! We had whole operating
systems in just 1% of that size. Even a full oracle database is
just around 30 MB if you strip away the java based management
console stuff ... and that thing is a feature monster for data
management.)



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


Re: [fpc-pascal] BSON formatter

2020-05-07 Thread Andreas Schneider

Am 2020-05-07 08:40, schrieb Ryan Joseph via fpc-pascal:

Working on the language server it's become clear that JSON is going to
be a killer bottleneck, but that's what Microsoft decided to use. It's
almost a deal breaker just because of the sheer size of the data due
to JSON's verbose plain text formatting.

I've seen there is such thing as BSON
(https://en.wikipedia.org/wiki/BSON) which could be implemented over
JSON without disrupting the underlying architecture. Is there any BSON
formatters for the FPC JSON libraries? It's just serializing in a
different text format so it's probably pretty easy to implement but I
thought I would ask first.


I would go with ProtoBuf for something like this. If you really want to
be flexibel in the datastructure, look at msgpack/messagepack. Both
(protobuf and msgpack) are pretty good in benchmarks.

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


Re: [fpc-pascal] "Hello world" syscalls

2020-01-09 Thread Andreas Schneider

Am 2020-01-09 00:30, schrieb Graeme Geldenhuys:

So the resulting Java.class is 16 MByte in size!!! How?


No it's not. I quote:


The size of all files which must be present at runtime (interpreters,
stdlib, libraries, loader, etc) are included.


So 16mb is pretty generous. I wouldn't immediately know how to strip
down the JRE to 16mb. Mine is ~300mb.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] heaptrc and high RAM usage

2016-03-30 Thread Andreas Schneider

Am 2016-03-30 13:35, schrieb Felipe Monteiro de Carvalho:

Any ideas if I should try something else instead of heaptrc? Or any
other ideas about what to do?


I think valgrind could be of more use in this case, since it has 
specific tools for profiling (not just error/leak detection):

http://valgrind.org/docs/manual/ms-manual.html

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


Re: [fpc-pascal] libxml on MacOS X

2015-02-22 Thread Andreas Schneider


Oh god, that must have been tunnel vision. Yeah, that was the obvious 
next step. Thanks :-)


I compiled all the supplied examples and ran them, and they seem to 
print plausible results.
The only hurdle is, that ld doesn't pick up libxml2.dylib on its own - 
for whatever reason.


I had to explicitly add {$linklib xml2} to the code to get it to link.
(Although in the code it explicitly references 
'libxml2.'+sharedsuffix; already, which should have the same result, 
imho.)


Can I easily install the libxml package into my installed fpc for the 
given target? (by using fppkg, fpmake, or whatever?)

Marco van de Voort mailto:mar...@stack.nl
21. Februar 2015 20:33

Copy libxml/src/* simply to your working dir and compile your demo ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] libxml on MacOS X

2015-02-21 Thread Andreas Schneider

Hello,

is there a specific reason why libxml is not built for MacOS X / darwin?
My first instinct was to just try it and but then I found out the hard 
way, that I have no idea how to correctly use fpmake ...


So in case there is simply no one who tried libxml on OSX, I would be 
willing to do. However, how to correctly build it?
I modified fpmake.pp to include darwin as possible target, but calling 
fpmake fails:


./fpmake
The installer encountered the following error:
Could not find unit directory for dependency package rtl

What would be the best next step from here?

Thanks!

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


Re: [fpc-pascal] SourceForge April 2014 Project of the Month: Free Pascal

2014-04-15 Thread Andreas Schneider

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 15.04.2014 14:43, João Marcelo Vaz wrote:
 Congratulations, FreePascal!

 http://sourceforge.net/blog/april-2014-project-of-the-month-free-pascal
I just saw that news too in the SourceForge newsletter :-) That's really
awesome!

Hopefully this pushes FreePascal further. It's such a great compiler and
platform to work with.

Thanks to all developers and contributors for offering us such a
fantastic toolset (especially Lazarus is outstanding in regards to RAD
GUI development).

Thanks!!

- -- 
Best Regards,
Andreas
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlNNb6YACgkQIxziJkiYZxEcXgD/R9urZy/M04idzZ5nzewBJpEb
/dg6GbsewX08RVZ6IdUA/0Ql3j36hUnxk809cWLXZuwV3e0pv7WwjH7l4IR3wAbH
=kj/y
-END PGP SIGNATURE-

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


Re: [fpc-pascal] Cloning objects?

2014-03-20 Thread Andreas Schneider
On 19.03.2014 23:01, Timothy Groves wrote:
 Is there a drop-dead simple way to clone an object?

 I've got a small tree of classes (tBaseProfile, and four descendants
 of such).  Only the descendant classes are instantiated.  I need to be
 able to create new copies of these objects for use in other lists.

 At the moment, I am writing a Duplicate method that returns the new
 object.  But this means assigning all of the data to the duplicated
 object.  There must be an easier way!
There is usually a good reason to NOT do it blindly for all members and
why you don't find a default clone method in any programming language
in can think of right now.

Just think about it: you clone a database object (from an ORM or
similar). How far does the clone/copy go? Will you also clone the
associated database connection object? Probably not, so your manual code
would only assign the same reference to the clone. However the table
name, field name, sql statement etc. will be copied.

Or think about file access: your object has a TFileStream as member.
Will you clone that? What if the access was read/write and maybe even
exclusive?

IMHO there is no one-size-fits-all here.

Best regards,
Andreas



signature.asc
Description: OpenPGP digital signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-27 Thread Andreas Schneider
On Saturday, November 16, 2013, at 02:36 Martin wrote:
 On 16/11/2013 01:03, Timothy Groves wrote:

 Here's the code I *actually* have in the method:

 var
   index,
   last : integer;
 begin
   last := length (t_volumes) - 1;
   index := 0;
   while ((t_volumes [index]  t_current_volume) and (index  last)) do
   inc (index);
   if (index  last) then begin
 t_volumes [index] := t_volumes [last];
 Objects are actually stored via a reference (internal pointer)
 So t_volumes [last] just points to the objects data

 The above statement duplicates the reference

 t_volumes [last].Destroy;

 destroys the object pointed to by both: t_volumes [last] and t_volumes
 [index]

 You should have destroyed t_volumes [index] *before* copying the value

Maybe a bit late, but that might not be true.
If  Timothy  really talks about _object_ (and not _class(TObject)_) it
should work as he does it. Also Destroy would probably be appropriate.

Just saying :-)

The actual type defs used are missing.

-- 
Best Regards,
Andreas

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


Re: [fpc-pascal] Bootstrap binaries

2013-03-04 Thread Andreas Schneider
On Monday, March 4, 2013, at 01:59 Joao Morais wrote:
 Hello list. How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap
 like lists are built? I missed at least i386-linux and i386-win32
 binaries. Just to know how I will update my drafts.

 Joao Morais


I guess bootstrap isn't necessary when the full compiler is available.
Which it is for i386-linux and i386-win32 (see directory above).

-- 
Best Regards,
Andreas

pgp4Vt49BdRvj.pgp
Description: PGP signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Cross platform signal handler?

2012-07-16 Thread Andreas Schneider
On Sunday, July 15, 2012, at 14:48 leledumbo wrote:
 It will depend on what you want to achive. So, what do you need it for?

 Handle Ctrl+C and other kinds of forced program termination.

Take a look here
http://hg.aksdb.de/CentrED/files/3bf040abc0311f68ad6c90486625fac2ce914c80/Server/UCEDServer.pas#L78-105

and here
http://hg.aksdb.de/CentrED/files/3bf040abc0311f68ad6c90486625fac2ce914c80/Server/UCEDServer.pas#L351-359

-- 
Best Regards,
Andreas

pgpVV4VtoVtbY.pgp
Description: PGP signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Andreas Schneider
On Sunday, January 15, 2012, at 15:04 Mattias Gaertner wrote:
 On Sun, 15 Jan 2012 05:58:21 -0800 (PST)
 Malvin malvin...@gmail.com wrote:

 So far i've managed to do the program quite well, and I was wondering, can
 i close the main form (form1) whils opening form2 and not closing the app?
 Is there any way that I can do it?

 If you mean LCL forms: The MainForm can not be closed, but you can hide
 it.

But  you can trick the LCL into changing what Form is considered to be
the MainForm.

Btw.  is  there any chance for having an official way to do this? i.e.
making  TApplication.MainForm  a  writable  property? (I ask this here
instead  of  opening  a ticket because I suspect there's a good reason
why this isn't available yet, which you will tell me now. :-))

-- 
Best Regards,
Andreas

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


Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Andreas Schneider
On Tuesday, January 17, 2012, at 13:15 Felipe Monteiro de Carvalho wrote:
 If the use case is closing the main form without quitting the
 application, then I would prefer a property
 TApplication.QuitApplicationWhenMainFormCloses or something like that.


My current use case is:
- show a login form
- when login succeeds, show a progress form (connection  initialization) and 
close login
- on failure: go back to login
- on success: show the actual application form and close the login form

Showing the main form always wouldn't seem nice. Starting the application 
with the
mainform hidden doesn't work afaik. You can hide it manually AFTER it was shown 
(.Hide),
but Visible=False is ignored on startup. This just doesn't look nice if the 
main form
pops up for a second to be hidden again. So I use the workflow described above, 
which
changes the current Application.MainForm several times.

-- 
Best Regards,
Andreas

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


Re: [fpc-pascal] Division by Zero

2011-08-23 Thread Andreas Schneider

At Tuesday, 23.08.2011 on 8:57 Michael Fuchs wrote:
 Hello,
 
WriteLn(FloatToStr(100 / 0));
 
 This code prints on the screen +Inf, but I think it should be NaN.
 Is this a bug or a special case in computer arithmetic?

http://en.wikipedia.org/wiki/Division_by_zero#In_computer_arithmetic

-- 
Best Regards,
Andreas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] compiling turbo power lockbox on ubuntu 64

2011-07-26 Thread Andreas Schneider
At Tuesday, 26.07.2011 on 10:13 herux wrote:
 Hi,
 I use RSA encryption library lockbox turbo power.
 in a windows environment I managed to compile and the apps working well, I
 use {$ mode delphi}. 
 but when I compile it on ubuntu 64bit, there is an error when compiling
 
 
 component/LockBox/LbCipher.pas(708,10) Error: Unknown identifier EBX
 component/LockBox/LbCipher.pas(708,10) Warning: No size specified and unable
 to determine the size of the operands, using DWORD as default
 component/LockBox/LbCipher.pas(709,10) Error: Unknown identifier EAX
 component/LockBox/LbCipher.pas(709,10) Warning: No size specified and unable
 to determine the size of the operands, using DWORD as default
 component/LockBox/LbCipher.pas(710,13) Error: Unknown identifier EAX
 component/LockBox/LbCipher.pas(710,15) Error: Assembler syntax error in
 operand
 component/LockBox/LbCipher.pas(710,19) Error: Unknown identifier EAX
 component/LockBox/LbCipher.pas(710,19) Error: Assembler syntax error in
 operand
 component/LockBox/LbCipher.pas(711,12) Error: Unknown identifier BH
 component/LockBox/LbCipher.pas(711,14) Error: Unknown identifier AL
 component/LockBox/LbCipher.pas(712,12) Error: Unknown identifier BL
 component/LockBox/LbCipher.pas(712,14) Error: Unknown identifier AH
 component/LockBox/LbCipher.pas(713,13) Error: Unknown identifier EBX
 so on ...
 
 asm delphi like code doesn't compiled right ? but why on windows compiled ?
 
 I am trying to cross compile it in windows, for linux x86_64, and produces
 the same error.
 whether the asm code is not supported for 64bit?

Assembler code is (highly) processor dependent. x86_64 is a different 
architecture from x86 (well, it's actually an extension, but with certain 
restrictions/changes). x86_64 can still execute 32bit code, but if you want a 
64bit application, the assembler code has to be written for 64bit aswell. If 
you want to compile for ARM, you have to write assembler for ARM. Same 
procedure with SPARC, POWER, etc.

In other words: you can't use that 32bit ASM when compiling as/for 64bit.

That's one of the reasons why you should avoid assembler whenever possible - 
and for LockBox it certainly was possible, but TurboPower liked to optimize 
their code by using loads of assembler.

-- 
Best Regards,
Andreas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : [fpc-pascal] compiling turbo power lockbox on ubuntu 64

2011-07-26 Thread Andreas Schneider
At Tuesday, 26.07.2011 on 15:31 herux wrote:
 thanks for the info for you guys, 
 where can I read the complete freepascal asm document for 64bit ?

Assembler is not FreePascal specific.

But before you rewrite that Assembler into x86_64 compatible Intel assembler, 
you better rewrite it into native (Object)Pascal and get rid of the assembler 
code at all. It's a lot easier to write and to maintain. Plus you also get rid 
of platform specific code and most likely even gain performance, since the old 
code probably doesn't utilize all the current extensions like SSE(2, 3, 4, ...) 
and other things the compiler MIGHT do better.

-- 
Best Regards,
Andreas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Memory leak or object destruction?

2011-02-03 Thread Andreas Schneider

On Wed, 2 Feb 2011 21:09:42 -0800, Andrew Hall wrote:

Interfaces support reference counting.


Only COM interfaces, but they are currently the default anyway.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: How to use GetElementById?

2011-01-30 Thread Andreas Schneider
Title: Re: [fpc-pascal] Re: How to use GetElementById?


On Sunday, January 30, 2011 13:52 silvioprog wrote:




Sorry... but nobody? :(



Well, when you crosspost to two mailing lists (which you shouldn't ...), then also check both of them ;-) There was an answer on the Lazarus ML.

--
Best Regards,
Andreas

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

Re: [fpc-pascal] Converting .doc and/or .html to .pdf

2011-01-28 Thread Andreas Schneider
On Friday, January 28, 2011 15:52 Marcos Douglas wrote:
 You're right. The command line is more simple.
 Thanks for the tip, I will try this.

 I have not found

Since  you also mentioned that you need to access it from ASP, I guess
that one might offer you the most flexibility:
http://www.artofsolving.com/opensource/jodconverter

...  because you can run it as webservice. Or you can simply invoke it
from commandline.

-- 
Best Regards,
Andreas

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


Re: [fpc-pascal] How to convert a large integer to base64

2011-01-15 Thread Andreas Schneider
On Saturday, January 15, 2011 18:52 Frank Church wrote:

 Is there a FCL library that can be used to convert a large integer into 
 base64 format?


Define  large  integer  ... in case you mean a normal integer/int64:
IntToHex(...);

-- 
Best Regards,
Andreas

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


Re: [fpc-pascal] How to convert a large integer to base64

2011-01-15 Thread Andreas Schneider
On Saturday, January 15, 2011 21:42 Frank Church wrote:
 I mean int64 into base64 encoding, as in the mime type. 

Oops,  my  bad.  Then yeah, as Henry said the base64 unit should help.
Depending  on  who and how the number is to be decoded then, you could
also  take  a look at strutils.Dec2Numb which can convert from decimal
into any given number system. (... and the opposite Numb2Dec)

-- 
Best Regards,
Andreas

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


Re: [fpc-pascal] Converting .doc and/or .html to .pdf

2011-01-15 Thread Andreas Schneider
On Saturday, January 15, 2011 22:18 Marcos Douglas wrote:
 Hi,
 There are libs, in Pascal,  to convert .doc and/or .html files to .pdf?

I   don't   think   so,   but  I  would  suggest  to  use  a  headless
OpenOffice.org/LibreOffice  for  the  conversion. Using the Pascal UNO
Bridge  you  may even be able to control it from a Pascal application,
but  for a simple conversion it's probably a lot easier to just invoke
it via commandline.

-- 
Best Regards,
Andreas

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


Re: [fpc-pascal] The new Delphi compatible unicode string

2011-01-04 Thread Andreas Schneider

On Tue, 4 Jan 2011 14:20:55 +0200, Juha Manninen wrote:


If I told to a Java programmer that Object Pascal features match Java
features, how would I prove it? By showing him the HTML component 
code?


IFDEFs and self-made conversion funcs just to support different 
string types.

The Java guy would ask if there is any common unicode string type. I
would say
Not yet but it's coming, but we can't use it because we must support
the old
compiler versions.

The code also has lots of containers and thousands of typecasts to 
access
their elements which could be eliminated by using generics 
containers.

I would explain to the Java person: Object Pascal already has
generics but we
can't use them because we must support the historical Pascal syntax.

I would also laugh if I was the Java developer.
So, the minimum requirements for the modernized HTML component would
be Delphi
2009 / FPC with the new unicode support.


If a Java developer ever pulls that argument, slap him in the face. 
Just look at some of the common Java libraries ... for example SWT. It 
is probably still compatible to Java 1.4 or even 1.3 (hell it could even 
be 1.2). For that reason it doesn't use generics and not even enums 
(which came with Java 1.5 ... yeah, no real type safety in that regard 
until then). It also took until Java 1.5 to have a for-each loop, so 
even in that regard FPC isn't really behind.


But Java is a bad example anyway ... if you read the fine Execution in 
the Kingdom of Nouns[1] by Steve Yegge, FPC will get a pretty good look 
;-) (Although he doesn't mention FPC, the points he makes with C++ match 
FPC just as well).


Best Regards,
Andreas.


[1] 
http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html

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


Re: [fpc-pascal] Re: Reading MDB (MS-Access) data under Linux

2010-11-01 Thread Andreas Schneider

On Mon, 01 Nov 2010 13:34:00 +0100, Bo Berglund bo.bergl...@gmail.com
wrote:
 Just tacking on the other MS database MSSQLServer:
 Is it possible to also work with MS SQLServer databases via ODBC on
 FPC from Linux? Obviously the SQLServer must be running on Windows so
 this is about network access to the database engine.
 When I make data sources in Windows for these databases I do not use
 ODBC but a native SQLServer driver, is such available also on Linux?
 
 Bo Berglund

I only know of a unixodbc driver called FreeTDS. I successfully
connected to a MSSQL Server 2008 from my FPC application on Linux, using
unixodbc, freetds and sqldb :)

Best Regards,
Andreas Schneider.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TFileStream and stdin - how to make this work?

2010-10-03 Thread Andreas Schneider

On Sun, 03 Oct 2010 15:05:10 +0200, Bernd Kreuss
prof7...@googlemail.com wrote:
 Hi,
 
 this might be a stupid question but I find myself again struggling with
 file IO and stdin/stdout. I am trying to do the following:
 
 StdIn := TFileStream.Create('/dev/stdin', fmOpenRead);
 
 and later on i want to poll whether there is something to read. I want
 to try reading binary data that will be piped to my application and i
 need to poll (non blocking!) and in case of incoming data read the first
 byte to determine the type of message that has arrived and then read the
 rest.
 
 The Stream seems to be able to read when there is something to read on
 stdin but I cannot find any way to actually test whether the ReadByte()
 will block (nothing to read) or whether there is data available.
 
 the properties size and position both are always $ and
 the stream has no eof property.
 
 Can this be done at all? And is my way of opening the stream correct?
 What would be a more platform independent way of opening the stdin as a
 stream to read binary data or is there a different and better way to do
 this, maybe a stream is not the correct thing for this at all? How do I
 poll and read binary data from stdin?
 
 Bernd

You could use TIOStream from the unit iostream. AFAICS that should do
exactly what you want - i.e. opening stdin/out/err as a TStream
descendant.
I don't know however, if that fixes the problem you have with the
stream blocking when nothing is to be read. If nothing else helps I
guess you could use a thread to read the data from stdin, then it
shouldn't matter if it blocks.

Best regards,
Andreas.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Hashmap for integers

2010-08-22 Thread Andreas Schneider

On Sun, 22 Aug 2010 17:05:21 +0300, Juha Manninen (gmail)
juha.mannine...@gmail.com wrote:
 Hi
 
 Is there an implementation of a hash map where the keys are integers. It
 is 
 needed when the integers are too big for a lookup array.
 I only need check the existence of keys so the data type is not
important.
 About like this:

uses fgl;

type
  TIntMap = specialize TFPGMapInteger, Integer; //Maps Int -- Int

 var
   Len: integer;
   SeenLen: TIntMap; // or whatever the type is called
 
   ...
 
   if not SeenLen.Has(Len) then begin
 ... work with Len ...
 SeenLen[Len] := nil;  // If the data type is pointer
   end;
 
 
 A related question:
 What is the state of the generic containers now?

FPC 2.4.x should be fine with generics, although 2.5 is still more
advanced in that sector.

Best regards,
Andreas.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] OFF TOPIC - how I can migrate of Delphi to FPC

2010-08-15 Thread Andreas Schneider

On Sun, 15 Aug 2010 09:59:10 -0300, Marcos Douglas m...@delfire.net wrote:
 Zeoslib uses ADO too. So, it could be used with MS SQLServer.
 I think Zeoslib is more faster than ODBC.

That depends on the platforms you want to target. AFAIK ADO is
Windows-only, so you bind yourself to Microsoft platforms. If you intend to
use *nix too, ODBC is the safer way to go, thanks to unixodbc (which can
use FreeTDS, a free implementation of the Sybase protocol as used by Sybase
and SQL Server). If you have the necessary time at hand, you can maybe
implement your own backend for SQLDB/ZEOS that directly uses FreeTDS,
completely skipping ODBC/ADO and still being platform independent.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] LNet

2010-06-11 Thread Andreas Schneider
Am Freitag 11 Juni 2010, 18:50:56 schrieb Felipe Monteiro de Carvalho:

 And from my tests Get is indeed returning the amount read. I still
 don't know if half a packet could be received in the OnReceive event
 or if it only returns an integer amount of packets. That makes
 difference in the algorithm to separate the packets.

IMHO your packets (not the TCP ones, I mean you own protocol) should always 
account for incomplete packets. Advantages: you can send more than the TCP 
window allows (which is usually around 60k bytes IIRC), and it doesn't matter 
if you get more than one packet with your Get - which also can happen.

I usually keep a pretty simple binary protocol. A Packet consists of a Packet 
ID (byte or word or whatever amount of possible packets you need), and if that 
doesn't imply the size, that one too.
So let's say packet IDs 1 to 5 are fixed size, I wouldn't need to supply their 
size too - would be a waste of bandwidth. Packet ID 6 however contains a text, 
so right after the packet ID I also send the expected packet size.

On Receive, I write all that Get returns into a buffer (a queue to be more 
precise). Then I loop through that buffer for as long as it contains data and 
as the size of the buffer is equal or greater than the size of the next packet. 
Once I'm out of that loop, I get back to the wait-for-more state (i.e. Get, 
Get, Get :D)

I do the same when sending: I put everything to send into a buffer, and then 
send it in as much chunks as necessary - Send will return how much it actually 
sent, that's the amount I take out of my send-buffer, and repeat, until the 
buffer hits zero or until the amount Send returns equals the amount in the 
buffer (whatever you prefer).

If you want to see that implementation, let me know, it's opensource anyway.

Best Regards,
Andreas.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] creating a standalone executable (eg: application installation file)

2010-01-12 Thread Andreas Schneider
Hi,

that works the same as in Windows and can probably be done with every 
executable format. Simply append the data to the end of the file and store the 
offset or length of that data at the end. All you have to do then is to let 
the program open itself (ParamStr(0)), seek to the end - SizeOf(Integer), 
read that integer to know the offset of the data, seek to that position, and 
read all you need from there. So essentially your file looks like:
original executableinstall datadata offset

(Of course you can also include the data offset hardcoded into the 
executable, but that's a bit harder to manage ... first compile to know the 
exe size, then change the constant storing that size, and recompile again ...)

Best regards,
Andreas.


Am Dienstag 12 Januar 2010 13:37:26 schrieb Graeme Geldenhuys:
 Hi,
 
 I have seen a few Linux application that have standalone executables
 that are installation programs. Once run, it installs the application
 in the appropriate directory location, can run as root or normal user
 and creates a desktop and Application menu icon. Similar to Windows's
 setup.exe idea. An example of such a Linux application is
 'installpixel32' from the Pixel32 project, or Kylix 3 installation.
 
 * How does one create such a standalone application?
 * How do you include the application executable and other resources
 (text, image, sound files etc) inside such an installation executable?
 
 
 I'm trying to create (mainly for our company, but probably open-source
 in the end) such a standalone setup creation for our projects. This
 way it will be Linux distro independent. I also don't want to go the
 route of projects like AutoPackage that first requires a setup runtime
 to be installed. I want a installation file like what Pixel32 did. One
 installation executable without any installation runtime etc. and
 after the installation, I can simply click on 'uninstall' or run
 'setup -u' and a graphical uninstaller is launched.
 
 I'm going to look at Loki Games's setup program to see if I can port
 it to fpGUI Toolkit, or at least get some ideas of how to create such
 a setup application. Basically I'm trying to create a InstallShield
 Lite but for Linux. :-)  The nice thing of Loki Games is that it run
 run as a console installation or a GUI installation - again, no idea
 how they managed that, but it was possible (Kylix 3 installation did
 that).
 
 Anybody have pointers or internet links I can read up on the subject?
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: creating a standalone executable (eg: application installation file)

2010-01-12 Thread Andreas Schneider
I think if digital signing is required, using Windows Resources would be the 
better way. Now that I think about it, with FPC 2.4 that should even be 
possible on Linux (and other platforms). Many roads lead to rome :D


Am Dienstag 12 Januar 2010 14:17:21 schrieb Milan Marusinec:
 Andreas Schneider wrote:
  Hi,
 
  that works the same as in Windows and can probably be done with every
  executable format. Simply append the data to the end of the file and
  store the offset or length of that data at the end. All you have to do
  then is to let the program open itself (ParamStr(0)), seek to the end -
  SizeOf(Integer), read that integer to know the offset of the data, seek
  to that position, and read all you need from there. So essentially your
  file looks like: original executableinstall datadata offset
 
 Andreas,
 
 Will this method work when the exe is digitally
 signed afterwards (or before) ?
 
 (tough, for linux it doesn't matter)
 
 Milan
 
 ___
 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


[fpc-pascal] Class Operators

2009-12-11 Thread Andreas Schneider
Hi,

since my reported bug (http://bugs.freepascal.org/view.php?id=15315) seems 
to turn out to be by design, a question came up:
are there any plans to implement class operators? In delphi they are 
implemented to allow operators to affect instances of classes. This would also 
enable to write operator overloads that work with generics. A good example of 
that would be smartpointers. A small snippet from an example in delphi:

  TSmartPointerT: class = record
  strict private
FValue: T;
FLifetime: IInterface;
  public
constructor Create(const AValue: T); overload;
class operator Implicit(const AValue: T): TSmartPointerT;
property Value: T read FValue;
  end;

There are surely other cases where class operators would fit in nice. They 
could for example allow to build something like TPersistent.Assign as := 
operator.

Is this already on a todo-list or am I out of luck here?

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


Re: [fpc-pascal] Free Pascal created libraries used by other languages

2009-12-09 Thread Andreas Schneider
Am Mittwoch 09 Dezember 2009 15:26:11 schrieb Graeme Geldenhuys:

 But clearly this language relationship is a very one-sided thing. We use
 their (C/C++) libraries, they don't use ours. :-(

Just look at the QT bindings. The LCL can't simply use QT, it has to use a 
wrapper library that flattens the object oriented structure of QT. You have 
similar problems with most languages. Writing bindings to foreign language 
libraries is always problematic. C (i.e. a flat API) is usually the common 
denominator.

Best Regards,
Andreas.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal