Re: [fpc-pascal] Re: SQLdb: TMSSQLConnection: using Instance name in Host

2013-06-22 Thread Ludo Brands
On 06/21/2013 09:12 PM, Marcos Douglas wrote:
 On Fri, Jun 21, 2013 at 4:08 PM, Marcos Douglas m...@delfire.net wrote:
 On Fri, Jun 21, 2013 at 3:59 PM, Ludo Brands ludo.bra...@free.fr wrote:
 Ah, just found out that DBSETAPP is wrongly defined for FreeTDS.
 It should be 5 instead of 4 according to include/sybdb.h.
 Try dbsetlname(FDBLogin, PChar('MyApp'), 5);

 Aff! I would post before you!  :)

 You're right I used DBSETID:
   dbsetlname(FDBLogin, PChar('MyApp'), DBSETID);

 You think is better use 5 instead DBSETID? The source will change?

 Thank you very much!
 
 Ah, you want a patch? -- should check the Params if there is the
 'Application Name' parameter.
 

Can you confirm it works with dbsetlname(FDBLogin, PChar('MyApp'), 5) ?
If that is the case I'll make a patch for dblib.pp and will add an
application parameter to mssqlconn.

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


Re: [fpc-pascal] Non-Latin (non-English) identifiers for COM automation

2013-06-22 Thread Max Vlasov
Sven, thanks,

I did something like this. Luckily both Delphi and fpc have a function
variable VarDispProc doing all the job. So my function calling a name
without parameters look very simple



type
  TVarDispInvoke = procedure(Result: PVariant; const Instance: Variant;
CallDesc: PCallDesc; Params: Pointer); cdecl;

function DCNA(Instance: Variant; const Name: string): Variant;
var
  CallDesc: TCallDesc;
begin
  CallDesc.CallType:=DISPATCH_METHOD;
  CallDesc.ArgCount:=0;
  CallDesc.NamedArgCount:=0;
  StrPCopy(@CallDesc.ArgTypes[0], Name);
  TVarDispInvoke(VarDispProc)(@Result, Instance, @CallDesc, Nil);
end;

.

So for an OleVariant instance V the calls
  V.SomeMethod
and
  DCNA(V, 'Somemethod')

are equivalent. Only that the latter can accept Cyrillic methods now

Max


On Sat, Jun 22, 2013 at 12:40 AM, Sven Barth pascaldra...@googlemail.comwrote:

 On 21.06.2013 09:01, Max Vlasov wrote:

 Hi,

 is it possible for fpc to allow using non-english characters for symbols
 when COM-automation is used?
 An accountant-related application very popular here in Russia mostly
 uses Cyrillic symbols for naming methods and properties of their OLE
 Object. They probably have English counterparts, but they're very hard
 to find since not so many uses this software outside of Russia.

 Delphi starting some version seems to support non-latin identifiers, at
 least I saw examples at the web. But I currently doesn't have access to
 latest versions.

 Or is there any other way to access some ole identifier other than
 direct referencing so instead of
 ...
OleVariant.**SomeMethodMaybeNonLatin...
 ...
