Re: [fpc-pascal] Syntax changes suggestions

2018-07-19 Thread Ben Grasset
If a feature works as intended and is useful (which is all that matters),
how is it "blind copying"?

On Thu, Jul 19, 2018 at 7:25 AM, Marco van de Voort  wrote:

>
> In our previous episode, Ryan Joseph said:
> >
> > That?s pretty disheartening honestly. So there was a useful feature users
> > could be leveraging but it was turned down because it didn?t fit into
> some
> > paradigm or something like that.  Sorry to hear that.
>
> No, because blind copying from one language to another is not always
> feasible.
> ___
> 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] Syntax changes suggestions

2018-07-19 Thread Ben Grasset
I'm quite certain a lot of people would disagree with you on that. But
there you have the reason why the "having to read code you don't like
looking at" argument makes no sense. It's completely subjective.

On Thu, Jul 19, 2018 at 12:37 AM, Martin Schreiber 
wrote:

> On Wednesday 18 July 2018 23:30:19 Ben Grasset wrote:
> >
> > For example, does *anyone *actually think the strange "lowercase
> > everything" capitalization style the compiler uses is "readable"
> nowadays?
>
> Yes.
>
> Martin
> ___
> 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] GetAppConfigDir(False) in a Citrix environment

2018-07-19 Thread Bart
On Wed, Jul 4, 2018 at 12:18 AM, Graeme Geldenhuys
 wrote:

> I haven't had time to look at that job at work yet, but it's on my todo
> list and should be done in the next week. I don't mind sharing the solution.

This is the easy part:

const
  WTS_CURRENT_SERVER_HANDLE = DWORD(0);
  WTS_CURRENT_SESSION = DWORD(-1);
  WTS_PROTOCOL_TYPE_CONSOLE = 0;
  WTS_SESSION_TYPE_ICA = 1;
  WTS_SESSION_TYPE_RDP = 2;

type
  WTS_INFO_CLASS = (
  WTSInitialProgram  ,
  WTSApplicationName ,
  WTSWorkingDirectory,
  WTSOEMId   ,
  WTSSessionId   ,
  WTSUserName,
  WTSWinStationName  ,
  WTSDomainName  ,
  WTSConnectState,
  WTSClientBuildNumber   ,
  WTSClientName  ,
  WTSClientDirectory ,
  WTSClientProductId ,
  WTSClientHardwareId,
  WTSClientAddress   ,
  WTSClientDisplay   ,
  WTSClientProtocolType  ,
  WTSIdleTime,
  WTSLogonTime   ,
  WTSIncomingBytes   ,
  WTSOutgoingBytes   ,
  WTSIncomingFrames  ,
  WTSOutgoingFrames  ,
  WTSClientInfo  ,
  WTSSessionInfo ,
  WTSSessionInfoEx   ,
  WTSConfigInfo  ,
  WTSValidationInfo  ,
  WTSSessionAddressV4,
  WTSIsRemoteSession);



function WTSQuerySessionInformationA(hServer: HANDLE;
  SessionId: DWORD;
  WTSInfoClass: WTS_INFO_CLASS;
  var ppBuffer: LPTSTR;
  var pBytesReturned: DWORD): BOOL; stdcall; external 'wtsapi32.dll'
name 'WTSQuerySessionInformationA';

procedure WTSFreeMemory(pMemory: Pointer); stdcall; external
'wtsapi32.dll'name 'WTSFreeMemory';

function WTSGetSessionType: Word;
var
  pBuf: Pointer;
  pBytesReturned: DWORD;
begin
  Result := Word(-1);
  pBuf := nil;
  pBytesReturned := 0;
  if not WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE,
WTS_CURRENT_SESSION, WTSClientProtocolType, pBuf, pBytesReturned) then
Exit;
  if (pBytesReturned > 0) {should be 2} then
  begin
Result := PWord(pBuf)^;
WTSFreeMemory(pBuf);
  end;
end;

function WTSSessionTypeToStr(ProtocolID: Word): String;
begin
  case ProtocolID of
WTS_PROTOCOL_TYPE_CONSOLE: Result := 'WTS_PROTOCOL_TYPE_CONSOLE';
WTS_SESSION_TYPE_ICA: Result := 'WTS_PROTOCOL_TYPE_ICA';
WTS_SESSION_TYPE_RDP: Result := 'WTS_PROTOCOL_TYPE_RDP';
else Result := 'WTS_SESSION_TYPE_UNKNOWN';
  end;//case
end;

Now only the hard part remains ...

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

Re: [fpc-pascal] Pascal units to connect to an Exchange server

2018-07-19 Thread Sven Barth via fpc-pascal
luciano de souza  schrieb am Do., 19. Juli 2018, 20:29:

> Hello all,
> From a Linux machine connected to a Windows machine by VPN, I’d like
> to send e-mails programmatically using a Microsoft Exchange account.
> Using Windows resources, I could call Outlook automation API to do
> this task. But is the same possible with Linux resources?
> Is there a Freepascal unit to handle with Exchange sending protocol?
> Best Regards,
>