OleVariant.IntermediateAccess(**'SomeMethodMaybeNonLatin') 


 It *should* work by casting your OleVariant to a IDispatch (e.g.
 IDispatch(MyOleVariant) ) and then calling GetIDsOfNames and Invoke. For
 more information please take a look at the MSDN documentation of IDispatch
 here: http://msdn.microsoft.com/en-**us/library/windows/desktop/**
 ms221608%28v=vs.85%29.aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ms221608%28v=vs.85%29.aspx
 You might also try to find examples for Delphi where GetIDsOfNames and
 Invoke are used directly as I've never done this before...

 Regards,
 Sven
 __**_
 fpc-pascal maillist  -  
 fpc-pascal@lists.freepascal.**orgfpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/**mailman/listinfo/fpc-pascalhttp://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: SQLdb: TMSSQLConnection: using Instance name in Host

2013-06-22 Thread Marcos Douglas
On Sat, Jun 22, 2013 at 4:35 AM, Ludo Brands ludo.bra...@free.fr wrote:
 On 06/21/2013 09:12 PM, Marcos Douglas wrote:
 On Fri, Jun 21, 2013 at 4:08 PM, Marcos Douglas m...@delfire.net wrote:
 On Fri, Jun 21, 2013 at 3:59 PM, Ludo Brands ludo.bra...@free.fr wrote:
 Ah, just found out that DBSETAPP is wrongly defined for FreeTDS.
 It should be 5 instead of 4 according to include/sybdb.h.
 Try dbsetlname(FDBLogin, PChar('MyApp'), 5);

 Aff! I would post before you!  :)

 You're right I used DBSETID:
   dbsetlname(FDBLogin, PChar('MyApp'), DBSETID);

 You think is better use 5 instead DBSETID? The source will change?

 Thank you very much!

 Ah, you want a patch? -- should check the Params if there is the
 'Application Name' parameter.


 Can you confirm it works with dbsetlname(FDBLogin, PChar('MyApp'), 5) ?
 If that is the case I'll make a patch for dblib.pp and will add an
 application parameter to mssqlconn.

Yes, I confirm. The ApplicationName was shown in Profiler tool.

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


Re: [fpc-pascal] Re: SQLdb: TMSSQLConnection: using Instance name in Host

2013-06-22 Thread Ludo Brands
On 06/22/2013 03:20 PM, Marcos Douglas wrote:
 On Sat, Jun 22, 2013 at 4:35 AM, Ludo Brands ludo.bra...@free.fr wrote:
 Can you confirm it works with dbsetlname(FDBLogin, PChar('MyApp'), 5) ?
 If that is the case I'll make a patch for dblib.pp and will add an
 application parameter to mssqlconn.
 
 Yes, I confirm. The ApplicationName was shown in Profiler tool.

Patch in http://bugs.freepascal.org/view.php?id=24635. New parameter is
ApplicationName.

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


[fpc-pascal] FPC under CentOS x64

2013-06-22 Thread Robert Wolfe
Hi all!  Just installed this and am getting the following message 
whenever I go to try to run any of the binaries that are included in the 
package (fp, ppcx64, etc):


[robert@shell bin]$ fpc
bash: /usr/bin/fpc: cannot execute binary file
[robert@shell bin]$ fp
bash: /usr/bin/fp: cannot execute binary file

This is CentOS 6.4 x86_64 with all the latest updates for my setup 
applied.  Is there something I am issing here that I need to get FP to run?

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


Re: [fpc-pascal] FPC under CentOS x64

2013-06-22 Thread Jonas Maebe

On 22 Jun 2013, at 15:46, Robert Wolfe wrote:

 Hi all!  Just installed this and am getting the following message whenever I 
 go to try to run any of the binaries that are included in the package (fp, 
 ppcx64, etc):
 
 [robert@shell bin]$ fpc
 bash: /usr/bin/fpc: cannot execute binary file
 [robert@shell bin]$ fp
 bash: /usr/bin/fp: cannot execute binary file
 
 This is CentOS 6.4 x86_64 with all the latest updates for my setup applied.  
 Is there something I am issing here that I need to get FP to run?

What does
  file `which fpc`

show?


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


Re: [fpc-pascal] Re: SQLdb: TMSSQLConnection: using Instance name in Host

2013-06-22 Thread Michael Van Canneyt



On Sat, 22 Jun 2013, Ludo Brands wrote:


On 06/22/2013 03:20 PM, Marcos Douglas wrote:

On Sat, Jun 22, 2013 at 4:35 AM, Ludo Brands ludo.bra...@free.fr wrote:

Can you confirm it works with dbsetlname(FDBLogin, PChar('MyApp'), 5) ?
If that is the case I'll make a patch for dblib.pp and will add an
application parameter to mssqlconn.


Yes, I confirm. The ApplicationName was shown in Profiler tool.


Patch in http://bugs.freepascal.org/view.php?id=24635. New parameter is
ApplicationName.


Applied.

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


Re: [fpc-pascal] FPC under CentOS x64

2013-06-22 Thread Robert Wolfe

On 06/22/2013 08:50 AM, Jonas Maebe wrote:

On 22 Jun 2013, at 15:46, Robert Wolfe wrote:


Hi all!  Just installed this and am getting the following message whenever I go 
to try to run any of the binaries that are included in the package (fp, ppcx64, 
etc):

[robert@shell bin]$ fpc
bash: /usr/bin/fpc: cannot execute binary file
[robert@shell bin]$ fp
bash: /usr/bin/fp: cannot execute binary file

This is CentOS 6.4 x86_64 with all the latest updates for my setup applied.  Is 
there something I am issing here that I need to get FP to run?

What does
   file `which fpc`

show?



[robert@shell ~]$ which fpc
/usr/bin/fpc

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


Re: [fpc-pascal] FPC under CentOS x64

2013-06-22 Thread Jonas Maebe

On 22 Jun 2013, at 16:33, Robert Wolfe wrote:

 On 06/22/2013 08:50 AM, Jonas Maebe wrote:
 On 22 Jun 2013, at 15:46, Robert Wolfe wrote:
 
 [robert@shell bin]$ fpc
 bash: /usr/bin/fpc: cannot execute binary file
 [robert@shell bin]$ fp
 bash: /usr/bin/fp: cannot execute binary file
 
 This is CentOS 6.4 x86_64 with all the latest updates for my setup applied. 
  Is there something I am issing here that I need to get FP to run?
 What does
   file `which fpc`
 
 show?
 
 [robert@shell ~]$ which fpc
 /usr/bin/fpc

And
  file `which fpc`

?


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


[fpc-pascal] Overloading properties

2013-06-22 Thread Michael Fuchs

Hello,

I try to define classes with properties an additional fluent setters. 
Unfortunally the compiler does not allow the fluent methods have the 
same names as the properties.


project1.lpr(18,24)
Error: overloaded identifier MyString isn't a function

Of course I could rename these methods and add a prefix like Set..., but 
I want to know why this limitation is. And if it is possible to get rid 
of it and allow the overloading of properties with methods.



Thanks
Michael

And please take a look to the example program:


---8--8--8--8--8--8--8---

program OverloadingTest;
{$mode objfpc}{$H+}

uses
  Classes, SysUtils;

type
  TMyObject = class(TObject)
private
  FMyBoolean: Boolean;
  FMyInteger: Integer;
  FMyString: String;
public
  property MyString: String read FMyString write FMyString;
  property MyBoolean: Boolean read FMyBoolean write FMyBoolean;
  property MyInteger: Integer read FMyInteger write FMyInteger;
public
  function MyString(Value: String): TMyObject;
  function MyBoolean(Value: Boolean): TMyObject;
  function MyInteger(Value: Integer): TMyObject;
  end;

function TMyObject.MyString(Value: String): TMyObject;
begin
  FMyString := Value;
  Result := Self;
end;

function TMyObject.MyBoolean(Value: Boolean): TMyObject;
begin
  FMyBoolean := Value;
  Result := Self;
end;

function TMyObject.MyInteger(Value: Integer): TMyObject;
begin
  FMyInteger := Value;
  Result := Self;
end;


var
  o: TMyObject;

begin
  o := TMyObject.Create.MyString('Test').MyBoolean(True).MyInteger(42);
end.

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


[fpc-pascal] How to use UPnP to create port forward in the router?

2013-06-22 Thread Dennis Poon
I know some software can use UPnP to add a port forwarding rule to the 
router automatically. I want to do the same with FPC.
Anyone has any idea on how to do so without using Microsoft's API?  I 
want a linux approach, possibly cross platform is possible.


Thanks.

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

Re: [fpc-pascal] FPC under CentOS x64

2013-06-22 Thread Robert Wolfe

[robert@shell ~]$ file 'which fpc'
which fpc: cannot open `which fpc' (No such file or directory)


On 06/22/2013 09:38 AM, Jonas Maebe wrote:

On 22 Jun 2013, at 16:33, Robert Wolfe wrote:


On 06/22/2013 08:50 AM, Jonas Maebe wrote:

On 22 Jun 2013, at 15:46, Robert Wolfe wrote:


[robert@shell bin]$ fpc
bash: /usr/bin/fpc: cannot execute binary file
[robert@shell bin]$ fp
bash: /usr/bin/fp: cannot execute binary file

This is CentOS 6.4 x86_64 with all the latest updates for my setup applied.  Is 
there something I am issing here that I need to get FP to run?

What does
   file `which fpc`

show?

[robert@shell ~]$ which fpc
/usr/bin/fpc

And
   file `which fpc`

?


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] FPC under CentOS x64

2013-06-22 Thread Robert Wolfe

When I redid the command another way, I got this:

[robert@shell ~]$ file /usr/bin/fpc
/usr/bin/fpc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), 
statically linked, for GNU/Linux 2.4.0, stripped


Okay, smack me hard in the head now...

[robert@shell ~]$ uname -a
Linux shell.rivernet.us 2.6.32-358.11.1.el6.i686 #1 SMP Wed Jun 12 
01:01:27 UTC 2013 i686 i686 i386 GNU/Linux


Duh!  Wrong version!  Guess I need to change the titling of my CenOS 6.4 
VM to read x86 :)  The RHEL 6.4 VM I have is 64 bit :) Thank you for 
helping me to locate the error. :)


On 06/22/2013 09:38 AM, Jonas Maebe wrote:

On 22 Jun 2013, at 16:33, Robert Wolfe wrote:


On 06/22/2013 08:50 AM, Jonas Maebe wrote:

On 22 Jun 2013, at 15:46, Robert Wolfe wrote:


[robert@shell bin]$ fpc
bash: /usr/bin/fpc: cannot execute binary file
[robert@shell bin]$ fp
bash: /usr/bin/fp: cannot execute binary file

This is CentOS 6.4 x86_64 with all the latest updates for my setup applied.  Is 
there something I am issing here that I need to get FP to run?

What does
   file `which fpc`

show?

[robert@shell ~]$ which fpc
/usr/bin/fpc

And
   file `which fpc`

?


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] FPC under CentOS x64

2013-06-22 Thread Jonas Maebe

On 22 Jun 2013, at 20:24, Robert Wolfe wrote:

 On 06/22/2013 09:38 AM, Jonas Maebe wrote:
 And
   file `which fpc`
 
 [robert@shell ~]$ file 'which fpc'
 which fpc: cannot open `which fpc' (No such file or directory)

FWIW, it should have been
  file `which fpc`

not

  file 'which fpc'

(backticks mean replace what's between the backticks with the output of that 
command)


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


Re: [fpc-pascal] How to use UPnP to create port forward in the router?

2013-06-22 Thread Dmitry Boyarintsev
Should this help

http://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol



On Saturday, June 22, 2013, Dennis Poon wrote:

 **
 I know some software can use UPnP to add a port forwarding rule to the
 router automatically. I want to do the same with FPC.
 Anyone has any idea on how to do so without using Microsoft's API?  I want
 a linux approach, possibly cross platform is possible.

 Thanks.

 Dennis

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

Re: [fpc-pascal] Re: SQLdb: TMSSQLConnection: using Instance name in Host

2013-06-22 Thread Marcos Douglas
On Sat, Jun 22, 2013 at 10:39 AM, Ludo Brands ludo.bra...@free.fr wrote:
 On 06/22/2013 03:20 PM, Marcos Douglas wrote:
 On Sat, Jun 22, 2013 at 4:35 AM, Ludo Brands ludo.bra...@free.fr wrote:
 Can you confirm it works with dbsetlname(FDBLogin, PChar('MyApp'), 5) ?
 If that is the case I'll make a patch for dblib.pp and will add an
 application parameter to mssqlconn.

 Yes, I confirm. The ApplicationName was shown in Profiler tool.

 Patch in http://bugs.freepascal.org/view.php?id=24635. New parameter is
 ApplicationName.

Thank you.

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


[fpc-pascal] Re: Overloading properties

2013-06-22 Thread leledumbo
 Of course I could rename these methods and add a prefix like Set..., but I
want to know why this limitation is

Can you create a variable and a function with the same name under the same
scope? If you could answer that, you'll know why. As something you might
want to think about: properties call is essentially a function call.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Overloading-properties-tp5715442p5715449.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/mailman/listinfo/fpc-pascal