The underlying protocol of Exchange seems to be MAPI. So you could maybe
try if libmapi is sufficient for you though you'll need to convert its
corresponding C header to Pascal (you can try to use h2pas for that).

Regards,
Sven

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

Re: [fpc-pascal] Pascal units to connect to an Exchange server

2018-07-19 Thread Sven Barth via fpc-pascal
Bo Berglund  schrieb am Do., 19. Juli 2018, 21:52:

> On Thu, 19 Jul 2018 15:29:12 -0300, luciano de souza
>  wrote:
>
> >Hello all,
> >From a Linux machine connected to a Windows machine by VPN, I’d like
> >to send e-mails programmatically using a Microsoft Exchange account.
> >Using Windows resources, I could call Outlook automation API to do
> >this task. But is the same possible with Linux resources?
> >Is there a Freepascal unit to handle with Exchange sending protocol?
> >Best Regards,
>
> Why not just use somethng like Indy10 to implement an smtp sending
> function?
> It is quite simple and straightforward.
> What exactly are you wanting to accomplish by mixing in Exchange and
> Outlook?
>

Just a guess, but it could be that the server the thread starter needs to
work with doesn't provide a SMTP endpoint. 路‍♀️

Regards,
Sven

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

Re: [fpc-pascal] Syntax changes suggestions

2018-07-19 Thread Bo Berglund
On Thu, 19 Jul 2018 03:42:26 +0200, "Tomas Hajny"
 wrote:

>Hello everybody,
>
>The discussion in this thread seems to be endless and arguments are
>repeating over and over. Moreover, some of the words and statements having
>appeared in certain posts are better avoided in polite communication.
>Everybody, please, think twice whether your post adds value (repetition of
>arguments and previously declined feature requests does not, attacks even
>less).
>
>Thank you
>
>Tomas
>(one of FPC mailing list moderators)

+1

And please move this thread to the free-pascal.social group...


-- 
Bo Berglund
Developer in Sweden

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

Re: [fpc-pascal] Pascal units to connect to an Exchange server

2018-07-19 Thread Bo Berglund
On Thu, 19 Jul 2018 15:29:12 -0300, luciano de souza
 wrote:

>Hello all,
>From a Linux machine connected to a Windows machine by VPN, I’d like
>to send e-mails programmatically using a Microsoft Exchange account.
>Using Windows resources, I could call Outlook automation API to do
>this task. But is the same possible with Linux resources?
>Is there a Freepascal unit to handle with Exchange sending protocol?
>Best Regards,

Why not just use somethng like Indy10 to implement an smtp sending
function?
It is quite simple and straightforward.
What exactly are you wanting to accomplish by mixing in Exchange and
Outlook?


-- 
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] Pascal units to connect to an Exchange server

2018-07-19 Thread luciano de souza
Hello all,
From a Linux machine connected to a Windows machine by VPN, I’d like
to send e-mails programmatically using a Microsoft Exchange account.
Using Windows resources, I could call Outlook automation API to do
this task. But is the same possible with Linux resources?
Is there a Freepascal unit to handle with Exchange sending protocol?
Best Regards,


-- 
Luciano de Souza

Hello all,
From a Linux machine connected to a Windows machine by VPN, I’d like
to send e-mails programmatically using a Microsoft Exchange account.
Using Windows resources, I could call Outlook automation API to do
this task. But is the same possible with Linux resources?
Is there a Freepascal unit to handle with Exchange sending protocol?
Best Regards,
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Syntax changes suggestions

2018-07-19 Thread Marco van de Voort

In our previous episode, Ryan Joseph said:
> 
> That?s pretty disheartening honestly. So there was a useful feature users
> could be leveraging but it was turned down because it didn?t fit into some
> paradigm or something like that.  Sorry to hear that.

No, because blind copying from one language to another is not always
feasible.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Syntax changes suggestions

2018-07-19 Thread Mark Morgan Lloyd

On 18/07/18 20:45, Ryan Joseph wrote:

On Jul 18, 2018, at 1:46 PM, R0b0t1  wrote:> > You can make the 
function yourself. That you may have problems with> typing are indicative that the language could 
use a more expressive> type system, not that it was a good idea to create an intrinsic that> 
could (potentially) ignore types.

I don’t remember what it did exactly. Like this maybe?
n = (x != 0) ? 10 : 20;
if x <> 0 then  n := 10else  n := 20;
n := IfThen(x <> 0, 10, 20);
People are probably sick of doing that and wanted a more concise statement. 
I’ve even seen people do stuff like this because they’re fighting the language.
if x <> 0 then n := 10 else n := 20;
They probably wanted something like this:
n := if x <> 0 then 10 else 20;
Not too crazy in my opinion.


Without wanting to reopen the debate or appear to be criticising the 
developers, ALGOL-60 did this:


FOR I := 1 STEP 6 UNTIL M DO
BEGIN  PCHTX(SYTB[I], WRITEBUFFER[0],
IF M-I > 6 THEN 6 ELSE M-I+1);
WRITE (PCH,10,WRITEBUFFER[*]);
CLEAR(WRITEBUFFER[0],9)
END;

I make no apology for the layout, since that's a fragment of Wirth's own 
code.


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

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal